From 1975d5eaf4ea2c19d5b7d8ae70c4e565cf75fd34 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 30 Nov 2022 18:54:00 +0100 Subject: [PATCH] r600/sfn: use only as many components as needed for tex backend coord Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_instr_tex.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_tex.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_tex.cpp index 84caf6e5ceb..1a47740058f 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_tex.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_tex.cpp @@ -1162,14 +1162,16 @@ LowerTexToBackend::finalize(nir_tex_instr *tex, nir_ssa_def * LowerTexToBackend::prep_src(std::array& coord, int& used_coord_mask) { + int max_coord = 0; for (int i = 0; i < 4; ++i) { - if (coord[i]) + if (coord[i]) { used_coord_mask |= 1 << i; - else + max_coord = i; + } else coord[i] = get_undef(); } - return nir_vec(b, coord.data(), 4); + return nir_vec(b, coord.data(), max_coord + 1); } nir_ssa_def *