From 36e49c162ce44c5e6fff3b1be5a871591a23c203 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 25 Sep 2023 10:57:15 +1000 Subject: [PATCH] glsl: switch to nir linkers cross_validate_outputs_to_inputs() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Alejandro PiƱeiro Part-of: --- src/compiler/glsl/gl_nir_linker.c | 17 +++++++++++++++++ src/compiler/glsl/linker.cpp | 6 ------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 84f58be2f1a..e6a1e882d70 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -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 diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index a87cc9150f8..6d098e04fed 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -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; }