Skip to content

perf: in-engine profiler — per-pass GPU timestamp queries + CPU zones + profiler window #144

Description

@shadow-kernel

Context

Only aggregate FPS and draw-call counters exist today (Real/Shown FPS readout, instances_tested/drawn). The v4.0 milestone rebuilds the renderer around a render graph, GPU culling, bindless and async compute — optimizing all of that blind, with end-to-end frame time as the only signal, is guesswork. The CI benchmark suite measures outcomes; this issue provides the instrumentation that explains them. It should land before the other v4 tickets.

Goal

Per-pass GPU timings via D3D12 timestamp queries, hierarchical CPU zone timers, and a live profiler window (per-pass bars, history graph, CSV/JSON export) usable in editor and standalone builds.

Acceptance Criteria

  • GPU timestamp pairs around every render pass (scene, shadow, mvec, post chain, upscale/DLSS, UI) resolved without stalling (double-buffered readback)
  • CPU zone macro/scope API for native + a C# scope helper; zones nest hierarchically
  • Profiler window: per-pass GPU ms + CPU zone tree + 120-frame history graph, sortable
  • Overhead < 0.1 ms when the window is closed (zones compiled to cheap counters)
  • JSON/CSV export per captured frame; benchmark suite consumes the same format
  • Standalone games can dump a capture via hotkey (pairs with the F12 capture pattern)

Technical Notes

ID3D12QueryHeap TIMESTAMP + resolve to readback buffer, calibrate with GetTimestampFrequency. Design the pass-marker API so the future render graph emits markers automatically.

Dependencies

  • build: benchmark suite in CI — perf regression gates (shared export format)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highHohe Priorität – als Nächstes einplanenarea:coreEngine-Kern, ECS, Jobs, Memory, Serialisierungarea:renderingRenderer, Lichter, Schatten, Post-FX, Shadersize:L~1 Wochetype:perfPerformance-Arbeit (FPS, Speicher, Ladezeiten)

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions