Mesa (main): radv: ignore redundant variable descriptor counts (v2)

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 29 09:54:28 UTC 2021


Module: Mesa
Branch: main
Commit: 4f959e368cfea073a459a7d18337c2c55fd958ae
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f959e368cfea073a459a7d18337c2c55fd958ae

Author: Ishi Tatsuyuki <ishitatsuyuki at gmail.com>
Date:   Thu Jun 24 21:12:48 2021 +0900

radv: ignore redundant variable descriptor counts (v2)

The Vulkan specification says: "If VkDescriptorSetAllocateInfo::pSetLayouts[i]
does not include a variable count descriptor binding, then
pDescriptorCounts[i] is ignored". The previous code triggered an assertion
in such cases, and this patch fixes it.

v2: removed the offending assertion that is now always satisfied and
    reworded the commit message with a reference to Vulkan spec.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4992
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11576>

---

 src/amd/vulkan/radv_descriptor_set.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c
index f2a999d6a17..409145ed025 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -578,7 +578,6 @@ radv_descriptor_set_create(struct radv_device *device, struct radv_descriptor_po
    set->header.buffer_count = buffer_count;
    uint32_t layout_size = layout->size;
    if (variable_count) {
-      assert(layout->has_variable_descriptors);
       uint32_t stride = layout->binding[layout->binding_count - 1].size;
       if (layout->binding[layout->binding_count - 1].type ==
           VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
@@ -885,7 +884,7 @@ radv_AllocateDescriptorSets(VkDevice _device, const VkDescriptorSetAllocateInfo
       RADV_FROM_HANDLE(radv_descriptor_set_layout, layout, pAllocateInfo->pSetLayouts[i]);
 
       const uint32_t *variable_count = NULL;
-      if (variable_counts) {
+      if (layout->has_variable_descriptors && variable_counts) {
          if (i < variable_counts->descriptorSetCount)
             variable_count = variable_counts->pDescriptorCounts + i;
          else



More information about the mesa-commit mailing list