[Mesa-dev] [PATCH 7/8] nir: Remove useless ftrunc inside f2i/f2u.

Matt Turner mattst88 at gmail.com
Thu Mar 26 12:27:07 PDT 2015


No shader-db changes, probably because they're all removed by the GLSL
compiler optimization added in commit 69ad5fd4.
---
 src/glsl/nir/nir_opt_algebraic.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 56dd8be..e46e7c0 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -179,6 +179,10 @@ optimizations = [
    (('bcsel', a, b, b), b),
    (('fcsel', a, b, b), b),
 
+   # Conversions
+   (('f2i', ('ftrunc', a)), ('f2i', a)),
+   (('f2u', ('ftrunc', a)), ('f2u', a)),
+
    # Subtracts
    (('fsub', a, ('fsub', 0.0, b)), ('fadd', a, b)),
    (('isub', a, ('isub', 0, b)), ('iadd', a, b)),
-- 
2.0.5



More information about the mesa-dev mailing list