From ae525da0e45b6d1a7c6921576f63380ae5e8ac95 Mon Sep 17 00:00:00 2001 From: Witold Baryluk Date: Fri, 15 Oct 2021 00:40:14 +0200 Subject: [PATCH] zink: Fully initialize VkBufferViewCreateInfo for hashing Makes hashing achieve higher hit rate, and valgrind happier. Reviewed-by: Hoe Hao Cheng Part-of: --- src/gallium/drivers/zink/zink_context.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 826ae3ce5fd..58fbc220624 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -626,7 +626,10 @@ static VkBufferViewCreateInfo create_bvci(struct zink_context *ctx, struct zink_resource *res, enum pipe_format format, uint32_t offset, uint32_t range) { struct zink_screen *screen = zink_screen(ctx->base.screen); - VkBufferViewCreateInfo bvci = {0}; + VkBufferViewCreateInfo bvci; + // Zero whole struct (including alignment holes), so hash_bufferview + // does not access potentially uninitialized data. + memset(&bvci, 0, sizeof(bvci)); bvci.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO; bvci.pNext = NULL; bvci.buffer = res->obj->buffer;