glsl: switch to NIR block validation

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28538>
This commit is contained in:
Timothy Arceri 2024-03-20 12:06:38 +11:00 committed by Marge Bot
parent aea1265470
commit d1c11d957a
2 changed files with 27 additions and 27 deletions

View file

@ -1677,6 +1677,32 @@ gl_nir_link_glsl(const struct gl_constants *consts,
MESA_TRACE_FUNC();
/* Validate the inputs of each stage with the output of the preceding
* stage.
*/
unsigned prev = MESA_SHADER_STAGES;
for (unsigned i = 0; i <= MESA_SHADER_FRAGMENT; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;
if (prev == MESA_SHADER_STAGES) {
prev = i;
continue;
}
gl_nir_validate_interstage_inout_blocks(prog, prog->_LinkedShaders[prev],
prog->_LinkedShaders[i]);
if (!prog->data->LinkStatus)
return false;
prev = i;
}
/* Cross-validate uniform blocks between shader stages */
gl_nir_validate_interstage_uniform_blocks(prog, prog->_LinkedShaders);
if (!prog->data->LinkStatus)
return false;
if (prog->IsES && prog->GLSL_Version == 100)
if (!validate_invariant_builtins(consts, prog,
prog->_LinkedShaders[MESA_SHADER_VERTEX],
@ -1721,7 +1747,7 @@ gl_nir_link_glsl(const struct gl_constants *consts,
/* Validate the inputs of each stage with the output of the preceding
* stage.
*/
unsigned prev = first;
prev = first;
for (unsigned i = prev + 1; i <= MESA_SHADER_FRAGMENT; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;

View file

@ -2554,7 +2554,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
#endif
void *mem_ctx = ralloc_context(NULL); // temporary linker context
unsigned prev = MESA_SHADER_STAGES;
/* Separate the shaders into groups based on their type.
*/
@ -2728,31 +2727,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
resize_tes_inputs(consts, prog);
/* Validate the inputs of each stage with the output of the preceding
* stage.
*/
for (unsigned i = 0; i <= MESA_SHADER_FRAGMENT; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;
if (prev == MESA_SHADER_STAGES) {
prev = i;
continue;
}
validate_interstage_inout_blocks(prog, prog->_LinkedShaders[prev],
prog->_LinkedShaders[i]);
if (!prog->data->LinkStatus)
goto done;
prev = i;
}
/* Cross-validate uniform blocks between shader stages */
validate_interstage_uniform_blocks(prog, prog->_LinkedShaders);
if (!prog->data->LinkStatus)
goto done;
done:
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
free(shader_list[i]);