Module: Mesa
Branch: main
Commit: 2b7b0868dee049eea8733b436fad76720ec52930
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b7b0868dee049eea8733b436fad76720ec52930

Author: Filip Gawin <[email protected]>
Date:   Tue Jan 10 22:51:30 2023 +0100

r300: don't cache abs in fragment shader

Currently this ends up with unneeded move.

fixes: 63f353b45605379b8b81754543907a6b0fc3afdd

Reviewed-by: Pavel Ondračka <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20625>

---

 src/gallium/drivers/r300/compiler/radeon_program_alu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.c 
b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
index 8e89214e186..c28cebce3a4 100644
--- a/src/gallium/drivers/r300/compiler/radeon_program_alu.c
+++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
@@ -272,11 +272,11 @@ static void transform_TRUNC(struct radeon_compiler* c,
         
        struct rc_src_register abs;
        
-       if (c->is_r500) {
+       if (c->is_r500 || c->type == RC_FRAGMENT_PROGRAM) {
                abs = absolute(inst->U.I.SrcReg[0]);
        } else {
-               /* abs isn't free on r300/r400, so we want
-                * to avoid doing it twice
+               /* abs isn't free on r300's and r400's vertex shader,
+                *  so we want to avoid doing it twice
                 */
                int tmp = rc_find_free_temporary(c);
 

Reply via email to