Mesa (mesa_7_7_branch): i965: Add support for OPCODE_CMP in the VS to fix GLSL sqrt()

Eric Anholt anholt at kemper.freedesktop.org
Sat Dec 19 04:36:04 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: f06c8bd8dd961c9b722759b5d1f8fca78023aba8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f06c8bd8dd961c9b722759b5d1f8fca78023aba8

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Dec 15 14:32:47 2009 -0800

i965: Add support for OPCODE_CMP in the VS to fix GLSL sqrt()

Bug #25628.  Fixes piglit case glsl-vs-sqrt-zero.

---

 src/mesa/drivers/dri/i965/brw_vs_emit.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 00efd34..27aac8b 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -392,6 +392,17 @@ static void emit_sge( struct brw_vs_compile *c,
   emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_GE);
 }
 
+static void emit_cmp( struct brw_compile *p,
+		      struct brw_reg dst,
+		      struct brw_reg arg0,
+		      struct brw_reg arg1,
+		      struct brw_reg arg2 )
+{
+   brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0, brw_imm_f(0));
+   brw_SEL(p, dst, arg1, arg2);
+   brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+}
+
 static void emit_max( struct brw_compile *p, 
 		      struct brw_reg dst,
 		      struct brw_reg arg0,
@@ -1485,6 +1496,9 @@ void brw_vs_emit(struct brw_vs_compile *c )
 	    brw_MOV(p, brw_acc_reg(), args[2]);
 	 brw_MAC(p, dst, args[0], args[1]);
 	 break;
+      case OPCODE_CMP:
+	 emit_cmp(p, dst, args[0], args[1], args[2]);
+	 break;
       case OPCODE_MAX:
 	 emit_max(p, dst, args[0], args[1]);
 	 break;




More information about the mesa-commit mailing list