feat: Tracy GPU 时间线——RG pass 级 GPU zone
RenderGraph 新增 IGpuProfiler 可选注入(pass 边界 Begin/End 钩子 + 帧尾 Collect,zone 覆盖 barrier+lambda+postBarriers),RG 本体不感知 任何 profiler 实现。Renderer 侧 TracyGpuProfiler 实现:TracyVkContext (校准用临时 cb,池必须带 RESET_COMMAND_BUFFER_BIT——tracy 校准流程 对同一 cb 连续 begin 三次)+ TracyVkZoneTransient(pass 名是运行时 字符串)。TRACY_ENABLE 关闭全链路退化为空。 用法:Tracy GUI(0.14.1 配对)连接后按 pass 名看 GPU 段时间线, 与 ImGui 数表互补;LOD 调优的测量前置。
This commit is contained in:
@@ -728,6 +728,14 @@ namespace Engine::RG {
|
||||
auto& pass = m_Passes[passIdx];
|
||||
if (pass.culled) continue;
|
||||
|
||||
// profiler zone:覆盖本 pass 的 barrier + lambda + postBarriers
|
||||
// (GPU 时间线里 pass 是完整段,含同步开销)
|
||||
Scope<IGpuProfiler::IScope> zoneScope;
|
||||
if (m_GpuProfiler) {
|
||||
zoneScope = m_GpuProfiler->BeginPass(pass.name.c_str(),
|
||||
frame.cmd);
|
||||
}
|
||||
|
||||
if (m_QueryPool) {
|
||||
frame.cmd.writeTimestamp2(
|
||||
vk::PipelineStageFlagBits2::eBottomOfPipe,
|
||||
@@ -798,8 +806,14 @@ namespace Engine::RG {
|
||||
vk::PipelineStageFlagBits2::eBottomOfPipe,
|
||||
m_QueryPool, frame.frameSlot * m_QueriesPerFrame + tsPos * 2 + 1);
|
||||
}
|
||||
zoneScope.reset(); // END 时间戳
|
||||
++tsPos;
|
||||
}
|
||||
|
||||
// 帧尾收集:profiler 在当帧 cmd 内解析查询并上报(提交前录制)
|
||||
if (m_GpuProfiler) {
|
||||
m_GpuProfiler->EndFrame(frame.cmd);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- RenderGraphContext ----------
|
||||
|
||||
Reference in New Issue
Block a user