zink: add ZINK_DEBUG=sync

this is great for debugging

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16544>
This commit is contained in:
Mike Blumenkrantz
2022-04-20 12:19:52 -04:00
committed by Marge Bot
parent 5d5b6197e3
commit b54516f944
4 changed files with 30 additions and 0 deletions

View File

@@ -269,6 +269,8 @@ variable:
Print the TGSI form of TGSI shaders to stderr.
``validation``
Dump Validation layer output.
``sync``
Emit full synchronization barriers before every draw and dispatch.
Vulkan Validation Layers
^^^^^^^^^^^^^^^^^^^^^^^^

View File

@@ -542,6 +542,19 @@ zink_draw(struct pipe_context *pctx,
zink_query_update_gs_states(ctx, dinfo->was_line_loop);
if (unlikely(zink_debug & ZINK_DEBUG_SYNC)) {
zink_batch_no_rp(ctx);
VkMemoryBarrier mb;
mb.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
mb.pNext = NULL;
mb.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT;
mb.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT;
VKSCR(CmdPipelineBarrier)(ctx->batch.state->cmdbuf,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
0, 1, &mb, 0, NULL, 0, NULL);
}
zink_batch_rp(ctx);
/* check dead swapchain */
if (unlikely(!ctx->batch.in_rp))
@@ -931,6 +944,19 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
if (ctx->memory_barrier)
zink_flush_memory_barrier(ctx, true);
if (unlikely(zink_debug & ZINK_DEBUG_SYNC)) {
zink_batch_no_rp(ctx);
VkMemoryBarrier mb;
mb.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
mb.pNext = NULL;
mb.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT;
mb.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT;
VKSCR(CmdPipelineBarrier)(ctx->batch.state->cmdbuf,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
0, 1, &mb, 0, NULL, 0, NULL);
}
if (zink_program_has_descriptors(&ctx->curr_compute->base))
screen->descriptors_update(ctx, true);
if (ctx->di.any_bindless_dirty && ctx->curr_compute->base.dd->bindless)

View File

@@ -78,6 +78,7 @@ zink_debug_options[] = {
{ "spirv", ZINK_DEBUG_SPIRV, "Dump SPIR-V during program compile" },
{ "tgsi", ZINK_DEBUG_TGSI, "Dump TGSI during program compile" },
{ "validation", ZINK_DEBUG_VALIDATION, "Dump Validation layer output" },
{ "sync", ZINK_DEBUG_SYNC, "Force synchronization before draws/dispatches" },
DEBUG_NAMED_VALUE_END
};

View File

@@ -66,6 +66,7 @@ enum zink_descriptor_type;
#define ZINK_DEBUG_SPIRV 0x2
#define ZINK_DEBUG_TGSI 0x4
#define ZINK_DEBUG_VALIDATION 0x8
#define ZINK_DEBUG_SYNC 0x10
#define NUM_SLAB_ALLOCATORS 3
#define MIN_SLAB_ORDER 8