zink: avoid emitting unnecessary pipeline barriers during update_descriptors

if the current state of the resource matches the desired state, we don't need
to emit anything, and we can potentially avoid ending a renderpass

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8945>
This commit is contained in:
Mike Blumenkrantz 2020-08-19 15:44:37 -04:00 committed by Marge Bot
parent 5d7cb2495a
commit 017dbd63fb
1 changed files with 10 additions and 6 deletions

View File

@ -425,14 +425,18 @@ update_descriptors(struct zink_context *ctx, struct zink_screen *screen, bool is
}
}
struct zink_batch *batch;
struct zink_batch *batch = NULL;
if (num_transitions > 0) {
if (is_compute)
batch = &ctx->compute_batch;
else
batch = zink_batch_no_rp(ctx);
for (int i = 0; i < num_transitions; ++i) {
if (!zink_resource_needs_barrier(transitions[i].res,
transitions[i].layout,
transitions[i].stage))
continue;
if (is_compute)
batch = &ctx->compute_batch;
else
batch = zink_batch_no_rp(ctx);
if (transitions[i].res->base.target == PIPE_BUFFER)
zink_resource_buffer_barrier(batch->cmdbuf, transitions[i].res,
transitions[i].layout, transitions[i].stage);