ref_vk: --//--

This commit is contained in:
Ivan Avdeev 2021-06-06 23:00:05 -07:00
parent ab215f35b6
commit 22eec42a60
1 changed files with 10 additions and 11 deletions

View File

@ -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));
}