Commit e9ab35ad authored by Mike Blumenkrantz's avatar Mike Blumenkrantz 🏋 Committed by Marge Bot

zink: fix gl_SampleMaskIn handling

this is an array[1], so we need to do some extra legwork here even though
probably it'd work fine even without it
Reviewed-by: Erik Faye-Lund 's avatarErik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <mesa/mesa!7490>
parent 354b2f7f
......@@ -1803,11 +1803,25 @@ 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 (!*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));
}
if (!*var_id) {
*var_id = create_builtin_var(ctx, var_type,
SpvStorageClassInput,
var_name,
builtin);
if (builtin == SpvBuiltInSampleMask) {
SpvId zero = emit_uint_const(ctx, 32, 0);
var_type = spirv_builder_type_uint(&ctx->builder, 32);
SpvId pointer_type = spirv_builder_type_pointer(&ctx->builder,
SpvStorageClassInput,
var_type);
*var_id = spirv_builder_emit_access_chain(&ctx->builder, pointer_type, *var_id, &zero, 1);
}
}
SpvId result = spirv_builder_emit_load(&ctx->builder, var_type, *var_id);
assert(1 == nir_dest_num_components(intr->dest));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment