Commit dc7f449d1ac53a66e6efb56ccf2a5953418a26ca introduced a new method
for avoiding MOVs: try to rewrite the destination of the instruction
that produced the RHS so it writes into the LHS.

Unfortunately, this is not safe for texturing operations, as they
return a set of four contiguous registers.  Consider the following:

SEND g7   ...
MOV  g15  g7
ADD  g8   1.0

Upon seeing the MOV, we would rewrite the SEND to write to g15 (and
implicitly g16, g17, and g18), causing the next instruction that
references g8 to read garbage.

The VS does not need texturing workarounds because sampler results fit
in a single register in SIMD4x2 mode.

Fixes color distortion in XBMC when using GLSL shaders.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44333
Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index e670ba7..5d93ba5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -605,6 +605,9 @@ fs_visitor::try_rewrite_rhs_to_dst(ir_assignment *ir,
        !src.equals(&last_rhs_inst->dst))
       return false;
 
+   if (last_rhs_inst->is_tex())
+      return false;
+
    /* Success!  Rewrite the instruction. */
    last_rhs_inst->dst = dst;
 
-- 
1.7.9

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to