mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 19:20:08 +01:00
st/glsl: set driver loc after lowering clipplane
We need to store the driver location when we add it to the state param list. Currently this code only works because st_nir_assign_uniform_locations() later adds duplicate params but this will be fixed in a following patch. Unfortunatly we could not simply move nir_lower_clip to the state tracker like we did in the reset of this MR as it is also called directly from some drivers. Also to avoid making nir depend on the gl_parameter defintions we simply loop over the results of the lowering and fix up the locations. 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
265b878f80
commit
5231bbe32e
1 changed files with 21 additions and 1 deletions
|
|
@ -713,7 +713,8 @@ lower_ucp(struct st_context *st,
|
|||
clipplane_state[i][0] = STATE_CLIP_INTERNAL;
|
||||
clipplane_state[i][1] = i;
|
||||
}
|
||||
_mesa_add_state_reference(params, clipplane_state[i]);
|
||||
if (!st->allow_st_finalize_nir_twice)
|
||||
_mesa_add_state_reference(params, clipplane_state[i]);
|
||||
}
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX ||
|
||||
|
|
@ -724,6 +725,25 @@ lower_ucp(struct st_context *st,
|
|||
NIR_PASS(_, nir, nir_lower_clip_gs, ucp_enables,
|
||||
can_compact, clipplane_state);
|
||||
}
|
||||
|
||||
if (st->allow_st_finalize_nir_twice) {
|
||||
nir_foreach_variable_with_modes(uniform, nir, nir_var_uniform |
|
||||
nir_var_image) {
|
||||
if (!uniform->state_slots || !st->allow_st_finalize_nir_twice)
|
||||
continue;
|
||||
|
||||
for (int plane = 0; plane < MAX_CLIP_PLANES; plane++) {
|
||||
char tmp[100];
|
||||
snprintf(tmp, ARRAY_SIZE(tmp), "gl_ClipPlane%dMESA", plane);
|
||||
if (strcmp(uniform->name, tmp) == 0) {
|
||||
unsigned loc =
|
||||
_mesa_add_state_reference(params, clipplane_state[plane]);
|
||||
uniform->data.driver_location = st->ctx->Const.PackedDriverUniformStorage ?
|
||||
params->Parameters[loc].ValueOffset : loc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue