projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2619b1c
)
ir_to_mesa: use RSQ+MUL instead of RSQ+RCP for SQRT
author
Marek Olšák
<maraeo@gmail.com>
Tue, 31 Aug 2010 03:38:50 +0000
(
05:38
+0200)
committer
Marek Olšák
<maraeo@gmail.com>
Tue, 31 Aug 2010 04:36:52 +0000
(06:36 +0200)
sqrt(x) = 1/rsq(x) = x*rsq(x)
This optimization already was in the old GLSL compiler.
Acked on irc by Eric Anholt.
src/mesa/program/ir_to_mesa.cpp
patch
|
blob
|
history
diff --git
a/src/mesa/program/ir_to_mesa.cpp
b/src/mesa/program/ir_to_mesa.cpp
index af6d7345a54a4d142b35053d2ebdac68f9a952de..516c991855d8078c06d95b5e721b596823fd43d9 100644
(file)
--- a/
src/mesa/program/ir_to_mesa.cpp
+++ b/
src/mesa/program/ir_to_mesa.cpp
@@
-880,8
+880,9
@@
ir_to_mesa_visitor::visit(ir_expression *ir)
break;
case ir_unop_sqrt:
+ /* sqrt(x) = x * rsq(x). */
ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]);
- ir_to_mesa_emit_
scalar_op1(ir, OPCODE_RCP, result_dst, result_src
);
+ ir_to_mesa_emit_
op2(ir, OPCODE_MUL, result_dst, result_src, op[0]
);
/* For incoming channels < 0, set the result to 0. */
ir_to_mesa_emit_op3(ir, OPCODE_CMP, result_dst,
op[0], src_reg_for_float(0.0), result_src);