mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-14 10:50:33 +01:00
st/glsl_to_nir: dont add duplicate state tokens
This avoids adding duplicates that also won't be optimised as the param optimise path is also skipped for variants. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13735 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37037>
This commit is contained in:
parent
5231bbe32e
commit
891d46f517
1 changed files with 7 additions and 3 deletions
|
|
@ -113,10 +113,11 @@ st_nir_lookup_parameter_index(struct gl_program *prog, nir_variable *var)
|
|||
}
|
||||
|
||||
static void
|
||||
st_nir_assign_uniform_locations(struct gl_context *ctx,
|
||||
st_nir_assign_uniform_locations(struct st_context *st,
|
||||
struct gl_program *prog,
|
||||
nir_shader *nir)
|
||||
nir_shader *nir, bool is_before_variants)
|
||||
{
|
||||
struct gl_context *ctx = st->ctx;
|
||||
int shaderidx = 0;
|
||||
int imageidx = 0;
|
||||
|
||||
|
|
@ -134,6 +135,9 @@ st_nir_assign_uniform_locations(struct gl_context *ctx,
|
|||
imageidx += type_size(uniform->type);
|
||||
}
|
||||
} else if (uniform->state_slots) {
|
||||
if (st->allow_st_finalize_nir_twice && !is_before_variants)
|
||||
continue;
|
||||
|
||||
const gl_state_index16 *const stateTokens = uniform->state_slots[0].tokens;
|
||||
|
||||
unsigned comps;
|
||||
|
|
@ -698,7 +702,7 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
|
|||
NIR_PASS(_, nir, nir_lower_tex, &opts);
|
||||
}
|
||||
|
||||
st_nir_assign_uniform_locations(st->ctx, prog, nir);
|
||||
st_nir_assign_uniform_locations(st, prog, nir, is_before_variants);
|
||||
|
||||
/* Set num_uniforms in number of attribute slots (vec4s) */
|
||||
nir->num_uniforms = DIV_ROUND_UP(prog->Parameters->NumParameterValues, 4);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue