From 1e5b316ac4f7b4e4a5f9d521812b425dc0f0b94f Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Fri, 17 Jan 2025 00:15:43 -0800 Subject: [PATCH] renderer_vulkan: Add debug markers for presenter. (#2167) --- .../renderer_vulkan/vk_presenter.cpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/video_core/renderer_vulkan/vk_presenter.cpp b/src/video_core/renderer_vulkan/vk_presenter.cpp index 4d76eb8db..95c7c4ea1 100644 --- a/src/video_core/renderer_vulkan/vk_presenter.cpp +++ b/src/video_core/renderer_vulkan/vk_presenter.cpp @@ -468,6 +468,12 @@ bool Presenter::ShowSplash(Frame* frame /*= nullptr*/) { draw_scheduler.EndRendering(); const auto cmdbuf = draw_scheduler.CommandBuffer(); + if (Config::vkHostMarkersEnabled()) { + cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ + .pLabelName = "ShowSplash", + }); + } + if (!frame) { if (!splash_img.has_value()) { VideoCore::ImageInfo info{}; @@ -535,6 +541,10 @@ bool Presenter::ShowSplash(Frame* frame /*= nullptr*/) { .pImageMemoryBarriers = &post_barrier, }); + if (Config::vkHostMarkersEnabled()) { + cmdbuf.endDebugUtilsLabelEXT(); + } + // Flush frame creation commands. frame->ready_semaphore = draw_scheduler.GetMasterSemaphore()->Handle(); frame->ready_tick = draw_scheduler.CurrentTick(); @@ -563,6 +573,12 @@ Frame* Presenter::PrepareFrameInternal(VideoCore::ImageId image_id, bool is_eop) auto& scheduler = is_eop ? draw_scheduler : flip_scheduler; scheduler.EndRendering(); const auto cmdbuf = scheduler.CommandBuffer(); + if (Config::vkHostMarkersEnabled()) { + const auto label = fmt::format("PrepareFrameInternal:{}", image_id.index); + cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ + .pLabelName = label.c_str(), + }); + } const auto frame_subresources = vk::ImageSubresourceRange{ .aspectMask = vk::ImageAspectFlagBits::eColor, @@ -677,6 +693,10 @@ Frame* Presenter::PrepareFrameInternal(VideoCore::ImageId image_id, bool is_eop) .pImageMemoryBarriers = &post_barrier, }); + if (Config::vkHostMarkersEnabled()) { + cmdbuf.endDebugUtilsLabelEXT(); + } + // Flush frame creation commands. frame->ready_semaphore = scheduler.GetMasterSemaphore()->Handle(); frame->ready_tick = scheduler.CurrentTick(); @@ -724,6 +744,12 @@ void Presenter::Present(Frame* frame, bool is_reusing_frame) { auto& scheduler = present_scheduler; const auto cmdbuf = scheduler.CommandBuffer(); + if (Config::vkHostMarkersEnabled()) { + cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ + .pLabelName = "Present", + }); + } + { auto* profiler_ctx = instance.GetProfilerContext(); TracyVkNamedZoneC(profiler_ctx, renderer_gpu_zone, cmdbuf, "Host frame", @@ -816,6 +842,10 @@ void Presenter::Present(Frame* frame, bool is_reusing_frame) { } } + if (Config::vkHostMarkersEnabled()) { + cmdbuf.endDebugUtilsLabelEXT(); + } + // Flush vulkan commands. SubmitInfo info{}; info.AddWait(swapchain.GetImageAcquiredSemaphore());