From 22eec42a6001c4d417d59ffd1e987774b51fa5d2 Mon Sep 17 00:00:00 2001 From: Ivan Avdeev Date: Sun, 6 Jun 2021 23:00:05 -0700 Subject: [PATCH] ref_vk: --//-- --- ref_vk/vk_descriptor.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ref_vk/vk_descriptor.c b/ref_vk/vk_descriptor.c index a8640135..dcd9119b 100644 --- a/ref_vk/vk_descriptor.c +++ b/ref_vk/vk_descriptor.c @@ -135,33 +135,32 @@ void VK_DescriptorsCreate(vk_descriptors_t *desc) } { - int num_desc_types = 0; VkDescriptorPoolSize pools[8] = {0}; + VkDescriptorPoolCreateInfo dpci = { + .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, + .maxSets = desc->num_sets, + .poolSizeCount = 0, + .pPoolSizes = pools, + }; for (int i = 0; i < desc->num_bindings; ++i) { const VkDescriptorSetLayoutBinding *bind = desc->bindings + i; int j; - for (j = 0; j < num_desc_types; ++j) { + for (j = 0; j < dpci.poolSizeCount; ++j) { if (pools[j].type == bind->descriptorType) { pools[j].descriptorCount += bind->descriptorCount; break; } } - if (j == num_desc_types) { - ASSERT(num_desc_types < ARRAYSIZE(pools)); + if (j == dpci.poolSizeCount) { + ASSERT(dpci.poolSizeCount < ARRAYSIZE(pools)); pools[j].descriptorCount = bind->descriptorCount; pools[j].type = bind->descriptorType; - ++num_desc_types; + ++dpci.poolSizeCount; } } - VkDescriptorPoolCreateInfo dpci = { - .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, - .maxSets = desc->num_sets, - .poolSizeCount = num_desc_types, - .pPoolSizes = pools, - }; XVK_CHECK(vkCreateDescriptorPool(vk_core.device, &dpci, NULL, &desc->desc_pool)); }