vc4 cse/algebraic-disabled stats: total instructions in shared programs: 44356 -> 44354 (-0.00%) instructions in affected programs: 55 -> 53 (-3.64%) --- src/gallium/drivers/vc4/vc4_program.c | 1 + src/glsl/nir/nir.h | 1 + src/glsl/nir/nir_opt_algebraic.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 8be2d15..3f06005 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2100,6 +2100,7 @@ nir_to_qir(struct vc4_compile *c) static const nir_shader_compiler_options nir_options = { .lower_ffma = true, .lower_fpow = true, + .lower_fsat = true, .lower_fsqrt = true, .lower_negate = true, }; diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index f7f5d33..03be7b4 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1329,6 +1329,7 @@ typedef struct nir_function { typedef struct nir_shader_compiler_options { bool lower_ffma; bool lower_fpow; + bool lower_fsat; bool lower_fsqrt; /** lowers fneg and ineg to fsub and isub. */ bool lower_negate; diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 84c60ec..9542ef3 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -83,7 +83,8 @@ optimizations = [ (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))), (('fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))), (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)), - (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a)), + (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'), + (('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'), # Logical and bit operations (('fand', a, 0.0), 0.0), (('iand', a, a), a), -- 2.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev