From: Caio Marcelo de Oliveira Filho Date: Wed, 23 Oct 2019 06:40:08 +0000 (-0700) Subject: spirv: Check that only one offset is defined as Image Operand X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7d8fe2f0d23a82ed92a58594645c227155c35f0;p=mesa.git spirv: Check that only one offset is defined as Image Operand Reviewed-by: Jason Ekstrand Reviewed-by: Bas Nieuwenhuizen --- 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);