mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Rate-limit icon GPU uploads in spellbook, action bar, and inventory screens
Opening the spellbook on a new tab, logging in with many auras/action slots, or opening a full bag all triggered synchronous BLP-decode + GPU uploads for every uncached icon in one frame, causing a visible stall. Apply the same 4-per-frame upload cap that was added to talent_screen, so icons load progressively.
This commit is contained in:
parent
6dd7213083
commit
8c2f69ca0e
3 changed files with 27 additions and 0 deletions
|
|
@ -411,6 +411,14 @@ VkDescriptorSet SpellbookScreen::getSpellIcon(uint32_t iconId, pipeline::AssetMa
|
|||
auto cit = spellIconCache.find(iconId);
|
||||
if (cit != spellIconCache.end()) return cit->second;
|
||||
|
||||
// Rate-limit GPU uploads to avoid a multi-frame stall when switching tabs.
|
||||
// Icons not loaded this frame will be retried next frame (progressive load).
|
||||
static int loadsThisFrame = 0;
|
||||
static int lastImGuiFrame = -1;
|
||||
int curFrame = ImGui::GetFrameCount();
|
||||
if (curFrame != lastImGuiFrame) { loadsThisFrame = 0; lastImGuiFrame = curFrame; }
|
||||
if (loadsThisFrame >= 4) return VK_NULL_HANDLE; // defer — do NOT cache null here
|
||||
|
||||
auto pit = spellIconPaths.find(iconId);
|
||||
if (pit == spellIconPaths.end()) {
|
||||
spellIconCache[iconId] = VK_NULL_HANDLE;
|
||||
|
|
@ -437,6 +445,7 @@ VkDescriptorSet SpellbookScreen::getSpellIcon(uint32_t iconId, pipeline::AssetMa
|
|||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
++loadsThisFrame;
|
||||
VkDescriptorSet ds = vkCtx->uploadImGuiTexture(image.data.data(), image.width, image.height);
|
||||
spellIconCache[iconId] = ds;
|
||||
return ds;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue