MCPcopy Create free account
hub / github.com/SFML/SFML / setupDescriptorPool

Method setupDescriptorPool

examples/vulkan/Vulkan.cpp:2131–2156  ·  view source on GitHub ↗

Set up our descriptor pool

Source from the content-addressed store, hash-verified

2129
2130 // Set up our descriptor pool
2131 void setupDescriptorPool()
2132 {
2133 // We need to allocate as many descriptor sets as we have frames in flight
2134 std::array<VkDescriptorPoolSize, 2> descriptorPoolSizes{};
2135
2136 descriptorPoolSizes[0] = VkDescriptorPoolSize();
2137 descriptorPoolSizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
2138 descriptorPoolSizes[0].descriptorCount = static_cast<std::uint32_t>(swapchainImages.size());
2139
2140 descriptorPoolSizes[1] = VkDescriptorPoolSize();
2141 descriptorPoolSizes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
2142 descriptorPoolSizes[1].descriptorCount = static_cast<std::uint32_t>(swapchainImages.size());
2143
2144 VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = VkDescriptorPoolCreateInfo();
2145 descriptorPoolCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
2146 descriptorPoolCreateInfo.poolSizeCount = static_cast<std::uint32_t>(descriptorPoolSizes.size());
2147 descriptorPoolCreateInfo.pPoolSizes = descriptorPoolSizes.data();
2148 descriptorPoolCreateInfo.maxSets = static_cast<std::uint32_t>(swapchainImages.size());
2149
2150 // Create the descriptor pool
2151 if (vkCreateDescriptorPool(device, &descriptorPoolCreateInfo, nullptr, &descriptorPool) != VK_SUCCESS)
2152 {
2153 vulkanAvailable = false;
2154 return;
2155 }
2156 }
2157
2158 // Set up our descriptor sets
2159 void setupDescriptorSets()

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected