From 41b136f674e440eeab7fcc16d41033f5e31b39ca Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 3 Apr 2025 14:17:35 +0000 Subject: [PATCH] nir/lower_tex: use texture_mask instead of shifting on use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In commit 292ac71a4a8 ("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: 880b00dc599 ("nir/lower_tex: Add support for lowering YUYV formats") Fixes: 1358d93650b ("nir/lower_tex: Add support for lowering Y41x formats") Fixes: 65d6f5aed28 ("nir: add options to lower y_vu, yv_yu, yx_xvxu and xy_vxux") Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir_lower_tex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 9618567d05e..6607616dfc6 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -1627,17 +1627,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; }