Repository navigation
Commit 6afb99e
committed
Compute dispatches between the draws of a pass run ahead of it (DM_NVN_CS_HOIST, on by default, 0 turns it off), exact for dispatches that sample the pass's depth: such a dispatch moves only while no draw before it in the pass writes depth
Metal cannot run a compute dispatch inside a render pass, so every dispatch between two draws of one pass ends it, and on a tile-based GPU each split stores and reloads every attachment and pays a pass's fixed cost. When a draw opens a pass, cs_hoist_try scans the ops after it up to the first one that would end the pass anyway; each dispatch met on the way runs right away, before the pass opens, when moving it ahead of the draws before it in that stretch changes nothing they read or write: it writes no memory those draws read (vertex, index, indirect, uniform and storage buffers; its storage buffers count as written), samples no colour attachment of the pass, writes no image, and the draws write no memory (no storage buffer, image or transform feedback). Replay then skips it (csh_take), and the pass stays open across it. A dispatch that samples the pass's depth would see it as the pass began, so the scan stops at such a dispatch once a draw of the stretch (the one opening the pass included) has depth writes on. Breath of the Wild's NintendoWare VFX particles run one dispatch per emitter between the effect draws of the G-buffer and of the half-resolution passes, and their collision samples the G-buffer depth: no draw before them writes depth (0 stops of that kind).
The residency set line counts moved dispatches, those sampling the pass's depth, and why scans stopped; DM_NVN_PASSDUMP prints H lines.
Measured (Zora's Domain, 900p, FPS 120, M2 Max, back to back, means over 300-frame windows, slice merging on in both): compute encoders 28 -> 8 and render passes 149 -> 132 a frame, frame p50 9.92 -> 8.97 ms, p95 10.70 -> 9.98 ms, window max 11.55 -> 10.76 ms, GPU p50 7.69 -> 6.70 ms, frame interval p99 11.1 -> 10.4 ms, 100.8 -> 111.4 fps. Checked: the cube-filter frame's 173 render targets dumped with and without (DM_NVN_TEXDUMP=layers=100) match within 0.7% RMSE for every 3D target (only the 2D overlay of the final picture differed: a loading banner's animation, timed by the wall clock); screenshots of the same scene; t_nvn (128 checks) and the docs test pass. Reference entry in docs/reference/rendering.md, the game's note, the switch in dm/gfx/README.md1 parent 01efe59 commit 6afb99e
6 files changed
Lines changed: 104 additions & 5 deletions
File tree
- dm
- games/01007EF00011E000
- gfx
- nvn
- docs
- agents
- reference
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
1398 | 1400 | | |
1399 | 1401 | | |
1400 | 1402 | | |
| |||
0 commit comments