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

Matt Turner mattst88 at gmail.com
Sat Jan 3 14:16:17 PST 2015


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));

and t1_ps is the result of texture2D().

I suspect this is a mistake in translating the program from DX to
GLSL, since DX's lrp opcode's arguments are reversed from GLSL's
mix().

In our shader-db, this appears in brutal-legend/211 and costume-quest/74.


More information about the mesa-dev mailing list