summaryrefslogtreecommitdiff
path: root/src/glsl/link_uniforms.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2014-07-16 15:40:32 -0700
committerIan Romanick <ian.d.romanick@intel.com>2014-08-04 14:40:07 -0700
commit7f731340d25b0c4a86ec3cc7b9a33f66c4818c2b (patch)
tree566febb63703c9ee54540c7d2e6ff8cf6f79d0d3 /src/glsl/link_uniforms.cpp
parent47c6fc5b04774737404b55b01cbab5c3baf1c183 (diff)
linker: Add padding after the last field of a structure
This causes the thing following the structure to be vec4-aligned. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.nested_structs.2 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.5 Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/glsl/link_uniforms.cpp')
-rw-r--r--src/glsl/link_uniforms.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 8014a3d9a99..cfb23effcf7 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -513,7 +513,7 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major, const glsl_type *record_type,
- bool /* last_field */)
+ bool last_field)
{
assert(!type->without_array()->is_record());
assert(!type->without_array()->is_interface());
@@ -582,6 +582,9 @@ private:
this->uniforms[id].offset = this->ubo_byte_offset;
this->ubo_byte_offset += type->std140_size(ubo_row_major);
+ if (last_field)
+ this->ubo_byte_offset = glsl_align(this->ubo_byte_offset, 16);
+
if (type->is_array()) {
this->uniforms[id].array_stride =
glsl_align(type->fields.array->std140_size(ubo_row_major), 16);