From f79110cb14ba0bad5d33801c91617f194d27eb9f Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 6 Apr 2026 18:06:03 -0700 Subject: [PATCH] fix(rendering): clear M2 texture cache on character switch M2Renderer::clear() reset descriptor pools but left the texture cache and failed-texture tracking intact. On re-login the stale cache filled the budget, failedTextureRetryAt_ blocked reloads, and the client entered an infinite model-load loop. Match the cleanup already done in shutdown() and CharacterRenderer::clear(). --- src/rendering/m2_renderer_instance.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/rendering/m2_renderer_instance.cpp b/src/rendering/m2_renderer_instance.cpp index f28f5d45..177afaee 100644 --- a/src/rendering/m2_renderer_instance.cpp +++ b/src/rendering/m2_renderer_instance.cpp @@ -344,6 +344,20 @@ void M2Renderer::clear() { particleOnlyInstanceIndices_.clear(); particleInstanceIndices_.clear(); smokeEmitAccum = 0.0f; + + // Clear texture cache so stale textures don't block loads for the next + // character/map. Without this, the old session's textures fill the cache + // budget and failedTextureRetryAt_ blocks legitimate reloads, causing an + // infinite model-load loop on character switch. + textureCache.clear(); + texturePropsByPtr_.clear(); + textureCacheBytes_ = 0; + textureCacheCounter_ = 0; + failedTextureCache_.clear(); + failedTextureRetryAt_.clear(); + loggedTextureLoadFails_.clear(); + textureLookupSerial_ = 0; + textureBudgetRejectWarnings_ = 0; } void M2Renderer::setCollisionFocus(const glm::vec3& worldPos, float radius) {