[Mesa-dev] [PATCH 19/22] glsl: Add a saturate range optimization

Matt Turner mattst88 at gmail.com
Fri Jan 30 16:25:37 PST 2015


On Sat, Jan 3, 2015 at 2:16 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Sat, Jan 3, 2015 at 11:18 AM, Thomas Helland
> <thomashelland90 at gmail.com> wrote:
>> This improves one shader from Brutal Legend.
>> It does a lrp that yields a result larger than 1,
>> that then gets saturated. This is replaced by a constant 1.
>
> Not a comment on your patch, but the code in question does this:
>
>> const vec4 ps_c0 = vec4(-0.65, -0.92, -6.0, -10.0);
>> ...
>> t2_ps.xy = clamp(mix(-ps_c0.xy, t1_ps.ww, -ps_c0.zw), vec2(0.0), vec2(1.0));

I just reinvesigated this. While this code does look funny, it does
not necessarily yield a result greater than one. Using V2 of the LRP
patch with x <-> y no longer reversed makes the changes to this shader
go away.

With that fixed, this commit doesn't affect shader-db. :(


More information about the mesa-dev mailing list