diff options
author | Rob Clark <[email protected]> | 2015-09-14 11:13:19 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-09-16 08:27:36 -0400 |
commit | d9efe40dc924b8bfd93c0572bd70c0585f823628 (patch) | |
tree | 071f356db7a9a72968774798a16d7f5131b58959 | |
parent | 47e18a595731c054ac254e26066e6dea804f34e8 (diff) |
nir: add lowering for ffract
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
-rw-r--r-- | src/glsl/nir/nir.h | 3 | ||||
-rw-r--r-- | src/glsl/nir/nir_opt_algebraic.py | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 4e4543ad5ec..fffb2f45719 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 acc3b04b118..43558a547b4 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'), |