[Mesa-dev] [PATCH 2/2] glsl: reduce size of swizzle field in ir_state_slot

Tapani tapani.palli at intel.com
Wed May 28 19:43:54 PDT 2014


On 05/28/2014 08:15 PM, Ian Romanick wrote:
> This won't actually do anything because the compiler still rounds the
> size of the structure upto a multiple of sizeof(int) for alignment
> purposes.  With your v2 patch applied, I still get
>
> (gdb) print sizeof(ir_state_slot)
> $1 = 24
>
> which is 6*sizeof(int).

I see, should've checked with 'pahole' tool first. As with 
glsl_type::base_type, 'swizzle' here was something that I was hoping to 
get smaller only from serialization perspective (shader cache work).

> On 05/27/2014 10:09 PM, Tapani Pälli wrote:
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>>   src/glsl/ir.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
>> index ef4a12d..bc19208 100644
>> --- a/src/glsl/ir.h
>> +++ b/src/glsl/ir.h
>> @@ -357,7 +357,7 @@ depth_layout_string(ir_depth_layout layout);
>>    */
>>   struct ir_state_slot {
>>      int tokens[5];
>> -   int swizzle;
>> +   uint8_t swizzle;
>>   };
>>   
>>   
>>



More information about the mesa-dev mailing list