diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp b/src/compiler/glsl/opt_copy_propagation_elements.cpp index 8bae424a1d0..8975e727522 100644 --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp @@ -544,6 +544,10 @@ ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir) if (!lhs || !(lhs->type->is_scalar() || lhs->type->is_vector())) return; + if (lhs->var->data.mode == ir_var_shader_storage || + lhs->var->data.mode == ir_var_shader_shared) + return; + ir_dereference_variable *rhs = ir->rhs->as_dereference_variable(); if (!rhs) { ir_swizzle *swiz = ir->rhs->as_swizzle(); @@ -560,6 +564,10 @@ ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir) orig_swizzle[3] = swiz->mask.w; } + if (rhs->var->data.mode == ir_var_shader_storage || + rhs->var->data.mode == ir_var_shader_shared) + return; + /* Move the swizzle channels out to the positions they match in the * destination. We don't want to have to rewrite the swizzle[] * array every time we clear a bit of the write_mask.