intel/nir: fix sparse shadow comparison for BRW

While Jay overwrites sparse_tex->op with the newer opcodes that only
return red and the sparse stuff, BRW keeps using the original opcode
of the cloned instruction, so it can't change def->num_components.

This was not previously detectable since we did not have sparse
enabled for depth/stencil on Anv for a while. A patch to re-enable
that was proposed a while ago (MR !37423), never merged, but then a
recent attempt to try to merge it (by me) detected this regression.
Let's fix the regression first, then we can finally re-enable sparse
depth/stencil support in Anv, hopefully.

Fixes: 7468261d3d ("intel/nir: Make intel_nir_lower_sparse work for either brw or jay")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37423>
This commit is contained in:
Paulo Zanoni 2026-05-05 12:52:46 -07:00 committed by Marge Bot
parent 4084f6900e
commit 7eab94d542

View file

@ -136,13 +136,15 @@ split_tex_residency(nir_builder *b, nir_tex_instr *tex, bool jay)
/* Clone the original instruction */
nir_tex_instr *sparse_tex =
nir_instr_as_tex(nir_instr_clone(b->shader, &tex->instr));
nir_def_init(&sparse_tex->instr, &sparse_tex->def, 2, tex->def.bit_size);
nir_def_init(&sparse_tex->instr, &sparse_tex->def,
tex->def.num_components, tex->def.bit_size);
nir_builder_instr_insert(b, &sparse_tex->instr);
if (jay) {
sparse_tex->op = tex->op == nir_texop_txf ?
nir_texop_sparse_residency_txf_intel :
nir_texop_sparse_residency_intel;
sparse_tex->def.num_components = 2;
}
/* txl/txb/tex and tg4 both access the same pixels for residency checking