summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-10-25 00:15:37 -0400
committerMarek Olšák <[email protected]>2019-11-04 16:49:44 -0500
commit4b4b383f38ab772d4ad1a4ddccc2d72749257b3a (patch)
treeacda46e3af1b3b2e478d50e0e36bffe0aa09e318 /src/mesa
parent7d00218aed7c9bc6ff6fb10d5fe11844ab68305f (diff)
st/mesa: call nir_lower_flrp only once per shader
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index e7b5060cfa9..5aa47a42b2a 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -244,10 +244,6 @@ void
st_nir_opts(nir_shader *nir)
{
bool progress;
- unsigned lower_flrp =
- (nir->options->lower_flrp16 ? 16 : 0) |
- (nir->options->lower_flrp32 ? 32 : 0) |
- (nir->options->lower_flrp64 ? 64 : 0);
do {
progress = false;
@@ -290,23 +286,30 @@ st_nir_opts(nir_shader *nir)
NIR_PASS(progress, nir, nir_opt_algebraic);
NIR_PASS(progress, nir, nir_opt_constant_folding);
- if (lower_flrp != 0) {
- bool lower_flrp_progress = false;
-
- NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp,
- lower_flrp,
- false /* always_precise */,
- nir->options->lower_ffma);
- if (lower_flrp_progress) {
- NIR_PASS(progress, nir,
- nir_opt_constant_folding);
- progress = true;
+ if (!nir->info.flrp_lowered) {
+ unsigned lower_flrp =
+ (nir->options->lower_flrp16 ? 16 : 0) |
+ (nir->options->lower_flrp32 ? 32 : 0) |
+ (nir->options->lower_flrp64 ? 64 : 0);
+
+ if (lower_flrp) {
+ bool lower_flrp_progress = false;
+
+ NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp,
+ lower_flrp,
+ false /* always_precise */,
+ nir->options->lower_ffma);
+ if (lower_flrp_progress) {
+ NIR_PASS(progress, nir,
+ nir_opt_constant_folding);
+ progress = true;
+ }
}
/* Nothing should rematerialize any flrps, so we only need to do this
* lowering once.
*/
- lower_flrp = 0;
+ nir->info.flrp_lowered = true;
}
NIR_PASS(progress, nir, nir_opt_undef);