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 <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18375>
This commit is contained in:
Mike Blumenkrantz 2022-09-01 15:21:12 -04:00 committed by Marge Bot
parent e2773d67fe
commit 8abbc6b19b

View file

@ -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);