summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-09-02 07:58:28 -0600
committerBrian Paul <[email protected]>2010-09-02 07:58:33 -0600
commitc9039fdb167865547dc9b3828d69b99209344999 (patch)
treeda51405f2f1451d0eb74b57e26fe5c89045d703a /src
parent9eca0e2c3e9409b5da49d9a5052d3665e7d45bb1 (diff)
mesa: fix code generation for ir_unop_sqrt
The CMP instruction needed to be flipped to properly handle operand==0. Fixes fd.o bug 29923.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index b2ba9a2fbcc..f0e14b8ece3 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1198,9 +1198,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
/* sqrt(x) = x * rsq(x). */
ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]);
ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, result_src, op[0]);
- /* For incoming channels < 0, set the result to 0. */
+ /* For incoming channels <= 0, set the result to 0. */
+ op[0].negate = ~op[0].negate;
ir_to_mesa_emit_op3(ir, OPCODE_CMP, result_dst,
- op[0], src_reg_for_float(0.0), result_src);
+ op[0], result_src, src_reg_for_float(0.0));
break;
case ir_unop_rsq:
ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]);