From 9bcc9597a5bb82f2013ea70bc8daa0bfd233b4c3 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 15 Aug 2023 11:07:36 -0500 Subject: [PATCH] nir: Fix nir_op_mov handling in nir_collect_src_uniforms For mov we need to follow the swizzle for the destination component, not grab swizzle[0] for some random source. Fixes: a406fff78a57 ("nir/inline_uniforms: support vector uniform") Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_inline_uniforms.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_inline_uniforms.c b/src/compiler/nir/nir_inline_uniforms.c index 1cc17f2df9d..f17972ebbed 100644 --- a/src/compiler/nir/nir_inline_uniforms.c +++ b/src/compiler/nir/nir_inline_uniforms.c @@ -82,7 +82,12 @@ nir_collect_src_uniforms(const nir_src *src, int component, nir_alu_instr *alu = nir_instr_as_alu(instr); /* Vector ops only need to check the corresponding component. */ - if (nir_op_is_vec(alu->op)) { + if (alu->op == nir_op_mov) { + return nir_collect_src_uniforms(&alu->src[0].src, + alu->src[0].swizzle[component], + uni_offsets, num_offsets, + max_num_bo, max_offset); + } else if (nir_op_is_vec(alu->op)) { nir_alu_src *alu_src = alu->src + component; return nir_collect_src_uniforms(&alu_src->src, alu_src->swizzle[0], uni_offsets, num_offsets,