Mesa (main): mesa/st: Only scalarize for doubles lowering if we're lowering doubles.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 1 11:38:13 UTC 2022


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

Author: Emma Anholt <emma at anholt.net>
Date:   Tue May 10 12:13:17 2022 -0700

mesa/st: Only scalarize for doubles lowering if we're lowering doubles.

lower_int64 doesn't need it, and the scalarizing ended up tickling some
bug in virgl once I started using lower_int64.

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16437>

---

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

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 113b2cbfa14..aca156de2f0 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -503,15 +503,14 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
       bool lowered_64bit_ops = false;
       bool revectorize = false;
 
-      /* nir_lower_doubles is not prepared for vector ops, so if the backend doesn't
-       * request lower_alu_to_scalar until now, lower all 64 bit ops, and try to
-       * vectorize them afterwards again */
-      if (!nir->options->lower_to_scalar) {
-         NIR_PASS(revectorize, nir, nir_lower_alu_to_scalar, filter_64_bit_instr, nullptr);
-         NIR_PASS(revectorize, nir, nir_lower_phis_to_scalar, false);
-      }
-
       if (nir->options->lower_doubles_options) {
+         /* nir_lower_doubles is not prepared for vector ops, so if the backend doesn't
+          * request lower_alu_to_scalar until now, lower all 64 bit ops, and try to
+          * vectorize them afterwards again */
+         if (!nir->options->lower_to_scalar) {
+            NIR_PASS(revectorize, nir, nir_lower_alu_to_scalar, filter_64_bit_instr, nullptr);
+            NIR_PASS(revectorize, nir, nir_lower_phis_to_scalar, false);
+         }
          NIR_PASS(lowered_64bit_ops, nir, nir_lower_doubles,
                   st->ctx->SoftFP64, nir->options->lower_doubles_options);
       }



More information about the mesa-commit mailing list