--- I add the true/false variables for clarity since there are some existing optimizations using ~0 where it actually has nothing to do with true.
I could take it or leave it. We obviously can't use them for feq and friends. Maybe itrue/ifalse and ftrue/ffalse? src/glsl/nir/nir_opt_algebraic.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 6aa8b1f..04261e7 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -32,6 +32,9 @@ b = 'b' c = 'c' d = 'd' +true = ~0 +false = 0 + # Written in the form (<search>, <replace>) where <search> is an expression # and <replace> is either an expression or a value. An expression is # defined as a tuple of the form (<op>, <src0>, <src1>, <src2>, <src3>) @@ -94,6 +97,8 @@ optimizations = [ (('inot', ('ige', a, b)), ('ilt', a, b)), (('inot', ('ieq', a, b)), ('ine', a, b)), (('inot', ('ine', a, b)), ('ieq', a, b)), + (('ieq', 'a@bool', true), a), + (('ine', 'a@bool', false), a), (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)), (('bcsel', ('flt', a, b), a, b), ('fmin', a, b)), (('bcsel', ('flt', a, b), b, a), ('fmax', a, b)), -- 2.4.9 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev