aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/link_uniform_blocks.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-08-26 10:26:21 +0200
committermarha <marha@users.sourceforge.net>2013-08-26 10:26:21 +0200
commitbe8a3ecf0bebc7134452778070cd83b7decf7f71 (patch)
treee3a5d81a99754c393062ed811bece6e0787e3767 /mesalib/src/glsl/link_uniform_blocks.cpp
parent7403278d95051a554e2cbec3fafdde8ce9c6d200 (diff)
parent5ee5b91b019005aa27273dff01388a68c12be293 (diff)
downloadvcxsrv-be8a3ecf0bebc7134452778070cd83b7decf7f71.tar.gz
vcxsrv-be8a3ecf0bebc7134452778070cd83b7decf7f71.tar.bz2
vcxsrv-be8a3ecf0bebc7134452778070cd83b7decf7f71.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver mesa fontconfig libX11 libxcb libxcb/xcb-proto xkeyboard-config git update 26 Aug 2013
Diffstat (limited to 'mesalib/src/glsl/link_uniform_blocks.cpp')
-rw-r--r--mesalib/src/glsl/link_uniform_blocks.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp
index 1083653c7..d96075849 100644
--- a/mesalib/src/glsl/link_uniform_blocks.cpp
+++ b/mesalib/src/glsl/link_uniform_blocks.cpp
@@ -59,6 +59,15 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
{
+ (void) type;
+ (void) name;
+ (void) row_major;
+ assert(!"Should not get here.");
+ }
+
+ virtual void visit_field(const glsl_type *type, const char *name,
+ bool row_major, const glsl_type *record_type)
+ {
assert(this->index < this->num_variables);
gl_uniform_buffer_variable *v = &this->variables[this->index++];
@@ -85,7 +94,9 @@ private:
v->IndexName = v->Name;
}
- unsigned alignment = type->std140_base_alignment(v->RowMajor);
+ const unsigned alignment = record_type
+ ? record_type->std140_base_alignment(v->RowMajor)
+ : type->std140_base_alignment(v->RowMajor);
unsigned size = type->std140_size(v->RowMajor);
this->offset = glsl_align(this->offset, alignment);
@@ -107,6 +118,10 @@ private:
virtual void visit_field(const glsl_struct_field *field)
{
+ /* FINISHME: When support for doubles (dvec4, etc.) is added to the
+ * FINISHME: compiler, this may be incorrect for a structure in a UBO
+ * FINISHME: like struct s { struct { float f } s1; dvec4 v; };.
+ */
this->offset = glsl_align(this->offset,
field->type->std140_base_alignment(false));
}