From: Eric Anholt Date: Tue, 15 Dec 2009 22:32:47 +0000 (-0800) Subject: i965: Add support for OPCODE_CMP in the VS to fix GLSL sqrt() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f06c8bd8dd961c9b722759b5d1f8fca78023aba8;p=mesa.git i965: Add support for OPCODE_CMP in the VS to fix GLSL sqrt() Bug #25628. Fixes piglit case glsl-vs-sqrt-zero. --- diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 00efd3443d1..27aac8b54a9 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;