Describe in docs/architecture.md how the game's submitting threads take turns, and bring nvn_call_note's comment, which said the front end relied on one thread at a time, up to date.

The submit path no longer relies on one guest thread at a time: replays take turns on the submission lock, a frame's
bookkeeping at its present runs between two replays (vk_frame_owed.h), a held present goes out once and in order
(vk_present_held.h), a second submission of a recording in flight gets a clone (nvn_submit_guard.h), and held work is
asked about from a published copy (vk_evo_peek.h). docs/architecture.md section 4 gets a bullet saying so, with the
switch and the log lines; the comment above nvn_api_core.c nvn_call_note now says what holds and that an overlap line
is a count, not a fault.

Checks that passed: pass_cc_check of nvn_api_core.c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 19:13:23 -05:00
parent 518185b808
commit effdbd8dc0
2 changed files with 15 additions and 3 deletions

View File

@@ -91,6 +91,16 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
queues"); a CPU signal counts for a submission only when it came before the copies above were taken, and a
submission it comes too late for goes on at once in one of its own (`vk_exec_xfer.c`, "events the CPU signals").
`NX2NAVI_EVO_TRACE=1` logs the order every frame was replayed in.
- Several submitting threads. The game submits from several threads and presents from one of them. Their replays take
turns on the submission lock (`vk_sync.c`). The state a present closes for the frame (the DLSS state, the motion
tables, the frame count conditional draws go by) is reset between two replays: by the present when the lock is free,
else first thing in the next submission (`vk_frame_owed.h`, `NX2NAVI_PRESENT_ORDER`). A present held for
event-ordered work is put out once and in order by whichever thread's submission finds its work done
(`vk_present_held.h`); submitting threads only try its lock, and the presenting thread waits for it only while
another thread puts a held present out. A recording two threads submit at once gets a copy of its own for the
second, for its deferred binds (`nvn_submit_guard.h`). Held work is asked about without the lock from a published
copy (`vk_evo_peek.h`). The log counts the overlaps with `NX2NAVI_TRACE=perf` ("enters a submit ... while"), and at
exit what they cost ("frame bookkeeping: ...").
- Driver data. The NVN driver keeps a per-stage constant bank (c0). The back end fills it as the driver does: storage
and uniform tables, push constants and, for NVN 2 compute, the dispatch's group counts in bytes 0-0xb.
- Storage buffers the shaders reach through pointer tables in memory are bound at the address the table holds