glsl: switch to nir linkers cross_validate_outputs_to_inputs()
authorTimothy Arceri <tarceri@itsqueeze.com>
Mon, 25 Sep 2023 00:57:15 +0000 (10:57 +1000)
committerMarge Bot <emma+marge@anholt.net>
Thu, 28 Sep 2023 13:55:16 +0000 (13:55 +0000)
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25371>

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

index 84f58be..e6a1e88 100644 (file)
@@ -1340,6 +1340,23 @@ gl_nir_link_glsl(const struct gl_constants *consts,
       last = i;
    }
 
+   /* Validate the inputs of each stage with the output of the preceding
+    * stage.
+    */
+   unsigned prev = first;
+   for (unsigned i = prev + 1; i <= MESA_SHADER_FRAGMENT; i++) {
+      if (prog->_LinkedShaders[i] == NULL)
+         continue;
+
+      gl_nir_cross_validate_outputs_to_inputs(consts, prog,
+                                              prog->_LinkedShaders[prev],
+                                              prog->_LinkedShaders[i]);
+      if (!prog->data->LinkStatus)
+         return false;
+
+      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
index a87cc91..6d098e0 100644 (file)
@@ -3109,12 +3109,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
       if (!prog->data->LinkStatus)
          goto done;
 
-      cross_validate_outputs_to_inputs(consts, prog,
-                                       prog->_LinkedShaders[prev],
-                                       prog->_LinkedShaders[i]);
-      if (!prog->data->LinkStatus)
-         goto done;
-
       prev = i;
    }