[Mesa-dev] [PATCH 1/2] glsl: reduce size of glsl_type::base_type

Tapani tapani.palli at intel.com
Wed May 28 19:39:58 PDT 2014


On 05/28/2014 08:11 PM, Ian Romanick wrote:
> Types are fly-weights, so there aren't that many of them allocated...
> maybe a couple hundred, tops.  Have you measured the memory savings?

Nope, I was mainly looking at this with 'shader cache' hat on, there I'm 
trying to write things as small as possible and base_type here is one of 
those things I found that I can safely use just uint8_t. But you are 
right, with the small amount of these it does not really matter from 
memory usage perspective.

> On 05/27/2014 10:09 PM, Tapani Pälli wrote:
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>>   src/glsl/glsl_types.h | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
>> index dca5492..e6aae26a 100644
>> --- a/src/glsl/glsl_types.h
>> +++ b/src/glsl/glsl_types.h
>> @@ -29,6 +29,7 @@
>>   #include <string.h>
>>   #include <assert.h>
>>   #include "main/mtypes.h" /* for gl_texture_index, C++'s enum rules are broken */
>> +#include "main/compiler.h"
>>   
>>   #ifdef __cplusplus
>>   extern "C" {
>> @@ -47,7 +48,7 @@ _mesa_glsl_release_types(void);
>>   }
>>   #endif
>>   
>> -enum glsl_base_type {
>> +enum PACKED glsl_base_type {
>>      GLSL_TYPE_UINT = 0,
>>      GLSL_TYPE_INT,
>>      GLSL_TYPE_FLOAT,
>>



More information about the mesa-dev mailing list