Skip to content

NVN: preserve indirect conversions across disjoint mesh writes - #1888

Open
bmjask wants to merge 1 commit into
seedds:mainfrom
bmjask:codex/nvn-indirect-cache-ranges
Open

bmjask wants to merge 1 commit into
seedds:mainfrom
bmjask:codex/nvn-indirect-cache-ranges

Conversation

@bmjask

@bmjask bmjask commented Nov 9, 2026 •

Copy link
Copy Markdown

A native mesh draw advances the global write epoch even when its writable buffers cannot affect cached indirect draw inputs. Preserve the indirect-conversion cache only after proving disjoint bounded storage writes; the global epoch and all other consumers keep their existing behavior.

Overlaps, unknown binding types, sparse aliases, invalid slots, overflow and stale epochs/submissions remain conservative. Indexed records protect the entire remaining source buffer, since GPU-written firstIndex can address beyond conversion output capacity.

Independent extraction from #1663 onto e3ad8255. It preserves main's newer native mesh argument conversion and Metal 4 pipeline archive support. It does not reintroduce our older synthetic mesh primitive path. No shader-chain change.

Historical A/B results

November 8 M4 Max, short camera routes, full image quality, combined playability branch; chat results cross-checked with saved JSON:

Route Control FPS Candidate FPS Median GPU ms (control → candidate)
Forest, forward order 92.37 99.00 10.052 → 9.592
Forest, reverse order 94.87 98.83 9.823 → 9.629
Market entrance 100.97 102.90 See game-note evidence
Field slope 94.10 103.27 See game-note evidence

Both forest pairs had 1578 MHz median GPU clocks and no new pipeline/library compilation. Market/Field accepted pairs passed compiler/drawable/preservation gates; earlier compiler-active pairs were rejected. Screenshots retained scene/HUD with animation differences. Historical full local Ocarina regression passed, with unchanged shaders and no new runtime errors.

Those gains were measured with the older combined mesh path. This narrower extraction has no new performance verdict on current main. A current-main performance comparison remains outstanding.

Current validation

check_t_ixc_ranges: 22 checks pass under Metal API validation. Eleven documentation tests pass. The fixture covers disjoint and overlapping records, unknown writes, stale submission/epoch, exact boundaries and index offsets beyond output capacity.

Full gameplay and five-game regression on this extraction are pending; only Ocarina assets are locally available. iOS is untested. Existing app and playability branch are unchanged.

Reproducible evidence

Tested extraction: 4bfe7e4d25731959544f206a526d5accae0592b1. Test source at that commit; game note at that commit. Run on an Apple-silicon Mac with the repository's build dependencies configured:

make -C dm/gfx/tests GAME=0400486024DEC000 check_t_ixc_ranges

Saved local test-output excerpt (not a new test run or a CI result):

indirect cache ranges: 22 checks, 0 failed

Historical A/B figures above describe the older combined branch. They are not fresh performance validation of this extracted commit. The remaining gameplay/regression limitations above still apply.

Rebase validation — 2026-11-09

Current head: a18d9a69f7dade623a23a5be9972ce45838b6908, one commit above upstream 9983d659e6101867215e4afe5dd6287ad8e0d4a3.

Graphics check list: 126 test targets plus the two Python check targets exercised. The sole initial failure was compiling the capture replay helper with a stale SDKROOT. After selecting the active Xcode SDK, the affected capture/replay check passed, with both fresh replays matching the live frame. The indirect range fixture passed 22 checks.

Mac fixtures were tested before the final upstream iOS-linker-only commit; verified that dm/ios/tools/gen_build.py is the sole subsequent file difference. Impact analysis was also run. No new gameplay A/B performance claim: historical figures above still describe the combined branch. Full current-chain game rebuild and gameplay regression remain pending; only Ocarina assets are locally available, and other titles/iOS are untested. The installed app and codex/ocarina-playability were preserved.

@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) docs Documentation game: 0400486024DEC000 A game labels Nov 9, 2026
@bmjask
bmjask marked this pull request as ready for review November 9, 2026 01:17
@FifteenPen

Copy link
Copy Markdown
Contributor

Supporting numbers from our tree, where we did the same on the older mesh path (indirect-draw conversions survive storage-buffer writes that hold none of their records): Ocarina of Time's grass split its render pass 6 → 2 times a frame, and the Link's-house bench went 18.1–18.6 → 17.4–17.6 ms (M4 Pro, docked).

@bmjask
bmjask force-pushed the codex/nvn-indirect-cache-ranges branch from 4bfe7e4 to a18d9a6 Compare November 9, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 0400486024DEC000 A game nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants