Mesa (master): r600/sfn: Only fetch the constants that are needed in fdd*

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 2 20:41:27 UTC 2021


Module: Mesa
Branch: master
Commit: 004ca7623824950a9888d5414366df362c5197b1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=004ca7623824950a9888d5414366df362c5197b1

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Fri Apr  2 14:27:38 2021 +0200

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 <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10011>

---

 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<int, 4> 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);
 



More information about the mesa-commit mailing list