diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2014-10-24 13:04:24 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2014-11-10 04:25:40 -0800 |
commit | 3711abd780141b84a33f393446b05a6a385200d4 (patch) | |
tree | 16023cd15fff5593a52d22250d3293eee7ee7f9f /src/glsl/glsl_types.h | |
parent | 378d92c74e2b07a630919a2b178a471d4f7407ba (diff) | |
download | external_mesa3d-3711abd780141b84a33f393446b05a6a385200d4.zip external_mesa3d-3711abd780141b84a33f393446b05a6a385200d4.tar.gz external_mesa3d-3711abd780141b84a33f393446b05a6a385200d4.tar.bz2 |
glsl: Store glsl_type::vector_elements and ::matrix_columns as uint8_t
Due to the total number of bits used in the bitfield, this does not
increase the size of the structure.
It does, however, reduce the number of instructions required each time
one of these fields is accessed. To access ::matrix_columns with the
bitfield, three instructions were required:
movzbl 0x9(%rdx),%eax
shr %al
and $0x7,%eax
As a uint8_t, only one instruction is required.
movzbl 0xa(%rdx),%eax
These fields are accessed *a lot*.
Valgrind callgrind results for a trace of Tesseract:
_mesa_Uniform4fv _mesa_Uniform4f _mesa_Uniform1i
Before (64-bit): 48,103,497 16,556,096 676,447
After (64-bit): 45,722,616 15,737,964 670,607
_mesa_Uniform4fv _mesa_Uniform4f _mesa_Uniform1i
Before (32-bit): 61,472,611 21,051,222 821,361
After (32-bit): 57,987,421 19,872,226 811,609
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'src/glsl/glsl_types.h')
-rw-r--r-- | src/glsl/glsl_types.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 6543041..096f546 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -153,8 +153,8 @@ struct glsl_type { * these will be 0. */ /*@{*/ - unsigned vector_elements:3; /**< 1, 2, 3, or 4 vector elements. */ - unsigned matrix_columns:3; /**< 1, 2, 3, or 4 matrix columns. */ + uint8_t vector_elements; /**< 1, 2, 3, or 4 vector elements. */ + uint8_t matrix_columns; /**< 1, 2, 3, or 4 matrix columns. */ /*@}*/ /** |