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

Jason Ekstrand jason at jlekstrand.net
Sun Feb 1 14:20:02 PST 2015


On Feb 1, 2015 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,

Yeah, the reason I added it is precisely because I've seen sat open-coded
with ternaries.  I just apparently failed at coding it correctly.

> Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
>
> > ---
> >  src/glsl/nir/nir_opt_algebraic.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/glsl/nir/nir_opt_algebraic.py
b/src/glsl/nir/nir_opt_algebraic.py
> > index 8a14fe0..84c60ec 100644
> > --- a/src/glsl/nir/nir_opt_algebraic.py
> > +++ b/src/glsl/nir/nir_opt_algebraic.py
> > @@ -83,7 +83,7 @@ optimizations = [
> >     (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),
> >     (('fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))),
> >     (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
> > -   (('fmin', ('fmax', a, 1.0), 0.0), ('fsat', a)),
> > +   (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a)),
> >     # Logical and bit operations
> >     (('fand', a, 0.0), 0.0),
> >     (('iand', a, a), a),
> > --
> > 2.1.4
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150201/f51962b5/attachment.html>


More information about the mesa-dev mailing list