zink: make descriptors_update hook return a bool if a flush occurred
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11964>
This commit is contained in:
parent
c5ccc41ca5
commit
f2f1892e62
|
@ -1324,10 +1324,11 @@ update_descriptors_internal(struct zink_context *ctx, struct zink_descriptor_set
|
|||
static void
|
||||
zink_context_update_descriptor_states(struct zink_context *ctx, struct zink_program *pg);
|
||||
|
||||
void
|
||||
bool
|
||||
zink_descriptors_update(struct zink_context *ctx, bool is_compute)
|
||||
{
|
||||
struct zink_program *pg = is_compute ? (struct zink_program *)ctx->curr_compute : (struct zink_program *)ctx->curr_program;
|
||||
struct zink_batch_state *bs = ctx->batch.state;
|
||||
|
||||
zink_context_update_descriptor_states(ctx, pg);
|
||||
bool cache_hit[ZINK_DESCRIPTOR_TYPES + 1];
|
||||
|
@ -1376,6 +1377,7 @@ zink_descriptors_update(struct zink_context *ctx, bool is_compute)
|
|||
pg->layout, 0, pg->num_dsl, sets,
|
||||
dynamic_offset_idx, dynamic_offsets);
|
||||
ctx->dd->pg[is_compute] = pg;
|
||||
return bs != batch->state;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -227,7 +227,7 @@ zink_descriptor_program_init(struct zink_context *ctx, struct zink_program *pg);
|
|||
void
|
||||
zink_descriptor_program_deinit(struct zink_screen *screen, struct zink_program *pg);
|
||||
|
||||
void
|
||||
bool
|
||||
zink_descriptors_update(struct zink_context *ctx, bool is_compute);
|
||||
|
||||
|
||||
|
@ -261,7 +261,7 @@ zink_descriptor_program_init_lazy(struct zink_context *ctx, struct zink_program
|
|||
void
|
||||
zink_descriptor_program_deinit_lazy(struct zink_screen *screen, struct zink_program *pg);
|
||||
|
||||
void
|
||||
bool
|
||||
zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute);
|
||||
|
||||
|
||||
|
|
|
@ -393,13 +393,14 @@ zink_descriptor_set_update_lazy(struct zink_context *ctx, struct zink_program *p
|
|||
screen->vk.UpdateDescriptorSetWithTemplate(screen->dev, set, pg->dd->layouts[type + 1]->desc_template, ctx);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute)
|
||||
{
|
||||
struct zink_screen *screen = zink_screen(ctx->base.screen);
|
||||
struct zink_batch *batch = &ctx->batch;
|
||||
struct zink_batch_state *bs = ctx->batch.state;
|
||||
struct zink_program *pg = is_compute ? &ctx->curr_compute->base : &ctx->curr_program->base;
|
||||
bool ret = false;
|
||||
|
||||
bool batch_changed = !bdd_lazy(bs)->pg[is_compute];
|
||||
if (batch_changed) {
|
||||
|
@ -431,11 +432,12 @@ zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute)
|
|||
(dd_lazy(ctx)->push_state_changed[is_compute] || batch_changed);
|
||||
if (!populate_sets(ctx, pg, &changed_sets, need_push, desc_sets)) {
|
||||
debug_printf("ZINK: couldn't get descriptor sets!\n");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (ctx->batch.state != bs) {
|
||||
/* recheck: populate may have overflowed the pool and triggered a flush */
|
||||
batch_changed = true;
|
||||
ret = true;
|
||||
dd_lazy(ctx)->state_changed[is_compute] = pg->dd->binding_usage;
|
||||
changed_sets = pg->dd->binding_usage & dd_lazy(ctx)->state_changed[is_compute];
|
||||
dd_lazy(ctx)->push_state_changed[is_compute] = !!pg->dd->push_usage;
|
||||
|
@ -479,6 +481,7 @@ zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute)
|
|||
/* set again in case of flushing */
|
||||
bdd_lazy(bs)->pg[is_compute] = pg;
|
||||
ctx->dd->pg[is_compute] = pg;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -131,7 +131,7 @@ struct zink_screen {
|
|||
|
||||
bool (*descriptor_program_init)(struct zink_context *ctx, struct zink_program *pg);
|
||||
void (*descriptor_program_deinit)(struct zink_screen *screen, struct zink_program *pg);
|
||||
void (*descriptors_update)(struct zink_context *ctx, bool is_compute);
|
||||
bool (*descriptors_update)(struct zink_context *ctx, bool is_compute);
|
||||
void (*context_update_descriptor_states)(struct zink_context *ctx, bool is_compute);
|
||||
void (*context_invalidate_descriptor_state)(struct zink_context *ctx, enum pipe_shader_type shader,
|
||||
enum zink_descriptor_type type,
|
||||
|
|
Loading…
Reference in New Issue