From 7b744bb8df51feaa280e3c224ff1780705bf4d71 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 21 Sep 2023 16:50:21 +1000 Subject: [PATCH] glsl: switch to nir validate_first_and_last_interface_explicit_locations() Use the new nir version. The glsl ir version will be removed in the following patch. Reviewed-by: Emma Anholt Part-of: --- src/compiler/glsl/gl_nir_linker.c | 21 +++++++++++++++++++++ src/compiler/glsl/linker.cpp | 14 +------------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index f8bd7c1..bc83733 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -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); diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 91ea8a8..a87cc91 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -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) -- 2.7.4