[Mesa-dev] [PATCH v2 24/82] glsl: Don't do constant propagation on buffer variables
Iago Toral Quiroga
itoral at igalia.com
Wed Jun 3 00:01:14 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_propagation.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp
index 90cc0c8..10be8e8 100644
--- a/src/glsl/opt_constant_propagation.cpp
+++ b/src/glsl/opt_constant_propagation.cpp
@@ -444,6 +444,14 @@ ir_constant_propagation_visitor::add_constant(ir_assignment *ir)
if (!deref->var->type->is_vector() && !deref->var->type->is_scalar())
return;
+ /* We can't do copy propagation on buffer variables, since the underlying
+ * memory storage is shared across multiple threads we can't be sure that
+ * the variable value isn't modified between this assignment and the next
+ * instruction where its value is read.
+ */
+ if (deref->var->data.mode == ir_var_shader_storage)
+ return;
+
entry = new(this->mem_ctx) acp_entry(deref->var, ir->write_mask, constant);
this->acp->push_tail(entry);
}
--
1.9.1
More information about the mesa-dev
mailing list