summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-03-18 09:47:54 -0400
committerDylan Baker <dylan.c.baker@intel.com>2021-03-18 09:34:37 -0700
commit2e7f59ef87b081df84928b4cb42f6b680a7053f0 (patch)
tree0eb1bce6b9d4a18998cdb59ba3a0fafaaf07ac4a /src
parenta9536794c33ee7c721f54e46f29b86484c651aed (diff)
compiler/spirv: fix image sample queries
this was only implemented for textures (I assume because drivers which implement the corresponding intrinsic don't support multisampled images), but it's also used for shader images Fixes: 22fdb2f8551 ("nir/spirv: Update to the latest revision") Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9682> (cherry picked from commit 50881d59e66fbf0be73cf61677754e512956fd84)
Diffstat (limited to 'src')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 6a784812ffd..f739a8389aa 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3141,6 +3141,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
break;
case SpvOpImageQuerySize:
+ case SpvOpImageQuerySamples:
res_val = vtn_untyped_value(b, w[3]);
image.image = vtn_get_image(b, w[3], &access);
image.coord = NULL;
@@ -3272,6 +3273,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
OP(AtomicFAddEXT, atomic_fadd)
OP(ImageQueryFormat, format)
OP(ImageQueryOrder, order)
+ OP(ImageQuerySamples, samples)
#undef OP
default:
vtn_fail_with_opcode("Invalid image opcode", opcode);
@@ -3282,6 +3284,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
intrin->src[0] = nir_src_for_ssa(&image.image->dest.ssa);
switch (opcode) {
+ case SpvOpImageQuerySamples:
case SpvOpImageQuerySize:
case SpvOpImageQuerySizeLod:
case SpvOpImageQueryFormat:
@@ -3313,6 +3316,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
nir_intrinsic_set_access(intrin, access);
switch (opcode) {
+ case SpvOpImageQuerySamples:
case SpvOpImageQueryFormat:
case SpvOpImageQueryOrder:
/* No additional sources */
@@ -5310,7 +5314,6 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpImageSparseDrefGather:
case SpvOpImageQueryLod:
case SpvOpImageQueryLevels:
- case SpvOpImageQuerySamples:
vtn_handle_texture(b, opcode, w, count);
break;
@@ -5323,6 +5326,7 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
vtn_handle_image(b, opcode, w, count);
break;
+ case SpvOpImageQuerySamples:
case SpvOpImageQuerySizeLod:
case SpvOpImageQuerySize: {
struct vtn_type *image_type = vtn_get_value_type(b, w[3]);