Module: Mesa
Branch: master
Commit: 6e8d4a2f8043a3a7a28175326e63770aa9511ee7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e8d4a2f8043a3a7a28175326e63770aa9511ee7

Author: Eric Anholt <e...@anholt.net>
Date:   Sun Mar 29 22:59:39 2015 -0700

nir: Recognize a pattern for doing b2f without the opcode.

Since we have patterns based on b2f, generate them if we see the b2f
equivalent using an iand.  This is common when generating NIR from TGSI.

Reviewed-by: Connor Abbott <cwabbo...@gmail.com>

---

 src/glsl/nir/nir_opt_algebraic.py |    1 +
 1 file changed, 1 insertion(+)

diff --git a/src/glsl/nir/nir_opt_algebraic.py 
b/src/glsl/nir/nir_opt_algebraic.py
index 66b456d..301d7a8 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -99,6 +99,7 @@ optimizations = [
    # Emulating booleans
    (('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),
    (('fsat', ('fadd', ('b2f', a), ('b2f', b))), ('b2f', ('ior', a, b))),
+   (('iand', 'a@bool', 1.0), ('b2f', a)),
    # Comparison with the same args.  Note that these are not done for
    # the float versions because NaN always returns false on float
    # inequalities.

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to