[Mesa-dev] [PATCH 1/6] anv/descriptor_set: memset anv_descriptor_set_layout

Jason Ekstrand jason at jlekstrand.net
Thu Aug 25 22:28:13 UTC 2016


We hash this data structure so we can't afford to have uninitialized data
even if it is just structure padding.
---
 src/intel/vulkan/anv_descriptor_set.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index cf1fe15..4ab1802 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -67,9 +67,8 @@ VkResult anv_CreateDescriptorSetLayout(
    struct anv_sampler **samplers =
       (struct anv_sampler **)&set_layout->binding[max_binding + 1];
 
+   memset(set_layout, 0, sizeof(*set_layout));
    set_layout->binding_count = max_binding + 1;
-   set_layout->shader_stages = 0;
-   set_layout->size = 0;
 
    for (uint32_t b = 0; b <= max_binding; b++) {
       /* Initialize all binding_layout entries to -1 */
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list