Bug 111019 - radv doesn't handle variable descriptor count properly
Summary: radv doesn't handle variable descriptor count properly
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2019-06-28 17:06 UTC by Józef Kucia
Modified: 2019-07-29 19:02 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Minimal reproducer (8.95 KB, text/x-csrc)
2019-06-28 17:06 UTC, Józef Kucia
Minimal reproducer 2 (8.98 KB, text/x-csrc)
2019-07-29 14:38 UTC, Józef Kucia

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 ...


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.