mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
intel/nir: Replace tg4 with txl/txb/tex when splitting texture residency
textureGather() returns the four taps that would have been filtered together to produce the value that ordinary texturing operations would return. As such, it should access the same data, so we can use either interchangeably when we're only checking for residency and not returning the actual data. This allows us to mask out some unneeded registers. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40590>
This commit is contained in:
parent
605ef577b3
commit
204af7e09f
1 changed files with 16 additions and 0 deletions
|
|
@ -130,6 +130,22 @@ split_tex_residency(nir_builder *b, nir_tex_instr *tex, int compare_idx)
|
|||
tex->def.num_components, tex->def.bit_size);
|
||||
nir_builder_instr_insert(b, &sparse_tex->instr);
|
||||
|
||||
/* txl/txb/tex and tg4 both access the same pixels for residency checking
|
||||
* purposes, but using the former for residency-only queries lets us mask
|
||||
* out unwanted color components, using fewer registers.
|
||||
*/
|
||||
if (sparse_tex->op == nir_texop_tg4) {
|
||||
if (nir_tex_instr_src_index(sparse_tex, nir_tex_src_bias) >= 0)
|
||||
sparse_tex->op = nir_texop_txb;
|
||||
else if (sparse_tex->is_gather_implicit_lod)
|
||||
sparse_tex->op = nir_texop_tex;
|
||||
else
|
||||
sparse_tex->op = nir_texop_txl;
|
||||
|
||||
sparse_tex->component = 0;
|
||||
sparse_tex->is_gather_implicit_lod = false;
|
||||
}
|
||||
|
||||
/* Drop the compare source on the cloned instruction */
|
||||
if (compare_idx != -1)
|
||||
nir_tex_instr_remove_src(sparse_tex, compare_idx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue