Skip to content

Add a Switch 2 profile for The Legend of Zelda: Ocarina of Time - #1387

Closed
vinifloriano wants to merge 3 commits into
seedds:mainfrom
vinifloriano:oot
Closed

vinifloriano wants to merge 3 commits into
seedds:mainfrom
vinifloriano:oot

Conversation

@vinifloriano

Copy link
Copy Markdown

What and why
Add a Switch 2 profile for The Legend of Zelda: Ocarina of Time and document its current Mac bring-up. The offline socket layer lacked local eventfd support, which prevented the game’s bundled gRPC poll engine from initializing. This change adds local event counters and polling while keeping network sockets offline, along with shader, NVN, and service fixes needed to reach the frame loop.

See the game notes and services reference. The main README gallery now includes the Ocarina of Time screenshot.

Checked
Tests: host net-eventfd and t_sf; documentation tests; BNSH and NDSR tests; Ampere ALU (12 tests) and memory (70 tests) regressions; translator lock check.
Games run: Ocarina of Time (0400486024DEC000, v131072), Mac discovery run reached frame 86 and rendered the AV1 opening. Gameplay is not validated.
Devices and OS: Mac host; model and macOS version not recorded.
scripts/regress.py check --games: not run.
Full gameplay and cross-game regression coverage remain unvalidated.

Docs
Game note and reference entry updated.
python3 dm/tools/docs_symptoms.py was not run.
Shader chain regenerated; dm/gfx/nvn/dmsh_chain.h is included.
Confirm the game-specific shader metadata meets the repository’s no-extracted-game-data requirement before submitting.

@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers ios The iPhone and iPad app (dm/ios) tools Tools and scripts (dm/tools, scripts) docs Documentation shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders game: 0400486024DEC000 A game new game Adds a game profile that main does not have yet labels Nov 5, 2026
@LudovicLemarinel

Copy link
Copy Markdown
Contributor

Hey,
Have you seen #1299 ?

@vinifloriano

Copy link
Copy Markdown
Author

#1299 doesn't work for me, games simply don't open.

Don't know if my setup is wrong but tried a fresh compile from the pr code.

Also this one fixes some shaders that fail with 1299.

@seedds

seedds commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Thank you for this work and testing. The game's profile has landed on main in b1d7c70 and 6121fd7, so this isn't needed now. Your notes on pool tables and wide writes were useful to read. Final checks on the rebased tree (full shader build, walks, regression) are still running, so please report anything you see.

@seedds seedds closed this Nov 6, 2026
javierdv7 pushed a commit to javierdv7/nxnative that referenced this pull request Nov 6, 2026
…ng walked whole: registrations, memory pools added or removed, retired IDs at a new submission and storage takeovers each leave a note

pool_gpu walked a table of handles traced to no slot whole at any change of g_reg_gen or g_ser_gen, though each
change reaches only a few of its IDs. On main (6121fd7), TheekshanaA measured about 53 s of a seven-minute walk
through Ocarina of Time's Kokiri Forest spent on 61,000 such builds of its 33,025-entry texture table (PR seedds#1405,
seedds#1464). The game registers something between most of its draws, its streamed textures map and unmap virtual pool
runs (vrun_set) dozens of times a second, finalized descriptors stay registered, and textures take over each
other's storage (alias_take_over, about 8,400 times in six minutes), which bumped g_ser_gen with no note and so
also sent every texture ID down the slow path.

This ports TheekshanaA's branch oot-pool-table-notes (9579768, 9d486f8) to main's walk. Those commits sat on
the table patching of seedds#1299 / seedds#1387, which main did not take, so the patching comes with them:
- A registration records its generation and ID (g_reg_log), a storage change its serial (g_ser_log, beside the
  notes ser_sync takes). A table built at an earlier generation takes again only the IDs they name, by the walk's
  own rules (pool_entry), and is kept when no entry changes, else copied and patched.
- A memory pool added or removed records REG_POOL and no ID: a table takes again only the IDs it found without
  storage (pool_snap.dead), and treg_gone notes each ID of a finalized pool. A note's generation is stored last
  (release) and read first (acquire), as pool changes come from threads that do not hold g_rmu.
- A table keeps the IDs whose entries are views of retired registrations (pool_snap.trans and .sub); the next
  submission takes only those again.
- A takeover records a note that names no texture (ser_note(0)).
- Past POOL_IDS_MAX IDs on a list, a note the ring has overwritten, a bump without a note, a pool that grew or a
  sparse mapping, the table is built whole as before. The log line says why tables were built whole and how many
  were patched or kept; the power lines gain "[nvn] pool tables up to frame ...".

What main's walk changes on the way:
- A patch makes textures only within what the frame may still make (pool_room, taken out of pool_walk_limit), as
  a walk does. A texture left out counts in the table's left, and the walk goes on next frame as before.
- Patched tables take and give their buffers through pool_table_take / pool_table_give, as walked ones do.
- A retired registration's view that the read scan writes in place (pool_seen_scan) is listed as transient too,
  and a table holding such views from an earlier submission does not stand under POOL_SUB_MS. Before, nothing
  made a table take those IDs again after the submission whose end drops the views.
- alias_sweep, and seedds#1387's exception that kept a retired view of a shared texture past its submission, are not
  needed: main drops every retired view at the submission's end, so the next submission takes those IDs again.
- A sampler table follows registrations alone.

Checked: t_pool_notes (new, 67 checks). A pool elsewhere keeps the table, the pool that brings an ID's storage
patches it, a finalized pool's ID holds the dummy, a bump without a note builds it whole, a retired ID and a
takeover are taken again at the next submission without a build, a registration past the budget is left out by
a patch, and a read written in place is taken again; patched tables match tables built whole. Without the
takeover note, the retake at a new submission or the in-place record, it fails (2, 4 and 2 checks).
make -C dm/gfx/tests GAME=0400486024DEC000 for the 35 tests that reach registrations, pool tables, serial notes
and the sharing table (t_pool_chunks, t_feedback, t_sparse_tiles, t_image_alias and t_nvn among them): all pass.
The Mac host builds, and the two changed files compile for the iPhone SDK. clang-tidy (LLVM 22, not CI's 23)
finds nothing new in them.
Ocarina of Time, four scripted runs on an M4 with 24 GB, alternating main (88c7e03) and this change, from the
autosave at Link's house (180 s in the house, Saria's greeting, 300 s on the balcony): the table was built whole
44,000 and 24,000 times per run on main (67 s and 72 s), about 100 times with this change (about 0.2 s), while
about 86,000 tables were patched and 63,000 kept. The submit thread's CPU time per frame (p50) went from 12-15 ms
to 3-5 ms; frame p50 is the GPU's and did not move, p99 in the house went from 34.6 and 41.0 ms to 24.2 and
25.6 ms, and frames over 50 ms walking from 23 and 48 to 3 and 2. Same picture, footprint and red lines.

Co-authored-by: TheekshanaA <10327965+TheekshanaA@users.noreply.github.com>
gnosticgeek pushed a commit to gnosticgeek/nxforge that referenced this pull request Nov 6, 2026
…ng walked whole: registrations, memory pools added or removed, retired IDs at a new submission and storage takeovers each leave a note

pool_gpu walked a table of handles traced to no slot whole at any change of g_reg_gen or g_ser_gen, though each
change reaches only a few of its IDs. On main (6121fd7), TheekshanaA measured about 53 s of a seven-minute walk
through Ocarina of Time's Kokiri Forest spent on 61,000 such builds of its 33,025-entry texture table (PR seedds#1405,
seedds#1464). The game registers something between most of its draws, its streamed textures map and unmap virtual pool
runs (vrun_set) dozens of times a second, finalized descriptors stay registered, and textures take over each
other's storage (alias_take_over, about 8,400 times in six minutes), which bumped g_ser_gen with no note and so
also sent every texture ID down the slow path.

This ports TheekshanaA's branch oot-pool-table-notes (9579768, 9d486f8) to main's walk. Those commits sat on
the table patching of seedds#1299 / seedds#1387, which main did not take, so the patching comes with them:
- A registration records its generation and ID (g_reg_log), a storage change its serial (g_ser_log, beside the
  notes ser_sync takes). A table built at an earlier generation takes again only the IDs they name, by the walk's
  own rules (pool_entry), and is kept when no entry changes, else copied and patched.
- A memory pool added or removed records REG_POOL and no ID: a table takes again only the IDs it found without
  storage (pool_snap.dead), and treg_gone notes each ID of a finalized pool. A note's generation is stored last
  (release) and read first (acquire), as pool changes come from threads that do not hold g_rmu.
- A table keeps the IDs whose entries are views of retired registrations (pool_snap.trans and .sub); the next
  submission takes only those again.
- A takeover records a note that names no texture (ser_note(0)).
- Past POOL_IDS_MAX IDs on a list, a note the ring has overwritten, a bump without a note, a pool that grew or a
  sparse mapping, the table is built whole as before. The log line says why tables were built whole and how many
  were patched or kept; the power lines gain "[nvn] pool tables up to frame ...".

What main's walk changes on the way:
- A patch makes textures only within what the frame may still make (pool_room, taken out of pool_walk_limit), as
  a walk does. A texture left out counts in the table's left, and the walk goes on next frame as before.
- Patched tables take and give their buffers through pool_table_take / pool_table_give, as walked ones do.
- A retired registration's view that the read scan writes in place (pool_seen_scan) is listed as transient too,
  and a table holding such views from an earlier submission does not stand under POOL_SUB_MS. Before, nothing
  made a table take those IDs again after the submission whose end drops the views.
- alias_sweep, and seedds#1387's exception that kept a retired view of a shared texture past its submission, are not
  needed: main drops every retired view at the submission's end, so the next submission takes those IDs again.
- A sampler table follows registrations alone.

Checked: t_pool_notes (new, 67 checks). A pool elsewhere keeps the table, the pool that brings an ID's storage
patches it, a finalized pool's ID holds the dummy, a bump without a note builds it whole, a retired ID and a
takeover are taken again at the next submission without a build, a registration past the budget is left out by
a patch, and a read written in place is taken again; patched tables match tables built whole. Without the
takeover note, the retake at a new submission or the in-place record, it fails (2, 4 and 2 checks).
make -C dm/gfx/tests GAME=0400486024DEC000 for the 35 tests that reach registrations, pool tables, serial notes
and the sharing table (t_pool_chunks, t_feedback, t_sparse_tiles, t_image_alias and t_nvn among them): all pass.
The Mac host builds, and the two changed files compile for the iPhone SDK. clang-tidy (LLVM 22, not CI's 23)
finds nothing new in them.
Ocarina of Time, four scripted runs on an M4 with 24 GB, alternating main (88c7e03) and this change, from the
autosave at Link's house (180 s in the house, Saria's greeting, 300 s on the balcony): the table was built whole
44,000 and 24,000 times per run on main (67 s and 72 s), about 100 times with this change (about 0.2 s), while
about 86,000 tables were patched and 63,000 kept. The submit thread's CPU time per frame (p50) went from 12-15 ms
to 3-5 ms; frame p50 is the GPU's and did not move, p99 in the house went from 34.6 and 41.0 ms to 24.2 and
25.6 ms, and frames over 50 ms walking from 23 and 48 to 3 and 2. Same picture, footprint and red lines.

Co-authored-by: TheekshanaA <10327965+TheekshanaA@users.noreply.github.com>
seedds added a commit that referenced this pull request Nov 6, 2026
…ng walked whole: registrations, memory pool changes, retired IDs at a new submission and storage takeovers each leave a note; Ocarina of Time's village walk builds its 33,025-entry table 16 times instead of over 4,000 (PR #1489)

pool_gpu walked a table of handles traced to no slot whole at any change of g_reg_gen or g_ser_gen, though each
change reaches only a few of its IDs. Ocarina of Time registers something between most of its draws, its streamed
textures map and unmap virtual pool runs dozens of times a second, finalized descriptors stay registered, and
textures take over each other's storage (alias_take_over), which bumped g_ser_gen with no note and so also sent
every texture ID down the slow path. TheekshanaA measured about 53 s of a seven-minute walk through Kokiri Forest
spent on 61,000 such builds (PR #1405, #1464).

This is TheekshanaA's branch oot-pool-table-notes, ported to main's walk by PucaVaz, with the table patching of
#1299 / #1387 it sat on:
- A registration records its generation and ID (g_reg_log), a storage change its serial (g_ser_log, beside the
  notes ser_sync takes). A table built at an earlier generation takes again only the IDs they name, by the walk's
  own rules (pool_entry), and is kept when no entry changes, else copied and patched.
- A memory pool added or removed records REG_POOL and no ID: a table takes again only the IDs it found without
  storage (pool_snap.dead); treg_gone notes each ID of a finalized pool.
- A table keeps the IDs whose entries are views of retired registrations, those the read scan writes in place
  among them (pool_snap.trans); the next submission takes only those again, and such a table does not stand
  under POOL_SUB_MS.
- A takeover records a note that names no texture (ser_note(0)): it changes no serial's texture (an entry a live
  serial holds is not evicted, serial_table_holds; one a finalized serial holds is only unref'd). A live sRGB /
  linear twin's view of an evicted texture is found stale by tex_mtl_ and dropped (serial_del), a note naming it.
- A patch makes textures only within what the frame may still make (pool_room). Past POOL_IDS_MAX IDs, a note
  the ring has overwritten, a bump without a note, a resized table or a sparse mapping, the table is built whole
  as before. The log line says why; the power lines gain "[nvn] pool tables up to frame ...".

On landing: the comment and the reference entry name serial_table_holds (#1439 replaced the serial table walk)
and describe the sRGB / linear twin case; a registration note is read as a sequence lock (reg_read: its
generation is checked before and after its ID, and the writer clears it first), as memory pool changes write
notes from threads that do not hold g_rmu and a note the ring overwrote during the read could be taken torn.

Checked: t_pool_notes 81 checks (patched tables compared with tables built whole), t_pool_chunks 102,
t_alias_takeover 28, t_gmem_words 16, t_feedback 159, t_image_alias 329, t_sparse_tiles 4,253, t_cpu_tex --metal
68, all 0 failed; test_docs; the Mac host builds and the iOS compile check passes (261 files). Ocarina of Time on
an M-series Mac, hosts at 51cc8bc with and without this (main's chain has no libraries on disk for it), the
village walk from save_ref: tables built whole 4,000+ (5.85 s+) on the base, 12 and 16 (0.11 s, 0.12 s) with
this; submit p50 in the village 11-16 ms on the base, about 7-12 ms with this; the same red lines and no GPU
error. Vertical stripes in both sides' shots at the same balcony points come from that old-chain setup, not this
change. The author measured submit p50 12-15 -> 3-5 ms and frames over 50 ms walking 23 and 48 -> 3 and 2 (M4,
two runs per side). No second game: none local has libraries for main's chain, and the one whose regress runs
reach these tables (Paper Mario: The Thousand-Year Door) needs 11,861 shaders translated first.

Co-authored-by: PucaVaz <65235669+PucaVaz@users.noreply.github.com>
Co-authored-by: TheekshanaA <10327965+TheekshanaA@users.noreply.github.com>
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…ng walked whole: registrations, memory pool changes, retired IDs at a new submission and storage takeovers each leave a note; Ocarina of Time's village walk builds its 33,025-entry table 16 times instead of over 4,000 (PR seedds#1489)

pool_gpu walked a table of handles traced to no slot whole at any change of g_reg_gen or g_ser_gen, though each
change reaches only a few of its IDs. Ocarina of Time registers something between most of its draws, its streamed
textures map and unmap virtual pool runs dozens of times a second, finalized descriptors stay registered, and
textures take over each other's storage (alias_take_over), which bumped g_ser_gen with no note and so also sent
every texture ID down the slow path. TheekshanaA measured about 53 s of a seven-minute walk through Kokiri Forest
spent on 61,000 such builds (PR seedds#1405, seedds#1464).

This is TheekshanaA's branch oot-pool-table-notes, ported to main's walk by PucaVaz, with the table patching of
seedds#1299 / seedds#1387 it sat on:
- A registration records its generation and ID (g_reg_log), a storage change its serial (g_ser_log, beside the
  notes ser_sync takes). A table built at an earlier generation takes again only the IDs they name, by the walk's
  own rules (pool_entry), and is kept when no entry changes, else copied and patched.
- A memory pool added or removed records REG_POOL and no ID: a table takes again only the IDs it found without
  storage (pool_snap.dead); treg_gone notes each ID of a finalized pool.
- A table keeps the IDs whose entries are views of retired registrations, those the read scan writes in place
  among them (pool_snap.trans); the next submission takes only those again, and such a table does not stand
  under POOL_SUB_MS.
- A takeover records a note that names no texture (ser_note(0)): it changes no serial's texture (an entry a live
  serial holds is not evicted, serial_table_holds; one a finalized serial holds is only unref'd). A live sRGB /
  linear twin's view of an evicted texture is found stale by tex_mtl_ and dropped (serial_del), a note naming it.
- A patch makes textures only within what the frame may still make (pool_room). Past POOL_IDS_MAX IDs, a note
  the ring has overwritten, a bump without a note, a resized table or a sparse mapping, the table is built whole
  as before. The log line says why; the power lines gain "[nvn] pool tables up to frame ...".

On landing: the comment and the reference entry name serial_table_holds (seedds#1439 replaced the serial table walk)
and describe the sRGB / linear twin case; a registration note is read as a sequence lock (reg_read: its
generation is checked before and after its ID, and the writer clears it first), as memory pool changes write
notes from threads that do not hold g_rmu and a note the ring overwrote during the read could be taken torn.

Checked: t_pool_notes 81 checks (patched tables compared with tables built whole), t_pool_chunks 102,
t_alias_takeover 28, t_gmem_words 16, t_feedback 159, t_image_alias 329, t_sparse_tiles 4,253, t_cpu_tex --metal
68, all 0 failed; test_docs; the Mac host builds and the iOS compile check passes (261 files). Ocarina of Time on
an M-series Mac, hosts at 66e6e4c with and without this (main's chain has no libraries on disk for it), the
village walk from save_ref: tables built whole 4,000+ (5.85 s+) on the base, 12 and 16 (0.11 s, 0.12 s) with
this; submit p50 in the village 11-16 ms on the base, about 7-12 ms with this; the same red lines and no GPU
error. Vertical stripes in both sides' shots at the same balcony points come from that old-chain setup, not this
change. The author measured submit p50 12-15 -> 3-5 ms and frames over 50 ms walking 23 and 48 -> 3 and 2 (M4,
two runs per side). No second game: none local has libraries for main's chain, and the one whose regress runs
reach these tables (Paper Mario: The Thousand-Year Door) needs 11,861 shaders translated first.

Co-authored-by: PucaVaz <65235669+PucaVaz@users.noreply.github.com>
Co-authored-by: TheekshanaA <10327965+TheekshanaA@users.noreply.github.com>
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 host The Horizon host: SVCs, services, threads, memory (dm/host) ios The iPhone and iPad app (dm/ios) new game Adds a game profile that main does not have yet nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants