zink: fix global stores

We have to cast the value if the type doesn't match.

Fixes: ddc5c30489 ("zink: handle global and scratch vars")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24859>
This commit is contained in:
Karol Herbst 2023-08-22 21:18:17 +02:00 committed by Marge Bot
parent ac1685bc6a
commit ac289b7268

View file

@ -2517,6 +2517,8 @@ emit_store_global(struct ntv_context *ctx, nir_intrinsic_instr *intr)
dest_type);
nir_alu_type atype;
SpvId param = get_src(ctx, &intr->src[0], &atype);
if (atype != nir_type_uint)
param = emit_bitcast(ctx, dest_type, param);
SpvId ptr = emit_bitcast(ctx, pointer_type, get_src(ctx, &intr->src[1], &atype));
spirv_builder_emit_store_aligned(&ctx->builder, ptr, param, bit_size / 8);
}