On Wed, Oct 16, 2013 at 11:14 AM, Ian Romanick <[email protected]> wrote:
> On 10/15/2013 11:55 PM, Matt Turner wrote:
>> Two extra instructions in some heroesofnewerth shaders, but a win for
>> everything else.
>>
>> total instructions in shared programs: 1531352 -> 1530815 (-0.04%)
>> instructions in affected programs: 121898 -> 121361 (-0.44%)
>
> Just curious... what causes these expressions in the affected shaders?
> Did the app developer write it, do did another one of our passes
> generate it?
I've just looked at a single shader (amnesia/20.frag) that was
improved, so others may be different but it does
float fRimLight = dot(gvNormal, vec3(0.0, 0.0, -1.0));
opt_algebraic optimizes dot products with 0.0 or where arguments
contain a single 1.0 and some number of 0.0, so that code was
optimized to
float fRimLight = gvNormal * -1.0;
... and the IR we generate for this (combined with some other bits are)
(assign (x) (var_ref channel_expressions@2)
(expression float + (constant float (1.000000))
(expression float neg (expression
float abs (expression float neg (var_ref gvNormal_z))))))
i.e., 1.0 - abs(-gvNormal.z). abs(-val). Nice.
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev