From 04f5c543ded15362dc6286ff4ae7a38f00f6ca7e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 16 Nov 2021 17:02:50 -0800 Subject: [PATCH] glsl/nir: Don't build soft float64 when it cannot be used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 82d9a37a59c ("glsl/nir: Add a shared helper for building float64 shaders") Closes: #5556 Reviewed-by: Matt Turner Reviewed-by: Tapani Pälli Part-of: --- src/compiler/glsl/glsl_to_nir.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 7ab447dcf06..0fc69be1b18 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" /* @@ -2607,6 +2608,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. */