renderer_vulkan: Add debug markers for presenter. (#2167)

This commit is contained in:
squidbus 2025-01-17 00:15:43 -08:00 committed by GitHub
parent c13b29662e
commit 1e5b316ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -468,6 +468,12 @@ bool Presenter::ShowSplash(Frame* frame /*= nullptr*/) {
draw_scheduler.EndRendering(); draw_scheduler.EndRendering();
const auto cmdbuf = draw_scheduler.CommandBuffer(); const auto cmdbuf = draw_scheduler.CommandBuffer();
if (Config::vkHostMarkersEnabled()) {
cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{
.pLabelName = "ShowSplash",
});
}
if (!frame) { if (!frame) {
if (!splash_img.has_value()) { if (!splash_img.has_value()) {
VideoCore::ImageInfo info{}; VideoCore::ImageInfo info{};
@ -535,6 +541,10 @@ bool Presenter::ShowSplash(Frame* frame /*= nullptr*/) {
.pImageMemoryBarriers = &post_barrier, .pImageMemoryBarriers = &post_barrier,
}); });
if (Config::vkHostMarkersEnabled()) {
cmdbuf.endDebugUtilsLabelEXT();
}
// Flush frame creation commands. // Flush frame creation commands.
frame->ready_semaphore = draw_scheduler.GetMasterSemaphore()->Handle(); frame->ready_semaphore = draw_scheduler.GetMasterSemaphore()->Handle();
frame->ready_tick = draw_scheduler.CurrentTick(); 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; auto& scheduler = is_eop ? draw_scheduler : flip_scheduler;
scheduler.EndRendering(); scheduler.EndRendering();
const auto cmdbuf = scheduler.CommandBuffer(); 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{ const auto frame_subresources = vk::ImageSubresourceRange{
.aspectMask = vk::ImageAspectFlagBits::eColor, .aspectMask = vk::ImageAspectFlagBits::eColor,
@ -677,6 +693,10 @@ Frame* Presenter::PrepareFrameInternal(VideoCore::ImageId image_id, bool is_eop)
.pImageMemoryBarriers = &post_barrier, .pImageMemoryBarriers = &post_barrier,
}); });
if (Config::vkHostMarkersEnabled()) {
cmdbuf.endDebugUtilsLabelEXT();
}
// Flush frame creation commands. // Flush frame creation commands.
frame->ready_semaphore = scheduler.GetMasterSemaphore()->Handle(); frame->ready_semaphore = scheduler.GetMasterSemaphore()->Handle();
frame->ready_tick = scheduler.CurrentTick(); frame->ready_tick = scheduler.CurrentTick();
@ -724,6 +744,12 @@ void Presenter::Present(Frame* frame, bool is_reusing_frame) {
auto& scheduler = present_scheduler; auto& scheduler = present_scheduler;
const auto cmdbuf = scheduler.CommandBuffer(); const auto cmdbuf = scheduler.CommandBuffer();
if (Config::vkHostMarkersEnabled()) {
cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{
.pLabelName = "Present",
});
}
{ {
auto* profiler_ctx = instance.GetProfilerContext(); auto* profiler_ctx = instance.GetProfilerContext();
TracyVkNamedZoneC(profiler_ctx, renderer_gpu_zone, cmdbuf, "Host frame", 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. // Flush vulkan commands.
SubmitInfo info{}; SubmitInfo info{};
info.AddWait(swapchain.GetImageAcquiredSemaphore()); info.AddWait(swapchain.GetImageAcquiredSemaphore());