From c7d8fe2f0d23a82ed92a58594645c227155c35f0 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Tue, 22 Oct 2019 23:40:08 -0700 Subject: [PATCH] spirv: Check that only one offset is defined as Image Operand Reviewed-by: Jason Ekstrand Reviewed-by: Bas Nieuwenhuizen --- src/compiler/spirv/spirv_to_nir.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 2de9bdf3389..d1884f48330 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2438,6 +2438,12 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_ddy); } + vtn_fail_if(util_bitcount(operands & (SpvImageOperandsConstOffsetsMask | + SpvImageOperandsOffsetMask | + SpvImageOperandsConstOffsetMask)) > 1, + "At most one of the ConstOffset, Offset, and ConstOffsets " + "image operands can be used on a given instruction."); + if (operands & SpvImageOperandsOffsetMask || operands & SpvImageOperandsConstOffsetMask) (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_offset); -- 2.30.2