[Mesa-dev] [PATCH 6/6] glsl: Optimize triop_csel with all-true or all-false.

Eric Anholt eric at anholt.net
Sun Jan 19 23:18:38 PST 2014


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

diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 7fbc32e..cc9c928 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -526,6 +526,13 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
       }
       break;
 
+   case ir_triop_csel:
+      if (is_vec_one(op_const[0]))
+	 return ir->operands[1];
+      if (is_vec_zero(op_const[0]))
+	 return ir->operands[2];
+      break;
+
    default:
       break;
    }
-- 
1.8.5.2



More information about the mesa-dev mailing list