[Mesa-dev] [PATCH] glsl: remove logical xor FINISHME

Matt Turner mattst88 at gmail.com
Sun Jan 8 19:44:17 PST 2012


GLSL spec boneheadedly says (a ^^ a) must actually be evaluated.

Signed-off-by: Matt Turner <mattst88 at gmail.com>
---

Fortunately, shaders that do this are even more boneheaded.

 src/glsl/opt_algebraic.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index cade961..5fc4fc8 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -320,7 +320,12 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
       break;
 
    case ir_binop_logic_xor:
-      /* FINISHME: Also simplify (a ^^ a) to (false). */
+      /* From page 59 (page 65 of the PDF) of the GLSL 1.50 spec:
+       *
+       *    "Exclusive or (^^) will always evaluate both operands."
+       *
+       * So we can't simplify (a ^^ a) to false.
+       */
       if (is_vec_zero(op_const[0])) {
 	 this->progress = true;
 	 return ir->operands[1];
-- 
1.7.3.4



More information about the mesa-dev mailing list