glsl: make use of nir lower discard flow
Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28005>
This commit is contained in:
committed by
Marge Bot
parent
8317a37ea7
commit
8ceb10a1bd
@@ -1485,6 +1485,15 @@ gl_nir_link_glsl(const struct gl_constants *consts,
|
||||
last = i;
|
||||
}
|
||||
|
||||
/* Implement the GLSL 1.30+ rule for discard vs infinite loops.
|
||||
* This rule also applies to GLSL ES 3.00.
|
||||
*/
|
||||
if (prog->GLSL_Version >= (prog->IsES ? 300 : 130)) {
|
||||
struct gl_linked_shader *sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
|
||||
if (sh)
|
||||
gl_nir_lower_discard_flow(sh->Program->nir);
|
||||
}
|
||||
|
||||
gl_nir_lower_named_interface_blocks(prog);
|
||||
|
||||
/* Validate the inputs of each stage with the output of the preceding
|
||||
|
||||
@@ -2820,19 +2820,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
||||
prog->_LinkedShaders[MESA_SHADER_FRAGMENT]))
|
||||
goto done;
|
||||
|
||||
/* Implement the GLSL 1.30+ rule for discard vs infinite loops Do
|
||||
* it before optimization because we want most of the checks to get
|
||||
* dropped thanks to constant propagation.
|
||||
*
|
||||
* This rule also applies to GLSL ES 3.00.
|
||||
*/
|
||||
if (max_version >= (prog->IsES ? 300 : 130)) {
|
||||
struct gl_linked_shader *sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
|
||||
if (sh) {
|
||||
lower_discard_flow(sh->ir);
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
||||
if (prog->_LinkedShaders[i] == NULL)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user