feat: Tracy profiler 接入(CPU 帧时间线)
- vendored tracy 子模块;TRACY_ENABLE 全局生效,宏关闭时零开销 - 插桩:Application::Run FrameMark(帧边界)、Renderer::Render、 SceneRenderer::BuildFrame(ZoneScopedN)+ GPUDriven Collect (ZoneNamedN——同作用域第二个 zone 不能用 ZoneScopedN,变量名 固定会重声明)、Scene::UpdateTransforms - 覆盖 CPU 侧关键路径:帧时间线 / 场景收集 / transform 重算 / 录制提交 - 用法:游戏运行时打开 Tracy GUI(release 下载)即自动连接(8086 端口)
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#include <Engine/ECS/Scene.h>
|
||||
#include <Engine/Assets/AssetManager.h>
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <array>
|
||||
@@ -307,6 +309,7 @@ namespace Engine
|
||||
|
||||
void Renderer::Render(ECS::Scene& scene, Assets::AssetManager& assets)
|
||||
{
|
||||
ZoneScoped; // CPU 侧:UBO/SSBO 上传 + 录制 + 提交(GPU 耗时见 RG timestamp)
|
||||
if (m_Window.WasResized()) {
|
||||
m_Window.ResetResizedFlag();
|
||||
HandleResize();
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
|
||||
@@ -129,6 +131,7 @@ namespace Engine
|
||||
bool SceneRenderer::BuildFrame(ECS::Scene& scene, Assets::AssetManager& assets,
|
||||
vk::Extent2D targetExtent)
|
||||
{
|
||||
ZoneScopedN("BuildFrame");
|
||||
const auto collectStart = std::chrono::steady_clock::now();
|
||||
|
||||
// ---- 0. TAA 时域状态先行(velocity = 上一帧姿态与相机)----
|
||||
@@ -188,6 +191,8 @@ namespace Engine
|
||||
ubo.cameraPos = glm::vec4(camTransform->GetPosition(), 1.0f);
|
||||
|
||||
// ---- 3. GPUDriven:单趟收集 + 多视图剔除 ----
|
||||
// 同作用域第二个 zone:ZoneScopedN 变量名固定会重声明,用 ZoneNamedN
|
||||
ZoneNamedN( ___tracy_collect, "GPUDriven Collect", true );
|
||||
// 每个实例的包围球对 4 个视锥分别测试:
|
||||
// 相机视锥 → 主视图(Forward 画)
|
||||
// 各级联光视锥 → 各自的阴影 batch(Shadow 按 region 各画各的)
|
||||
|
||||
Reference in New Issue
Block a user