MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / DescriptorPool

Method DescriptorPool

framework/core/descriptor_pool.cpp:25–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace vkb
24{
25DescriptorPool::DescriptorPool(vkb::core::DeviceC &device,
26 const DescriptorSetLayout &descriptor_set_layout,
27 uint32_t pool_size) :
28 device{device},
29 descriptor_set_layout{&descriptor_set_layout}
30{
31 const auto &bindings = descriptor_set_layout.get_bindings();
32
33 std::map<VkDescriptorType, std::uint32_t> descriptor_type_counts;
34
35 // Count each type of descriptor set
36 for (auto &binding : bindings)
37 {
38 descriptor_type_counts[binding.descriptorType] += binding.descriptorCount;
39 }
40
41 // Allocate pool sizes array
42 pool_sizes.resize(descriptor_type_counts.size());
43
44 auto pool_size_it = pool_sizes.begin();
45
46 // Fill pool size for each descriptor type count multiplied by the pool size
47 for (auto &it : descriptor_type_counts)
48 {
49 pool_size_it->type = it.first;
50
51 pool_size_it->descriptorCount = it.second * pool_size;
52
53 ++pool_size_it;
54 }
55
56 pool_max_sets = pool_size;
57}
58
59DescriptorPool::~DescriptorPool()
60{

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.80
resizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected