World mesh passes run their groups but the rasterizer receives no primitive #54

Closed
opened 2026-11-27 03:15:54 +00:00 by github-bot · 2 comments
Owner

@⁠Sr-0w on GitHub · 2026-11-26 03:59 UTC · original

In the world, the depth pre-pass, the G-buffer, the terrain and the impostor passes all run their mesh groups, yet the rasterizer receives no primitive from them. The lighting and the UI draw normally, so the world shows only its lights.

All runs below are on a retail game, an RX 7800 XT and build 397a2335, with the measurement tools of #52 and #53.

Measured

Hardware counters (#53, PIPELINE_STATISTICS1 + OCCLUSION around each traced draw or ExecuteIndirect, 3 captured world frames):

Work MS invocations MS primitives clipper in PS samples
UI draw (VS) – – 179,928 307,497 13,323
full-screen draw (VS) – – 2 8,294,400 8,294,400
PS_DeferredTextured + MS_VS_TransformD, …StdNC + MS_VS_TransformTerrainNormalTint, PS_OctaSLODReZ + MS_VS_OctaSLOD(Wind), MS_VS_Transform_PositionOnly 128 – 22,912 0 0 0 0

The pattern is the same on the clamp path (CS 64/128 for the clamp) and with --mesh-launch. It also holds for the probe-instrumented variants of the same programs (66 of 66 draws).

Mesh probe, same run and same programs (--probe-pipeline MS_VS_Transform):

  • MS_VS_TransformD_062b2704: 1,717 groups; vertices 4–128 and primitives 2–128 given to SetMeshOutputCounts; 0 of 175,704 primitives culled.
  • Vertex 0 is finite and inside the view, e.g. (450.1, 123.8, 0.0481, 379.1). No w is 0 and nothing is NaN.

The G-buffer target (2560x1440, format 29) has 0 non-black pixels after every traced ExecuteIndirect.

Ruled out

  • Pipeline state as the desktop gets it. G-buffer: depth GREATER_EQUAL with write on; stencil ALWAYS/REPLACE; 6 RTs (29/28/28/28/34/28) with masks 0xf, no blend; cull BACK with FrontCounterClockwise=1. The DSV is 2560x1440 format 19, in DEPTH_WRITE (#52).
  • Stand-ins. The counted draws are recorded draws with built pipelines.
  • Output metadata of the DXIL backend. For MS_VS_TransformD_c5fd36bb, the backend's DXIL and dxc's DXIL of the same translated HLSL have the same output signatures, the same SV_CullPrimitive (I1, nointerpolation), 128/128 outputs, triangle topology and numthreads 128; only one shader-flag bit differs. SetMeshOutputCounts is called once, at the loop exit, from group-shared counts read after a barrier.
  • The game's primitive guard. The guard "index ≥ vertex count → 0x80000000" is the game's own code, translated as written.

Open question

The mesh programs declare primitives that are not culled and have valid positions, yet the hardware counts 0 primitives out of the mesh stage. The next step I can think of is to run one of these programs with captured inputs on WARP, or with dxc instead of the DXIL backend (--shader-backend dxc), and see whether primitives come out.

🤖 Generated with Claude Code

**@⁠Sr-0w** on GitHub · 2026-11-26 03:59 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/issues/54) In the world, the depth pre-pass, the G-buffer, the terrain and the impostor passes all run their mesh groups, yet the rasterizer receives no primitive from them. The lighting and the UI draw normally, so the world shows only its lights. All runs below are on a retail game, an RX 7800 XT and build 397a2335, with the measurement tools of #52 and #53. ## Measured **Hardware counters** (#53, `PIPELINE_STATISTICS1` + `OCCLUSION` around each traced draw or ExecuteIndirect, 3 captured world frames): | Work | MS invocations | MS primitives | clipper in | PS | samples | |---|---|---|---|---|---| | UI draw (VS) | – | – | 179,928 | 307,497 | 13,323 | | full-screen draw (VS) | – | – | 2 | 8,294,400 | 8,294,400 | | `PS_DeferredTextured + MS_VS_TransformD`, `…StdNC + MS_VS_TransformTerrainNormalTint`, `PS_OctaSLODReZ + MS_VS_OctaSLOD(Wind)`, `MS_VS_Transform_PositionOnly` | 128 – 22,912 | **0** | **0** | **0** | **0** | The pattern is the same on the clamp path (CS 64/128 for the clamp) and with `--mesh-launch`. It also holds for the probe-instrumented variants of the same programs (66 of 66 draws). **Mesh probe, same run and same programs** (`--probe-pipeline MS_VS_Transform`): - `MS_VS_TransformD_062b2704`: 1,717 groups; vertices 4–128 and primitives 2–128 given to `SetMeshOutputCounts`; 0 of 175,704 primitives culled. - Vertex 0 is finite and inside the view, e.g. `(450.1, 123.8, 0.0481, 379.1)`. No w is 0 and nothing is NaN. **The G-buffer target** (2560x1440, format 29) has 0 non-black pixels after every traced ExecuteIndirect. ## Ruled out - **Pipeline state as the desktop gets it.** G-buffer: depth GREATER_EQUAL with write on; stencil ALWAYS/REPLACE; 6 RTs (29/28/28/28/34/28) with masks 0xf, no blend; cull BACK with FrontCounterClockwise=1. The DSV is 2560x1440 format 19, in DEPTH_WRITE (#52). - **Stand-ins.** The counted draws are recorded draws with built pipelines. - **Output metadata of the DXIL backend.** For `MS_VS_TransformD_c5fd36bb`, the backend's DXIL and dxc's DXIL of the same translated HLSL have the same output signatures, the same `SV_CullPrimitive` (I1, nointerpolation), 128/128 outputs, triangle topology and numthreads 128; only one shader-flag bit differs. `SetMeshOutputCounts` is called once, at the loop exit, from group-shared counts read after a barrier. - **The game's primitive guard.** The guard "index ≥ vertex count → 0x80000000" is the game's own code, translated as written. ## Open question The mesh programs declare primitives that are not culled and have valid positions, yet the hardware counts 0 primitives out of the mesh stage. The next step I can think of is to run one of these programs with captured inputs on WARP, or with dxc instead of the DXIL backend (`--shader-backend dxc`), and see whether primitives come out. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:15:54 +00:00
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-26 05:04 UTC · original

Found and fixed in #55. On AMD (RX 7800 XT), once a primitive's SV_CullPrimitive has been written true, it stays culled: a later false is lost. Every translated mesh program initialised cull = true after SetMeshOutputCounts, so on this GPU none of its primitives were ever drawn. The repository's native mesh cases reproduce it with FIVESTAR_TEST_ADAPTER=hardware. With the fix, the world's depth buffer and G-buffer fill.

**@⁠Sr-0w** on GitHub · 2026-11-26 05:04 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/issues/54#issuecomment-7183160604) Found and fixed in #55. On AMD (RX 7800 XT), once a primitive's SV_CullPrimitive has been written true, it stays culled: a later false is lost. Every translated mesh program initialised `cull = true` after SetMeshOutputCounts, so on this GPU none of its primitives were ever drawn. The repository's native mesh cases reproduce it with `FIVESTAR_TEST_ADAPTER=hardware`. With the fix, the world's depth buffer and G-buffer fill.
Author
Owner

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

fixed by #55, thanks for the counters, they made it obvious

**@⁠ThatRecompDev** on GitHub · 2026-11-26 07:30 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/issues/54#issuecomment-7185525878) fixed by #55, thanks for the counters, they made it obvious
This discussion has been locked. Commenting is limited to contributors.
No description provided.