From 9cdf66657a152ad7455db7018f39b7cb5445464d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 24 Oct 2014 13:08:06 -0700 Subject: [PATCH] glsl: Swap the order of glsl_type::name and ::length MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Brian Paul Reviewed-by: Tapani Pälli --- src/glsl/glsl_types.cpp | 2 +- src/glsl/glsl_types.h | 14 +++++++------- 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 @@ -157,13 +157,6 @@ struct glsl_type { uint8_t matrix_columns; /**< 1, 2, 3, or 4 matrix columns. */ /*@}*/ - /** - * 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 @@ -172,6 +165,13 @@ struct glsl_type { */ unsigned length; + /** + * Name of the data type + * + * Will never be \c NULL. + */ + const char *name; + /** * Subtype of composite data types. */ -- 2.30.2