diff --git a/src/video_core/amdgpu/liverpool.cpp b/src/video_core/amdgpu/liverpool.cpp index 590660b3..e5c17583 100644 --- a/src/video_core/amdgpu/liverpool.cpp +++ b/src/video_core/amdgpu/liverpool.cpp @@ -280,7 +280,10 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::spanindex_count; regs.draw_initiator = draw_index->draw_initiator; if (rasterizer) { + rasterizer->ScopeMarkerBegin( + fmt::format("dcb:{}:DrawIndex2", reinterpret_cast(dcb.data()))); rasterizer->Draw(true); + rasterizer->ScopeMarkerEnd(); } break; } @@ -290,7 +293,10 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::spanindex_count; regs.draw_initiator = draw_index_off->draw_initiator; if (rasterizer) { + rasterizer->ScopeMarkerBegin(fmt::format( + "dcb:{}:DrawIndexOffset2", reinterpret_cast(dcb.data()))); rasterizer->Draw(true, draw_index_off->index_offset); + rasterizer->ScopeMarkerEnd(); } break; } @@ -299,7 +305,10 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::spanindex_count; regs.draw_initiator = draw_index->draw_initiator; if (rasterizer) { + rasterizer->ScopeMarkerBegin( + fmt::format("dcb:{}:DrawIndexAuto", reinterpret_cast(dcb.data()))); rasterizer->Draw(false); + rasterizer->ScopeMarkerEnd(); } break; } @@ -310,7 +319,10 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::spandim_z; regs.cs_program.dispatch_initiator = dispatch_direct->dispatch_initiator; if (rasterizer && (regs.cs_program.dispatch_initiator & 1)) { + rasterizer->ScopeMarkerBegin( + fmt::format("dcb:{}:Dispatch", reinterpret_cast(dcb.data()))); rasterizer->DispatchDirect(); + rasterizer->ScopeMarkerEnd(); } break; } @@ -421,8 +433,8 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb) { } case PM4ItOpcode::IndirectBuffer: { const auto* indirect_buffer = reinterpret_cast(header); - auto task = - ProcessCompute({indirect_buffer->Address(), indirect_buffer->ib_size}); + auto task = ProcessCompute( + {indirect_buffer->Address(), indirect_buffer->ib_size}, vqid); while (!task.handle.done()) { task.handle.resume(); @@ -448,7 +460,10 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb) { regs.cs_program.dim_z = dispatch_direct->dim_z; regs.cs_program.dispatch_initiator = dispatch_direct->dispatch_initiator; if (rasterizer && (regs.cs_program.dispatch_initiator & 1)) { + rasterizer->ScopeMarkerBegin(fmt::format( + "acb[{}]:{}:Dispatch", vqid, reinterpret_cast(acb.data()))); rasterizer->DispatchDirect(); + rasterizer->ScopeMarkerEnd(); } break; } @@ -508,7 +523,7 @@ void Liverpool::SubmitAsc(u32 vqid, std::span acb) { ASSERT_MSG(vqid >= 0 && vqid < NumTotalQueues, "Invalid virtual ASC queue index"); auto& queue = mapped_queues[vqid]; - const auto& task = ProcessCompute(acb); + const auto& task = ProcessCompute(acb, vqid); { std::unique_lock lock{queue.m_access}; queue.submits.emplace(task.handle); diff --git a/src/video_core/amdgpu/liverpool.h b/src/video_core/amdgpu/liverpool.h index a9117867..0711b074 100644 --- a/src/video_core/amdgpu/liverpool.h +++ b/src/video_core/amdgpu/liverpool.h @@ -988,7 +988,7 @@ private: Task ProcessGraphics(std::span dcb, std::span ccb); Task ProcessCeUpdate(std::span ccb); - Task ProcessCompute(std::span acb); + Task ProcessCompute(std::span acb, int vqid); void Process(std::stop_token stoken); diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 6f8ab1a6..d0944fcc 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -254,4 +254,16 @@ void Rasterizer::UpdateDepthStencilState() { cmdbuf.setDepthBoundsTestEnable(depth.depth_bounds_enable); } +void Rasterizer::ScopeMarkerBegin(const std::string& str) { + const auto cmdbuf = scheduler.CommandBuffer(); + cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ + .pLabelName = str.c_str(), + }); +} + +void Rasterizer::ScopeMarkerEnd() { + const auto cmdbuf = scheduler.CommandBuffer(); + cmdbuf.endDebugUtilsLabelEXT(); +} + } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 7bf1ab9b..aead5955 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -33,6 +33,9 @@ public: void DispatchDirect(); + void ScopeMarkerBegin(const std::string& str); + void ScopeMarkerEnd(); + private: u32 SetupIndexBuffer(bool& is_indexed, u32 index_offset); void MapMemory(VAddr addr, size_t size);