From: Rob Clark <robcl...@freedesktop.org> Signed-off-by: Rob Clark <robcl...@freedesktop.org> --- src/glsl/nir/nir.h | 3 +++ src/glsl/nir/nir_opt_algebraic.py | 1 + 2 files changed, 4 insertions(+)
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index f0acd75..284fccd 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1440,6 +1440,9 @@ typedef struct nir_shader_compiler_options { */ bool fdot_replicates; + /** lowers ffract to fsub+ffloor: */ + bool lower_ffract; + /** * Does the driver support real 32-bit integers? (Otherwise, integers * are simulated by floats.) diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index acc3b04..43558a5 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -76,6 +76,7 @@ optimizations = [ (('flrp', a, a, b), a), (('flrp', 0.0, a, b), ('fmul', a, b)), (('flrp', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp'), + (('ffract', a), ('fsub', a, ('ffloor', a)), 'options->lower_ffract'), (('fadd', ('fmul', a, ('fadd', 1.0, ('fneg', c))), ('fmul', b, c)), ('flrp', a, b, c), '!options->lower_flrp'), (('fadd', a, ('fmul', c, ('fadd', b, ('fneg', a)))), ('flrp', a, b, c), '!options->lower_flrp'), (('ffma', a, b, c), ('fadd', ('fmul', a, b), c), 'options->lower_ffma'), -- 2.4.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev