zink: reapply program refs automatically

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10997>
This commit is contained in:
Mike Blumenkrantz 2021-01-26 09:56:04 -05:00 committed by Marge Bot
parent a64ef1cd12
commit 62ad23239c
2 changed files with 12 additions and 4 deletions

View File

@ -1664,9 +1664,11 @@ void
zink_update_descriptor_refs(struct zink_context *ctx, bool compute) zink_update_descriptor_refs(struct zink_context *ctx, bool compute)
{ {
struct zink_batch *batch = &ctx->batch; struct zink_batch *batch = &ctx->batch;
if (compute) if (compute) {
update_resource_refs_for_stage(ctx, PIPE_SHADER_COMPUTE); update_resource_refs_for_stage(ctx, PIPE_SHADER_COMPUTE);
else { if (ctx->curr_compute)
zink_batch_reference_program(batch, &ctx->curr_compute->base);
} else {
for (unsigned i = 0; i < ZINK_SHADER_COUNT; i++) for (unsigned i = 0; i < ZINK_SHADER_COUNT; i++)
update_resource_refs_for_stage(ctx, i); update_resource_refs_for_stage(ctx, i);
unsigned vertex_buffers_enabled_mask = ctx->gfx_pipeline_state.vertex_buffers_enabled_mask; unsigned vertex_buffers_enabled_mask = ctx->gfx_pipeline_state.vertex_buffers_enabled_mask;
@ -1675,6 +1677,8 @@ zink_update_descriptor_refs(struct zink_context *ctx, bool compute)
if (ctx->vertex_buffers[i].buffer.resource) if (ctx->vertex_buffers[i].buffer.resource)
zink_batch_reference_resource_rw(batch, zink_resource(ctx->vertex_buffers[i].buffer.resource), false); zink_batch_reference_resource_rw(batch, zink_resource(ctx->vertex_buffers[i].buffer.resource), false);
} }
if (ctx->curr_program)
zink_batch_reference_program(batch, &ctx->curr_program->base);
} }
ctx->descriptor_refs_dirty[compute] = false; ctx->descriptor_refs_dirty[compute] = false;
} }

View File

@ -178,8 +178,10 @@ get_compute_program(struct zink_context *ctx)
if (!entry) if (!entry)
return NULL; return NULL;
} }
if (entry->data != ctx->curr_compute) if (ctx->curr_compute != entry->data) {
ctx->compute_pipeline_state.dirty = true; ctx->compute_pipeline_state.dirty = true;
zink_batch_reference_program(&ctx->batch, entry->data);
}
ctx->curr_compute = entry->data; ctx->curr_compute = entry->data;
ctx->dirty_shader_stages &= bits; ctx->dirty_shader_stages &= bits;
ctx->inlinable_uniforms_dirty_mask &= bits; ctx->inlinable_uniforms_dirty_mask &= bits;
@ -217,8 +219,10 @@ get_gfx_program(struct zink_context *ctx)
if (!entry) if (!entry)
return NULL; return NULL;
} }
if (ctx->curr_program != entry->data) if (ctx->curr_program != entry->data) {
ctx->gfx_pipeline_state.combined_dirty = true; ctx->gfx_pipeline_state.combined_dirty = true;
zink_batch_reference_program(&ctx->batch, entry->data);
}
ctx->curr_program = entry->data; ctx->curr_program = entry->data;
ctx->dirty_shader_stages &= ~bits; ctx->dirty_shader_stages &= ~bits;
ctx->inlinable_uniforms_dirty_mask &= ~bits; ctx->inlinable_uniforms_dirty_mask &= ~bits;