nir/lower_tex: use texture_mask instead of shifting on use

In commit 292ac71a4a ("nir/lower_tex: handle deref casts"), we avoided
using texture_index when a texture instruction contained a variable
deref. There's no good reason why this should be done to some of the
lowering, but not all.

So let's fix up code-paths that were added after this change to do the
same.

The first two patches here crossed paths with the commit that introduced
texture_mask, so it's not strange that the change was missed. The last
one seems to have just copied what was done around it, propagating the
issue.

Fixes: 880b00dc59 ("nir/lower_tex: Add support for lowering YUYV formats")
Fixes: 1358d93650 ("nir/lower_tex: Add support for lowering Y41x formats")
Fixes: 65d6f5aed2 ("nir: add options to lower y_vu, yv_yu, yx_xvxu and xy_vxux")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34365>
(cherry picked from commit 41b136f674)
This commit is contained in:
Erik Faye-Lund 2025-04-03 14:17:35 +00:00 committed by Eric Engestrom
parent 5d6c82000c
commit 27342a5532
2 changed files with 4 additions and 4 deletions

View file

@ -1104,7 +1104,7 @@
"description": "nir/lower_tex: use texture_mask instead of shifting on use",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "880b00dc59973ee64cf0ce5f21dc13f19ac12e70",
"notes": null

View file

@ -1633,17 +1633,17 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
progress = true;
}
if ((1 << tex->texture_index) & options->lower_yu_yv_external) {
if (texture_mask & options->lower_yu_yv_external) {
lower_yu_yv_external(b, tex, options, texture_index);
progress = true;
}
if ((1 << tex->texture_index) & options->lower_yv_yu_external) {
if (texture_mask & options->lower_yv_yu_external) {
lower_yv_yu_external(b, tex, options, texture_index);
progress = true;
}
if ((1 << tex->texture_index) & options->lower_y41x_external) {
if (texture_mask & options->lower_y41x_external) {
lower_y41x_external(b, tex, options, texture_index);
progress = true;
}