Module: Mesa Branch: main Commit: ee24c719eeaa711ce1e981cf9e1fb84434d2462d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee24c719eeaa711ce1e981cf9e1fb84434d2462d
Author: Mike Blumenkrantz <[email protected]> Date: Tue May 11 12:18:19 2021 -0400 zink: slightly refactor program updating during draw Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11406> --- src/gallium/drivers/zink/zink_draw.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/zink/zink_draw.c b/src/gallium/drivers/zink/zink_draw.c index d9f80aa4004..43f35f99497 100644 --- a/src/gallium/drivers/zink/zink_draw.c +++ b/src/gallium/drivers/zink/zink_draw.c @@ -169,20 +169,19 @@ get_compute_program(struct zink_context *ctx) ctx->inlinable_uniforms_valid_mask & ctx->shader_has_inlinable_uniforms_mask & bits; if (ctx->dirty_shader_stages & bits) { + struct zink_compute_program *comp = NULL; struct hash_entry *entry = _mesa_hash_table_search(ctx->compute_program_cache, &ctx->compute_stage->shader_id); if (!entry) { - struct zink_compute_program *comp; comp = zink_create_compute_program(ctx, ctx->compute_stage); entry = _mesa_hash_table_insert(ctx->compute_program_cache, &comp->shader->shader_id, comp); - if (!entry) - return NULL; } - if (ctx->curr_compute != entry->data) { + comp = entry ? entry->data : NULL; + if (comp && comp != ctx->curr_compute) { ctx->compute_pipeline_state.dirty = true; - zink_batch_reference_program(&ctx->batch, entry->data); + zink_batch_reference_program(&ctx->batch, &comp->base); } - ctx->curr_compute = entry->data; + ctx->curr_compute = comp; ctx->dirty_shader_stages &= bits; ctx->inlinable_uniforms_dirty_mask &= bits; } @@ -208,22 +207,21 @@ get_gfx_program(struct zink_context *ctx) ctx->inlinable_uniforms_valid_mask & ctx->shader_has_inlinable_uniforms_mask & bits; if (ctx->dirty_shader_stages & bits) { + struct zink_gfx_program *prog = NULL; struct hash_entry *entry = _mesa_hash_table_search(ctx->program_cache, ctx->gfx_stages); if (entry) zink_update_gfx_program(ctx, entry->data); else { - struct zink_gfx_program *prog; prog = zink_create_gfx_program(ctx, ctx->gfx_stages); entry = _mesa_hash_table_insert(ctx->program_cache, prog->shaders, prog); - if (!entry) - return NULL; } - if (ctx->curr_program != entry->data) { + prog = entry ? entry->data : NULL; + if (prog && prog != ctx->curr_program) { ctx->gfx_pipeline_state.combined_dirty = true; - zink_batch_reference_program(&ctx->batch, entry->data); + zink_batch_reference_program(&ctx->batch, &prog->base); } - ctx->curr_program = entry->data; + ctx->curr_program = prog; ctx->dirty_shader_stages &= ~bits; ctx->inlinable_uniforms_dirty_mask &= ~bits; } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
