From 974829185e1a9473cb407f4d3434c81df8e6b970 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 1 Feb 2024 10:46:55 -0500 Subject: [PATCH] zink: zero allocate resident_defs array in ntv this makes assert(def!=0) more reliable Fixes: 73ef54e3424 ("zink: handle residency return value from sparse texture instructions") Part-of: (cherry picked from commit aacc4e1c687b643929d496cec72891b814fc2256) --- .pick_status.json | 2 +- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index cf4d2ee09b4..524faccc15f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -10214,7 +10214,7 @@ "description": "zink: zero allocate resident_defs array in ntv", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "73ef54e34242fa59803a3a89b5a6eb92053e917e", "notes": null diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index c30426aba83..5bcc6d6adeb 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -4774,7 +4774,7 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, uint32_ /* this could be huge, so only alloc if needed since it's extremely unlikely to * ever be used by anything except cts */ - ctx.resident_defs = ralloc_array_size(ctx.mem_ctx, + ctx.resident_defs = rzalloc_array_size(ctx.mem_ctx, sizeof(SpvId), entry->ssa_alloc); if (!ctx.resident_defs) goto fail;