glsl/fp64: move context.h dependent checks into main.
authorDave Airlie <airlied@redhat.com>
Fri, 7 Jan 2022 05:28:08 +0000 (15:28 +1000)
committerMarge Bot <emma+marge@anholt.net>
Thu, 20 Jan 2022 00:20:06 +0000 (00:20 +0000)
allows dropping context.h include.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>

src/compiler/glsl/glsl_to_nir.cpp
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 3bcc1cd..e91f9b7 100644 (file)
@@ -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.
     */
index db5b361..4eb7d90 100644 (file)
@@ -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