mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
fix(rendering): increase ImGui descriptor pool from 100 to 2048
The pool was exhausted by cached spell/item/talent icon textures, causing vkAllocateDescriptorSets to fail inside ImGui_ImplVulkan_AddTexture. The NVIDIA driver crashed on the subsequent invalid descriptor write. Also add a null-check on the returned descriptor set so pool exhaustion gracefully returns VK_NULL_HANDLE instead of crashing.
This commit is contained in:
parent
2096e67bf9
commit
8e1addf7a6
1 changed files with 15 additions and 4 deletions
|
|
@ -1177,15 +1177,18 @@ bool VkContext::createImGuiResources() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create descriptor pool for ImGui
|
// Create descriptor pool for ImGui.
|
||||||
|
// Budget: ~10 internal ImGui sets + up to 2000 UI icon textures (spells,
|
||||||
|
// items, talents, buffs, etc.) that are uploaded and cached for the session.
|
||||||
|
static constexpr uint32_t IMGUI_POOL_SIZE = 2048;
|
||||||
VkDescriptorPoolSize poolSizes[] = {
|
VkDescriptorPoolSize poolSizes[] = {
|
||||||
{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 100},
|
{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, IMGUI_POOL_SIZE},
|
||||||
};
|
};
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo dpInfo{};
|
VkDescriptorPoolCreateInfo dpInfo{};
|
||||||
dpInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
dpInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||||
dpInfo.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
dpInfo.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
||||||
dpInfo.maxSets = 100;
|
dpInfo.maxSets = IMGUI_POOL_SIZE;
|
||||||
dpInfo.poolSizeCount = 1;
|
dpInfo.poolSizeCount = 1;
|
||||||
dpInfo.pPoolSizes = poolSizes;
|
dpInfo.pPoolSizes = poolSizes;
|
||||||
|
|
||||||
|
|
@ -1374,10 +1377,18 @@ VkDescriptorSet VkContext::uploadImGuiTexture(const uint8_t* rgba, int width, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register with ImGui
|
// Register with ImGui (allocates from imguiDescriptorPool)
|
||||||
VkDescriptorSet ds = ImGui_ImplVulkan_AddTexture(uiTextureSampler_, imageView,
|
VkDescriptorSet ds = ImGui_ImplVulkan_AddTexture(uiTextureSampler_, imageView,
|
||||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||||
|
|
||||||
|
if (!ds) {
|
||||||
|
LOG_ERROR("ImGui descriptor pool exhausted — cannot upload UI texture");
|
||||||
|
vkDestroyImageView(device, imageView, nullptr);
|
||||||
|
vkDestroyImage(device, image, nullptr);
|
||||||
|
vkFreeMemory(device, imageMemory, nullptr);
|
||||||
|
return VK_NULL_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
// Track for cleanup
|
// Track for cleanup
|
||||||
uiTextures_.push_back({image, imageMemory, imageView});
|
uiTextures_.push_back({image, imageMemory, imageView});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue