mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Bound MPQ archive lookup cache; remove always-on composite dumps; track texture cache entries
This commit is contained in:
parent
46c672d1c2
commit
5fda1a3157
10 changed files with 169 additions and 56 deletions
|
|
@ -112,8 +112,13 @@ private:
|
|||
// Cache for mapping "virtual filename" -> archive handle (or INVALID_HANDLE_VALUE for not found).
|
||||
// This avoids scanning every archive for repeated lookups, which can otherwise appear as a hang
|
||||
// on screens that trigger many asset probes (character select, character preview, etc.).
|
||||
//
|
||||
// Important: caching misses can blow up memory if the game probes many unique non-existent filenames.
|
||||
// Miss caching is disabled by default and must be explicitly enabled.
|
||||
mutable std::mutex fileArchiveCacheMutex_;
|
||||
mutable std::unordered_map<std::string, HANDLE> fileArchiveCache_;
|
||||
size_t fileArchiveCacheMaxEntries_ = 500000;
|
||||
bool fileArchiveCacheMisses_ = false;
|
||||
|
||||
mutable std::mutex missingFileMutex_;
|
||||
mutable std::unordered_set<std::string> missingFileWarnings_;
|
||||
|
|
|
|||
|
|
@ -236,7 +236,15 @@ private:
|
|||
bool shadowEnabled = false;
|
||||
|
||||
// Texture cache
|
||||
std::unordered_map<std::string, GLuint> textureCache;
|
||||
struct TextureCacheEntry {
|
||||
GLuint id = 0;
|
||||
size_t approxBytes = 0;
|
||||
uint64_t lastUse = 0;
|
||||
};
|
||||
std::unordered_map<std::string, TextureCacheEntry> textureCache;
|
||||
size_t textureCacheBytes_ = 0;
|
||||
uint64_t textureCacheCounter_ = 0;
|
||||
size_t textureCacheBudgetBytes_ = 1024ull * 1024 * 1024; // Default, overridden at init
|
||||
GLuint whiteTexture = 0;
|
||||
|
||||
std::unordered_map<uint32_t, M2ModelGPU> models;
|
||||
|
|
|
|||
|
|
@ -356,7 +356,15 @@ private:
|
|||
uint32_t lastDrawCallCount = 0;
|
||||
|
||||
GLuint loadTexture(const std::string& path);
|
||||
std::unordered_map<std::string, GLuint> textureCache;
|
||||
struct TextureCacheEntry {
|
||||
GLuint id = 0;
|
||||
size_t approxBytes = 0;
|
||||
uint64_t lastUse = 0;
|
||||
};
|
||||
std::unordered_map<std::string, TextureCacheEntry> textureCache;
|
||||
size_t textureCacheBytes_ = 0;
|
||||
uint64_t textureCacheCounter_ = 0;
|
||||
size_t textureCacheBudgetBytes_ = 2048ull * 1024 * 1024; // Default, overridden at init
|
||||
GLuint whiteTexture = 0;
|
||||
GLuint glowTexture = 0; // Soft radial gradient for glow sprites
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,15 @@ private:
|
|||
std::vector<TerrainChunkGPU> chunks;
|
||||
|
||||
// Texture cache (path -> GL texture ID)
|
||||
std::unordered_map<std::string, GLuint> textureCache;
|
||||
struct TextureCacheEntry {
|
||||
GLuint id = 0;
|
||||
size_t approxBytes = 0;
|
||||
uint64_t lastUse = 0;
|
||||
};
|
||||
std::unordered_map<std::string, TextureCacheEntry> textureCache;
|
||||
size_t textureCacheBytes_ = 0;
|
||||
uint64_t textureCacheCounter_ = 0;
|
||||
size_t textureCacheBudgetBytes_ = 4096ull * 1024 * 1024; // Default, overridden at init
|
||||
|
||||
// Lighting parameters
|
||||
float lightDir[3] = {-0.5f, -1.0f, -0.5f};
|
||||
|
|
|
|||
|
|
@ -552,7 +552,15 @@ private:
|
|||
std::string mapName_;
|
||||
|
||||
// Texture cache (path -> texture ID)
|
||||
std::unordered_map<std::string, GLuint> textureCache;
|
||||
struct TextureCacheEntry {
|
||||
GLuint id = 0;
|
||||
size_t approxBytes = 0;
|
||||
uint64_t lastUse = 0;
|
||||
};
|
||||
std::unordered_map<std::string, TextureCacheEntry> textureCache;
|
||||
size_t textureCacheBytes_ = 0;
|
||||
uint64_t textureCacheCounter_ = 0;
|
||||
size_t textureCacheBudgetBytes_ = 2048ull * 1024 * 1024; // Default, overridden at init
|
||||
|
||||
// Default white texture
|
||||
GLuint whiteTexture = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue