diff options
author | Iago Toral Quiroga <[email protected]> | 2015-04-24 11:15:48 +0200 |
---|---|---|
committer | Samuel Iglesias Gonsalvez <[email protected]> | 2015-07-14 07:04:04 +0200 |
commit | 5dfea83ee6bf85fb3962679d043eb06b33bfd4c1 (patch) | |
tree | 7f45ba3521740f762f99dfd31a3d0de01e05b344 /src/glsl | |
parent | 0b1111d985714816fad20c99b4e6ea762df17b46 (diff) |
glsl: Don't do constant variable on buffer variables
Since the backing storage for these is shared we cannot ensure that
the value won't change by writes from other threads. Normally SSBO
accesses are not guaranteed to be syncronized with other threads,
except when memoryBarrier is used. So, we might be able to optimize
some SSBO accesses, but for now we always take the safe path and emit
the SSBO access.
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/opt_constant_variable.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp index 7222eb92a7d..7aaaeedf98d 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_shader_storage) + return visit_continue; + constval = ir->rhs->constant_expression_value(); if (!constval) return visit_continue; |