Created attachment 144676 [details]
When a descriptor set layout is created with VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT, descriptorCount in VkDescriptorSetLayoutBinding should be treated as an upper bound. The actual descriptor count is provided in VkDescriptorSetVariableDescriptorCountAllocateInfoEXT when vkAllocateDescriptorSets() is called. radv uses the upper limit from VkDescriptorSetLayoutBinding as descriptor count and fails to allocate descriptor sets with VK_ERROR_OUT_OF_POOL_MEMORY.
The attached program reproduces the bug.
Forgot a hunk somehow apparently ...
should fix this.
The MR above landed. I'm marking as fixed, but please reopen if there are still issues. Thanks!
Created attachment 144908 [details]
Minimal reproducer 2
With the fix it works for samplers now. Unfortunately, it still doesn't work for other descriptor types. I'm attaching a slightly modified program to reproduce the bug.
It seems that layout->buffer_count is incorrectly used for VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT. layout->buffer_count is based on the upper limit taken from descriptor set layout.
Fixed in https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1484