From 004ca7623824950a9888d5414366df362c5197b1 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 2 Apr 2021 14:27:38 +0200 Subject: [PATCH] r600/sfn: Only fetch the constants that are needed in fdd* The number of source components can be deternmined based on the number of dest components, and copying other components to the gradient get call is not required. Closes #4557 Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp index 9c8ee2d13d6..44e43c1b578 100644 --- a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp @@ -913,12 +913,10 @@ bool EmitAluInstruction::emit_tex_fdd(const nir_alu_instr& instr, TexInstruction GPRVector::Values v; std::array writemask = {0,1,2,3}; - int ncomp = nir_src_num_components(instr.src[0].src); - - GPRVector::Swizzle src_swz; - for (auto i = 0; i < 4; ++i) { + int ncomp = nir_dest_num_components(instr.dest.dest); + GPRVector::Swizzle src_swz = {7,7,7,7}; + for (auto i = 0; i < ncomp; ++i) src_swz[i] = instr.src[0].swizzle[i]; - } auto src = vec_from_nir_with_fetch_constant(instr.src[0].src, (1 << ncomp) - 1, src_swz);