From 708c47e663be686b150c1dae33fee5b8323c8d1b Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Tue, 8 Dec 2020 15:44:07 +0100 Subject: [PATCH] nir: Validate nir_tex_instr::dest_type bitsize In theory, we could also verify this against the sampler type for sampler derefs, but there are a number of complications there: - SPIR-V 1.4 lets you override the signedness of integer samplers per-instruction. So the base type may not match. - mediump/RelaxedPrecision samplers may get lowered to f16 in the instruction or may not. So the bitsize may not match. Reviewed-by: Jason Ekstrand Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_validate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 17fa705d55b..a01501d0c70 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -824,6 +824,10 @@ validate_tex_instr(nir_tex_instr *instr, validate_state *state) } validate_dest(&instr->dest, state, 0, nir_tex_instr_dest_size(instr)); + + validate_assert(state, + nir_alu_type_get_type_size(instr->dest_type) == + nir_dest_bit_size(instr->dest)); } static void