zink: make NOREORDER mode context-based

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28880>
This commit is contained in:
Mike Blumenkrantz 2024-04-23 11:29:00 -04:00 committed by Marge Bot
parent ef0c9231a7
commit ffb082f811
3 changed files with 7 additions and 3 deletions

View File

@ -4522,7 +4522,7 @@ zink_copy_buffer(struct zink_context *ctx, struct zink_resource *dst, struct zin
bool unordered_src = !valid_write && !zink_check_unordered_transfer_access(src, 0, &box);
zink_screen(ctx->base.screen)->buffer_barrier(ctx, src, VK_ACCESS_TRANSFER_READ_BIT, 0);
bool unordered_dst = zink_resource_buffer_transfer_dst_barrier(ctx, dst, dst_offset, size);
bool can_unorder = unordered_dst && unordered_src && !(zink_debug & ZINK_DEBUG_NOREORDER);
bool can_unorder = unordered_dst && unordered_src && !ctx->no_reorder;
VkCommandBuffer cmdbuf = can_unorder ? ctx->batch.state->reordered_cmdbuf : zink_get_cmdbuf(ctx, src, dst);
ctx->batch.state->has_barriers |= can_unorder;
zink_batch_reference_resource_rw(batch, src, false);
@ -5632,6 +5632,9 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
zink_batch_rp(ctx);
}
if (zink_debug & ZINK_DEBUG_NOREORDER)
ctx->no_reorder = true;
if (!(flags & PIPE_CONTEXT_PREFER_THREADED) || flags & PIPE_CONTEXT_COMPUTE_ONLY) {
return &ctx->base;
}

View File

@ -275,7 +275,7 @@ check_unordered_exec(struct zink_context *ctx, struct zink_resource *res, bool i
VkCommandBuffer
zink_get_cmdbuf(struct zink_context *ctx, struct zink_resource *src, struct zink_resource *dst)
{
bool unordered_exec = (zink_debug & ZINK_DEBUG_NOREORDER) == 0;
bool unordered_exec = !ctx->no_reorder;
unordered_exec &= check_unordered_exec(ctx, src, false) &&
check_unordered_exec(ctx, dst, true);
@ -739,7 +739,7 @@ zink_resource_buffer_barrier(struct zink_context *ctx, struct zink_resource *res
* - there is no current-batch unordered access
*/
bool can_skip_ordered = unordered ? false : (!res->obj->access && !unordered_usage_matches);
if (zink_debug & ZINK_DEBUG_NOREORDER)
if (ctx->no_reorder)
can_skip_unordered = can_skip_ordered = false;
if (!can_skip_unordered && !can_skip_ordered) {

View File

@ -1818,6 +1818,7 @@ struct zink_context {
bool oom_flush;
bool oom_stall;
bool track_renderpasses;
bool no_reorder;
struct zink_batch batch;
unsigned shader_has_inlinable_uniforms_mask;