Bug 111019

Summary: radv doesn't handle variable descriptor count properly
Product: Mesa Reporter: Józef Kucia <joseph.kucia>
Component: Drivers/Vulkan/radeonAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Minimal reproducer
Minimal reproducer 2

Description Józef Kucia 2019-06-28 17:06:42 UTC
Created attachment 144676 [details]
Minimal reproducer

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.
Comment 1 Bas Nieuwenhuizen 2019-06-29 01:12:06 UTC
Forgot a hunk somehow apparently ...

https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1205

should fix this.
Comment 2 Bas Nieuwenhuizen 2019-07-01 23:57:54 UTC
The MR above landed. I'm marking as fixed, but please reopen if there are still issues. Thanks!
Comment 3 Józef Kucia 2019-07-29 14:38:00 UTC
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.
Comment 4 Józef Kucia 2019-07-29 16:07:58 UTC
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.
Comment 5 Bas Nieuwenhuizen 2019-07-29 19:02:54 UTC
Fixed in https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1484

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.