Mesa (staging/21.3): zink: Fully initialize VkBufferViewCreateInfo for hashing
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Oct 18 20:57:14 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: 1f59152302259ebfc163a5e004ca62f4ce83eca3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f59152302259ebfc163a5e004ca62f4ce83eca3
Author: Witold Baryluk <baryluk at smp.if.uj.edu.pl>
Date: Fri Oct 15 00:40:14 2021 +0200
zink: Fully initialize VkBufferViewCreateInfo for hashing
Makes hashing achieve higher hit rate, and valgrind happier.
Reviewed-by: Hoe Hao Cheng <haochengho12907 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13371>
(cherry picked from commit ae525da0e45b6d1a7c6921576f63380ae5e8ac95)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_context.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 2d63f9f23fa..49614ebcf98 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
"description": "zink: Fully initialize VkBufferViewCreateInfo for hashing",
"nominated": false,
"nomination_type": null,
- "resolution": 4,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
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;
More information about the mesa-commit
mailing list