mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
glsl: fix potential crash with DisableUniformArrayResize
We still need to gather information on uniform use when skipping
uniform array resize.
Fixes: ac5af6c0 ("util/driconf: add Dune: Spice Wars workaround")
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24576>
This commit is contained in:
parent
5c70a55bf3
commit
ae5a08de67
1 changed files with 10 additions and 8 deletions
|
|
@ -1554,7 +1554,7 @@ gl_nir_link_uniforms(const struct gl_constants *consts,
|
|||
/* Iterate through all linked shaders */
|
||||
struct nir_link_uniforms_state state = {0,};
|
||||
|
||||
if (!prog->data->spirv && !consts->DisableUniformArrayResize) {
|
||||
if (!prog->data->spirv) {
|
||||
/* Gather information on uniform use */
|
||||
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
|
||||
struct gl_linked_shader *sh = prog->_LinkedShaders[stage];
|
||||
|
|
@ -1569,14 +1569,16 @@ gl_nir_link_uniforms(const struct gl_constants *consts,
|
|||
add_var_use_shader(nir, state.referenced_uniforms[stage]);
|
||||
}
|
||||
|
||||
/* Resize uniform arrays based on the maximum array index */
|
||||
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
|
||||
struct gl_linked_shader *sh = prog->_LinkedShaders[stage];
|
||||
if (!sh)
|
||||
continue;
|
||||
if(!consts->DisableUniformArrayResize) {
|
||||
/* Resize uniform arrays based on the maximum array index */
|
||||
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
|
||||
struct gl_linked_shader *sh = prog->_LinkedShaders[stage];
|
||||
if (!sh)
|
||||
continue;
|
||||
|
||||
nir_foreach_gl_uniform_variable(var, sh->Program->nir)
|
||||
update_array_sizes(prog, var, state.referenced_uniforms, stage);
|
||||
nir_foreach_gl_uniform_variable(var, sh->Program->nir)
|
||||
update_array_sizes(prog, var, state.referenced_uniforms, stage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue