Repository navigation
en quality profiling
中文 | English | Docs | Repository
Performance work happens in two layers: first locate the stage with CPU/GPU time, then inspect resources and state with a capture tool. This page covers Nullus's marker API, capture workflows, and reading order.
Engine and editor code mark work through a unified facade rather than tool-specific calls at each site.
| Macro | Purpose |
|---|---|
NLS_PROFILE_SCOPE() |
Uses the calling function name as the event name |
NLS_PROFILE_NAMED_SCOPE("name") |
Uses a custom display name |
NLS_PROFILE_REGISTER_THREAD("name") |
Registers a thread name at the entry point |
NLS_GPU_PROFILE_SCOPE(nativeCommandBuffer) |
GPU command recording scope |
NLS_GPU_PROFILE_NAMED_SCOPE(nativeCommandBuffer, "name") |
Named GPU scope |
void Editor::Core::Editor::Update(float p_deltaTime)
{
NLS_PROFILE_SCOPE();
// work to measure
}Thread registration writes the name into shared scope events and forwards it to Tracy, so the track is already named before a capture connects. An unregistered thread gets a stable Thread <id> fallback.
RHI code should prefer RHICommandBuffer::BeginGpuProfileScope() / EndGpuProfileScope() and let the backend decide how to bridge them.
| Option | Default | Effect |
|---|---|---|
NLS_ENABLE_PROFILING |
ON |
Shared profiling marker behavior |
NLS_ENABLE_TRACY |
OFF |
Tracy destination |
NLS_ENABLE_TIMELINE_PROFILER |
OFF |
Built-in editor Timeline Profiler |
NLS_BUILD_TRACY_PROFILER |
Follows NLS_ENABLE_TRACY
|
Builds the Tracy GUI tool |
With all three off, instrumented code still builds and runs; there is simply no destination.
Tracy provides CPU and GPU timelines. When enabled on Windows, the DX12 command buffer bridge carries the native command queue: one context per profileable direct and compute queue, plus copy queues only when the device reports copy-queue timestamp support. A queue calibration failure leaves only that queue unprofiled; it never disables CPU scopes or other queues.
Editor builds deploy three tool executables to App/<platform>_<config>_Runtime_*/Tracy/<version> next to Editor.exe, so the packaged directory carries a protocol-matched profiler. The same tools are exposed through Tools > Tracy Profiler, which shows the resolved paths, launches the GUI, and opens the capture directory.
The editor emits one CPU frame mark per editor frame, and DX12 command-list submission batches advance the matching GPU context, so one capture shows CPU scopes and GPU pass times on the same timeline.
tracy-capture -o Build\Tracy\capture.tracy -f -s 30
App\Win64_RelWithDebInfo_Runtime_Shared\Editor.exe --backend dx12 path\to\Project.nullus
tracy-csvexport --truncated_mean=95 Build\Tracy\capture.tracy > Build\Tracy\cpu-total.csv
tracy-csvexport -e --truncated_mean=95 Build\Tracy\capture.tracy > Build\Tracy\cpu-self.csv
tracy-csvexport -g Build\Tracy\capture.tracy > Build\Tracy\gpu-events.csvStart the capture before launching the editor, trigger the workload (including Play mode) while it runs, and only compare captures with matching build, project, scene, backend, and frame count.
- Rank CPU total/self and GPU pass times using the CSV exports.
- Use the Tracy GUI when call stacks or frame correlation are needed.
- After Tracy identifies a pass or queue, switch to RenderDoc for draws, shaders, and resources.
- When you want the in-editor DX12 GPU timeline without connecting Tracy, use Timeline Profiler.
For steady-state editor or Play measurement, attach Tracy after startup and asset restore complete. Capture from the beginning only when startup is the target.
The editor registers a dockable Profiler panel. Without a destination enabled, the panel reports availability and explains why live data is missing. With NLS_ENABLE_TIMELINE_PROFILER, the panel draws the Timeline Profiler HUD.
Timeline Profiler GPU support requires the native DX12 device and graphics queue to be initialized. CPU scopes remain valid when GPU data is unavailable.
- Only destinations reporting
ProfilerCapability_GPUScopesreceive GPU events. - The DX12 backend bridges GPU scopes to Timeline Profiler's D3D12 timestamp profiler (with
NLS_ENABLE_TIMELINE_PROFILER=ON) or Tracy's DX12 contexts (withNLS_ENABLE_TRACY=ON). - Other backends keep CPU profiling and report GPU scopes as unavailable.
RenderDoc is the first choice for rendering problems. The runtime probes these locations: RENDERDOC_PATH, %ProgramFiles%\RenderDoc, %ProgramFiles(x86)%\RenderDoc, and PATH. Without it, the application runs normally and capture actions are simply unavailable.
| Action | Location |
|---|---|
| Queue the next frame |
Debugging > RenderDoc > Capture Next Frame (F11) |
| Open the latest capture |
Debugging > RenderDoc > Open Latest Capture (Ctrl+F11) |
| Open the capture folder | Debugging > RenderDoc > Open Capture Folder |
| Auto-open the Replay UI | Debugging > RenderDoc > Auto Open Replay UI |
Editor.exe --renderdoc MyProject.nullus
Editor.exe --capture-after-frames 60 MyProject.nullus
Game.exe --renderdoc
Game.exe --capture-after-frames 120
Editor.exe --backend dx12 --renderdoc MyProject.nullus| Variable | Effect |
|---|---|
NLS_RENDERDOC_ENABLE=1 |
Enable RenderDoc |
NLS_RENDERDOC_CAPTURE=1 |
Queue a startup capture |
NLS_RENDERDOC_CAPTURE_AFTER_FRAMES=N |
Capture after N frames |
NLS_RENDERDOC_CAPTURE_DIR=<path> |
Custom capture directory |
NLS_RENDERDOC_CAPTURE_LABEL=<name> |
Capture file label |
NLS_RENDERDOC_AUTO_OPEN=1 |
Auto-open the Replay UI after capture |
Command-line flags take precedence over environment variables, which take precedence over defaults.
| Target | Directory |
|---|---|
| Editor | <project>/Logs/RenderDoc/Editor/ |
| Game | <project>/Logs/RenderDoc/Game/ |
The repository runner adds a backend directory below that, for example TestProject/Logs/RenderDoc/Editor/dx12/. Output directory priority is --capture-dir, NLS_RENDERDOC_CAPTURE_DIR, then the project default.
py -3 Tools/RenderDoc/renderdoc_runner.py --target editor --backend dx12 --capture --open-capture-uiThe runner defaults to launch-mode=auto, can use renderdoccmd capture on DX12, locates Editor.exe or Game.exe under App, defaults the Editor project to TestProject/TestProject.nullus, writes captures under <project>/Logs/RenderDoc/<target>/<backend>, and reports the exact latest_capture path after capture.
py -3 Tools/RenderDoc/rdc_analyze.py TestProject/Logs/RenderDoc/Editor/dx12/editor_dx12_DX12_frame2.rdc
py -3 Tools/RenderDoc/rdc_analyze.py path\to\capture.rdc --focus-eid 66
py -3 Tools/RenderDoc/rdc_analyze.py path\to\capture.rdc --json-out Build\RenderDocAnalysis\capture.json
py -3 Tools/RenderDoc/rdc_analyze.py path\to\capture.rdc --skip-doctorThe analyzer runs rdc doctor (skippable with --skip-doctor), opens the capture, collects info, stats, passes, draws, and events, picks a focus event automatically, loads pipeline, binding, and shader metadata, and prints a Markdown analysis skeleton. If rdc --session fails, it falls back to RenderDoc Python replay.
- Use RenderDoc first for rendering problems.
- Fall back to screenshots only for desktop or interface problems RenderDoc cannot cover.
- Record both the requested and the actual backend whenever a fallback happens.
- Performance conclusions require repeated measurements on matching builds and workloads.
Large-scene occlusion validation must run on the active DX12 runtime path and archive the capture alongside the validation record:
py -3 Tools/RenderDoc/renderdoc_runner.py --target editor --backend dx12 --capture --open-capture-uiWhat to record is listed in Visibility and Occlusion. Unit tests cannot replace real DX12 capture evidence.
| Symptom | Cause |
|---|---|
TimelineProfiler: Disabled |
The build switch is off; configure with NLS_ENABLE_TIMELINE_PROFILER=ON
|
TimelineProfiler: Unavailable |
The destination is enabled but cannot initialize in this environment |
| Tracy destination unavailable |
NLS_ENABLE_TRACY is off, or the third-party source is missing |
| Tracy connects but has no GPU data | Requires Windows/DX12, a queue with timestamp calibration support, and --backend dx12
|
| Timeline has no GPU data | Requires the native DX12 device and graphics queue; CPU data remains valid |
- Debugging and Testing covers behavior regressions and CI coverage.
- Graphics Backends and Large-Scene Features covers capability queries and conservative fallback.
Nullus Engine
中文
- 认识 Nullus
- 安装与快速入门
- 使用编辑器
- 场景与对象
- Prefab 工作流
- 资产与内容管线
- 渲染、材质与光照
- 大场景与资源管理
- 游戏逻辑与脚本
- 用户界面
- 动画与角色
- 物理与交互
- 音频、特效与媒体
- AI 与联网
- 平台、构建与发布
- 扩展与引擎架构
- 调试、性能与质量
- 参考手册
- 示例与发展路线
English
- Getting to Know Nullus
- Install and Quick Start
- Using the Editor
- Scenes and Objects
- Prefab Workflow
- Assets and Content Pipeline
- Rendering, Materials, and Lighting
- Large Scenes and Resource Management
- Gameplay and Scripting
- User Interface
- Animation and Characters
- Physics and Interaction
- Audio, Visual Effects, and Media
- AI and Networking
- Platforms, Builds, and Releases
- Extending the Engine
- Debugging, Performance, and Quality
- Reference
- Examples and Roadmap