Merge pull request #791 from diharaw/variable_descriptor_validation

Added descriptorindexing sample to CMake and fixed variable descriptor size validation errors
This commit is contained in:
Sascha Willems 2021-01-28 19:31:05 +01:00 committed by GitHub
commit 6994d17448
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -75,6 +75,7 @@ set(EXAMPLES
deferred
deferredmultisampling
deferredshadows
descriptorindexing
descriptorsets
displacement
distancefieldfonts

View file

@ -292,7 +292,17 @@ public:
Descriptor sets
*/
VkDescriptorSetVariableDescriptorCountAllocateInfoEXT variableDescriptorCountAllocInfo = {};
uint32_t variableDescCounts[] = {textures.size()};
variableDescriptorCountAllocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT;
variableDescriptorCountAllocInfo.descriptorSetCount = 1;
variableDescriptorCountAllocInfo.pDescriptorCounts = variableDescCounts;
VkDescriptorSetAllocateInfo allocInfo = vks::initializers::descriptorSetAllocateInfo(descriptorPool, &descriptorSetLayout, 1);
allocInfo.pNext = &variableDescriptorCountAllocInfo;
VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &allocInfo, &descriptorSet));
std::vector<VkWriteDescriptorSet> writeDescriptorSets(2);