zink: use the sanitized key in update_gfx_program_optimal()

this otherwise pulls in unused state values that are otherwise
sanitized away

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28017>
(cherry picked from commit 460c7eeecb)
This commit is contained in:
Mike Blumenkrantz 2024-03-06 10:22:59 -05:00 committed by Eric Engestrom
parent 90386f2a27
commit ff06623baf
2 changed files with 5 additions and 4 deletions

View file

@ -544,7 +544,7 @@
"description": "zink: use the sanitized key in update_gfx_program_optimal()",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -669,14 +669,15 @@ update_gfx_shader_module_optimal(struct zink_context *ctx, struct zink_gfx_progr
static void
update_gfx_program_optimal(struct zink_context *ctx, struct zink_gfx_program *prog)
{
const union zink_shader_key_optimal *key = (union zink_shader_key_optimal*)&ctx->gfx_pipeline_state.optimal_key;
const union zink_shader_key_optimal *last_prog_key = (union zink_shader_key_optimal*)&prog->last_variant_hash;
if (ctx->gfx_pipeline_state.shader_keys_optimal.key.vs_bits != last_prog_key->vs_bits) {
if (key->vs_bits != last_prog_key->vs_bits) {
assert(!prog->is_separable);
bool changed = update_gfx_shader_module_optimal(ctx, prog, ctx->last_vertex_stage->info.stage);
ctx->gfx_pipeline_state.modules_changed |= changed;
}
const bool shadow_needs_shader_swizzle = last_prog_key->fs.shadow_needs_shader_swizzle && (ctx->dirty_gfx_stages & BITFIELD_BIT(MESA_SHADER_FRAGMENT));
if (ctx->gfx_pipeline_state.shader_keys_optimal.key.fs_bits != last_prog_key->fs_bits ||
if (key->fs_bits != last_prog_key->fs_bits ||
/* always recheck shadow swizzles since they aren't directly part of the key */
unlikely(shadow_needs_shader_swizzle)) {
assert(!prog->is_separable);
@ -688,7 +689,7 @@ update_gfx_program_optimal(struct zink_context *ctx, struct zink_gfx_program *pr
}
}
if (prog->shaders[MESA_SHADER_TESS_CTRL] && prog->shaders[MESA_SHADER_TESS_CTRL]->non_fs.is_generated &&
ctx->gfx_pipeline_state.shader_keys_optimal.key.tcs_bits != last_prog_key->tcs_bits) {
key->tcs_bits != last_prog_key->tcs_bits) {
assert(!prog->is_separable);
bool changed = update_gfx_shader_module_optimal(ctx, prog, MESA_SHADER_TESS_CTRL);
ctx->gfx_pipeline_state.modules_changed |= changed;