mesa/st: Only scalarize for doubles lowering if we're lowering doubles.
authorEmma Anholt <emma@anholt.net>
Tue, 10 May 2022 19:13:17 +0000 (12:13 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 1 Jun 2022 10:56:35 +0000 (10:56 +0000)
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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16437>

src/mesa/state_tracker/st_glsl_to_nir.cpp

index 113b2cb..aca156d 100644 (file)
@@ -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);
       }