Mesa (staging/21.2): glsl/nir: Don't build soft float64 when it cannot be used

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 24 22:54:05 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: ad44b8a8211ee032e25083eb23ae48e74605cdc2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad44b8a8211ee032e25083eb23ae48e74605cdc2

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Tue Nov 16 17:02:50 2021 -0800

glsl/nir: Don't build soft float64 when it cannot be used

Fixes: 82d9a37a59c ("glsl/nir: Add a shared helper for building float64 shaders")
Closes: #5556
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13828>
(cherry picked from commit 04f5c543ded15362dc6286ff4ae7a38f00f6ca7e)

---

 .pick_status.json                 | 2 +-
 src/compiler/glsl/glsl_to_nir.cpp | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9beb773c3ad..5774cb8b6d5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1732,7 +1732,7 @@
         "description": "glsl/nir: Don't build soft float64 when it cannot be used",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "82d9a37a59c94ba3678b33acb9f2749cbbd7bfcc"
     },
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index c3a5bba80c3..bc722a32450 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -39,6 +39,7 @@
 #include "main/errors.h"
 #include "main/mtypes.h"
 #include "main/shaderobj.h"
+#include "main/context.h"
 #include "util/u_math.h"
 
 /*
@@ -2622,6 +2623,13 @@ nir_shader *
 glsl_float64_funcs_to_nir(struct gl_context *ctx,
                           const nir_shader_compiler_options *options)
 {
+   /* It's not possible to use float64 on GLSL ES, so don't bother trying to
+    * build the support code.  The support code depends on higher versions of
+    * desktop GLSL, so it will fail to compile (below) anyway.
+    */
+   if (!_mesa_is_desktop_gl(ctx) || ctx->Const.GLSLVersion < 400)
+      return NULL;
+
    /* We pretend it's a vertex shader.  Ultimately, the stage shouldn't
     * matter because we're not optimizing anything here.
     */



More information about the mesa-commit mailing list