zink: create compute programs on bind
this simplifies the launch_grid codepath and gets shader binds out the shader update bitmask Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12532>
This commit is contained in:
@@ -174,20 +174,6 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct zink_context *ctx)
|
||||
ctx->vertex_buffers_dirty = false;
|
||||
}
|
||||
|
||||
static void
|
||||
update_compute_program(struct zink_context *ctx)
|
||||
{
|
||||
const unsigned bits = 1 << PIPE_SHADER_COMPUTE;
|
||||
if (ctx->dirty_shader_stages & bits) {
|
||||
struct zink_compute_program *comp = zink_create_compute_program(ctx, ctx->compute_stage);
|
||||
_mesa_hash_table_insert(&ctx->compute_program_cache, comp->shader, comp);
|
||||
ctx->compute_pipeline_state.dirty = true;
|
||||
ctx->curr_compute = comp;
|
||||
ctx->dirty_shader_stages &= bits;
|
||||
zink_batch_reference_program(&ctx->batch, &ctx->curr_compute->base);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_gfx_program(struct zink_context *ctx)
|
||||
{
|
||||
@@ -775,8 +761,6 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
|
||||
|
||||
update_barriers(ctx, true);
|
||||
|
||||
update_compute_program(ctx);
|
||||
|
||||
if (zink_program_has_descriptors(&ctx->curr_compute->base))
|
||||
screen->descriptors_update(ctx, true);
|
||||
|
||||
|
||||
@@ -540,8 +540,6 @@ zink_create_compute_program(struct zink_context *ctx, struct zink_shader *shader
|
||||
assert(comp->module->shader);
|
||||
_mesa_hash_table_insert(&comp->base.shader_cache[0], shader, comp->module);
|
||||
|
||||
ctx->dirty_shader_stages &= ~(1 << PIPE_SHADER_COMPUTE);
|
||||
|
||||
comp->pipelines = _mesa_hash_table_create(NULL, hash_compute_pipeline_state,
|
||||
equals_compute_pipeline_state);
|
||||
|
||||
@@ -883,8 +881,13 @@ bind_stage(struct zink_context *ctx, enum pipe_shader_type stage,
|
||||
if (entry) {
|
||||
ctx->compute_pipeline_state.dirty = true;
|
||||
ctx->curr_compute = entry->data;
|
||||
} else
|
||||
ctx->dirty_shader_stages |= 1 << stage;
|
||||
} else {
|
||||
struct zink_compute_program *comp = zink_create_compute_program(ctx, shader);
|
||||
_mesa_hash_table_insert(&ctx->compute_program_cache, comp->shader, comp);
|
||||
ctx->compute_pipeline_state.dirty = true;
|
||||
ctx->curr_compute = comp;
|
||||
zink_batch_reference_program(&ctx->batch, &ctx->curr_compute->base);
|
||||
}
|
||||
} else if (!shader)
|
||||
ctx->curr_compute = NULL;
|
||||
ctx->compute_stage = shader;
|
||||
|
||||
Reference in New Issue
Block a user