Module: Mesa Branch: staging/21.3 Commit: e0ace9df66ab66abb7fa2951532c650a96db18e2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0ace9df66ab66abb7fa2951532c650a96db18e2
Author: Mike Blumenkrantz <[email protected]> Date: Tue Nov 9 19:42:16 2021 -0500 zink: be more consistent about applying module hash for gfx pipeline this was a little spaghetti-ish: the module hash was sometimes being applied during module update, sometimes in draw during program create, and then also it was removed when a shader unbind would cause the program to no longer be reachable now things are more consistent: * keep removing module hash when program becomes unreachable * only apply module hash in draw during updates there cc: mesa-stable Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13727> (cherry picked from commit bfa81c1e8c8f1885ab63c4c09e57e4c0bbb37bb2) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_draw.cpp | 4 ++++ src/gallium/drivers/zink/zink_program.c | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 21c681f5ad4..0dd99439dbc 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -31,7 +31,7 @@ "description": "zink: be more consistent about applying module hash for gfx pipeline", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index c1bbe5d49ee..b724f962bcc 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -207,7 +207,11 @@ update_gfx_program(struct zink_context *ctx) ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; ctx->gfx_dirty = false; } else if (ctx->dirty_shader_stages & bits) { + /* remove old hash */ + ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; zink_update_gfx_program(ctx, ctx->curr_program); + /* apply new hash */ + ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; } ctx->dirty_shader_stages &= ~bits; } diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 8c23d57851e..bfa06611d02 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -179,9 +179,6 @@ update_shader_modules(struct zink_context *ctx, } if (hash_changed && state) { - if (!first && likely(state->pipeline)) //avoid on first hash - state->final_hash ^= prog->last_variant_hash; - if (default_variants && !first) prog->last_variant_hash = prog->default_variant_hash; else { @@ -192,7 +189,6 @@ update_shader_modules(struct zink_context *ctx, } } - state->final_hash ^= prog->last_variant_hash; state->modules_changed = true; } }
