From: Timothy Arceri Date: Mon, 25 Sep 2023 00:57:15 +0000 (+1000) Subject: glsl: switch to nir linkers cross_validate_outputs_to_inputs() X-Git-Tag: upstream/23.3.3~1481 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36e49c162ce44c5e6fff3b1be5a871591a23c203;p=platform%2Fupstream%2Fmesa.git glsl: switch to nir linkers cross_validate_outputs_to_inputs() Reviewed-by: Alejandro PiƱeiro Part-of: --- diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 84f58be..e6a1e88 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 a87cc91..6d098e0 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; }