i965: Add support for OPCODE_CMP in the VS to fix GLSL sqrt()
authorEric Anholt <eric@anholt.net>
Tue, 15 Dec 2009 22:32:47 +0000 (14:32 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 19 Dec 2009 04:35:57 +0000 (20:35 -0800)
Bug #25628.  Fixes piglit case glsl-vs-sqrt-zero.

src/mesa/drivers/dri/i965/brw_vs_emit.c

index 00efd3443d1152290a105f7e2dd03d3bd135c898..27aac8b54a95da8b1279d4cc073c45be4163c10d 100644 (file)
@@ -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;