[Mesa-dev] [PATCH] st/mesa: fix XPD lowering - don't read dst

Marek Olšák maraeo at gmail.com
Mon Aug 28 21:30:42 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102461
---
 src/mesa/state_tracker/st_mesa_to_tgsi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 916f7fa..fa9fa44 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -555,33 +555,36 @@ compile_instruction(
                      src, num_src );
       return;
 
    case OPCODE_SCS:
       ureg_COS(ureg, ureg_writemask(dst[0], TGSI_WRITEMASK_X),
                ureg_scalar(src[0], TGSI_SWIZZLE_X));
       ureg_SIN(ureg, ureg_writemask(dst[0], TGSI_WRITEMASK_Y),
                ureg_scalar(src[0], TGSI_SWIZZLE_X));
       break;
 
-   case OPCODE_XPD:
-      ureg_MUL(ureg, ureg_writemask(dst[0], TGSI_WRITEMASK_XYZ),
+   case OPCODE_XPD: {
+      struct ureg_dst tmp = ureg_DECL_temporary(ureg);
+
+      ureg_MUL(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ),
                ureg_swizzle(src[0], TGSI_SWIZZLE_Y, TGSI_SWIZZLE_Z,
                             TGSI_SWIZZLE_X, 0),
                ureg_swizzle(src[1], TGSI_SWIZZLE_Z, TGSI_SWIZZLE_X,
                             TGSI_SWIZZLE_Y, 0));
       ureg_MAD(ureg, ureg_writemask(dst[0], TGSI_WRITEMASK_XYZ),
                ureg_swizzle(src[0], TGSI_SWIZZLE_Z, TGSI_SWIZZLE_X,
                             TGSI_SWIZZLE_Y, 0),
                ureg_negate(ureg_swizzle(src[1], TGSI_SWIZZLE_Y,
                                         TGSI_SWIZZLE_Z, TGSI_SWIZZLE_X, 0)),
-               ureg_src(dst[0]));
+               ureg_src(tmp));
       break;
+   }
 
    case OPCODE_RSQ:
       ureg_RSQ( ureg, dst[0], ureg_abs(src[0]) );
       break;
 
    case OPCODE_ABS:
       ureg_MOV(ureg, dst[0], ureg_abs(src[0]));
       break;
 
    case OPCODE_SUB:
-- 
2.7.4



More information about the mesa-dev mailing list