Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2261a38
File pages under a buffer joining the residency set are wired by mloc…
seedds Nov 9, 2026
bfa1214
Where Metal's working set is under 8 GB, textures in GPU-only memory …
seedds Nov 9, 2026
3db7eb5
The power line names the threads that make clock waits, with their pr…
seedds Nov 9, 2026
aa82d4c
Ocarina of Time's note: the M1 iPad holds 20 fps at the Great Deku Tr…
seedds Nov 9, 2026
e0209b5
The present takes the shape of the game's crop: a crop whose width / …
seedds Nov 9, 2026
cf623ee
screen_aspect any: a profile's stubs follow any window or screen shap…
seedds Nov 9, 2026
021300a
Probe diagnostics for values the game caches: float arguments, a scan…
seedds Nov 9, 2026
d97bed7
Ocarina of Time fills any window or screen shape, live while playing:…
seedds Nov 9, 2026
a8fe89b
Ocarina of Time's HUD takes the output's shape at its own pixel size …
seedds Nov 9, 2026
2f2c543
Docs for any screen shape: Ocarina of Time's Screen shape section, th…
seedds Nov 9, 2026
6f4c427
file_wire keeps its list when growing it fails: the range it cannot r…
seedds Nov 9, 2026
1c92e40
A shader-code pool's own address keeps it out of the raw pool table: …
seedds Nov 9, 2026
66867a7
OoT3 2b: the frame step calls the GPU slowed only against a reference…
seedds Nov 6, 2026
fb9f13b
OoT5 A-4: a movie the player reads one picture per game frame follows…
seedds Nov 7, 2026
c855a8c
The frame step's GPU reference also matches compute dispatches, so Oc…
seedds Nov 9, 2026
d845268
Docs: Ocarina of Time plays on an iPhone 17 (27-30 fps in Kokiri Fore…
seedds Nov 9, 2026
0e303a6
iOS: a Rotation setting (Automatic, Landscape, Portrait) on the setti…
seedds Nov 9, 2026
e5bc342
iOS: upright, a game that renders any shape fills the space above the…
seedds Nov 9, 2026
7bfa426
screen_aspect any: upright, the vertical angle is held to a square pi…
seedds Nov 9, 2026
c4aae7a
iOS: Portrait layout, Full screen by default: upright, a game that re…
seedds Nov 10, 2026
e0f33bd
screen_aspect any: the shape line no longer adds "screen shape 16:9" …
seedds Nov 10, 2026
2e35fa7
Docs: portrait play on the iPhone (Rotation, Portrait layout, the upr…
seedds Nov 10, 2026
adb6431
OoT-iPhone A-2: a submission's end hands its records to the encode th…
seedds Nov 9, 2026
e73aaac
Frame step: late frames with the GPU idle do not step up, and a longe…
uncraftablexd Nov 9, 2026
1a273e8
OoT-iPhone B-2: frames late at a 30 fps cap's hold 2 are shown at the…
seedds Nov 9, 2026
99a52c8
OoT-iPhone B-3: the frame step's log lines name the cap, the longest …
seedds Nov 9, 2026
4850da5
OoT-iPhone B-2: the 60 Hz link that shows a 30 fps cap's late frames …
seedds Nov 9, 2026
3a625e5
OoT-iPhone B-1: why a 30 fps cap's late frames left a 66.7 ms gap abo…
seedds Nov 9, 2026
47412a7
OoT-iPhone B-3: the game-time line counts the switches to the next vs…
seedds Nov 9, 2026
2fa00c2
OoT-iPhone A (merge): the 20 graphics tests that build nvn_mtl.m and …
seedds Nov 10, 2026
1d91b35
OoT-iPhone B-1: the iPhone's numbers with late frames at the next vsy…
seedds Nov 10, 2026
d17df17
OoT-iPhone A-2 docs: the iPhone 17 frame's profile, the fix's A/B, an…
seedds Nov 10, 2026
f0e390e
DM_NVN_GPUPROF_GEOM=1 stamps each render pass where its vertex and me…
seedds Nov 8, 2026
0ca0186
OoT-iPhone A-1: DM_NVN_GPUPROF logs the host's CPU timeline beside a …
seedds Nov 9, 2026
e66db18
OoT-iPhone A-1 docs: the game note's iPhone 17 table names DM_NVN_GPU…
seedds Nov 10, 2026
3a181b6
test_env_switches passes again: DM_NVN_SUB_DRAIN has its row, and thr…
seedds Nov 10, 2026
1eac389
OoT-iPhone: test_oot_aspect's camera and shape helpers take a float c…
seedds Nov 10, 2026
8a8fb0b
OoT-iPhone: the Python lint baseline drops test_gpuprof.py's unused o…
seedds Nov 10, 2026
ed769e9
OoT-iPhone B-4: Ocarina of Time's smoke route, so regress.py check bo…
seedds Nov 10, 2026
4283410
Ocarina of Time's output-size stub keeps the size it hands the setter…
seedds Nov 10, 2026
e26ff09
iPhone memory 1: large sampled textures leave out their largest level…
seedds Nov 10, 2026
d78ddfa
iPhone memory 1b: the image flag no longer keeps a large sampled text…
seedds Nov 10, 2026
f9f1aa9
Docs for smaller textures on small devices: a memory.md entry with th…
seedds Nov 10, 2026
c5a352e
MetalFX draws Ocarina of Time's upscaler: the shader map's agl_ndsr_v…
seedds Nov 10, 2026
9612bc4
Upload staging is released after each batch where Metal's working set…
seedds Nov 10, 2026
42279e5
DM_SCREEN_PIXELS holds a picture in another shape than 16:9 to a shar…
seedds Nov 10, 2026
5af0e6e
Ocarina of Time's note: the iPhone 17 played through the Great Deku T…
seedds Nov 10, 2026
dbe335e
iPhone memory 2a: a probe of what a shader gets through a pointer to …
seedds Nov 10, 2026
845fdb3
iPhone memory 2b: a read through a pointer to a buffer outside the re…
seedds Nov 10, 2026
5e5be14
iPhone memory: the census counts a heap once and says who holds the t…
seedds Nov 11, 2026
098362b
iPhone memory: memory pressure trims what no frame needs, and the mem…
seedds Nov 11, 2026
bbed3b3
iPhone memory: an upload batch's reads over guest memory have a budge…
seedds Nov 11, 2026
d07be66
iPhone memory docs: the system's memory and the pressure trim, the up…
seedds Nov 11, 2026
e3193df
iPhone memory docs: the iPhone 17 run with the trim lived through Hyr…
seedds Nov 11, 2026
23d12a5
iPhone memory docs: back on the field after the castle town the iPhon…
seedds Nov 11, 2026
93ff62f
iPhone memory docs: the iPhone 17 run with the trim ended for proc-th…
seedds Nov 11, 2026
cb57493
iPhone memory 2: the residency set is described at each memory pressu…
seedds Nov 11, 2026
29b351d
iPhone memory 2: the census says who holds every texture in the resid…
seedds Nov 11, 2026
28083ec
iPhone memory 2 docs: what the residency set holds across loads on th…
seedds Nov 11, 2026
0832d01
iPhone memory 2 docs: the iPhone 17 run with the measuring build live…
seedds Nov 11, 2026
1df6607
iPhone memory 3: a packaged texture's spare that no re-upload took wi…
seedds Nov 11, 2026
c680394
iPhone memory 3: no rule says beforehand which pools a raw-memory sha…
seedds Nov 11, 2026
d634521
iPhone memory 3: at memory pressure, the Metal copies of uploaded tex…
seedds Nov 11, 2026
7374881
iPhone memory 3 docs: the re-uploads' spares, the uploaded textures f…
seedds Nov 11, 2026
c7ebf30
iPhone memory 3 docs: the iPhone 17 lived through 120 loads with trim…
seedds Nov 12, 2026
408e1b4
iPhone memory: DM_NVN_MEM_PRESSURE and DM_NVN_UPLOAD_SRC_MB have thei…
seedds Nov 12, 2026
36e013e
Ocarina of Time: pso_mtl4 on, so the iPhone and the iPad take render …
seedds Nov 12, 2026
b8cb0bd
nvn: give the whole-again texture warning its own RED_ONCE key
seedds Nov 12, 2026
4fc17cb
OoT-night N-1: submissions that end while the GPU still runs an earli…
seedds Nov 14, 2026
52d5c6a
OoT-night N-1: held submissions keep their own command buffers, so an…
seedds Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Docs: Ocarina of Time plays on an iPhone 17 (27-30 fps in Kokiri Fore…
…st), and a reference entry for the shader-code pools the raw pool table wired
  • Loading branch information
seedds committed Nov 12, 2026
commit d845268c35f8a4cf007fe05ff09eed49fd15092a
6 changes: 4 additions & 2 deletions dm/games/0400486024DEC000/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ Measured on an M6 Mac with 16 GB, headless, on one walk with camera turns (`walk
Current (2026-11-09): plays on an M1 iPad Pro (11-inch, 3rd generation, `iPad13,4`, 8 GB, iPadOS 27.0.1), docked, at 20 fps where its views are light. Built from upstream `main` 7ffa63cc with this branch, chain `dedc9391c30b`, the device's `env.txt` holding only `DM_LAUNCHER=0`, `DM_NVN_GPUPROF=every:600` and `DM_GUEST_FILE_MIN_FREE=2G` (none needed for play). Two 32-minute scripted runs from a save at the Great Deku Tree's entrance (camera turns and short steps, "Try Again" after a death).
- **Memory.** iOS gives the app 7.97 GB of room against the game's 9.00 GB pool, so the guest goes into files by itself ([the guest in files](../../../docs/reference/memory.md#ios-ends-the-app-once-the-guests-touched-pages-reach-its-memory-limit)): footprint 2.2-2.3 GB, headroom to the memory limit 5.87 GB at its lowest, 4.4 GB of guest pages on disk. Metal's working set is 5,461 MB: [textures in GPU-only memory share bytes](../../../docs/reference/memory.md#textures-in-gpu-only-memory-took-an-allocation-per-description) there by themselves, and the residency set holds 3.2 GB. With each render target in a recycled heap of its own, the set reached 5,184 MB at an outdoor save load and every command buffer failed out of memory.
- **Frame rate and GPU time.** At the Deku Tree's entrance: 20.0 fps in every 300-frame window of both runs (frame p50 50.0 ms, the frame step's 3-vsync hold; worst p95 51.0 and 66.6 ms), GPU 34-35 ms a frame (29 ms of work over 127 encoders, 205 MB of attachments loaded and 215 MB stored), game speed 0.97-1.00 after the load. Views deeper in that take 54-67 ms of GPU fall to 11-12 fps, and the game runs slow (game speed 0.53-0.61), as no hold is longer than 3 vsyncs. The title scene takes 61 ms of GPU, the game over screen 66-74 ms. Kokiri Forest by the owner's eye: 20 fps in handheld mode, 15 docked.
- **iPhone** (current, 2026-11-09): plays on an iPhone 17 (`iPhone18,3`, 8 GB, A19, iOS 26.6.1) from the owner's save in Kokiri Forest, with the launcher's 30 fps cap and Dynamic resolution on. Built from upstream `main` 04811a63 with this branch and, for testing, PRs #1842, #1901, #1942 and #1751, chain `39eb2f781d07`. iOS gives the app 5.96 GB of room (the iPad 7.97), Metal's working set is 5,461 MB. Before [the pool table left shader-code pools out](../../../docs/reference/memory.md#shader-code-pools-wired-by-the-raw-pool-table) it stuttered too much to play: the guest's file pages were read back all the time, 14-17 fps. Now 27 fps standing, 27-30 walking, frame p50 36.5 / p95 40 ms, GPU p50 32 ms, the guest file's page-ins at 100-400 every 10 s. Frames just over the cap's 33.3 ms are late: about 30 of 300 are dropped, a light stutter walking. The title, with its movie on its own clock, holds 30 fps. An earlier build without these fixes ended in a kernel panic after the save loaded (`wait for termination failed … AppleCentauriManager`).
- **Not this:** no thread of the game makes a [clock wait](../../../docs/reference/threads.md#clock-waits-sleep-to-their-predicted-end) (no `clock waits up to frame` line in either run), so that rule's predicted sleep plays no part in its speed.
- Open: the GPU time of the heavy views (the frame leaves the GPU idle a quarter of the time, and its 110 render passes reload their attachments). A GPU hang after 18.5 minutes of play on an earlier build (`kIOGPUCommandBufferCallbackErrorHang`, then GPU access revoked): both hung command buffers held the Hi-Z task `a5288d0a6c4971fd` and its mesh `3439aaa071d868ae`, the draws of the M1 Mac's hangs in [PR #1842](https://github.com/seedds/nxnative/pull/1842). One kernel data abort on the iPad (2026-11-09 03:57) in kernel code that handles GPU-wired memory, cause unknown. Building for iOS on 7ffa63cc needs [PR #1906](https://github.com/seedds/nxnative/pull/1906) (`IOBluetooth` is linked otherwise).
- Open: the GPU time of the heavy views (the frame leaves the GPU idle a quarter of the time, and its 110 render passes reload their attachments). A GPU hang after 18.5 minutes of play on an earlier build (`kIOGPUCommandBufferCallbackErrorHang`, then GPU access revoked): both hung command buffers held the Hi-Z task `a5288d0a6c4971fd` and its mesh `3439aaa071d868ae`, the draws of the M1 Mac's hangs in [PR #1842](https://github.com/seedds/nxnative/pull/1842). One kernel data abort on the iPad (2026-11-09 03:57) in kernel code that handles GPU-wired memory, cause unknown. Building for iOS on 7ffa63cc needed [PR #1906](https://github.com/seedds/nxnative/pull/1906) (`IOBluetooth` was linked otherwise); main has it since 9983d659.

## Screen shape

Expand Down Expand Up @@ -140,7 +141,7 @@ From an empty save: at about 45 s `A` (title), `A` (New Game), then the movie. F
- The "Navi" name label in the Great Deku Tree scene was missing on an earlier chain and has not been checked since. Not played yet: the Deku Tree dungeon, combat, later areas. Sound opens with no red line; movies and speech were not listened to. Physics issues reported in PR 1299 were not seen on this route (walking, the ladder, the camera).
- Resolved: dotted horizontal rows across the picture in play, in fog and light (GitHub issue 1537): the agl_ndsr_vr networks' HMMA calls outside a chain overwrote an accumulator a chain held ([An HMMA outside a chain overwrote the chain's accumulator](../../../docs/reference/shaders.md#an-hmma-outside-a-chain-overwrote-the-chains-accumulator)), since chain 23a1ea1db092; found by bisecting chains on the Kokiri Forest autosave (0f510fd5's chain clean, bd9f422d's not). Under the game's upscaler they had also grown into white blotches: [LDSM reads rows other lanes stored](../../../docs/reference/shaders.md#ldsm-reads-rows-other-lanes-stored).
- Open: GPU hangs in play ([#1326](https://github.com/seedds/nxnative/issues/1326), [#1605](https://github.com/seedds/nxnative/issues/1605)), repeatable in a Kokiri Forest conversation and the Impa escort on an M2 Pro and gone with the pipelines of task `a5288d0a6c4971fd` dropped ([#2011](https://github.com/seedds/nxnative/issues/2011)). They are not [threads returning before a barrier](../../../docs/reference/shaders.md#compute-threads-that-return-before-a-barrier): that task, the culling tasks `47f9b38490dcf9a2` and `99280b7b8aae78df` and mesh `3439aaa071d868ae` have no barrier in their bodies (none of the game's 520 task and mesh shaders has one). The lead in #2011 is pixel shader `bd09ab5fc4fd7680`'s light loop, which runs `min(count, 1000) + 1` times per pixel with per-tile counts the GPU reads.
- Not run on an iPhone yet; the M1 iPad: [For an iPhone or iPad build](#for-an-iphone-or-ipad-build).
- On an iPhone 17 and an M1 iPad: [For an iPhone or iPad build](#for-an-iphone-or-ipad-build). Open on the iPhone: frames a little over the 30 fps cap's 33.3 ms (GPU p50 32 ms in Kokiri Forest) make a light stutter.

## Unused border corrections

Expand Down Expand Up @@ -239,6 +240,7 @@ Its 37 kernels that correct samples, NDSR's network among them, gave about 0.25
- [Shaders report which textures they read through a pool](../../../docs/reference/memory.md#shaders-report-which-textures-they-read-through-a-pool)
- [Repeated GPU out-of-memory failures end the game](../../../docs/reference/memory.md#repeated-gpu-out-of-memory-failures-end-the-game)
- [Pools that hold shader code made resident to key the shaders](../../../docs/reference/memory.md#pools-that-hold-shader-code-made-resident-to-key-the-shaders): first reported here (222 pools, 334 MB on a build with other changes); on main the raw pool table makes those pools resident anyway (4,276 resident pools before the fix, 4,277 after, on the village walk).
- [Shader-code pools wired by the raw pool table](../../../docs/reference/memory.md#shader-code-pools-wired-by-the-raw-pool-table): the iPhone 17 read its guest file back all the time in Kokiri Forest (14-17 fps); with the 223 shader-code pools (317 MB) out of the table, 27-30 fps.
- [Guest files keep the blocks of memory the game gave back](../../../docs/reference/memory.md#guest-files-keep-the-blocks-of-memory-the-game-gave-back): the iPad stopped at 5.0 GB free with 6.6 GB of guest files.
- [A GPU whose access macOS revoked stops the game](../../../docs/reference/rendering.md#a-gpu-whose-access-macos-revoked-stops-the-game): after a GPU hang or page faults (issue #1326), nothing was drawn for about 70 s before the game aborted, and in full screen WindowServer's watchdog killed it.
- [A texture ID with no texture kept its cached view](../../../docs/reference/rendering.md#a-texture-id-with-no-texture-kept-its-cached-view): the page faults at f3,677 and f4,851 with the render-target reclaim on.
Expand Down
1 change: 1 addition & 0 deletions docs/agents/symptoms.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ One line per symptom in the [subsystem references](../reference/): what you see
- a Switch 2 game goes past Metal's recommended working set while its first 3D scene loads: `Insufficient Memory` command buffer errors, then a hung Mac. Ocarina of Time on a 16 GB Mac: 12 GB and more wired, once a kernel panic in `IOGPUGroupMemory.cpp` at 14.7 GB wired. → [Memory pools nothing gave an address to stay out of the raw pool table](../reference/memory.md#memory-pools-nothing-gave-an-address-to-stay-out-of-the-raw-pool-table)
- a game whose shaders read texture handles from memory wires far past the working set while a scene loads, with `Insufficient Memory` errors or a panic, and stutters when new textures stream in. With a limit on how many it makes, surfaces in shadow go near black instead. → [Shaders report which textures they read through a pool](../reference/memory.md#shaders-report-which-textures-they-read-through-a-pool)
- memory pools that hold only shader code are in the residency set, though no shader reads them. In The Great Ace Attorney Chronicles, three shared buffers, about 5 MB: chunks of its 1,000 MB pool (`DM_CTL` `restop`: shared buffers 241 MB at 30 s, 236 MB with the fix). → [Pools that hold shader code made resident to key the shaders](../reference/memory.md#pools-that-hold-shader-code-made-resident-to-key-the-shaders)
- on an 8 GB iPhone a game stutters badly in play although its GPU time fits: the `[mem]` lines show the process reading its guest file back all the time (Ocarina of Time in Kokiri Forest on an iPhone 17: 6,000-15,600 page-ins and 0.2-0.4 GB every 10 s, 13.6 GB read in all), whole frames of 117 ms on average with a GPU time of 27 ms, 14-17 fps, and 122 of 300 frames dropped. The app's own footprint stays far under its limit (headroom 2.9 GB): the device as a whole is short of memory. → [Shader-code pools wired by the raw pool table](../reference/memory.md#shader-code-pools-wired-by-the-raw-pool-table)
- on a small device the residency set grows past Metal's working set and every command buffer fails with `kIOGPUCommandBufferCallbackErrorOutOfMemory`, then `FATAL the GPU is out of memory`. On the M1 iPad (8 GB, working set 5,461 MB) Ocarina of Time died going outside from Link's house, the set at 5,147 MB, 2,780 MB of it textures; with the render targets' recycled heaps (rendering.md) it died at the outdoor save load, the set at 5,184 MB (544 heaps of 1,384 MB over 1,455 MB of textures). `res_top`'s line `GPU-made textures in the set by the pool that holds their storage` shows Metal bytes far above the `union` of their NVN storage. → [Textures in GPU-only memory took an allocation per description](../reference/memory.md#textures-in-gpu-only-memory-took-an-allocation-per-description)
- the Mac grows unresponsive for hours, then panics, with the host still submitting work that fails. → [Repeated GPU out-of-memory failures end the game](../reference/memory.md#repeated-gpu-out-of-memory-failures-end-the-game)
- a scene load logs `upload command buffer execution error: … Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)` right after a `large texture … format 0x32 … 296 MB` line, then `upload command buffer dropped`, then the game's own command buffers fail one after another, up to the 32-failures stop (Repeated GPU out-of-memory failures end the game), with most of the GPU's working set free. → [A clear pass on a large depth texture fails with `Insufficient Memory`](../reference/memory.md#a-clear-pass-on-a-large-depth-texture-fails-with-insufficient-memory)
Expand Down
10 changes: 9 additions & 1 deletion docs/reference/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,17 @@ The guest address space, heaps, pools, virtual address memory and the allocators
- **Symptom:** memory pools that hold only shader code are in the residency set, though no shader reads them. In The Great Ace Attorney Chronicles, three shared buffers, about 5 MB: chunks of its 1,000 MB pool (`DM_CTL` `restop`: shared buffers 241 MB at 30 s, 236 MB with the fix).
- **Cause:** `keys_hash` (`hle_nvn.c`) checks that a shader's code lies in a pool before it hashes it, and it asked `mtl_addr`, which also makes the pool resident (and, in a pool in chunks, makes the chunk that holds the code). The GPU never reads that code: the shaders run translated, and a shader's c1 constants are copied into the host's own buffers.
- **Fix:** general: `keys_hash` asks `mtl_addr_known` (`nvn_mtl.m`), the pool lookup with no side effect that texture uploads already used: it makes no pool resident, and in a pool in chunks it makes no chunk (it answers from the pool's range). A pool the GPU does read through a binding or an address is made resident there, as before. Keys are unchanged. `t_addr_known` checks it.
- **Where it does not help:** a game whose shaders read raw global memory has every pool it took an address in made resident by the raw pool table (`gmem_map`), shader code pools included. Ocarina of Time is one: on the village walk it kept 4,276 pools resident before the fix and 4,277 after, 2,324 on both at the title. The 222 pools and 334 MB first reported there came from a build with other changes.
- **Where it does not help:** a game whose shaders read raw global memory has every pool it took an address in made resident by the raw pool table (`gmem_map`), shader code pools included, until [the pool table left shader-code pools out](#shader-code-pools-wired-by-the-raw-pool-table). Ocarina of Time is one: on the village walk it kept 4,276 pools resident before the fix and 4,277 after, 2,324 on both at the title. The 222 pools and 334 MB first reported there came from a build with other changes.
- **Found on:** [The Legend of Zelda: Ocarina of Time](../../dm/games/0400486024DEC000/README.md) (reported), [The Great Ace Attorney Chronicles](../../dm/games/010036E00FB20000/README.md) (measured).


### Shader-code pools wired by the raw pool table

- **Symptom:** on an 8 GB iPhone a game stutters badly in play although its GPU time fits: the `[mem]` lines show the process reading its guest file back all the time (Ocarina of Time in Kokiri Forest on an iPhone 17: 6,000-15,600 page-ins and 0.2-0.4 GB every 10 s, 13.6 GB read in all), whole frames of 117 ms on average with a GPU time of 27 ms, 14-17 fps, and 122 of 300 frames dropped. The app's own footprint stays far under its limit (headroom 2.9 GB): the device as a whole is short of memory.
- **Cause:** the raw pool table (`gmem_map`) lists every pool something gave a GPU address in and makes each resident, which wires its pages. A game asks for each shader-code pool's address (`nvnMemoryPoolGetBufferAddress`) to place its programs, so all of them were wired, though the GPU never reads shader code here: the shaders run translated and their constants are copied into the host's buffers. On Ocarina of Time `res_top` counted 223 pools of flags 0x64 (`SHADER_CODE`, CPU and GPU cached), 317 MB, in the table only. On an 8 GB device those wired pages left too little room for the guest's own file pages, which the system evicted and the game read back.
- **Fix:** general (`hle_nvn.c` `nvnMemoryPoolGetBufferAddress`, `nvn_mtl.m` `mtl_pool_addressed_by`): a shader-code pool's own address (flag 0x40, not virtual) is reported as kind 4, which the table leaves out; the memory report counts those ranges (`shader-code ranges kept out of the table`). A buffer made in such a pool still puts the pool in (`nvnBufferInitialize`), so data the game keeps there stays reachable. `t_addr_known` checks it.
- **Result on Ocarina of Time,** iPhone 17, Kokiri Forest, the owner's play: page-ins 100-400 every 10 s (from 6,000-15,600), the guest file's dirty pages in memory 1.70 GB (from 2.02), resident pools 4,041 (from 4,261), 27 fps standing and 27-30 walking (from 14-17), frame p50 36.5 ms, GPU p50 32 ms, about 30 of 300 frames dropped under the launcher's 30 fps cap.
- **Found on:** [The Legend of Zelda: Ocarina of Time](../../dm/games/0400486024DEC000/README.md#for-an-iphone-or-ipad-build).
### Textures in GPU-only memory took an allocation per description

- **Symptom:** on a small device the residency set grows past Metal's working set and every command buffer fails with `kIOGPUCommandBufferCallbackErrorOutOfMemory`, then `FATAL the GPU is out of memory`. On the M1 iPad (8 GB, working set 5,461 MB) Ocarina of Time died going outside from Link's house, the set at 5,147 MB, 2,780 MB of it textures; with the render targets' recycled heaps ([rendering.md](rendering.md#render-targets-that-move-with-the-dynamic-resolution-get-new-metal-memory-each-time)) it died at the outdoor save load, the set at 5,184 MB (544 heaps of 1,384 MB over 1,455 MB of textures). `res_top`'s line `GPU-made textures in the set by the pool that holds their storage` shows Metal bytes far above the `union` of their NVN storage.
Expand Down