mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
zink: slightly refactor program updating during draw
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11406>
This commit is contained in:
parent
3edb0a0a53
commit
ee24c719ee
1 changed files with 10 additions and 12 deletions
|
|
@ -169,20 +169,19 @@ get_compute_program(struct zink_context *ctx)
|
||||||
ctx->inlinable_uniforms_valid_mask &
|
ctx->inlinable_uniforms_valid_mask &
|
||||||
ctx->shader_has_inlinable_uniforms_mask & bits;
|
ctx->shader_has_inlinable_uniforms_mask & bits;
|
||||||
if (ctx->dirty_shader_stages & 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,
|
struct hash_entry *entry = _mesa_hash_table_search(ctx->compute_program_cache,
|
||||||
&ctx->compute_stage->shader_id);
|
&ctx->compute_stage->shader_id);
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
struct zink_compute_program *comp;
|
|
||||||
comp = zink_create_compute_program(ctx, ctx->compute_stage);
|
comp = zink_create_compute_program(ctx, ctx->compute_stage);
|
||||||
entry = _mesa_hash_table_insert(ctx->compute_program_cache, &comp->shader->shader_id, comp);
|
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;
|
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->dirty_shader_stages &= bits;
|
||||||
ctx->inlinable_uniforms_dirty_mask &= bits;
|
ctx->inlinable_uniforms_dirty_mask &= bits;
|
||||||
}
|
}
|
||||||
|
|
@ -208,22 +207,21 @@ get_gfx_program(struct zink_context *ctx)
|
||||||
ctx->inlinable_uniforms_valid_mask &
|
ctx->inlinable_uniforms_valid_mask &
|
||||||
ctx->shader_has_inlinable_uniforms_mask & bits;
|
ctx->shader_has_inlinable_uniforms_mask & bits;
|
||||||
if (ctx->dirty_shader_stages & bits) {
|
if (ctx->dirty_shader_stages & bits) {
|
||||||
|
struct zink_gfx_program *prog = NULL;
|
||||||
struct hash_entry *entry = _mesa_hash_table_search(ctx->program_cache,
|
struct hash_entry *entry = _mesa_hash_table_search(ctx->program_cache,
|
||||||
ctx->gfx_stages);
|
ctx->gfx_stages);
|
||||||
if (entry)
|
if (entry)
|
||||||
zink_update_gfx_program(ctx, entry->data);
|
zink_update_gfx_program(ctx, entry->data);
|
||||||
else {
|
else {
|
||||||
struct zink_gfx_program *prog;
|
|
||||||
prog = zink_create_gfx_program(ctx, ctx->gfx_stages);
|
prog = zink_create_gfx_program(ctx, ctx->gfx_stages);
|
||||||
entry = _mesa_hash_table_insert(ctx->program_cache, prog->shaders, prog);
|
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;
|
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->dirty_shader_stages &= ~bits;
|
||||||
ctx->inlinable_uniforms_dirty_mask &= ~bits;
|
ctx->inlinable_uniforms_dirty_mask &= ~bits;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue