vk_descriptor_pool: Make use of designated initializers where applicable
This commit is contained in:
parent
5330ca396d
commit
6d165481ad
1 changed files with 17 additions and 14 deletions
|
@ -43,27 +43,30 @@ vk::DescriptorPool* VKDescriptorPool::AllocateNewPool() {
|
||||||
{VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, num_sets * 64},
|
{VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, num_sets * 64},
|
||||||
{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, num_sets * 64},
|
{VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, num_sets * 64},
|
||||||
{VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, num_sets * 64},
|
{VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, num_sets * 64},
|
||||||
{VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, num_sets * 40}};
|
{VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, num_sets * 40},
|
||||||
|
};
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo ci;
|
const VkDescriptorPoolCreateInfo ci{
|
||||||
ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
||||||
ci.pNext = nullptr;
|
.pNext = nullptr,
|
||||||
ci.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
|
||||||
ci.maxSets = num_sets;
|
.maxSets = num_sets,
|
||||||
ci.poolSizeCount = static_cast<u32>(std::size(pool_sizes));
|
.poolSizeCount = static_cast<u32>(std::size(pool_sizes)),
|
||||||
ci.pPoolSizes = std::data(pool_sizes);
|
.pPoolSizes = std::data(pool_sizes),
|
||||||
|
};
|
||||||
return &pools.emplace_back(device.GetLogical().CreateDescriptorPool(ci));
|
return &pools.emplace_back(device.GetLogical().CreateDescriptorPool(ci));
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::DescriptorSets VKDescriptorPool::AllocateDescriptors(VkDescriptorSetLayout layout,
|
vk::DescriptorSets VKDescriptorPool::AllocateDescriptors(VkDescriptorSetLayout layout,
|
||||||
std::size_t count) {
|
std::size_t count) {
|
||||||
const std::vector layout_copies(count, layout);
|
const std::vector layout_copies(count, layout);
|
||||||
VkDescriptorSetAllocateInfo ai;
|
VkDescriptorSetAllocateInfo ai{
|
||||||
ai.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
|
||||||
ai.pNext = nullptr;
|
.pNext = nullptr,
|
||||||
ai.descriptorPool = **active_pool;
|
.descriptorPool = **active_pool,
|
||||||
ai.descriptorSetCount = static_cast<u32>(count);
|
.descriptorSetCount = static_cast<u32>(count),
|
||||||
ai.pSetLayouts = layout_copies.data();
|
.pSetLayouts = layout_copies.data(),
|
||||||
|
};
|
||||||
|
|
||||||
vk::DescriptorSets sets = active_pool->Allocate(ai);
|
vk::DescriptorSets sets = active_pool->Allocate(ai);
|
||||||
if (!sets.IsOutOfPoolMemory()) {
|
if (!sets.IsOutOfPoolMemory()) {
|
||||||
|
|
Loading…
Reference in a new issue