diff options
author | Karol Herbst <kherbst@redhat.com> | 2022-04-14 19:14:10 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-04-29 00:01:20 +0000 |
commit | 93144175fae626690fe34b9941a600eba8fe8738 (patch) | |
tree | b15a7f618db5c9efecf31200c230e612085d28c6 | |
parent | c31db58f656a99796ef1431b2f5063935c86d4a4 (diff) |
vtn: clamp SpvOpImageQuerySize dest to 32 bit
CL image arrays slice is 64 bit for whatever reason...
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16205>
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index ad7a8d7bfe4..be9e922324c 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3563,9 +3563,14 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode, if (nir_intrinsic_infos[op].dest_components == 0) intrin->num_components = dest_components; + unsigned bit_size = glsl_get_bit_size(type->type); + if (opcode == SpvOpImageQuerySize || + opcode == SpvOpImageQuerySizeLod) + bit_size = MIN2(bit_size, 32); + nir_ssa_dest_init(&intrin->instr, &intrin->dest, nir_intrinsic_dest_components(intrin), - glsl_get_bit_size(type->type), NULL); + bit_size, NULL); nir_builder_instr_insert(&b->nb, &intrin->instr); @@ -3573,6 +3578,10 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode, if (nir_intrinsic_dest_components(intrin) != dest_components) result = nir_channels(&b->nb, result, (1 << dest_components) - 1); + if (opcode == SpvOpImageQuerySize || + opcode == SpvOpImageQuerySizeLod) + result = nir_u2u(&b->nb, result, glsl_get_bit_size(type->type)); + if (opcode == SpvOpImageSparseRead) { struct vtn_ssa_value *dest = vtn_create_ssa_value(b, struct_type->type); unsigned res_type_size = glsl_get_vector_elements(type->type); |