From 7b7f6276000a39a582acd22456337b56954219af Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 7 Jan 2022 15:28:08 +1000 Subject: [PATCH] glsl/fp64: move context.h dependent checks into main. allows dropping context.h include. Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/compiler/glsl/glsl_to_nir.cpp | 8 -------- src/mesa/state_tracker/st_glsl_to_nir.cpp | 8 +++++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 3bcc1cd0c70..e91f9b73208 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -39,7 +39,6 @@ #include "main/errors.h" #include "main/mtypes.h" #include "main/shaderobj.h" -#include "main/context.h" #include "util/u_math.h" /* @@ -2715,13 +2714,6 @@ 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. */ diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index db5b3611a65..4eb7d909e89 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -375,7 +375,13 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog, nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); if (!st->ctx->SoftFP64 && ((nir->info.bit_sizes_int | nir->info.bit_sizes_float) & 64) && (options->lower_doubles_options & nir_lower_fp64_full_software) != 0) { - st->ctx->SoftFP64 = glsl_float64_funcs_to_nir(st->ctx, 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(st->ctx) && st->ctx->Const.GLSLVersion >= 400) + st->ctx->SoftFP64 = glsl_float64_funcs_to_nir(st->ctx, options); } /* ES has strict SSO validation rules for shader IO matching so we can't