Module: Mesa Branch: main Commit: bfa81c1e8c8f1885ab63c4c09e57e4c0bbb37bb2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfa81c1e8c8f1885ab63c4c09e57e4c0bbb37bb2
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> --- src/gallium/drivers/zink/zink_draw.cpp | 4 ++++ src/gallium/drivers/zink/zink_program.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index 1548f64229c..2be1085048b 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 03f2756cbe6..7802a37376d 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -179,9 +179,6 @@ update_gfx_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_gfx_shader_modules(struct zink_context *ctx, } } - state->final_hash ^= prog->last_variant_hash; state->modules_changed = true; } }
