Allow texture load retries instead of permanently caching failures

Remove negative cache for transient load failures in M2, terrain, and
character renderers. Failed textures return white and will be retried
on next model/tile load when assets may have finished streaming.
This commit is contained in:
Kelsi 2026-02-23 06:51:06 -08:00
parent 3e6de8485b
commit 93f873b521
4 changed files with 11 additions and 25 deletions

View file

@ -442,16 +442,10 @@ VkTexture* TerrainRenderer::loadTexture(const std::string& path) {
it->second.lastUse = ++textureCacheCounter_;
return it->second.texture.get();
}
if (failedTextureCache_.count(key)) {
return whiteTexture.get();
}
pipeline::BLPImage blp = assetManager->loadTexture(key);
if (!blp.isValid()) {
static constexpr size_t kMaxFailedTextureCache = 200000;
if (failedTextureCache_.size() < kMaxFailedTextureCache) {
failedTextureCache_.insert(key);
}
// Return white fallback but don't cache the failure — allow retry
// on next tile load in case the asset becomes available.
if (loggedTextureLoadFails_.insert(key).second) {
LOG_WARNING("Failed to load texture: ", path);
}