summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2014-10-24 13:08:06 -0700
committerIan Romanick <[email protected]>2014-11-10 04:25:40 -0800
commit9cdf66657a152ad7455db7018f39b7cb5445464d (patch)
tree311aa5e275fc320160108f03e85441d9c57ff410
parent3711abd780141b84a33f393446b05a6a385200d4 (diff)
glsl: Swap the order of glsl_type::name and ::length
On x86-64 this saves 8 bytes of padding in the structure, and this reduces the size of the structure to 32 bytes. v2: Fix constructor so that GCC won't warn about the order of initialization. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
-rw-r--r--src/glsl/glsl_types.cpp2
-rw-r--r--src/glsl/glsl_types.h14
2 files changed, 8 insertions, 8 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 321df2504b3..5f991934856 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -326,7 +326,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) :
sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
sampler_type(0), interface_packing(0),
vector_elements(0), matrix_columns(0),
- name(NULL), length(length)
+ length(length), name(NULL)
{
this->fields.array = array;
/* Inherit the gl type of the base. The GL type is used for
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 096f5462af4..474b1291424 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -158,13 +158,6 @@ struct glsl_type {
/*@}*/
/**
- * Name of the data type
- *
- * Will never be \c NULL.
- */
- const char *name;
-
- /**
* For \c GLSL_TYPE_ARRAY, this is the length of the array. For
* \c GLSL_TYPE_STRUCT or \c GLSL_TYPE_INTERFACE, it is the number of
* elements in the structure and the number of values pointed to by
@@ -173,6 +166,13 @@ struct glsl_type {
unsigned length;
/**
+ * Name of the data type
+ *
+ * Will never be \c NULL.
+ */
+ const char *name;
+
+ /**
* Subtype of composite data types.
*/
union {