zink: unref programs last in batch reset

we're going to want to make sure all other resources have been handled
at this point so that we can make some better decisions in this block
based on descriptor usage

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9273>
This commit is contained in:
Mike Blumenkrantz
2020-10-04 10:19:28 -04:00
committed by Marge Bot
parent 992ddf7e4b
commit f840057700

View File

@@ -25,16 +25,6 @@ zink_reset_batch(struct zink_context *ctx, struct zink_batch *batch)
zink_fence_finish(screen, &ctx->base, batch->fence, PIPE_TIMEOUT_INFINITE);
zink_framebuffer_reference(screen, &batch->fb, NULL);
set_foreach(batch->programs, entry) {
if (batch->batch_id == ZINK_COMPUTE_BATCH_ID) {
struct zink_compute_program *comp = (struct zink_compute_program*)entry->key;
zink_compute_program_reference(screen, &comp, NULL);
} else {
struct zink_gfx_program *prog = (struct zink_gfx_program*)entry->key;
zink_gfx_program_reference(screen, &prog, NULL);
}
}
_mesa_set_clear(batch->programs, NULL);
/* unref all used resources */
set_foreach(batch->resources, entry) {
@@ -62,6 +52,17 @@ zink_reset_batch(struct zink_context *ctx, struct zink_batch *batch)
util_dynarray_clear(&batch->zombie_samplers);
util_dynarray_clear(&batch->persistent_resources);
set_foreach(batch->programs, entry) {
if (batch->batch_id == ZINK_COMPUTE_BATCH_ID) {
struct zink_compute_program *comp = (struct zink_compute_program*)entry->key;
zink_compute_program_reference(screen, &comp, NULL);
} else {
struct zink_gfx_program *prog = (struct zink_gfx_program*)entry->key;
zink_gfx_program_reference(screen, &prog, NULL);
}
}
_mesa_set_clear(batch->programs, NULL);
if (vkResetDescriptorPool(screen->dev, batch->descpool, 0) != VK_SUCCESS)
fprintf(stderr, "vkResetDescriptorPool failed\n");