mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
mesa/st: use same path for setting state ref locations
After the fix ina6fcc2835ewe can now take the same path whether allow_st_finalize_nir_twice is set or not. Reviewed-by: Marek Olšák <marek.olsak@amd.com> (cherry picked from commitb59c3ac82a) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
parent
b2a34da82f
commit
0edb7039cb
3 changed files with 25 additions and 48 deletions
|
|
@ -9744,7 +9744,7 @@
|
|||
"description": "mesa/st: use same path for setting state ref locations",
|
||||
"nominated": false,
|
||||
"nomination_type": 0,
|
||||
"resolution": 4,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -136,34 +136,18 @@ st_nir_assign_uniform_locations(struct st_context *st,
|
|||
}
|
||||
} else if (uniform->state_slots) {
|
||||
const gl_state_index16 *const stateTokens = uniform->state_slots[0].tokens;
|
||||
if (st->allow_st_finalize_nir_twice) {
|
||||
/* Make sure the variant has the correct locations set */
|
||||
loc = _mesa_lookup_state_param_idx(prog->Parameters, stateTokens);
|
||||
if (loc >= 0) {
|
||||
if (ctx->Const.PackedDriverUniformStorage) {
|
||||
uniform->data.driver_location =
|
||||
prog->Parameters->Parameters[loc].ValueOffset;
|
||||
} else
|
||||
uniform->data.driver_location = loc;
|
||||
}
|
||||
|
||||
continue;
|
||||
/* Make sure the variant has the correct locations set */
|
||||
loc = _mesa_lookup_state_param_idx(prog->Parameters, stateTokens);
|
||||
if (loc >= 0) {
|
||||
if (ctx->Const.PackedDriverUniformStorage) {
|
||||
uniform->data.driver_location =
|
||||
prog->Parameters->Parameters[loc].ValueOffset;
|
||||
} else
|
||||
uniform->data.driver_location = loc;
|
||||
}
|
||||
|
||||
unsigned comps;
|
||||
if (glsl_type_is_struct_or_ifc(type)) {
|
||||
comps = 4;
|
||||
} else {
|
||||
comps = glsl_get_vector_elements(type);
|
||||
}
|
||||
|
||||
if (ctx->Const.PackedDriverUniformStorage) {
|
||||
loc = _mesa_add_sized_state_reference(prog->Parameters,
|
||||
stateTokens, comps, false);
|
||||
loc = prog->Parameters->Parameters[loc].ValueOffset;
|
||||
} else {
|
||||
loc = _mesa_add_state_reference(prog->Parameters, stateTokens);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
loc = st_nir_lookup_parameter_index(prog, uniform);
|
||||
|
||||
|
|
|
|||
|
|
@ -713,8 +713,6 @@ lower_ucp(struct st_context *st,
|
|||
clipplane_state[i][0] = STATE_CLIP_INTERNAL;
|
||||
clipplane_state[i][1] = i;
|
||||
}
|
||||
if (!st->allow_st_finalize_nir_twice)
|
||||
_mesa_add_state_reference(params, clipplane_state[i]);
|
||||
}
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX ||
|
||||
|
|
@ -726,21 +724,19 @@ lower_ucp(struct st_context *st,
|
|||
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;
|
||||
nir_foreach_variable_with_modes(uniform, nir, nir_var_uniform |
|
||||
nir_var_image) {
|
||||
if (!uniform->state_slots)
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -832,8 +828,7 @@ st_create_common_variant(struct st_context *st,
|
|||
/* if flag is set, shader must export psiz */
|
||||
_mesa_add_state_reference(params, point_size_state);
|
||||
NIR_PASS(_, state.ir.nir, st_nir_lower_point_size_mov,
|
||||
point_size_state,
|
||||
st->allow_st_finalize_nir_twice ? prog->Parameters : NULL,
|
||||
point_size_state, prog->Parameters,
|
||||
st->ctx->Const.PackedDriverUniformStorage);
|
||||
|
||||
finalize = true;
|
||||
|
|
@ -1104,8 +1099,7 @@ st_create_fp_variant(struct st_context *st,
|
|||
if (key->lower_alpha_func != COMPARE_FUNC_ALWAYS) {
|
||||
_mesa_add_state_reference(params, alpha_ref_state);
|
||||
NIR_PASS(_, state.ir.nir, st_nir_lower_alpha_test, key->lower_alpha_func,
|
||||
false, alpha_ref_state,
|
||||
st->allow_st_finalize_nir_twice ? fp->Parameters : NULL,
|
||||
false, alpha_ref_state, fp->Parameters,
|
||||
st->ctx->Const.PackedDriverUniformStorage);
|
||||
finalize = true;
|
||||
}
|
||||
|
|
@ -1180,8 +1174,7 @@ st_create_fp_variant(struct st_context *st,
|
|||
sizeof(options.texcoord_state_tokens));
|
||||
|
||||
NIR_PASS(_, state.ir.nir, st_nir_lower_drawpixels, &options,
|
||||
st->allow_st_finalize_nir_twice ? fp->Parameters : NULL,
|
||||
st->ctx->Const.PackedDriverUniformStorage);
|
||||
fp->Parameters, st->ctx->Const.PackedDriverUniformStorage);
|
||||
finalize = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue