About descriptorCount in VkDescriptorPoolSize

Hello,
in Sascha’s pbrtexture.cpp

std::vector poolSizes = {
vks::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 4),
vks::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 16)};

I cannot figure out those descriptorCount numbers
For VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, it is said 4
for VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, it is said 16

But this pbrtexture.cpp does not load 16 image samplers (nor textures)

So could you please teach me
what descriptorCount number I should use in this VkDescriptorPoolSize setting ?

Thank you

The descriptor pool information is purely about setting up the maximum number of each kind of descriptor that you’re might ever use. Since this is a tutorial and not production software, the number is basically arbitrary. So long as it’s big enough for the demo, it’s fine. That is, as long as the tutorial doesn’t use more than 16 sampler descriptors, it’s fine.

The number you should use is based on your needs. You can’t just copy and paste tutorial code into real software. There isn’t a right answer, only the answer that is correct for your needs.

1 Like

Hello, Alfonse
How are you? Thank you for your help and kindness

Also, I just figured out how to code them

If “vkAllocateDescriptorSets and vkUpdateDescriptorSets” pair are used three times
and for each update, the maximal number of VkWriteDescriptorSet is 8
then descriptorPoolSize’s descriptorCount for that resource should be 3 * 8 = 24 or larger

I still may not be perfectly correct, but I checked it generates validation error if I set descriptorCount < 24 in this case

So now I think I can handle this

Thank you again and have a great holiday season, Alfonse