Draw trace: hardware counters around each traced draw and ExecuteIndirect #53

Manually merged
github merged 1 commit from gh-pr/53/head into gh-pr/53/base 2026-11-27 03:15:53 +00:00
Owner

@⁠Sr-0w on GitHub · 2026-11-26 03:59 UTC · original
Sr-0w:diagnostics/draw-pipeline-statistics → main · +213 −1 · 4 files · 1 commits · merged 2026-11-26 06:50 UTC

What

Each draw and ExecuteIndirect the draw trace logs is now wrapped in a PIPELINE_STATISTICS1 query and an OCCLUSION query (DrawQueries). The results are resolved into a readback buffer and logged with the probes two presents later:

[draws] counters of indirect on list 0x… <pipeline>: AS 0 MS 7936 MS primitives 0, clipper in 0 out 0, PS 0, VS 0 IA primitives 0, CS 64; samples through depth and stencil 0

With --mesh-launch, the number of launches and drops so far follows.

Why

The world's G-buffer stays empty. The trace and the mesh probe showed that the mesh programs run and declare primitives, but the pixels could be lost at several stages: after the mesh shader, at the clipper, at the pixel shader, or at the depth and stencil tests. These counters name the stage directly.

What it shows (a retail game, world frame, RX 7800 XT, 397a2335)

Traced work MS invocations MS primitives clipper in PS samples
UI draw (VS), control – – 179,928 307,497 13,323
full-screen draw (VS), control – – 2 8,294,400 8,294,400
G-buffer MS_VS_TransformD, terrain, OctaSLOD impostors, PositionOnly pre-pass (64–66 draws per run, clamp path and --mesh-launch alike) 128 – 22,912 0 0 0 0

On the same draws, the mesh probe (--probe-pipeline MS_VS_Transform) shows groups that give SetMeshOutputCounts 2–128 primitives, cull none of them, and write finite positions inside the view. The groups run and declare primitives, but the rasterizer receives none. A separate issue will follow with the details.

In game

Diagnostics only. The world is still reached with its lights but without geometry, at about 2–10 fps.

Tests

  • New DrawQueriesTests: the counters are named in D3D12_QUERY_DATA_PIPELINE_STATISTICS1 order, and the occlusion count comes last.
  • Loader tests: 420 passed.

🤖 Generated with Claude Code

**@⁠Sr-0w** on GitHub · 2026-11-26 03:59 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/53) `Sr-0w:diagnostics/draw-pipeline-statistics` → `main` · +213 −1 · 4 files · 1 commits · merged 2026-11-26 06:50 UTC ## What Each draw and ExecuteIndirect the draw trace logs is now wrapped in a `PIPELINE_STATISTICS1` query and an `OCCLUSION` query (`DrawQueries`). The results are resolved into a readback buffer and logged with the probes two presents later: ``` [draws] counters of indirect on list 0x… <pipeline>: AS 0 MS 7936 MS primitives 0, clipper in 0 out 0, PS 0, VS 0 IA primitives 0, CS 64; samples through depth and stencil 0 ``` With `--mesh-launch`, the number of launches and drops so far follows. ## Why The world's G-buffer stays empty. The trace and the mesh probe showed that the mesh programs run and declare primitives, but the pixels could be lost at several stages: after the mesh shader, at the clipper, at the pixel shader, or at the depth and stencil tests. These counters name the stage directly. ## What it shows (a retail game, world frame, RX 7800 XT, 397a2335) | Traced work | MS invocations | MS primitives | clipper in | PS | samples | |---|---|---|---|---|---| | UI draw (VS), control | – | – | 179,928 | 307,497 | 13,323 | | full-screen draw (VS), control | – | – | 2 | 8,294,400 | 8,294,400 | | G-buffer `MS_VS_TransformD`, terrain, `OctaSLOD` impostors, `PositionOnly` pre-pass (64–66 draws per run, clamp path and `--mesh-launch` alike) | 128 – 22,912 | **0** | **0** | **0** | **0** | On the same draws, the mesh probe (`--probe-pipeline MS_VS_Transform`) shows groups that give `SetMeshOutputCounts` 2–128 primitives, cull none of them, and write finite positions inside the view. The groups run and declare primitives, but the rasterizer receives none. A separate issue will follow with the details. ## In game Diagnostics only. The world is still reached with its lights but without geometry, at about 2–10 fps. ## Tests - New `DrawQueriesTests`: the counters are named in `D3D12_QUERY_DATA_PIPELINE_STATISTICS1` order, and the occlusion count comes last. - Loader tests: 420 passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A pass whose target stays empty could lose its pixels at any stage: no primitive out of the mesh shader, none into
the clipper, no pixel shader run, or every sample failing depth and stencil. Each draw and ExecuteIndirect the trace
logs is now wrapped in a PIPELINE_STATISTICS1 and an OCCLUSION query (DrawQueries), resolved into a readback buffer
and logged with the probes two presents later, so the log names the stage. With --mesh-launch the launches and drops
so far follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:15:52 +00:00
github manually merged commit e12a900bcd into gh-pr/53/base 2026-11-27 03:15:53 +00:00
Author
Owner

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

really useful, the counters are exactly what we were missing

the architecture tests tripped on StatementGrouping in the DrawTrace constructor, so I added a blank line on merge (c8cfcb7). merged

**@⁠ThatRecompDev** on GitHub · 2026-11-26 07:30 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/53#issuecomment-7185524413) really useful, the counters are exactly what we were missing the architecture tests tripped on StatementGrouping in the DrawTrace constructor, so I added a blank line on merge (c8cfcb7). merged
This discussion has been locked. Commenting is limited to contributors.
No description provided.