[Mesa-dev] [PATCH] glsl: remove rsq+rcp -> sqrt transformation to fix the game Risen

Marek Olšák maraeo at gmail.com
Tue May 31 10:46:43 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

Using sqrt here breaks rendering.

Apitrace: In the bugzilla.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94627
---
 src/compiler/glsl/opt_algebraic.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp
index f5858c8..f5fec9d 100644
--- a/src/compiler/glsl/opt_algebraic.cpp
+++ b/src/compiler/glsl/opt_algebraic.cpp
@@ -898,11 +898,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
                                            neg(op_expr[0]->operands[0]));
       }
 
-      /* While ir_to_mesa.cpp will lower sqrt(x) to rcp(rsq(x)), it does so at
-       * its IR level, so we can always apply this transformation.
-       */
-      if (op_expr[0] && op_expr[0]->operation == ir_unop_rsq)
-         return sqrt(op_expr[0]->operands[0]);
+      /* DO NOT transform rsq+rcp into sqrt. It breaks the game Risen. */
 
       /* As far as we know, all backends are OK with rsq. */
       if (op_expr[0] && op_expr[0]->operation == ir_unop_sqrt) {
-- 
2.7.4



More information about the mesa-dev mailing list