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 <jason@jlekstrand.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989>
This commit is contained in:
Connor Abbott 2020-12-08 15:44:07 +01:00
parent 65a35dc7ea
commit 708c47e663
1 changed files with 4 additions and 0 deletions

View File

@ -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