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>
(cherry picked from commit ac289b7268)
This commit is contained in:
Karol Herbst 2023-08-22 21:18:17 +02:00 committed by Dylan Baker
parent f81d8db0ac
commit a078c471d3
2 changed files with 3 additions and 1 deletions

View file

@ -10994,7 +10994,7 @@
"description": "zink: fix global stores",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "ddc5c3048992debc3cedd22b0f2ff2ca27e8d7e4",
"notes": null

View file

@ -2984,6 +2984,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(&ctx->builder, ptr, param);
}