summaryrefslogtreecommitdiff
path: root/src/glsl/glsl_types.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2013-01-22 00:06:10 -0500
committerIan Romanick <ian.d.romanick@intel.com>2013-01-25 09:07:35 -0500
commit11d42de681d07884efd7f5b09bd639ee4423093b (patch)
tree5902ecc0ca919e81007fe038a80975da87de0504 /src/glsl/glsl_types.cpp
parente2c95cd6746ca9bb6e90ed8211afb22727f57e19 (diff)
glsl: Make the align function available elsewhere in the linker
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Carl Worth <cworth@cworth.org>
Diffstat (limited to 'src/glsl/glsl_types.cpp')
-rw-r--r--src/glsl/glsl_types.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 40368ddd0f7..4a2c8790790 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -863,12 +863,6 @@ glsl_type::std140_base_alignment(bool row_major) const
return -1;
}
-static unsigned
-align(unsigned val, unsigned align)
-{
- return (val + align - 1) / align * align;
-}
-
unsigned
glsl_type::std140_size(bool row_major) const
{
@@ -970,11 +964,11 @@ glsl_type::std140_size(bool row_major) const
for (unsigned i = 0; i < this->length; i++) {
const struct glsl_type *field_type = this->fields.structure[i].type;
unsigned align = field_type->std140_base_alignment(row_major);
- size = (size + align - 1) / align * align;
+ size = glsl_align(size, align);
size += field_type->std140_size(row_major);
}
- size = align(size,
- this->fields.structure[0].type->std140_base_alignment(row_major));
+ size = glsl_align(size,
+ this->fields.structure[0].type->std140_base_alignment(row_major));
return size;
}