[Mesa-dev] glsl2: optimizing unused struct assignments

Ian Romanick idr at freedesktop.org
Thu Aug 5 15:00:00 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aras Pranckevicius wrote:

>> We'll have similar issue with code like:
>> uniform vec4 angles;
>> void main() {
>>   vec4 v;
>>   v.x = sin(angles.x);
>>   v.y = cos(angles.y);
>>   v.z = tan(angles.z);
>>   v.w = 1/tan(angles.w);
>>   gl_Position = v.xyxy;
>> }
>>
>> In this case v.zw is never used, and the (expensive) assignments should
>> be killed.
> 
> What's the plan for attacking this? Splitting up structures into
> individual variables won't help with this case.

We'll need to track setting and using of vector components individually.
 In the case above, we could detect that v.zw are never used.  That
information could be used to find (and kill) places that set them.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxbNF0ACgkQX1gOwKyEAw+eAgCdGHyCidnbyWkPHafEbvXfNJE0
HZ4An3KTNzRGoX0dZSlpVKhD0eSb/OKO
=/WYU
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list