zink: remove descriptor vtable

no longer used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18051>
This commit is contained in:
Mike Blumenkrantz
2022-08-04 08:23:10 -04:00
parent dc3c1206be
commit 58e6480ee0
6 changed files with 33 additions and 83 deletions

View File

@@ -81,7 +81,7 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs)
util_dynarray_clear(&bs->zombie_samplers);
util_dynarray_clear(&bs->persistent_resources);
screen->batch_descriptor_reset(screen, bs);
zink_batch_descriptor_reset_lazy(screen, bs);
set_foreach_remove(bs->programs, entry) {
struct zink_program *pg = (struct zink_program*)entry->key;
@@ -184,7 +184,7 @@ zink_batch_state_destroy(struct zink_screen *screen, struct zink_batch_state *bs
_mesa_set_destroy(bs->bufferviews, NULL);
_mesa_set_destroy(bs->programs, NULL);
_mesa_set_destroy(bs->active_queries, NULL);
screen->batch_descriptor_deinit(screen, bs);
zink_batch_descriptor_deinit_lazy(screen, bs);
ralloc_free(bs);
}
@@ -247,7 +247,7 @@ create_batch_state(struct zink_context *ctx)
cnd_init(&bs->usage.flush);
mtx_init(&bs->usage.mtx, mtx_plain);
if (!screen->batch_descriptor_init(screen, bs))
if (!zink_batch_descriptor_init_lazy(screen, bs))
goto fail;
util_queue_fence_init(&bs->flush_completed);

View File

@@ -109,13 +109,13 @@ zink_context_destroy(struct pipe_context *pctx)
hash_table_foreach(&ctx->program_cache[i], entry) {
struct zink_program *pg = entry->data;
pg->removed = true;
screen->descriptor_program_deinit(ctx, pg);
zink_descriptor_program_deinit_lazy(ctx, pg);
}
}
hash_table_foreach(&ctx->compute_program_cache, entry) {
struct zink_program *pg = entry->data;
pg->removed = true;
screen->descriptor_program_deinit(ctx, pg);
zink_descriptor_program_deinit_lazy(ctx, pg);
}
if (ctx->blitter)
@@ -176,7 +176,7 @@ zink_context_destroy(struct pipe_context *pctx)
slab_destroy_child(&ctx->transfer_pool_unsync);
if (ctx->dd)
screen->descriptors_deinit(ctx);
zink_descriptors_deinit_lazy(ctx);
zink_descriptor_layouts_deinit(ctx);
@@ -605,7 +605,7 @@ update_descriptor_state_sampler(struct zink_context *ctx, enum pipe_shader_type
state->sampler_clamped :
state->sampler;
if (ctx->di.textures[shader][slot].sampler != sampler) {
screen->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
ctx->di.textures[shader][slot].sampler = sampler;
}
}
@@ -694,7 +694,7 @@ zink_bind_sampler_states(struct pipe_context *pctx,
for (unsigned i = 0; i < num_samplers; ++i) {
struct zink_sampler_state *state = samplers[i];
if (ctx->sampler_states[shader][start_slot + i] != state)
zink_screen(pctx->screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, start_slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, start_slot, 1);
bool was_nonseamless = false;
if (ctx->sampler_states[shader][start_slot + i])
was_nonseamless = ctx->sampler_states[shader][start_slot + i]->emulate_nonseamless;
@@ -720,7 +720,7 @@ zink_bind_sampler_states(struct pipe_context *pctx,
ctx->di.images[shader][start_slot + i].imageView = surface->image_view;
ctx->di.image_surfaces[shader][start_slot + i].surface = surface;
update_descriptor_state_sampler(ctx, shader, start_slot + i, zink_resource(surface->base.texture));
screen->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, start_slot + i, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, start_slot + i, 1);
}
}
} else {
@@ -1393,7 +1393,7 @@ zink_set_constant_buffer(struct pipe_context *pctx,
}
if (update)
zink_screen(pctx->screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_UBO, index, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_UBO, index, 1);
}
ALWAYS_INLINE static void
@@ -1490,7 +1490,7 @@ zink_set_shader_buffers(struct pipe_context *pctx,
if (start_slot + count >= ctx->di.num_ssbos[p_stage])
ctx->di.num_ssbos[p_stage] = max_slot + 1;
if (update)
zink_screen(pctx->screen)->context_invalidate_descriptor_state(ctx, p_stage, ZINK_DESCRIPTOR_TYPE_SSBO, start_slot, count);
zink_context_invalidate_descriptor_state_lazy(ctx, p_stage, ZINK_DESCRIPTOR_TYPE_SSBO, start_slot, count);
}
static void
@@ -1501,7 +1501,7 @@ update_binds_for_samplerviews(struct zink_context *ctx, struct zink_resource *re
u_foreach_bit(slot, res->sampler_binds[PIPE_SHADER_COMPUTE]) {
if (ctx->di.textures[PIPE_SHADER_COMPUTE][slot].imageLayout != layout) {
update_descriptor_state_sampler(ctx, PIPE_SHADER_COMPUTE, slot, res);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, PIPE_SHADER_COMPUTE, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, PIPE_SHADER_COMPUTE, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
}
}
} else {
@@ -1509,7 +1509,7 @@ update_binds_for_samplerviews(struct zink_context *ctx, struct zink_resource *re
u_foreach_bit(slot, res->sampler_binds[i]) {
if (ctx->di.textures[i][slot].imageLayout != layout) {
update_descriptor_state_sampler(ctx, i, slot, res);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, i, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, i, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
}
}
}
@@ -1723,7 +1723,7 @@ zink_set_shader_images(struct pipe_context *pctx,
}
ctx->di.num_images[p_stage] = start_slot + count;
if (update)
zink_screen(pctx->screen)->context_invalidate_descriptor_state(ctx, p_stage, ZINK_DESCRIPTOR_TYPE_IMAGE, start_slot, count);
zink_context_invalidate_descriptor_state_lazy(ctx, p_stage, ZINK_DESCRIPTOR_TYPE_IMAGE, start_slot, count);
}
ALWAYS_INLINE static void
@@ -1854,7 +1854,7 @@ zink_set_sampler_views(struct pipe_context *pctx,
ctx->di.num_sampler_views[shader_type] = start_slot + num_views;
if (update) {
struct zink_screen *screen = zink_screen(pctx->screen);
screen->context_invalidate_descriptor_state(ctx, shader_type, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, start_slot, num_views);
zink_context_invalidate_descriptor_state_lazy(ctx, shader_type, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, start_slot, num_views);
if (!screen->info.have_EXT_non_seamless_cube_map)
update_nonseamless_shader_key(ctx, shader_type);
}
@@ -2184,7 +2184,7 @@ zink_update_fbfetch(struct zink_context *ctx)
ctx->di.fbfetch.imageView = zink_screen(ctx->base.screen)->info.rb2_feats.nullDescriptor ?
VK_NULL_HANDLE :
zink_csurface(ctx->dummy_surface[0])->image_view;
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, PIPE_SHADER_FRAGMENT, ZINK_DESCRIPTOR_TYPE_UBO, 0, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, PIPE_SHADER_FRAGMENT, ZINK_DESCRIPTOR_TYPE_UBO, 0, 1);
return;
}
@@ -2203,7 +2203,7 @@ zink_update_fbfetch(struct zink_context *ctx)
}
ctx->di.fbfetch.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
if (changed) {
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, PIPE_SHADER_FRAGMENT, ZINK_DESCRIPTOR_TYPE_UBO, 0, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, PIPE_SHADER_FRAGMENT, ZINK_DESCRIPTOR_TYPE_UBO, 0, 1);
if (!had_fbfetch) {
ctx->rp_changed = true;
zink_batch_no_rp(ctx);
@@ -3843,7 +3843,7 @@ rebind_ubo(struct zink_context *ctx, enum pipe_shader_type shader, unsigned slot
{
struct zink_resource *res = update_descriptor_state_ubo(ctx, shader, slot,
ctx->di.descriptor_res[ZINK_DESCRIPTOR_TYPE_UBO][shader][slot]);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_UBO, slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_UBO, slot, 1);
return res;
}
@@ -3857,7 +3857,7 @@ rebind_ssbo(struct zink_context *ctx, enum pipe_shader_type shader, unsigned slo
util_range_add(&res->base.b, &res->valid_buffer_range, ssbo->buffer_offset,
ssbo->buffer_offset + ssbo->buffer_size);
update_descriptor_state_ssbo(ctx, shader, slot, res);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_SSBO, slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_SSBO, slot, 1);
return res;
}
@@ -3875,7 +3875,7 @@ rebind_tbo(struct zink_context *ctx, enum pipe_shader_type shader, unsigned slot
zink_buffer_view_reference(zink_screen(ctx->base.screen), &sampler_view->buffer_view, NULL);
sampler_view->buffer_view = get_buffer_view(ctx, res, &bvci);
update_descriptor_state_sampler(ctx, shader, slot, res);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, slot, 1);
return res;
}
@@ -3901,7 +3901,7 @@ rebind_ibo(struct zink_context *ctx, enum pipe_shader_type shader, unsigned slot
util_range_add(&res->base.b, &res->valid_buffer_range, image_view->base.u.buf.offset,
image_view->base.u.buf.offset + image_view->base.u.buf.size);
update_descriptor_state_image(ctx, shader, slot, res);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, shader, ZINK_DESCRIPTOR_TYPE_IMAGE, slot, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, shader, ZINK_DESCRIPTOR_TYPE_IMAGE, slot, 1);
return res;
}
@@ -4287,7 +4287,7 @@ rebind_image(struct zink_context *ctx, struct zink_resource *res)
struct pipe_surface *psurf = &sv->image_view->base;
zink_rebind_surface(ctx, &psurf);
sv->image_view = zink_surface(psurf);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, i, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, j, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, i, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, j, 1);
update_descriptor_state_sampler(ctx, i, j, res);
}
}
@@ -4296,7 +4296,7 @@ rebind_image(struct zink_context *ctx, struct zink_resource *res)
continue;
for (unsigned j = 0; j < ctx->di.num_images[i]; j++) {
if (zink_resource(ctx->image_views[i][j].base.resource) == res) {
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, i, ZINK_DESCRIPTOR_TYPE_IMAGE, j, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, i, ZINK_DESCRIPTOR_TYPE_IMAGE, j, 1);
update_descriptor_state_image(ctx, i, j, res);
_mesa_set_add(ctx->need_barriers[i == PIPE_SHADER_COMPUTE], res);
}
@@ -4363,7 +4363,7 @@ zink_rebind_all_images(struct zink_context *ctx)
struct pipe_surface *psurf = &sv->image_view->base;
zink_rebind_surface(ctx, &psurf);
sv->image_view = zink_surface(psurf);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, i, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, j, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, i, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, j, 1);
update_descriptor_state_sampler(ctx, i, j, res);
}
}
@@ -4375,7 +4375,7 @@ zink_rebind_all_images(struct zink_context *ctx)
if (ctx->image_views[i][j].surface->obj != res->obj) {
zink_surface_reference(zink_screen(ctx->base.screen), &image_view->surface, NULL);
image_view->surface = create_image_surface(ctx, &image_view->base, i == PIPE_SHADER_COMPUTE);
zink_screen(ctx->base.screen)->context_invalidate_descriptor_state(ctx, i, ZINK_DESCRIPTOR_TYPE_IMAGE, j, 1);
zink_context_invalidate_descriptor_state_lazy(ctx, i, ZINK_DESCRIPTOR_TYPE_IMAGE, j, 1);
update_descriptor_state_image(ctx, i, j, res);
_mesa_set_add(ctx->need_barriers[i == PIPE_SHADER_COMPUTE], res);
}
@@ -4614,11 +4614,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
if (!zink_descriptor_layouts_init(ctx))
goto fail;
if (!screen->descriptors_init(ctx)) {
zink_screen_init_descriptor_funcs(screen, true);
if (!screen->descriptors_init(ctx))
goto fail;
}
if (!zink_descriptors_init_lazy(ctx))
goto fail;
ctx->base.create_texture_handle = zink_create_texture_handle;
ctx->base.delete_texture_handle = zink_delete_texture_handle;

View File

@@ -761,7 +761,7 @@ zink_draw(struct pipe_context *pctx,
}
if (zink_program_has_descriptors(&ctx->curr_program->base))
screen->descriptors_update(ctx, false);
zink_descriptors_update_lazy(ctx, false);
if (ctx->di.any_bindless_dirty &&
/* some apps (d3dretrace) call MakeTextureHandleResidentARB randomly */
@@ -957,7 +957,7 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
}
if (zink_program_has_descriptors(&ctx->curr_compute->base))
screen->descriptors_update(ctx, true);
zink_descriptors_update_lazy(ctx, true);
if (ctx->di.any_bindless_dirty && ctx->curr_compute->base.dd->bindless)
zink_descriptors_update_bindless(ctx);

View File

@@ -555,7 +555,7 @@ zink_create_gfx_program(struct zink_context *ctx,
}
_mesa_sha1_final(&sctx, prog->base.sha1);
if (!screen->descriptor_program_init(ctx, &prog->base))
if (!zink_descriptor_program_init_lazy(ctx, &prog->base))
goto fail;
zink_screen_get_pipeline_cache(screen, &prog->base);
@@ -635,7 +635,7 @@ zink_create_compute_program(struct zink_context *ctx, struct zink_shader *shader
comp->shader = shader;
memcpy(comp->base.sha1, shader->base.sha1, sizeof(shader->base.sha1));
if (!screen->descriptor_program_init(ctx, &comp->base))
if (!zink_descriptor_program_init_lazy(ctx, &comp->base))
goto fail;
zink_screen_get_pipeline_cache(screen, &comp->base);
@@ -798,7 +798,7 @@ zink_destroy_gfx_program(struct zink_context *ctx,
}
if (prog->base.pipeline_cache)
VKSCR(DestroyPipelineCache)(screen->dev, prog->base.pipeline_cache, NULL);
screen->descriptor_program_deinit(ctx, &prog->base);
zink_descriptor_program_deinit_lazy(ctx, &prog->base);
ralloc_free(prog);
}
@@ -828,7 +828,7 @@ zink_destroy_compute_program(struct zink_context *ctx,
free(comp->module);
if (comp->base.pipeline_cache)
VKSCR(DestroyPipelineCache)(screen->dev, comp->base.pipeline_cache, NULL);
screen->descriptor_program_deinit(ctx, &comp->base);
zink_descriptor_program_deinit_lazy(ctx, &comp->base);
ralloc_free(comp);
}

View File

@@ -1553,37 +1553,6 @@ zink_get_format(struct zink_screen *screen, enum pipe_format format)
return ret;
}
void
zink_screen_init_descriptor_funcs(struct zink_screen *screen, bool fallback)
{
if (!fallback &&
zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_LAZY) {
#define LAZY(FUNC) screen->FUNC = zink_##FUNC##_lazy
LAZY(descriptor_program_init);
LAZY(descriptor_program_deinit);
LAZY(context_invalidate_descriptor_state);
LAZY(batch_descriptor_init);
LAZY(batch_descriptor_reset);
LAZY(batch_descriptor_deinit);
LAZY(descriptors_init);
LAZY(descriptors_deinit);
LAZY(descriptors_update);
#undef LAZY
} else {
#define DEFAULT(FUNC) screen->FUNC = zink_##FUNC
DEFAULT(descriptor_program_init);
DEFAULT(descriptor_program_deinit);
DEFAULT(context_invalidate_descriptor_state);
DEFAULT(batch_descriptor_init);
DEFAULT(batch_descriptor_reset);
DEFAULT(batch_descriptor_deinit);
DEFAULT(descriptors_init);
DEFAULT(descriptors_deinit);
DEFAULT(descriptors_update);
#undef DEFAULT
}
}
static bool
check_have_device_time(struct zink_screen *screen)
{
@@ -2395,7 +2364,6 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
simple_mtx_init(&screen->dt_lock, mtx_plain);
zink_screen_init_descriptor_funcs(screen, false);
util_idalloc_mt_init_tc(&screen->buffer_ids);
util_vertex_state_cache_init(&screen->vertex_state_cache,

View File

@@ -178,18 +178,6 @@ struct zink_screen {
bool compact_descriptors;
uint8_t desc_set_id[ZINK_MAX_DESCRIPTOR_SETS];
bool (*descriptor_program_init)(struct zink_context *ctx, struct zink_program *pg);
void (*descriptor_program_deinit)(struct zink_context *ctx, struct zink_program *pg);
void (*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,
unsigned start, unsigned count);
bool (*batch_descriptor_init)(struct zink_screen *screen, struct zink_batch_state *bs);
void (*batch_descriptor_reset)(struct zink_screen *screen, struct zink_batch_state *bs);
void (*batch_descriptor_deinit)(struct zink_screen *screen, struct zink_batch_state *bs);
bool (*descriptors_init)(struct zink_context *ctx);
void (*descriptors_deinit)(struct zink_context *ctx);
struct {
bool dual_color_blend_by_location;
@@ -309,9 +297,6 @@ zink_screen_update_pipeline_cache(struct zink_screen *screen, struct zink_progra
void
zink_screen_get_pipeline_cache(struct zink_screen *screen, struct zink_program *pg);
void
zink_screen_init_descriptor_funcs(struct zink_screen *screen, bool fallback);
void
zink_stub_function_not_loaded(void);