zink: fix gl_SampleMaskIn spirv generation

the uint[1] -> uint dance is only relevant on the first load, so move
the variable type shuffling inside the create block to avoid breaking successive
loads

fixes #5543

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13488>
(cherry picked from commit 8899f6a198)
This commit is contained in:
Mike Blumenkrantz 2021-10-22 13:47:16 -04:00 committed by Dylan Baker
parent a29d40b563
commit 29fac5d715
2 changed files with 6 additions and 6 deletions

View file

@ -157,7 +157,7 @@
"description": "zink: fix gl_SampleMaskIn spirv generation",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -2199,12 +2199,12 @@ static void
emit_load_uint_input(struct ntv_context *ctx, nir_intrinsic_instr *intr, SpvId *var_id, const char *var_name, SpvBuiltIn builtin)
{
SpvId var_type = spirv_builder_type_uint(&ctx->builder, 32);
if (builtin == SpvBuiltInSampleMask) {
/* gl_SampleMaskIn is an array[1] in spirv... */
var_type = spirv_builder_type_array(&ctx->builder, var_type, emit_uint_const(ctx, 32, 1));
spirv_builder_emit_array_stride(&ctx->builder, var_type, sizeof(uint32_t));
}
if (!*var_id) {
if (builtin == SpvBuiltInSampleMask) {
/* gl_SampleMaskIn is an array[1] in spirv... */
var_type = spirv_builder_type_array(&ctx->builder, var_type, emit_uint_const(ctx, 32, 1));
spirv_builder_emit_array_stride(&ctx->builder, var_type, sizeof(uint32_t));
}
*var_id = create_builtin_var(ctx, var_type,
SpvStorageClassInput,
var_name,