nir_to_tgsi_lower_tex puts some NIR texture instructions in an invalid state
This lowering pass removes the named parameters from the texture instructions (e.g., the nir_tex_src_bias
parameter in a nir_texop_txb
) and appends it to the nir_tex_src_coord
parameter. The problem is that other optimization passes may very reasonably expect those parameters be there.
This led to failures in https://gitlab.freedesktop.org/mesa/mesa/-/pipelines/458626. The original version of !14025 (merged) would assert that bias_idx >= 0
. Nearly every other place that looks up nir_tex_src_bias
for a nir_texop_txb
has a similar assertion, so this seemed reasonable.
This may be fine... but it seems fishy to me.
I'd really like to add something like this to validate_tex_instr
in nir_validate_shader
:
if (instr->op == nir_texop_txb) {
validate_assert(state,
nir_tex_instr_src_index(instr, nir_tex_src_bias) >= 0);
}