Module: Mesa Branch: staging/22.2 Commit: 9b94b96829b1bf9b4a4fbe74225ba4647084ba2f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b94b96829b1bf9b4a4fbe74225ba4647084ba2f
Author: Mike Blumenkrantz <[email protected]> Date: Thu Sep 1 15:21:12 2022 -0400 zink: check the variable mode before taking samplemask path in ntv this otherwise may break for function temps cc: mesa-stable Reviewed-by: Emma Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18375> (cherry picked from commit 8abbc6b19bb73cd4f36de7461204b06f2afddd8a) --- .pick_status.json | 2 +- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2a4c1f72a3b..019c63272c9 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6340,7 +6340,7 @@ "description": "zink: check the variable mode before taking samplemask path in ntv", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": 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 535d0f91b7d..1c7b4b4f686 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 @@ -2415,7 +2415,9 @@ emit_store_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr) } SpvId result; - if (ctx->stage == MESA_SHADER_FRAGMENT && var->data.location == FRAG_RESULT_SAMPLE_MASK) { + if (ctx->stage == MESA_SHADER_FRAGMENT && + var->data.mode == nir_var_shader_out && + var->data.location == FRAG_RESULT_SAMPLE_MASK) { src = emit_bitcast(ctx, type, src); /* SampleMask is always an array in spirv, so we need to construct it into one */ result = spirv_builder_emit_composite_construct(&ctx->builder, ctx->sample_mask_type, &src, 1);
