Help wanted: where does a world frame's CPU time go? #39

Closed
opened 2026-11-27 03:14:46 +00:00 by github-bot · 1 comment
Owner

@⁠ThatRecompDev on GitHub · 2026-11-25 16:23 UTC · original

the opening cutscene and menus already hold 30 fps, but once the 3D world loads the frame rate drops well below that. before we optimise blindly we need to know where a world frame's CPU time goes.

what would help:

  • a per-frame CPU breakdown in the loader: game threads vs our shim (draw/dispatch recording, descriptor table mirroring, user-data uploads, list splits, memory waits, present). --sample-threads and the managed profile summary are a start, a proper per-frame timeline (ETW/PIX markers or our own counters) would be better
  • then the obvious hot spots. other ports found their descriptor sync and per-draw clamps dominated (one went from 70-220 ms to ~3 ms a frame with a cheap per-record fingerprint), we do table-bind mirroring with a shadow compare, worth measuring at world draw counts

background: docs/debugging.md (sample lines, profiles), docs/d3d12x-shim.md. related: #35 (GPU side of the mesh shaders).

**@⁠ThatRecompDev** on GitHub · 2026-11-25 16:23 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/issues/39) the opening cutscene and menus already hold 30 fps, but once the 3D world loads the frame rate drops well below that. before we optimise blindly we need to know where a world frame's CPU time goes. what would help: - a per-frame CPU breakdown in the loader: game threads vs our shim (draw/dispatch recording, descriptor table mirroring, user-data uploads, list splits, memory waits, present). `--sample-threads` and the managed profile summary are a start, a proper per-frame timeline (ETW/PIX markers or our own counters) would be better - then the obvious hot spots. other ports found their descriptor sync and per-draw clamps dominated (one went from 70-220 ms to ~3 ms a frame with a cheap per-record fingerprint), we do table-bind mirroring with a shadow compare, worth measuring at world draw counts background: `docs/debugging.md` (sample lines, profiles), `docs/d3d12x-shim.md`. related: #35 (GPU side of the mesh shaders).
github-bot 2026-11-27 03:14:46 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:14:46 +00:00
Author
Owner

@⁠ThatRecompDev on GitHub · 2026-11-26 11:37 UTC · original

we have an answer for this one now

--cpu-sample samples the game threads and splits them into game code / our shims / system / blocked, and names the loader method when it's ours. --profile-managed adds allocations

what it found: the 5 subrender threads were spending ~half their time in two per-draw scans of the write-combined descriptor window, plus CPU waits for a list's previous run and --watch-hang's stack scans. all three are fixed, our share on the game threads went from ~50% to under 1% and a world frame from ~1.1 s to ~400 ms. the remaining CPU cost is texture refresh and GC, both being worked on

closing, new findings can go in fresh issues

**@⁠ThatRecompDev** on GitHub · 2026-11-26 11:37 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/issues/39#issuecomment-7190973884) we have an answer for this one now `--cpu-sample` samples the game threads and splits them into game code / our shims / system / blocked, and names the loader method when it's ours. `--profile-managed` adds allocations what it found: the 5 subrender threads were spending ~half their time in two per-draw scans of the write-combined descriptor window, plus CPU waits for a list's previous run and `--watch-hang`'s stack scans. all three are fixed, our share on the game threads went from ~50% to under 1% and a world frame from ~1.1 s to ~400 ms. the remaining CPU cost is texture refresh and GC, both being worked on closing, new findings can go in fresh issues
This discussion has been locked. Commenting is limited to contributors.
No description provided.