[Mesa-dev] [PATCH 7/9] nir: Fix broken fsat recognizer.

Matt Turner mattst88 at gmail.com
Sun Feb 1 15:12:06 PST 2015


On Sun, Feb 1, 2015 at 2:07 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:
> On Sun, Feb 1, 2015 at 4:17 PM, Eric Anholt <eric at anholt.net> wrote:
>> We've probably never seen this ridiculous pattern in the wild, so it
>> didn't matter.
>
> I don't think this pattern is 'ridiculous' at all -- GLSL doesn't have
> a sat operation, so shaders wanting to do a saturate have to do this
> already. Rather, what probably saves us is that we already recognize
> this pattern in GLSL IR. Other than that,

I don't think it's ridiculous either, but for different reasons --

While GLSL doesn't have saturate, GLSL IR has ir_unop_saturate and we
have optimizations that recognize this exact pattern. (with no
shader-db numbers... sigh)

In fact, we recognize {min|max} ({max|min} (x, 0.0), b) where b < 1.0
and emit a saturate.


More information about the mesa-dev mailing list