Skip to content

Commit 6ede871

Browse files
committed
Increase Vulkan descriptor pools and add guards
Cap instance API to VK_API_VERSION_1_3 and enlarge Vulkan descriptor pools to reduce descriptor exhaustion: preview pool descriptorCount/maxSets increased from 64 to 256, and main pool combined image sampler and maxSets increased from 256 to 1024. Also add early-return guards in imiv_test_engine to skip test-engine hooks when ui_ctx->TestEngine is null, avoiding invalid hook calls when the test engine is not initialized. Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
1 parent ad089ab commit 6ede871

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/imiv/imiv_test_engine.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,8 @@ register_layout_dump_synthetic_rect(const char* kind, const char* label,
19371937
kind ? kind : "item");
19381938
}
19391939

1940+
if (ui_ctx->TestEngine == nullptr)
1941+
return;
19401942
const ImRect bb(min, max);
19411943
ImGuiTestEngineHook_ItemAdd(ui_ctx, id, bb, nullptr);
19421944
ImGuiTestEngineHook_ItemInfo(ui_ctx, id, debug_label,
@@ -1969,6 +1971,8 @@ register_test_engine_item_label(const char* label, bool openable)
19691971
const ImGuiID id = ImGui::GetID(id_source);
19701972
if (id == 0)
19711973
return;
1974+
if (ui_ctx->TestEngine == nullptr)
1975+
return;
19721976
const ImRect bb(min, max);
19731977
ImGuiItemStatusFlags flags = ImGuiItemStatusFlags_None;
19741978
if (openable)

src/imiv/imiv_vulkan_setup.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ query_loader_api_version()
112112
uint32_t
113113
choose_instance_api_version()
114114
{
115-
return std::min(vulkan_header_api_version(), query_loader_api_version());
115+
return std::min(std::min(vulkan_header_api_version(),
116+
query_loader_api_version()),
117+
VK_API_VERSION_1_3);
116118
}
117119

118120

@@ -846,11 +848,11 @@ init_preview_resources(VulkanState& vk_state, std::string& error_message)
846848

847849
VkDescriptorPoolSize preview_pool_size = {};
848850
preview_pool_size.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
849-
preview_pool_size.descriptorCount = 64;
851+
preview_pool_size.descriptorCount = 256;
850852
VkDescriptorPoolCreateInfo preview_pool_ci = {};
851853
preview_pool_ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
852854
preview_pool_ci.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
853-
preview_pool_ci.maxSets = 64;
855+
preview_pool_ci.maxSets = 256;
854856
preview_pool_ci.poolSizeCount = 1;
855857
preview_pool_ci.pPoolSizes = &preview_pool_size;
856858
err = vkCreateDescriptorPool(vk_state.device, &preview_pool_ci,
@@ -1396,11 +1398,11 @@ setup_vulkan_device(VulkanState& vk_state, std::string& error_message)
13961398
"imiv.main.queue");
13971399

13981400
VkDescriptorPoolSize pool_sizes[]
1399-
= { { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 256 } };
1401+
= { { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1024 } };
14001402
VkDescriptorPoolCreateInfo pool_ci = {};
14011403
pool_ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
14021404
pool_ci.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
1403-
pool_ci.maxSets = 256;
1405+
pool_ci.maxSets = 1024;
14041406
pool_ci.poolSizeCount = static_cast<uint32_t>(IM_ARRAYSIZE(pool_sizes));
14051407
pool_ci.pPoolSizes = pool_sizes;
14061408
err = vkCreateDescriptorPool(vk_state.device, &pool_ci, vk_state.allocator,

0 commit comments

Comments
 (0)