Module: Mesa
Branch: main
Commit: fb60edf4e9809742b49f91c92d3dd3358e0f6070
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb60edf4e9809742b49f91c92d3dd3358e0f6070

Author: Emma Anholt <[email protected]>
Date:   Thu Mar 23 11:49:14 2023 -0700

state_tracker: Lower frexp before lowering doubles.

We don't have softfp64 for frexp, it has been lowered in GLSL up until
now.  I didn't bother splitting out 32 from 64 because it's not worth any
effort.

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22083>

---

 src/mesa/state_tracker/st_glsl_to_nir.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 8fa0ae735f2..02d588bc35a 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -542,6 +542,14 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct 
gl_program *prog,
             NIR_PASS(revectorize, nir, nir_lower_alu_to_scalar, 
filter_64_bit_instr, nullptr);
             NIR_PASS(revectorize, nir, nir_lower_phis_to_scalar, false);
          }
+         /* doubles lowering requires frexp to be lowered first if it will be,
+          * since the pass generates other 64-bit ops.  Most backends lower
+          * frexp, and using doubles is rare, and using frexp is even more rare
+          * (no instances in shader-db), so we're not too worried about
+          * accidentally lowering a 32-bit frexp here.
+          */
+         NIR_PASS(lowered_64bit_ops, nir, nir_lower_frexp);
+
          NIR_PASS(lowered_64bit_ops, nir, nir_lower_doubles,
                   st->ctx->SoftFP64, nir->options->lower_doubles_options);
       }

Reply via email to