intel/compiler: Trim vector properly till array index

This fixes the off-by one mistake, we want to trim the vector till the
array index not till the coordinates last component.

v2: (Ian)
- Use tex->coord_component - 1 in nir_trim_vector

Fixes: 73a3257968 ("intel/compiler: Add texture operation lowering pass")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27447>
This commit is contained in:
Sagar Ghuge 2024-02-14 09:40:14 -08:00 committed by Marge Bot
parent db0291c235
commit d4ce848476

View file

@ -84,7 +84,8 @@ pack_lod_and_array_index(nir_builder *b, nir_tex_instr *tex)
/* Second, replace the coordinate with a new value that has one fewer
* component (i.e., drop the array index).
*/
nir_def *reduced_coord = nir_trim_vector(b, coord, 2);
nir_def *reduced_coord = nir_trim_vector(b, coord,
tex->coord_components - 1);
tex->coord_components--;
/* Finally, remove the old sources and add the new. */