<p dir="ltr"><br>
On Feb 1, 2015 2:07 PM, "Connor Abbott" <<a href="mailto:cwabbott0@gmail.com">cwabbott0@gmail.com</a>> wrote:<br>
><br>
> On Sun, Feb 1, 2015 at 4:17 PM, Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>> wrote:<br>
> > We've probably never seen this ridiculous pattern in the wild, so it<br>
> > didn't matter.<br>
><br>
> I don't think this pattern is 'ridiculous' at all -- GLSL doesn't have<br>
> a sat operation, so shaders wanting to do a saturate have to do this<br>
> already. Rather, what probably saves us is that we already recognize<br>
> this pattern in GLSL IR. Other than that,</p>
<p dir="ltr">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.</p>
<p dir="ltr">> Reviewed-by: Connor Abbott <<a href="mailto:cwabbott0@gmail.com">cwabbott0@gmail.com</a>><br>
><br>
> > ---<br>
> >  src/glsl/nir/nir_opt_algebraic.py | 2 +-<br>
> >  1 file changed, 1 insertion(+), 1 deletion(-)<br>
> ><br>
> > diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py<br>
> > index 8a14fe0..84c60ec 100644<br>
> > --- a/src/glsl/nir/nir_opt_algebraic.py<br>
> > +++ b/src/glsl/nir/nir_opt_algebraic.py<br>
> > @@ -83,7 +83,7 @@ optimizations = [<br>
> >     (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),<br>
> >     (('fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))),<br>
> >     (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),<br>
> > -   (('fmin', ('fmax', a, 1.0), 0.0), ('fsat', a)),<br>
> > +   (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a)),<br>
> >     # Logical and bit operations<br>
> >     (('fand', a, 0.0), 0.0),<br>
> >     (('iand', a, a), a),<br>
> > --<br>
> > 2.1.4<br>
> ><br>
> > _______________________________________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>