summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-17 14:41:14 -0700
committerJason Ekstrand <[email protected]>2016-03-23 16:28:07 -0700
commitb2209b2333e71549f4101d3d1193c7a2df4e1c14 (patch)
tree3341418afd2872e624d20a01566c66e8feb2749a /src/compiler/glsl/opt_algebraic.cpp
parent89b604922d2fb50ca1013473b2003227d61507cd (diff)
glsl/opt_algebraic: Don't handle invariant or precise trees
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/compiler/glsl/opt_algebraic.cpp')
-rw-r--r--src/compiler/glsl/opt_algebraic.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp
index 1e58062cb0d..f5858c83865 100644
--- a/src/compiler/glsl/opt_algebraic.cpp
+++ b/src/compiler/glsl/opt_algebraic.cpp
@@ -58,6 +58,8 @@ public:
{
}
+ virtual ir_visitor_status visit_enter(ir_assignment *ir);
+
ir_rvalue *handle_expression(ir_expression *ir);
void handle_rvalue(ir_rvalue **rvalue);
bool reassociate_constant(ir_expression *ir1,
@@ -80,6 +82,23 @@ public:
} /* unnamed namespace */
+ir_visitor_status
+ir_algebraic_visitor::visit_enter(ir_assignment *ir)
+{
+ ir_variable *var = ir->lhs->variable_referenced();
+ if (var->data.invariant || var->data.precise) {
+ /* If we're assigning to an invariant or precise variable, just bail.
+ * Most of the algebraic optimizations aren't precision-safe.
+ *
+ * FINISHME: Find out which optimizations are precision-safe and enable
+ * then only for invariant or precise trees.
+ */
+ return visit_continue_with_parent;
+ } else {
+ return visit_continue;
+ }
+}
+
static inline bool
is_vec_zero(ir_constant *ir)
{