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

Author: Eric Anholt <[email protected]>
Date:   Thu Jul  7 17:08:04 2011 -0700

i965: Fix fp-dst-aliasing-[12].vpfp.

There's no pretty way to avoid the overwriting of the src operands, so
just use a temporary destination and rely on the MOV optimization.

Reviewed-by: Ian Romanick <[email protected]>

---

 src/mesa/drivers/dri/i965/brw_wm_fp.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c 
b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 87eabf1..7cd3eda 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -563,13 +563,14 @@ static void precalc_dst( struct brw_wm_compile *c,
    struct prog_src_register src0 = inst->SrcReg[0];
    struct prog_src_register src1 = inst->SrcReg[1];
    struct prog_dst_register dst = inst->DstReg;
-   
+   struct prog_dst_register temp = get_temp(c);
+
    if (dst.WriteMask & WRITEMASK_Y) {      
       /* dst.y = mul src0.y, src1.y
        */
       emit_op(c,
              OPCODE_MUL,
-             dst_mask(dst, WRITEMASK_Y),
+             dst_mask(temp, WRITEMASK_Y),
              inst->SaturateMode,
              src0,
              src1,
@@ -584,7 +585,7 @@ static void precalc_dst( struct brw_wm_compile *c,
        */
       swz = emit_op(c,
                    OPCODE_SWZ,
-                   dst_mask(dst, WRITEMASK_XZ),
+                   dst_mask(temp, WRITEMASK_XZ),
                    inst->SaturateMode,
                    src_swizzle(src0, SWIZZLE_ONE, z, z, z),
                    src_undef(),
@@ -597,12 +598,26 @@ static void precalc_dst( struct brw_wm_compile *c,
        */
       emit_op(c,
              OPCODE_MOV,
-             dst_mask(dst, WRITEMASK_W),
+             dst_mask(temp, WRITEMASK_W),
              inst->SaturateMode,
              src1,
              src_undef(),
              src_undef());
    }
+
+   /* This will get optimized out in general, but it ensures that we
+    * don't overwrite src operands in our channel-wise splitting
+    * above.  See piglit fp-dst-aliasing-[12].
+    */
+   emit_op(c,
+          OPCODE_MOV,
+          dst,
+          0,
+          src_reg_from_dst(temp),
+          src_undef(),
+          src_undef());
+
+   release_temp(c, temp);
 }
 
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to