summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/nir.h1
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index bcc51e88ac8..37e15efa5cf 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1328,6 +1328,7 @@ typedef struct nir_function {
typedef struct nir_shader_compiler_options {
bool lower_fpow;
+ bool lower_fsqrt;
} nir_shader_compiler_options;
typedef struct nir_shader {
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index b8b28f1d6d1..f93757e0325 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -128,7 +128,8 @@ optimizations = [
(('fdiv', 1.0, a), ('frcp', a)),
(('frcp', ('frcp', a)), a),
(('frcp', ('fsqrt', a)), ('frsq', a)),
- (('frcp', ('frsq', a)), ('fsqrt', a)),
+ (('fsqrt', a), ('frcp', ('frsq', a)), 'options->lower_fsqrt'),
+ (('frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'),
# Boolean simplifications
(('ine', 'a@bool', 0), 'a'),
(('ieq', 'a@bool', 0), ('inot', 'a')),