[Mesa-dev] [PATCH 24/74] glsl: Don't do constant variable on buffer variables
Iago Toral Quiroga
itoral at igalia.com
Thu May 14 07:06:27 PDT 2015
Since the backing storage for these is shared we cannot ensure that the
value won't change by writes from other threads.
---
src/glsl/opt_constant_variable.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp
index 7222eb9..ab78e4c 100644
--- a/src/glsl/opt_constant_variable.cpp
+++ b/src/glsl/opt_constant_variable.cpp
@@ -115,6 +115,13 @@ ir_constant_variable_visitor::visit_enter(ir_assignment *ir)
if (!var)
return visit_continue;
+ /* Ignore buffer variables, since the underlying storage is shared
+ * and we can't be sure that this variable won't be written by another
+ * thread.
+ */
+ if (var->data.mode == ir_var_buffer)
+ return visit_continue;
+
constval = ir->rhs->constant_expression_value();
if (!constval)
return visit_continue;
--
1.9.1
More information about the mesa-dev
mailing list