glsl: switch to nir validate_first_and_last_interface_explicit_locations()
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 21 Sep 2023 06:50:21 +0000 (16:50 +1000)
committerMarge Bot <emma+marge@anholt.net>
Fri, 22 Sep 2023 00:41:18 +0000 (00:41 +0000)
Use the new nir version. The glsl ir version will be removed in the
following patch.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25318>

src/compiler/glsl/gl_nir_linker.c
src/compiler/glsl/linker.cpp

index f8bd7c1..bc83733 100644 (file)
@@ -1337,6 +1337,27 @@ gl_nir_link_glsl(const struct gl_constants *consts,
       break;
    }
 
+   unsigned first = MESA_SHADER_STAGES;
+   unsigned last = 0;
+
+   /* Determine first and last stage. */
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+      if (!prog->_LinkedShaders[i])
+         continue;
+      if (first == MESA_SHADER_STAGES)
+         first = i;
+      last = i;
+   }
+
+   /* The cross validation of outputs/inputs above validates interstage
+    * explicit locations. We need to do this also for the inputs in the first
+    * stage and outputs of the last stage included in the program, since there
+    * is no cross validation for these.
+    */
+   gl_nir_validate_first_and_last_interface_explicit_locations(consts, prog,
+                                                               (gl_shader_stage) first,
+                                                               (gl_shader_stage) last);
+
    if (prog->SeparateShader)
       disable_varying_optimizations_for_sso(prog);
 
index 91ea8a8..a87cc91 100644 (file)
@@ -3076,18 +3076,15 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    if (!prog->data->LinkStatus)
       goto done;
 
-   unsigned first, last, prev;
+   unsigned first, prev;
 
    first = MESA_SHADER_STAGES;
-   last = 0;
-
    /* Determine first and last stage. */
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (!prog->_LinkedShaders[i])
          continue;
       if (first == MESA_SHADER_STAGES)
          first = i;
-      last = i;
    }
 
    check_explicit_uniform_locations(&ctx->Extensions, prog);
@@ -3121,15 +3118,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
       prev = i;
    }
 
-   /* The cross validation of outputs/inputs above validates interstage
-    * explicit locations. We need to do this also for the inputs in the first
-    * stage and outputs of the last stage included in the program, since there
-    * is no cross validation for these.
-    */
-   validate_first_and_last_interface_explicit_locations(consts, prog,
-                                                        (gl_shader_stage) first,
-                                                        (gl_shader_stage) last);
-
    /* Cross-validate uniform blocks between shader stages */
    validate_interstage_uniform_blocks(prog, prog->_LinkedShaders);
    if (!prog->data->LinkStatus)