[Mesa-stable] [PATCH 1/3 v2] anv/descriptor_set: Fix binding partly undefined descriptor sets

Nanley Chery nanleychery at gmail.com
Wed Jul 13 23:15:31 UTC 2016


Section 13.2.3. of the Vulkan spec requires that implementations be able to
bind sparsely-defined Descriptor Sets without any errors or exceptions.

When binding a descriptor set that contains a dynamic buffer binding/descriptor,
the driver attempts to dereference the descriptor's buffer_view field if it is
non-NULL. It currently segfaults on undefined descriptors as this field is never
zero-initialized. Zero undefined descriptors to avoid segfaulting. This
solution was suggested by Jason Ekstrand.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96850
Cc: 12.0 <mesa-stable at lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---

v2: memset all descriptor array elements at once (Jason Ekstrand)

 src/intel/vulkan/anv_descriptor_set.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 448ae0e..39d4dde 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -424,6 +424,12 @@ anv_descriptor_set_create(struct anv_device *device,
                .sampler = layout->binding[b].immutable_samplers[i],
             };
          }
+      } else {
+         /* By defining the descriptors to be zero now, we can later verify that
+          * the descriptor has not been populated with user data.
+          */
+         memset(desc, 0,
+               sizeof(struct anv_descriptor) * layout->binding[b].array_size);
       }
       desc += layout->binding[b].array_size;
    }
-- 
2.9.0



More information about the mesa-stable mailing list