summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-10-31 14:03:10 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-09 13:57:21 +0000
commit996c20208fdbf50e64480ebe9d87c256b939be4e (patch)
treee608d7b4aa5e98d100ead68bb04bf53783bbb8cb /src/compiler
parent9397899aedeec92ec678377785dd78441a74a5fb (diff)
downloadexternal_mesa3d-996c20208fdbf50e64480ebe9d87c256b939be4e.zip
external_mesa3d-996c20208fdbf50e64480ebe9d87c256b939be4e.tar.gz
external_mesa3d-996c20208fdbf50e64480ebe9d87c256b939be4e.tar.bz2
glsl: fix lowering of UBO references of named blocks
When a UBO reference has the form block_name.foo where block_name refers to a block where the first member has a non-zero offset, the base offset was incorrectly added to the reference. Fixes an assertion triggered in debug builds by GL45-CTS.enhanced_layouts.uniform_block_layout_qualifier_conflict. That test doesn't properly check for correct execution in this case, so I am also going to send out a piglit test. Cc: 13.0 <mesa-stable@lists.freedesktop.org> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (cherry picked from commit 37d646c1b3626ad54ed93a784824af7b5abe8a99)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/lower_ubo_reference.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/glsl/lower_ubo_reference.cpp b/src/compiler/glsl/lower_ubo_reference.cpp
index 37134a9..eafa1dd 100644
--- a/src/compiler/glsl/lower_ubo_reference.cpp
+++ b/src/compiler/glsl/lower_ubo_reference.cpp
@@ -107,7 +107,6 @@ public:
struct gl_linked_shader *shader;
bool clamp_block_indices;
- struct gl_uniform_buffer_variable *ubo_var;
const struct glsl_struct_field *struct_field;
ir_variable *variable;
ir_rvalue *uniform_block;
@@ -308,8 +307,11 @@ lower_ubo_reference_visitor::setup_for_load_or_store(void *mem_ctx,
this->uniform_block = index;
}
- this->ubo_var = var->is_interface_instance()
- ? &blocks[i]->Uniforms[0] : &blocks[i]->Uniforms[var->data.location];
+ if (var->is_interface_instance()) {
+ *const_offset = 0;
+ } else {
+ *const_offset = blocks[i]->Uniforms[var->data.location].Offset;
+ }
break;
}
@@ -317,8 +319,6 @@ lower_ubo_reference_visitor::setup_for_load_or_store(void *mem_ctx,
assert(this->uniform_block);
- *const_offset = ubo_var->Offset;
-
this->struct_field = NULL;
setup_buffer_access(mem_ctx, deref, offset, const_offset, row_major,
matrix_columns, &this->struct_field, packing);