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
|
|
@ -101,6 +101,14 @@ VkDescriptorSet InventoryScreen::getItemIcon(uint32_t displayInfoId) {
|
|||
auto it = iconCache_.find(displayInfoId);
|
||||
if (it != iconCache_.end()) return it->second;
|
||||
|
||||
// Rate-limit GPU uploads per frame to avoid stalling when many items appear at once
|
||||
// (e.g., opening a full bag, vendor window, or loot from a boss with many drops).
|
||||
static int iiLoadsThisFrame = 0;
|
||||
static int iiLastImGuiFrame = -1;
|
||||
int iiCurFrame = ImGui::GetFrameCount();
|
||||
if (iiCurFrame != iiLastImGuiFrame) { iiLoadsThisFrame = 0; iiLastImGuiFrame = iiCurFrame; }
|
||||
if (iiLoadsThisFrame >= 4) return VK_NULL_HANDLE; // defer — do NOT cache null here
|
||||
|
||||
// Load ItemDisplayInfo.dbc
|
||||
auto displayInfoDbc = assetManager_->loadDBC("ItemDisplayInfo.dbc");
|
||||
if (!displayInfoDbc) {
|
||||
|
|
@ -143,6 +151,7 @@ VkDescriptorSet InventoryScreen::getItemIcon(uint32_t displayInfoId) {
|
|||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
++iiLoadsThisFrame;
|
||||
VkDescriptorSet ds = vkCtx->uploadImGuiTexture(image.data.data(), image.width, image.height);
|
||||
iconCache_[displayInfoId] = ds;
|
||||
return ds;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue