Ocarina of Time's shaders all build: ATOMG.CAS translates, Metal takes 259 nested brackets, and the BAHS split no longer reads a control section's words as a program entry; a decoder's busy answer is no red line (chain 844bf1a5ea8f, PRs #1414, #1357)

The build left 9 of 42,854 shaders out. Six foliage compute shaders used ATOMG.CAS (0x3a9), which the translator refused (PR #1414: AAtomgCas; also ATOMG / RED INC and DEC as a compare-and-swap loop, and desc[URb][Ra.64], where URb is a memory descriptor and not part of the address; no Ocarina instruction uses that form or INC / DEC). Two agl_technique_pfx compute shaders nest 259 brackets past Metal's 256 (PR #1357: -fbracket-depth=1024 in every library compile, which changes no output within the old limit).

The ninth, 68bbe98b3bfd9876 ("Ampere instruction 481 at 0x0"), was no shader. bahs_shaders scans the table area 4 bytes at a time, and an NVN2 control section's +0x38..+0x47 (instruction length, c1 start and end, code length: L, 0, L, L) reads as an entry whose control is the next program's and whose code is whatever lies at L: here a compute control with a vertex shader's code, whose SPH reached the translator as an instruction. An entry that lies inside a control section another entry names, measured by that section's own length, is dropped. Ocarina's map loses six such rows (agl and terrain files), none ever loaded, and tera_common gives 175 variation pairs once its lowest false entry no longer hides its binary array. Splatoon Raiders' map has the same three agl keys; it, Mario Kart World and Donkey Kong Bananza need their tables split again, which their notes say.

nn::codec's refusal of a packet with 12 pictures waiting returns 3603, which NintendoSDK_movie expects: detail::SubmitDecoderInputBuffer turns exactly that result into its retry code 0x7a and VideoDecoder::DecodeAsync hands it to the player (Ocarina's subsdk0 +0x10fd20, +0x103840). It is logged plainly now (Ocarina AV1, Kirby Air Riders VP9).

Checked: the 9 shaders rebuilt on chain 28ecc05ed4ac, before the rebase onto 9c2fb0c9 (8 ok, the ninth gone from the map); test_dmsh_ampere_alu.py, test_shader_pch.py, test_nsp_chain.py, the new test_split_bahs_entries.py (the false entry is taken on the previous splitter), test_docs.py; the re-split's tables against the profile's (only the six rows and the renumbering differ); the Mac host builds. Not run: the full shader build on this chain (stopped at 12,534 of 42,848), a game run, regress.py.

Co-authored-by: Copak731 <[email protected]>
Co-authored-by: Pedro Nascimento <[email protected]>
This commit is contained in:
committed 2026-11-06 23:52:15 +08:00
1 parent cac783a10c
commit 04df08d429
26 files changed
+5466 -5100

No files matched your search

+1
View File
@@ -40,6 +40,7 @@ The work folder's `run/drive.sh <name> <secs> "<sec> <control line>"…` boots i
- An IPA: the 16 GB alias region is over iOS's limit until the SDK 21 cuts are ported.
- A crash dump once hung in `flockfile` under `shader_load`, with the log contended.
- `dm/games/profile_guess.py` does not recognise `Generic_21_4_4`. `pl::IsRunningOnOunce` answers false.
- The shader tables need splitting again: `shader_map.tsv` holds rows that are no shaders ([A control section's words read as a BAHS entry](../../../docs/reference/shaders.md#a-control-sections-words-read-as-a-bahs-entry); at least the agl keys `68bbe98b3bfd9876`, `18be578dfdaaffa0`, `7a4936fccf82094e`, as in Ocarina of Time), and the NSP script stops at the table check until the split's tables replace them.
## Found on this game
+3 -2
View File
@@ -64,19 +64,20 @@ From an empty save: at about 45 s `A` (title), `A` (New Game), then the movie. F
## Open
- Open: 2 of about 42,850 shaders do not compile (`1f78730053feb036`, `e172bd7ec218ab8e`: `bracket nesting level exceeded maximum of 256`). Neither has shown up in a run so far.
- Resolved: the build left 9 shaders out. Six foliage compute shaders used `ATOMG.CAS` ([Global memory: descriptors, ATOMG.CAS, INC / DEC](../../../docs/reference/shaders.md#global-memory-descriptors-atomgcas-inc--dec)); `1f78730053feb036` and `e172bd7ec218ab8e` nest 259 brackets ([Bracket nesting past the front end's 256](../../../docs/reference/shaders.md#bracket-nesting-past-the-front-ends-256)); `68bbe98b3bfd9876` (`Ampere instruction 481 at 0x0`) and five more map rows were no shaders at all ([A control section's words read as a BAHS entry](../../../docs/reference/shaders.md#a-control-sections-words-read-as-a-bahs-entry)), now gone from the map. None of the eight real ones was used on the walk to Kokiri Forest.
- Open: [the movie network](https://github.com/seedds/nxnative/issues/1375) took 35 ms a frame on an M1 Max, so movies and the title ran at about 28 fps there; on this M6 it takes 11.4 ms since [HMMA chains keep their matrices in the SIMD-group](../../../docs/reference/shaders.md#hmma-chains-keep-their-matrices-in-the-simd-group) (from 14.8), not measured on an M1 Max since.
- Current: against a frame of console video of Navi's close-up the picture matches: hair and sign within 1–2 % in red and green. The causes, each general: [float atomics](../../../docs/reference/shaders.md#float-atomics-in-storage-memory) (too bright, yellow skin, a pale veil: the exposure read back from buffers that stayed 0), the terrain's CPU-written maps (holes, wrong materials; the profile keys above), [the gather offsets](../../../docs/reference/shaders.md#texturegatheroffsets-and-a-loop-over-its-offsets) (the dotted rows in blurred areas, born in the NDSR upscaler, three pictures from one input), and [image atomics on RGBA8](../../../docs/reference/shaders.md#image-atomics-on-a-32-bit-colour-texture) (the anti-aliasing's blend weights).
- Current: the grass no longer flickers. Its blades shifted at 10 Hz because the wind's pressure solve read one neighbour at an undefined row ([dead-code removal](../../../docs/reference/shaders.md#dead-code-removal-dropped-a-coordinate-of-a-multi-output-instruction)), so the velocity field (512x512 RGBA16F, a two-buffer ring) held strong stripes up to ±11 with a 6-frame cycle. In the moss on the bridge, the mean difference between adjacent frames fell from 5.97 to 0.70 of 255, and it now grows smoothly with the lag.
- Open, small differences from that same console frame: Navi's core has a harder edge and a narrower glow here (the bloom texture peaks at 0.44; the ball's HDR is about 0.9 with a tiny spot at 45); shadows are less blue, and the far grass about 1.4 times brighter. One frame of compressed video is weak evidence for either. The falling leaves look dark near the camera, not compared.
- A red `texture type mismatch` on `9b310b3349825e9a` (a UI merge shader): a 3D texture left bound in a slot its active branch does not sample. Harmless so far.
- `nn::codec AV1: a packet refused with 12 pictures waiting` (4 lines a run): the decoder's queue is full and the game retries; movies play.
- `nn::codec AV1: busy (result 3603), a packet refused with 12 pictures waiting` (4 lines a run): the decoder's queue is full and the movie library retries, as it is written to ([a refusal is no fault](../../../docs/reference/movies.md#the-submission-ready-event-counted-as-packets)); movies play. It was a red line until then.
- The `pipeline archive` red line is [issue 342](https://github.com/seedds/nxnative/issues/342), a limit of this system build. `c1_full.tsv is stale` holds on partial libraries, which no full build has stamped.
- 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).
- No iOS shader build or iPhone run has been done. Its memory use makes an iPhone unlikely as it stands.
## Found on this game
- [A control section's words read as a BAHS entry](../../../docs/reference/shaders.md#a-control-sections-words-read-as-a-bahs-entry): six map rows that were no shaders, one of them failing the build; `tera_common` gave its variation pairs once its row was gone.
- [Freeing a memory pool during a texture ID walk](../../../docs/reference/nvn-objects.md#freeing-a-memory-pool-during-a-texture-id-walk): the `-[NvPkg buffer]: unrecognized selector` crash after a save or a scene change.
- [HMMA chains keep their matrices in the SIMD-group](../../../docs/reference/shaders.md#hmma-chains-keep-their-matrices-in-the-simd-group): the NDVE movie networks behind the title and the opening, 14.8 → 11.4 ms of compute a frame on this M6.
- [Raw global memory lookups that start from their last entry](../../../docs/reference/shaders.md#raw-global-memory-lookups-that-start-from-their-last-entry): the foliage, vertex and compute shaders read structures word by word through loaded addresses; about 2 ms less GPU a frame at the spawn point.
+175
View File
@@ -27,12 +27,33 @@
0690296a9e3a3ebb e07824df9200cc7f
0690296a9e3a3ebb f2f26e842597a0cd
06a62ea4ee7a7fd9 354412af7df329bc
06f14fa278dddec5 00cbadd92d5092f3
06f14fa278dddec5 1776fc9ba2ca94a2
06f14fa278dddec5 1ce2748f74745dc8
06f14fa278dddec5 52367de8bc4f8b38
06f14fa278dddec5 6a40677e7f6927dd
06f14fa278dddec5 70cb8ef3e097d06a
06f14fa278dddec5 72872657b5dcca40
06f14fa278dddec5 770a69b842e799df
06f14fa278dddec5 8304ca844bb70e52
06f14fa278dddec5 9448974662fb99b5
06f14fa278dddec5 a1d4539ac0cd7a69
06f14fa278dddec5 c9be4dd66b82d5a8
06f14fa278dddec5 d060bb5948fa68eb
06f14fa278dddec5 d7adedec4d03dd2f
06f14fa278dddec5 df92ad25f09ba013
06f14fa278dddec5 e2197503170b335f
07a79fb91543fe2c d25a960d01da950d
07d696dc3187478f 28939e5d2729be26
085be08bf6e4db6a 8c4fef209c01edd6
085be08bf6e4db6a cfca9df95298ed81
085be08bf6e4db6a f720193297564ec0
08c5032e40b9f5c4 571a61d6548b1a52
0b448d2d9a157734 b283f4771482d29f
0c24daa9be2d4bb2 2480f76bccaf8b7a
0c24daa9be2d4bb2 39ceff2c8b2756d3
0c24daa9be2d4bb2 4ad910dcbc2de272
0c24daa9be2d4bb2 747ca0fe3dfa438a
0cc45bf016741cec b4d0e19166420a2c
0da07d9ba1c3fce1 1b249ddfcb84b078
0da07d9ba1c3fce1 8c703377d1e5c43c
@@ -44,6 +65,7 @@
0df57171fd34bf84 b3254ec57e90472c
0df57171fd34bf84 c4dffe0b5c8a890b
0ed48a9e7ae9c3c6 cd8a02f4b9031b77
0f35a198956f1097 9534af2c7570c789
0f8b802ab11124fc 213d9ec9b7bc1740
0f8b802ab11124fc 5ea8a13de412ea08
0f8b802ab11124fc 61cd2238926915dd
@@ -145,6 +167,23 @@
1f459749d9a5b314 d5a6af7f747561ba
1f5d0afebca92847 bf4071bb9836bde4
1f9ab3217c1cb7ff 76113007713a0a52
2231ba2bb8835775 292af60c488cf5aa
2231ba2bb8835775 3af239444bb18ed4
2231ba2bb8835775 3e897bf71e109a9c
2231ba2bb8835775 40d6e004f06f1de7
2231ba2bb8835775 63b221674e985506
2231ba2bb8835775 9653f47175722c47
2231ba2bb8835775 b60e3cab617387d6
2231ba2bb8835775 b7dde0f3a9f14d3c
2231ba2bb8835775 bab89bbbcfd7b155
2231ba2bb8835775 bdc417d926307031
2231ba2bb8835775 d8719cf15fc49bb3
2231ba2bb8835775 d9b79806e3c4f827
2231ba2bb8835775 de17397c13e3ac2d
2231ba2bb8835775 ec0acbdc47477fd2
2231ba2bb8835775 ef89e305adc0b38a
2231ba2bb8835775 f30638dc111a9bfc
2231ba2bb8835775 f9e89e67385f2d7d
2248aa4ff3f9e86c 29d816c85584542b
2248aa4ff3f9e86c 598f2a99ebc9b28d
2248aa4ff3f9e86c 8cde7e69a26e9a73
@@ -179,11 +218,16 @@
25d75991cda1cc1d 3ca38aa439605f2c
28d2fa887f9959f9 3577f90d861586c0
299472cf4cbf3438 53e669dbf5c68d55
2ac82190b3ec7944 b2f754a29f9a3cac
2b13c3c9773cf124 e55f45d0df50c572
2b6e071b929cac8e cd8a02f4b9031b77
2ba057f0c91ba3ad 348d7aee5377aa12
2ba057f0c91ba3ad 7db622769e1ee569
2ba057f0c91ba3ad f3caaa0cc7fd4d72
2badc54fd01a4e12 12fcbf45460925da
2badc54fd01a4e12 4994ac83a5b816b8
2badc54fd01a4e12 51a49e0d3230d3e6
2badc54fd01a4e12 fd95733d52dafcb6
2c20087b3ffa9579 3ab2556c9c2aa5b2
2c20087b3ffa9579 883dd1ae7559b875
2c20087b3ffa9579 c5096a501ceb0e84
@@ -248,6 +292,10 @@
3021081d923b9d42 e55f45d0df50c572
305c3c96ba7ee850 d4163dff471ef778
30a3e02400170d06 7555831c9b330e97
30e099fdce5a8ba8 12fcbf45460925da
30e099fdce5a8ba8 4994ac83a5b816b8
30e099fdce5a8ba8 51a49e0d3230d3e6
30e099fdce5a8ba8 fd95733d52dafcb6
317bc52404bddb02 8b3c7c05b2a5cbb3
31e9ea1fc3d7f794 8c24a38c2362de17
3267b5d0dd9db8aa 027834332dc6ef28
@@ -425,7 +473,10 @@
3961ccb9114e86aa 354412af7df329bc
39cb80a6e6f77fb4 3496705ced7dc0d5
3afd46a218741216 caa14084fdbfde07
3b6f044bf79ec50b 8745ba207b03a77c
3be3604ea84c019e fba81b04cce463a3
3c0a117c26557573 34201bbb6006a3c5
3c0a117c26557573 cb9f90803de9b3f8
3c702670051d2a46 2ec452e02874114d
3c702670051d2a46 da5dd7ea6c4ff9c0
3cc55c54c5c53fb2 0738e88c1f5b3aa4
@@ -865,6 +916,7 @@
40ad099d2943ed76 eef5fddfa1219c26
40f414a41ea5eb4d e61ea7ff49c4dc7c
415b77882064e123 e29f165ea0b184fc
4173d51c5110c011 a2a4bfba83cdc573
41c314c7820189e2 354412af7df329bc
4253f72fdc2fc793 50811f68f359fb08
42f30c87a9c409c3 1af7f3e44de3fd18
@@ -904,6 +956,7 @@
42f30c87a9c409c3 f20bcda4c725baa1
42f30c87a9c409c3 fe8e234464e9b98a
42ff4b8fb82cf3fe 48f53596533c8eef
4311a2c62dbc4e67 0dde66011176ee8e
43f87e27a030082c 1f1fe7d1b767858d
43f87e27a030082c 782c17780ddcc566
43f87e27a030082c b03d04851704680a
@@ -1248,7 +1301,29 @@
4fd1e8989166539a e8b74b927ca1a320
4ff75a0933c11f36 00ee3c7f4cb31f27
508dbc2b529ac565 2d89c0f60120b173
50f08f89a90b1eae 011f2c5ec27f2d36
50f08f89a90b1eae 1872e9f4f924a8bf
50f08f89a90b1eae 215cd89b6e94c96b
50f08f89a90b1eae 279d409fca4ace57
50f08f89a90b1eae 2e08e8221ca58332
50f08f89a90b1eae 357080f788e83cc7
50f08f89a90b1eae 3653bb740e152fdf
50f08f89a90b1eae 4c95bec2ac625d22
50f08f89a90b1eae 546564fdf65cf38b
50f08f89a90b1eae 5b726aaafde3e5bf
50f08f89a90b1eae 72672de4a31549bc
50f08f89a90b1eae 8763f0bac011b76c
50f08f89a90b1eae 87b52229fee7a03e
50f08f89a90b1eae 937c1196359cbdb6
50f08f89a90b1eae 959c6606790e3515
50f08f89a90b1eae 960ef7feab4ce962
50f08f89a90b1eae 98ca216e14214975
50f08f89a90b1eae 9f7f27ee28534e5e
50f08f89a90b1eae c652baae07d794b1
50f08f89a90b1eae e29722c896f8b13d
50f08f89a90b1eae f1ce7cae0477c4b7
50f08f89a90b1eae fda0339602abc456
50f08f89a90b1eae fdf13c36372dd0a2
51aa96d7aa0147c8 563823dbf11fc7c4
51aa96d7aa0147c8 a933eee562a127e8
51e9ae07b06973e5 0014991b2da24b0f
@@ -2107,6 +2182,7 @@
6d7b4321ff055c74 ff1d2fb9d402a42e
6d7b4321ff055c74 ff479d2601a978f7
6d8fff6cf00d4817 a38fabe6fb5675e0
6e20fa5f6651f477 9cc40961e48fe312
6e2af0a25cd28d92 db8d89eacb6c18d2
6e4127cb17c245ba 354412af7df329bc
6ead2e525d30106f 06a4e255d8b0cc17
@@ -2263,6 +2339,22 @@
7cee980dfe8cb8cc e36b37d2dfba58f5
7cf403de72dde88b b4bff004cdb40ab3
7cf403de72dde88b d73b644a35b99860
7d3907840c472032 0247cf8404f5a984
7d3907840c472032 07c2c5ef7ebc2f3d
7d3907840c472032 3610644947f59030
7d3907840c472032 382c2698b3f95e0d
7d3907840c472032 522e6f6e39e22345
7d3907840c472032 67715a0f8489ba88
7d3907840c472032 6d8a1fbfedc4ae44
7d3907840c472032 6efae6e4e7cc19e6
7d3907840c472032 895d4ba4b33736f1
7d3907840c472032 9404f9c106f497da
7d3907840c472032 b59b36639c86c2e5
7d3907840c472032 cb608824c0ba1458
7d3907840c472032 d64cd0b709cdc1fa
7d3907840c472032 d9b6732e78cadec6
7d3907840c472032 db9f9e18ef3df299
7d3907840c472032 faac71f4f700dc78
7d86d307cc933eda d0efefbaa9b1a9b2
7e188f24a18217d4 00d5b560c5c48992
7e188f24a18217d4 01957b1da718bd0f
@@ -2307,6 +2399,26 @@
8094453ec0a25b44 85600e7973aa9e98
8094453ec0a25b44 ad27fb935f023bfc
810c2a7ab732a54e d8752649da236f70
814a27157cfd3474 011f2c5ec27f2d36
814a27157cfd3474 1872e9f4f924a8bf
814a27157cfd3474 279d409fca4ace57
814a27157cfd3474 357080f788e83cc7
814a27157cfd3474 3653bb740e152fdf
814a27157cfd3474 4c95bec2ac625d22
814a27157cfd3474 546564fdf65cf38b
814a27157cfd3474 5b726aaafde3e5bf
814a27157cfd3474 72672de4a31549bc
814a27157cfd3474 8763f0bac011b76c
814a27157cfd3474 87b52229fee7a03e
814a27157cfd3474 937c1196359cbdb6
814a27157cfd3474 960ef7feab4ce962
814a27157cfd3474 98ca216e14214975
814a27157cfd3474 9f7f27ee28534e5e
814a27157cfd3474 c652baae07d794b1
814a27157cfd3474 e29722c896f8b13d
814a27157cfd3474 f1ce7cae0477c4b7
814a27157cfd3474 fda0339602abc456
814a27157cfd3474 fdf13c36372dd0a2
81928d498045746d 238013251aea30c1
81928d498045746d 60893ce7aaf0cc1a
81928d498045746d eba1d8b576ab1241
@@ -2327,6 +2439,8 @@
82df16cf9c96ce58 cc2a8689915b3bd2
82df16cf9c96ce58 d2323ecdb024cbac
830c346f974f0b10 431cf8cb0fbc4966
834d676579f09130 7149b321a6428384
834d676579f09130 d04cbbe78ed392d3
8393c125a88f150b 33a7886158ce4d2b
8393c125a88f150b 5067679f2bf2714b
8393c125a88f150b 82319c270e507ce2
@@ -3035,8 +3149,26 @@
876554e47e172ca7 4ab0214d291de0ca
876554e47e172ca7 8b602dcc740fdf19
876554e47e172ca7 8ecd212336da8792
879ebc18021cf477 0247cf8404f5a984
879ebc18021cf477 07c2c5ef7ebc2f3d
879ebc18021cf477 1b18f9f909714b5e
879ebc18021cf477 3610644947f59030
879ebc18021cf477 382c2698b3f95e0d
879ebc18021cf477 522e6f6e39e22345
879ebc18021cf477 67715a0f8489ba88
879ebc18021cf477 6d8a1fbfedc4ae44
879ebc18021cf477 6efae6e4e7cc19e6
879ebc18021cf477 895d4ba4b33736f1
879ebc18021cf477 9404f9c106f497da
879ebc18021cf477 b59b36639c86c2e5
879ebc18021cf477 cb608824c0ba1458
879ebc18021cf477 d64cd0b709cdc1fa
879ebc18021cf477 d9b6732e78cadec6
879ebc18021cf477 db9f9e18ef3df299
879ebc18021cf477 faac71f4f700dc78
87c1b0e55d39a8e5 504f2da7af27e2a0
896c6c3ce1f8f0df 5f06ec80e95d71e3
89dacb547a77a13b 016ea40826e62cab
8a4ffcbfd9c71555 2850d638b93a7223
8b045dc9eb39f9d4 89baa9e086771a9a
8b76621482b9caec 1eb883d8c25935df
@@ -3187,6 +3319,7 @@
9bb5b3ddaa93dd15 8afab3d92ede523c
9bb5b3ddaa93dd15 a613ca90858589be
9bb5b3ddaa93dd15 eff3284a5db8e424
9bcefe55ba25a843 0dde66011176ee8e
9c35e9852b4e0194 2d89c0f60120b173
9c368986a5629485 84d5edaa049d76ea
9c3d6bff45a7fd49 d4b72537cd7fc651
@@ -3244,6 +3377,7 @@
9d5236c57791dd66 ecc0f01b116d0972
9d5236c57791dd66 f38d101600f5a454
9da5bbb932817e55 b4d0e19166420a2c
9dbc56108a854a44 413ecaca87669e99
9e446afbd3d57084 025b1dead2c35c7c
9e446afbd3d57084 08474bfaf47b370d
9e72f3cf803123bc f605596a8bcc1376
@@ -4139,6 +4273,7 @@ b98d6862194eb2d0 b70aee34419b323f
b98d6862194eb2d0 e1edb4c7c47d83e2
b9a60e866058c078 85600e7973aa9e98
b9a60e866058c078 ad27fb935f023bfc
b9ac2efcc318dd3f b2f754a29f9a3cac
ba19ee7ac6498808 c754c2261cbda7ba
ba59fe02fd9d73ea 027834332dc6ef28
ba59fe02fd9d73ea 6f8d296f91a9b7f6
@@ -4196,6 +4331,7 @@ c50b700c29a7bac4 e5c03d58434c0c84
c50b700c29a7bac4 f5bac4b2e97312d7
c53e6a3fab9d4081 2c2002750d9a72a8
c53e6a3fab9d4081 dab10f0565ad5f93
c54af970cdda6b83 d25a960d01da950d
c56494db81e00f45 12d7f1eec834c420
c630144509ec4fb3 b4d0e19166420a2c
c652318a8d446f03 49fa70f788e1e392
@@ -4403,9 +4539,42 @@ c8648571bd52ee5d adcc21f62adb53c1
cb25a01bba2b3cd9 cba76ccd83428d81
cb25a01bba2b3cd9 d428d0219f2efcf5
cb5624450ea02f57 273e667263d762a1
cbb703eddc84ef52 00cbadd92d5092f3
cbb703eddc84ef52 1776fc9ba2ca94a2
cbb703eddc84ef52 1ce2748f74745dc8
cbb703eddc84ef52 52367de8bc4f8b38
cbb703eddc84ef52 69c467197425233e
cbb703eddc84ef52 6a40677e7f6927dd
cbb703eddc84ef52 70cb8ef3e097d06a
cbb703eddc84ef52 72872657b5dcca40
cbb703eddc84ef52 770a69b842e799df
cbb703eddc84ef52 8304ca844bb70e52
cbb703eddc84ef52 9448974662fb99b5
cbb703eddc84ef52 a1d4539ac0cd7a69
cbb703eddc84ef52 c9be4dd66b82d5a8
cbb703eddc84ef52 d060bb5948fa68eb
cbb703eddc84ef52 d7adedec4d03dd2f
cbb703eddc84ef52 df92ad25f09ba013
cbb703eddc84ef52 e2197503170b335f
cbbc665da2bd9d13 1d8f587e774c7461
cbbc665da2bd9d13 22972bbbeec60f47
cbc433806027cf8f 2d89c0f60120b173
cc0d8d07ed9cddce 292af60c488cf5aa
cc0d8d07ed9cddce 3af239444bb18ed4
cc0d8d07ed9cddce 3e897bf71e109a9c
cc0d8d07ed9cddce 40d6e004f06f1de7
cc0d8d07ed9cddce 63b221674e985506
cc0d8d07ed9cddce 9653f47175722c47
cc0d8d07ed9cddce b60e3cab617387d6
cc0d8d07ed9cddce b7dde0f3a9f14d3c
cc0d8d07ed9cddce bab89bbbcfd7b155
cc0d8d07ed9cddce bdc417d926307031
cc0d8d07ed9cddce d8719cf15fc49bb3
cc0d8d07ed9cddce d9b79806e3c4f827
cc0d8d07ed9cddce de17397c13e3ac2d
cc0d8d07ed9cddce ec0acbdc47477fd2
cc0d8d07ed9cddce ef89e305adc0b38a
cc0d8d07ed9cddce f30638dc111a9bfc
cc5658c25ac5e5b0 39211ff714a86ca1
cc5658c25ac5e5b0 42dcb8877b0adb7b
cc5658c25ac5e5b0 9016fc417c7e27a0
@@ -4433,6 +4602,7 @@ cd8480cd648acaee 893e259b4200e2a6
cd8480cd648acaee 90ba75271daa7e92
cd8480cd648acaee a0612574df498b83
cd8480cd648acaee fb818ae06ef81fd9
cdd8fbe8a66d7b16 f5cb591b09ea6a25
cde0f51a09598f78 b4d0e19166420a2c
ce3dbb75eacbc5d8 1d94e6b9cb8410b3
ce3dbb75eacbc5d8 319bcb95ce1d8e63
@@ -5804,6 +5974,10 @@ dc707bb24332aa85 bdb980eaf2e2d4f5
dc707bb24332aa85 d73a52fd610abaff
dd1599a2592b69b4 3a7ed58caa5d9049
dd392b6a52b76fde 425a21077b4489dd
dd7e8656c0292e5d 20e12beab3a78cdf
dd7e8656c0292e5d 4a85d9a003b99f54
dd7e8656c0292e5d 4d5e3e43c4a0fff3
dd7e8656c0292e5d 65c4fce2321fefde
de21c8bc297f1a28 030d78a95729b7dc
de21c8bc297f1a28 27ed77345ef418f9
de21c8bc297f1a28 88605234b82a1a3b
@@ -6280,6 +6454,7 @@ fe22a4525d70a6d1 3a65fa665ab729a2
fe22a4525d70a6d1 721d810ee570d8a7
fe22a4525d70a6d1 c0baf2350008f2c2
fe22a4525d70a6d1 db2a4cbf9fa329e4
fe8776051ee37286 0966ef09ba7fbb05
fe9514b898f4624b c4a4c0909a118b8b
fe9c2906a7fddc66 32c0d7291269ded1
fe9c2906a7fddc66 588e61d613c013a1
1 # kind: evidence supplemental vertex / pixel shader pairs (BAHS program variations and legacy Unity pass-input covers) for vertex output padding and the pipeline prebuild (generated by dm/gfx/tools/shader_split.py, do not edit): vertex key <TAB> pixel key
27 0690296a9e3a3ebb
28 0690296a9e3a3ebb
29 06a62ea4ee7a7fd9
30 06f14fa278dddec5
31 06f14fa278dddec5
32 06f14fa278dddec5
33 06f14fa278dddec5
34 06f14fa278dddec5
35 06f14fa278dddec5
36 06f14fa278dddec5
37 06f14fa278dddec5
38 06f14fa278dddec5
39 06f14fa278dddec5
40 06f14fa278dddec5
41 06f14fa278dddec5
42 06f14fa278dddec5
43 06f14fa278dddec5
44 06f14fa278dddec5
45 06f14fa278dddec5
46 07a79fb91543fe2c
47 07d696dc3187478f
48 085be08bf6e4db6a
49 085be08bf6e4db6a
50 085be08bf6e4db6a
51 08c5032e40b9f5c4
52 0b448d2d9a157734
53 0c24daa9be2d4bb2
54 0c24daa9be2d4bb2
55 0c24daa9be2d4bb2
56 0c24daa9be2d4bb2
57 0cc45bf016741cec
58 0da07d9ba1c3fce1
59 0da07d9ba1c3fce1
65 0df57171fd34bf84
66 0df57171fd34bf84
67 0ed48a9e7ae9c3c6
68 0f35a198956f1097
69 0f8b802ab11124fc
70 0f8b802ab11124fc
71 0f8b802ab11124fc
167 1f459749d9a5b314
168 1f5d0afebca92847
169 1f9ab3217c1cb7ff
170 2231ba2bb8835775
171 2231ba2bb8835775
172 2231ba2bb8835775
173 2231ba2bb8835775
174 2231ba2bb8835775
175 2231ba2bb8835775
176 2231ba2bb8835775
177 2231ba2bb8835775
178 2231ba2bb8835775
179 2231ba2bb8835775
180 2231ba2bb8835775
181 2231ba2bb8835775
182 2231ba2bb8835775
183 2231ba2bb8835775
184 2231ba2bb8835775
185 2231ba2bb8835775
186 2231ba2bb8835775
187 2248aa4ff3f9e86c
188 2248aa4ff3f9e86c
189 2248aa4ff3f9e86c
218 25d75991cda1cc1d
219 28d2fa887f9959f9
220 299472cf4cbf3438
221 2ac82190b3ec7944
222 2b13c3c9773cf124
223 2b6e071b929cac8e
224 2ba057f0c91ba3ad
225 2ba057f0c91ba3ad
226 2ba057f0c91ba3ad
227 2badc54fd01a4e12
228 2badc54fd01a4e12
229 2badc54fd01a4e12
230 2badc54fd01a4e12
231 2c20087b3ffa9579
232 2c20087b3ffa9579
233 2c20087b3ffa9579
292 3021081d923b9d42
293 305c3c96ba7ee850
294 30a3e02400170d06
295 30e099fdce5a8ba8
296 30e099fdce5a8ba8
297 30e099fdce5a8ba8
298 30e099fdce5a8ba8
299 317bc52404bddb02
300 31e9ea1fc3d7f794
301 3267b5d0dd9db8aa
473 3961ccb9114e86aa
474 39cb80a6e6f77fb4
475 3afd46a218741216
476 3b6f044bf79ec50b
477 3be3604ea84c019e
478 3c0a117c26557573
479 3c0a117c26557573
480 3c702670051d2a46
481 3c702670051d2a46
482 3cc55c54c5c53fb2
916 40ad099d2943ed76
917 40f414a41ea5eb4d
918 415b77882064e123
919 4173d51c5110c011
920 41c314c7820189e2
921 4253f72fdc2fc793
922 42f30c87a9c409c3
956 42f30c87a9c409c3
957 42f30c87a9c409c3
958 42ff4b8fb82cf3fe
959 4311a2c62dbc4e67
960 43f87e27a030082c
961 43f87e27a030082c
962 43f87e27a030082c
1301 4fd1e8989166539a
1302 4ff75a0933c11f36
1303 508dbc2b529ac565
1304 50f08f89a90b1eae
1305 50f08f89a90b1eae
1306 50f08f89a90b1eae
1307 50f08f89a90b1eae
1308 50f08f89a90b1eae
1309 50f08f89a90b1eae
1310 50f08f89a90b1eae
1311 50f08f89a90b1eae
1312 50f08f89a90b1eae
1313 50f08f89a90b1eae
1314 50f08f89a90b1eae
1315 50f08f89a90b1eae
1316 50f08f89a90b1eae
1317 50f08f89a90b1eae
1318 50f08f89a90b1eae
1319 50f08f89a90b1eae
1320 50f08f89a90b1eae
1321 50f08f89a90b1eae
1322 50f08f89a90b1eae
1323 50f08f89a90b1eae
1324 50f08f89a90b1eae
1325 50f08f89a90b1eae
1326 50f08f89a90b1eae
1327 51aa96d7aa0147c8
1328 51aa96d7aa0147c8
1329 51e9ae07b06973e5
2182 6d7b4321ff055c74
2183 6d7b4321ff055c74
2184 6d8fff6cf00d4817
2185 6e20fa5f6651f477
2186 6e2af0a25cd28d92
2187 6e4127cb17c245ba
2188 6ead2e525d30106f
2339 7cee980dfe8cb8cc
2340 7cf403de72dde88b
2341 7cf403de72dde88b
2342 7d3907840c472032
2343 7d3907840c472032
2344 7d3907840c472032
2345 7d3907840c472032
2346 7d3907840c472032
2347 7d3907840c472032
2348 7d3907840c472032
2349 7d3907840c472032
2350 7d3907840c472032
2351 7d3907840c472032
2352 7d3907840c472032
2353 7d3907840c472032
2354 7d3907840c472032
2355 7d3907840c472032
2356 7d3907840c472032
2357 7d3907840c472032
2358 7d86d307cc933eda
2359 7e188f24a18217d4
2360 7e188f24a18217d4
2399 8094453ec0a25b44
2400 8094453ec0a25b44
2401 810c2a7ab732a54e
2402 814a27157cfd3474
2403 814a27157cfd3474
2404 814a27157cfd3474
2405 814a27157cfd3474
2406 814a27157cfd3474
2407 814a27157cfd3474
2408 814a27157cfd3474
2409 814a27157cfd3474
2410 814a27157cfd3474
2411 814a27157cfd3474
2412 814a27157cfd3474
2413 814a27157cfd3474
2414 814a27157cfd3474
2415 814a27157cfd3474
2416 814a27157cfd3474
2417 814a27157cfd3474
2418 814a27157cfd3474
2419 814a27157cfd3474
2420 814a27157cfd3474
2421 814a27157cfd3474
2422 81928d498045746d
2423 81928d498045746d
2424 81928d498045746d
2439 82df16cf9c96ce58
2440 82df16cf9c96ce58
2441 830c346f974f0b10
2442 834d676579f09130
2443 834d676579f09130
2444 8393c125a88f150b
2445 8393c125a88f150b
2446 8393c125a88f150b
3149 876554e47e172ca7
3150 876554e47e172ca7
3151 876554e47e172ca7
3152 879ebc18021cf477
3153 879ebc18021cf477
3154 879ebc18021cf477
3155 879ebc18021cf477
3156 879ebc18021cf477
3157 879ebc18021cf477
3158 879ebc18021cf477
3159 879ebc18021cf477
3160 879ebc18021cf477
3161 879ebc18021cf477
3162 879ebc18021cf477
3163 879ebc18021cf477
3164 879ebc18021cf477
3165 879ebc18021cf477
3166 879ebc18021cf477
3167 879ebc18021cf477
3168 879ebc18021cf477
3169 87c1b0e55d39a8e5
3170 896c6c3ce1f8f0df
3171 89dacb547a77a13b
3172 8a4ffcbfd9c71555
3173 8b045dc9eb39f9d4
3174 8b76621482b9caec
3319 9bb5b3ddaa93dd15
3320 9bb5b3ddaa93dd15
3321 9bb5b3ddaa93dd15
3322 9bcefe55ba25a843
3323 9c35e9852b4e0194
3324 9c368986a5629485
3325 9c3d6bff45a7fd49
3377 9d5236c57791dd66
3378 9d5236c57791dd66
3379 9da5bbb932817e55
3380 9dbc56108a854a44
3381 9e446afbd3d57084
3382 9e446afbd3d57084
3383 9e72f3cf803123bc
4273 b98d6862194eb2d0
4274 b9a60e866058c078
4275 b9a60e866058c078
4276 b9ac2efcc318dd3f
4277 ba19ee7ac6498808
4278 ba59fe02fd9d73ea
4279 ba59fe02fd9d73ea
4331 c50b700c29a7bac4
4332 c53e6a3fab9d4081
4333 c53e6a3fab9d4081
4334 c54af970cdda6b83
4335 c56494db81e00f45
4336 c630144509ec4fb3
4337 c652318a8d446f03
4539 cb25a01bba2b3cd9
4540 cb25a01bba2b3cd9
4541 cb5624450ea02f57
4542 cbb703eddc84ef52
4543 cbb703eddc84ef52
4544 cbb703eddc84ef52
4545 cbb703eddc84ef52
4546 cbb703eddc84ef52
4547 cbb703eddc84ef52
4548 cbb703eddc84ef52
4549 cbb703eddc84ef52
4550 cbb703eddc84ef52
4551 cbb703eddc84ef52
4552 cbb703eddc84ef52
4553 cbb703eddc84ef52
4554 cbb703eddc84ef52
4555 cbb703eddc84ef52
4556 cbb703eddc84ef52
4557 cbb703eddc84ef52
4558 cbb703eddc84ef52
4559 cbbc665da2bd9d13
4560 cbbc665da2bd9d13
4561 cbc433806027cf8f
4562 cc0d8d07ed9cddce
4563 cc0d8d07ed9cddce
4564 cc0d8d07ed9cddce
4565 cc0d8d07ed9cddce
4566 cc0d8d07ed9cddce
4567 cc0d8d07ed9cddce
4568 cc0d8d07ed9cddce
4569 cc0d8d07ed9cddce
4570 cc0d8d07ed9cddce
4571 cc0d8d07ed9cddce
4572 cc0d8d07ed9cddce
4573 cc0d8d07ed9cddce
4574 cc0d8d07ed9cddce
4575 cc0d8d07ed9cddce
4576 cc0d8d07ed9cddce
4577 cc0d8d07ed9cddce
4578 cc5658c25ac5e5b0
4579 cc5658c25ac5e5b0
4580 cc5658c25ac5e5b0
4602 cd8480cd648acaee
4603 cd8480cd648acaee
4604 cd8480cd648acaee
4605 cdd8fbe8a66d7b16
4606 cde0f51a09598f78
4607 ce3dbb75eacbc5d8
4608 ce3dbb75eacbc5d8
5974 dc707bb24332aa85
5975 dd1599a2592b69b4
5976 dd392b6a52b76fde
5977 dd7e8656c0292e5d
5978 dd7e8656c0292e5d
5979 dd7e8656c0292e5d
5980 dd7e8656c0292e5d
5981 de21c8bc297f1a28
5982 de21c8bc297f1a28
5983 de21c8bc297f1a28
6454 fe22a4525d70a6d1
6455 fe22a4525d70a6d1
6456 fe22a4525d70a6d1
6457 fe8776051ee37286
6458 fe9514b898f4624b
6459 fe9c2906a7fddc66
6460 fe9c2906a7fddc66
@@ -1654,7 +1654,6 @@
68ada6f00e566787 {"local":[128,1,1],"shared":0}
68aedc5d3427a74a {"local":[64,1,1],"shared":0}
68b823b16acabbc7 {"local":[64,1,1],"shared":0}
68bbe98b3bfd9876 {"local":[16,16,1],"shared":0}
68c040dab083cb03 {"local":[32,1,1],"shared":0}
68df2c92d67d77ec {"local":[64,1,1],"shared":0}
68eb3c62ac132a17 {"local":[64,1,1],"shared":0}
Can't render this file because it contains an unexpected character in line 2 and column 19.
File diff suppressed because it is too large. Load diff
+1
View File
@@ -54,6 +54,7 @@ Each step below stopped the boot before its fix:
## Open
- **Shader tables:** split them again with this game's files and compare: `shader_map.tsv` may hold agl rows that are no shaders ([A control section's words read as a BAHS entry](../../../docs/reference/shaders.md#a-control-sections-words-read-as-a-bahs-entry); `bahs_variations` already met one stray entry in `agl_common`), and if so the NSP script stops at the table check until the split's tables replace them.
- **Video decoding:** the guide movies are VP9 and play (a 180-picture clip on loop in the tutorial's panel, read back as NV12). The player also imports the VP8, H.264 and AV1 decoders: VP8 and H.264 are served too (checked by `t_codec_video` only), AV1 is not ([`nn::codec` video decoders taken over](../../../docs/reference/movies.md#nncodec-video-decoders-taken-over)).
- **The gameplay picture:** the mining tunnel matches a YouTube capture of the same spot ([Rendering](#rendering) 7); nothing past the tunnel's first minute has been compared.
- Full shader build (about 75 minutes on the Mac from an empty cache): 22,852 of 22,852 shaders on chain 6f41726ef36d (SUATOM decoded; 22,850 on chain 3c66991eb439). Chain 9a0726336e9d had 22,834: the Metal compiler refused 11 (too deeply nested jump tables) and 5 used BRXU or REDUX ([Ampere shader code](../../../docs/reference/shaders.md#ampere-shader-code-switch-2)); 2 still do not translate (0x593).
+1 -1
View File
@@ -55,7 +55,7 @@ Moving objects get their ambient light from eight values per object in a storage
- A crash seen once in dozens of runs, in a run slowed by another game on the same GPU: the game's own wait at `main+0x2ecff24` (`ldarb` on a thread object at +0x285, in a loop that sleeps between reads) read an alias page just unmapped, right after `[mem] alias region mapped` fell. Not caused by the host's page protection, which does not unmap; whether the host unmaps earlier than Horizon would is not known.
- The 12x12 cube the vertex shader mixes with the probe values holds 4 to 27 with `tex_flush_upload`, and read zeros without it.
- [The guard band cull's](../../../docs/reference/shaders.md#a-guard-band-cull-in-every-vertex-shader-0x80d) real meaning, and the vertex output at `a[0x5c]` that 4,771 vertex shaders write and the translator drops (probably a shading rate, not checked).
- `[RED] nn::codec VP9: a packet refused with 12 pictures waiting for a released buffer` (4 lines at the first movie); the movies seen play.
- `nn::codec VP9: busy (result 3603), a packet refused with 12 pictures waiting for a released buffer` (4 lines at the first movie, a red line until [a refusal was known to be no fault](../../../docs/reference/movies.md#the-submission-ready-event-counted-as-packets)); the movies seen play.
- A `pso_manifest.tsv` has not been recorded, so the first race compiles pipelines as it goes.
- What `nvnTextureViewCompare`'s return value means is taken from its name.
- City Trial played by hand, Road Trip, online, the base game, iOS: not tested.
+1
View File
@@ -86,6 +86,7 @@ Update 1.8.0 (v917504, SDK 21.4.0) is not on this Mac. Pull request #1116 ported
## Open
- **Shader tables:** split them again with this game's files and compare: `shader_map.tsv` may hold agl rows that are no shaders ([A control section's words read as a BAHS entry](../../../docs/reference/shaders.md#a-control-sections-words-read-as-a-bahs-entry)), and if so the NSP script stops at the table check until the split's tables replace them.
- **Long frames:** first-use pipeline compiles (no `pso_manifest.tsv` yet).
- **Shading rate:** the calls are accepted and ignored ([Variable rate shading ignored](../../../docs/reference/rendering.md#variable-rate-shading-ignored)), so every pixel is shaded where the game meant to save GPU time.
- **Mesh draws:** `DrawMeshTasks3D` and the indirect forms are not implemented; no run reached them.
+1 -1
View File
@@ -1,3 +1,3 @@
// Generated file (dm/gfx/tools/dmsh_chain.py --header): the B shader library translation chain version this source tree expects (default options), one for every game;
// the host loads only <library dir>/b-<V>/. Run dmsh_chain.py --header after changing the chain's tools and commit this file with the change
#define DMSH_CHAIN "c8849b34b7b0"
#define DMSH_CHAIN "844bf1a5ea8f"
+21
View File
@@ -84,6 +84,27 @@ class HalfImmediate(Alu):
self.assertRegex(msl, r'\b2\.0\b')
class GlobalMemory(Alu):
"""Global memory. desc[URb][Ra.64] (bit 76 of LDG / STG, bit 71 of ATOMG / RED; nvdisasm): URb is a memory descriptor, not part of the address, which is Ra.64 (plus the offset)
alone; [Ra.64+URb] adds it. The descriptor's value was added to the address. ATOMG.CAS (0x3a9) was refused; ATOMG / RED INC and DEC had no case in EmitAtomicOp (the operation
vanished). A GPU cross-check of 300 LDG / STG / ATOMG / RED through the host's gmem_map (one-thread compute shaders, production options): 135 identical to 300. Encodings
built from the sm_86 oracle corpus and checked with nvdisasm"""
R2UR = (0x000fe200000e0000, 0x00000000130473c2) # R2UR UR4, R19
LDG_DESC = (0x000fe2200c1e1900, 0x0000000414067981) # LDG.E R6, desc[UR4][R20.64]
LDG_URZ = (0x000fe2200c1e1900, 0x0000003f14067981) # LDG.E R6, desc[URZ][R20.64]
CAS = (0x000fe200001ee116, 0x00000013140673a9) # ATOMG.E.CAS.STRONG.GPU PT, R6, [R20], R19, R22
INC = (0x000fe200019ee100, 0x00000013140673a8) # ATOMG.E.INC.STRONG.GPU PT, R6, [R20], R19
def test_a_descriptor_is_not_an_offset(self): # the same code whatever the descriptor register holds
self.assertEqual(self.kept(self.R2UR, self.LDG_DESC, srcs=(19, 20, 21)), self.kept(self.R2UR, self.LDG_URZ, srcs=(19, 20, 21)))
def test_atomg_cas_is_translated(self):
self.assertIn('atomic_compare_exchange', self.kept(self.CAS, srcs=(19, 20, 21, 22)))
def test_atomg_inc_is_a_compare_and_swap_loop(self):
self.assertIn('atomic_compare_exchange', self.kept(self.INC, srcs=(19, 20, 21)))
class CompareFtz(Alu):
"""FSETP / FSET .FTZ (bit 80): a denormal operand compares as zero, as on NVIDIA; Apple's GPUs keep denormals. Mario Kart World's deferred lighting 635061c90d75a8d1
normalises its four depth-weighted samples by 1 / sum only where FSETP.NEU.FTZ says sum != 0: a denormal sum passed, its reciprocal overflowed, and the NaN came out
+6 -2
View File
@@ -329,11 +329,15 @@ PRE_STATS = collections.Counter()
# Odyssey's alRenderMaterialUber took 25 minutes and 17.3 MB of GPU code, 31 s and 1.3 MB at -O1. Ordinary shaders come out within a few percent either way (the backend optimizes again)
MAC_METAL = ['xcrun', '-sdk', 'macosx', 'metal', '-c', '-O1', '-fpreserve-invariance']
MAC_RECORD = ' '.join(MAC_METAL) + '; xcrun -sdk macosx metallib'
# -fbracket-depth: the front end stops at 256 nested brackets ("bracket nesting level exceeded maximum of 256"). Ocarina of Time's compute shaders 1f78730053feb036 and e172bd7ec218ab8e
# (3.5 MB of MSL each) nest 259 deep in one expression and were left out. A source within the default limit compiles to the same bytes with it (checked on macOS and iOS), so, like the
# precompiled header, the records do not name it and the Metal cache keeps its libraries. ios_metal.DEPTH is the same
METAL_DEPTH = ['-fbracket-depth=1024']
# The outer shader and fetch-variant caches restore compiled libraries directly,
# before the MSL compile cache can check their compiler. Keep override builds separate there too.
METAL_FP = dmsh_mtlcache.compiler_id('macosx') + ('\0iphoneos\0' + dmsh_mtlcache.compiler_id('iphoneos') if IOSOUT else '')
def mac_compile(msl, air, lib): # same interface as ios_metal.compile; the precompiled header changes no output, so MAC_RECORD does not name it (dmsh_pch.py)
dmsh_pch.compile(MAC_METAL, msl, air)
def mac_compile(msl, air, lib): # same interface as ios_metal.compile; the precompiled header and METAL_DEPTH change no output, so MAC_RECORD does not name them (dmsh_pch.py)
dmsh_pch.compile(MAC_METAL + METAL_DEPTH, msl, air)
subprocess.run(['xcrun', '-sdk', 'macosx', 'metallib', air, '-o', lib], check=True)
# The NVN driver's constant segments have one layout in every game, which dm/gfx/nvn/dmsh_abi.h holds for the host and this build (through dmsh_abi.py); nvn_mtl.m fills them the same way at run time.
# c2 C2_TEX + 8 r: handles bound with nvnCommandBufferBindTexture (combined texture and sampler), slot r. The driver has 32 such slots, but a game may bind higher ones, whose words lie in the
+3 -3
View File
@@ -1,7 +1,7 @@
# Translation chain tool fingerprints (written by tool_lock.py --update-lock; regenerate after changing tools and commit it)
dmsh_xlate.dll 05a743916a64e9dd
Ryujinx.Graphics.Shader.dll 49eae1cefcaa15b8
Ryujinx.Common.dll f8e7fc00c9e75859
dmsh_xlate.dll 7be436127e2ede2e
Ryujinx.Graphics.Shader.dll c923d7c786c527e2
Ryujinx.Common.dll 5edacc90d34d6ab5
xlate_source 0bd66426675438a9
spirv-cross e37945d8e441d34d
metal_macosx Apple metal version 32023.922 (metalfe-32023.922.4)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8 -2
View File
@@ -183,7 +183,7 @@ def nvn2_stage(ctl, code): # an NVN2 shader's stage: compute, task and mesh by
def bahs_shaders(d, label):
rsz, region = field(d, '<II', 0x18, f'{label} BAHS header')
if region + rsz > len(d): red(f'{label} BAHS code region out of bounds')
out = []
found = []
for a in range(0, region - 16, 4):
off, z, csz, rel = struct.unpack_from('<IIIi', d, a)
nvn2 = 0x48 <= csz < 0x10000 and 0 <= a + rel and a + rel + csz <= region and nvn2_ctl(d[a + rel:a + rel + csz])
@@ -196,7 +196,13 @@ def bahs_shaders(d, label):
code, ctl = d[region + off:region + off + n], d[c:c + csz]
st = nvn2_stage(ctl, code) if nvn2 else 'cs' if code[:4] == CS_MAGIC else sph_stage(code) if code[:4] == GFX_MAGIC else None
if not st or check(label, st, ctl, code): continue
out.append((f'{label}#BAHS@{a:#x}', st, ctl, code))
found.append((a, c, (f'{label}#BAHS@{a:#x}', st, ctl, code)))
# A program entry never lies inside a control section. An NVN2 section's +0x38..+0x47 (instruction length, c1 start and end, code length: 0x1100, 0, 0x1100, 0x1100) reads as
# an entry whose offset, control length and control distance are all that length: Ocarina of Time's agl_common.sharcb@0x357f0 paired compute shader 30's control with a vertex
# shader's code, a shader the game never loads, and its SPH came to the translator as an instruction ("Ampere instruction 481 at 0x0"). Each section counts with its own
# length (ctl_len), not the length an entry gives it, which for such a false entry covers real entries after it
spans = {(c, c + ctl_len(s[2])) for _, c, s in found}
out = [s for a, _, s in found if not any(lo <= a < hi for lo, hi in spans)]
bahs_variations(d, label, [o[0] for o in out])
return out
+5 -2
View File
@@ -343,11 +343,14 @@ static vpx_image_t *av1_to_i420(const mav1_picture *p) { // the decoder's NV12
}
return c;
}
// One packet: decoded at once; its pictures wait for released buffers (end of stream marks the last one, or comes as a buffer of its own)
// One packet: decoded at once; its pictures wait for released buffers (end of stream marks the last one, or comes as a buffer of its own).
// A refusal (CV_BUSY, nn::codec 3603) is the decoder's defined answer, not a fault: NintendoSDK_movie's detail::SubmitDecoderInputBuffer turns exactly that result into its
// own retry code 0x7a, which VideoDecoder::DecodeAsync hands back to the player, and aborts on any other failure (Ocarina of Time's subsdk0 +0x10fd20, +0x103840). So it is
// logged plainly; a picture the host has to drop prints its own [RED] line (cv_hold)
static Result cv_dec_submit(uint64_t *out, void *t, const void *data, uint64_t size, int64_t ts, bool eos) {
cv_dec *d = cv_of(t); if (!d) return CV_R(2004);
pthread_mutex_lock(&d->mu);
if (d->nheld >= CV_HOLD) { static int n; if (n++ < 4) LOG("[RED] nn::codec %s: a packet refused with %d pictures waiting for a released buffer", k_cv_name[d->codec], d->nheld); if (d->event) hle_clear_system_event(d->event); pthread_mutex_unlock(&d->mu); return CV_BUSY; }
if (d->nheld >= CV_HOLD) { static int n; if (n++ < 4) LOG("nn::codec %s: busy (result 3603), a packet refused with %d pictures waiting for a released buffer",k_cv_name[d->codec], d->nheld); if (d->event) hle_clear_system_event(d->event); pthread_mutex_unlock(&d->mu); return CV_BUSY; }
int got = 0;
if (d->codec == CV_H264 && d->avc) { // VideoToolbox reorders: pictures leave in presentation order, all of them at the end of the stream
if (size && mavc_decode(d->avc, data, (int)size, ts / 1000) < 0) { static int n; if (n++ < 4) LOG("[RED] nn::codec H.264: VideoToolbox could not decode a packet"); }
+2 -1
View File
@@ -9,7 +9,8 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '../
METAL = ['xcrun', '-sdk', 'iphoneos', 'metal', '-c', '-O1', '-mios-version-min=18.0', '-fmetal-math-mode=relaxed', '-fpreserve-invariance']
METALLIB = ['xcrun', '-sdk', 'iphoneos', 'metallib']
RECORD = ' '.join(METAL) + '; ' + ' '.join(METALLIB) # Written into json chain.metal
DEPTH = ['-fbracket-depth=1024'] # more nested brackets than the front end's 256 (as dmsh_build.py's METAL_DEPTH): no output changes with it, so RECORD does not name it
def compile(msl, air, lib):
dmsh_pch.compile(METAL, msl, air)
dmsh_pch.compile(METAL + DEPTH, msl, air)
subprocess.run([*METALLIB, air, '-o', lib], check=True)
@@ -29,6 +29,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
x(0x98e, InstName.Red, ARed, N, writesRd: false);
x(0x9a8, InstName.Atom, AAtomg, N);
x(0x3a8, InstName.Atom, AAtomg, N);
x(0x3a9, InstName.Atom, AAtomgCas, N);
x(AmpereOpcodes.Ldl, InstName.Ldl, ALdLocalShared, N);
x(0x984, InstName.Lds, ALdLocalShared, N);
x(0x387, InstName.Stl, AStLocalShared, N, writesRd: false);
@@ -224,7 +225,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
// The 64-bit address of a global access: Ra (a pair with bit raPairBit, else 32 bits) plus a uniform register pair at urLo (a pair with bit 72) in
// the uniform form (bit 91), plus the signed offset (40..64). The low word stays (UR + Ra + offset), the form Ryujinx's global-to-storage pass
// traces back to a storage buffer table entry in c[0].
private static (Operand Low, Operand High) AGlobalAddress(EmitterContext context, AmpereOp x, int raPairBit, int urLo, int extraOffset)
private static (Operand Low, Operand High) AGlobalAddress(EmitterContext context, AmpereOp x, int raPairBit, int urLo, int extraOffset, int descBit)
{
bool uniformForm = x.Bit(91);
bool raPair = uniformForm ? x.Bit(raPairBit) : x.Bit(72);
@@ -233,7 +234,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
Operand lo = Register(x.Ra, RegisterType.Gpr);
Operand hi = raPair && x.Ra != RegisterConsts.RegisterZeroIndex ? Register(x.Ra + 1, RegisterType.Gpr) : Const(0);
if (uniformForm)
// desc[URb][Ra.64] (descBit: 76 in LDG / STG, 71 in ATOMG / RED; nvdisasm): URb is a memory descriptor (the compiler's cache policy), not part of the address
if (uniformForm && !x.Bit(descBit))
{
int ur = x.Bits(urLo, urLo + 6);
@@ -292,7 +294,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
for (int index = 0; index < count; index++)
{
(Operand lo, Operand hi) = AGlobalAddress(context, x, 90, 32, index * 4);
(Operand lo, Operand hi) = AGlobalAddress(context, x, 90, 32, index * 4, 76);
(los[index], his[index]) = (context.Copy(lo), context.Copy(hi));
}
@@ -344,7 +346,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
bool isRz = x.Rb + index >= RegisterConsts.RegisterZeroIndex;
Operand value = isRz ? Const(0) : Register(x.Rb + index, RegisterType.Gpr);
(Operand lo, Operand hi) = AGlobalAddress(context, x, 90, 64, index * 4);
(Operand lo, Operand hi) = AGlobalAddress(context, x, 90, 64, index * 4, 76);
context.Store(storageKind, lo, hi, value);
}
@@ -354,22 +356,66 @@ namespace Ryujinx.Graphics.Shader.Instructions
public static void ARed(EmitterContext context)
{
AmpereOp x = new(context.CurrOp);
(Operand lo, Operand hi) = AGlobalAddress(context, x, 90, 64, 0);
(Operand lo, Operand hi) = AGlobalAddress(context, x, 90, 64, 0, 71);
AtomOp op = (AtomOp)x.Bits(87, 90);
EmitAtomicOp(context, StorageKind.GlobalMemory, (AtomOp)x.Bits(87, 90), (AtomSize)x.Bits(73, 76), lo, hi, Register(x.Rb, RegisterType.Gpr));
if (op is AtomOp.Inc or AtomOp.Dec && x.Bits(73, 75) is 0 or 1)
{
AGlobalIncDec(context, op, lo, hi, Register(x.Rb, RegisterType.Gpr));
return;
}
EmitAtomicOp(context, StorageKind.GlobalMemory, op, (AtomSize)x.Bits(73, 76), lo, hi, Register(x.Rb, RegisterType.Gpr));
}
// ATOMG Rd, [Ra + UR + offset], Rb: operation 87..91; the uniform form keeps Ra's pair bit at 70
public static void AAtomg(EmitterContext context)
{
AmpereOp x = new(context.CurrOp);
(Operand lo, Operand hi) = AGlobalAddress(context, x, 70, 64, 0);
(Operand lo, Operand hi) = AGlobalAddress(context, x, 70, 64, 0, 71);
AtomOp op = (AtomOp)x.Bits(87, 91);
Operand value = x.Rb >= RegisterConsts.RegisterZeroIndex ? Const(0) : Register(x.Rb, RegisterType.Gpr);
Operand res = EmitAtomicOp(context, StorageKind.GlobalMemory, (AtomOp)x.Bits(87, 91), (AtomSize)x.Bits(73, 76), lo, hi, Register(x.Rb, RegisterType.Gpr));
Operand res = op is AtomOp.Inc or AtomOp.Dec && x.Bits(73, 75) is 0 or 1
? AGlobalIncDec(context, op, lo, hi, value)
: EmitAtomicOp(context, StorageKind.GlobalMemory, op, (AtomSize)x.Bits(73, 76), lo, hi, value);
ASet(context, x, res);
}
// INC (3) / DEC (4) on global memory, CUDA's atomicInc / atomicDec: EmitAtomicOp has no case for them (the operation vanished, its result 0). A compare-and-swap loop, as ATOMS's:
// INC: old >= b ? 0 : old + 1; DEC: old == 0 || old > b ? b : old - 1 (unsigned), retried until the word did not change meanwhile; the old value
private static Operand AGlobalIncDec(EmitterContext context, AtomOp op, Operand lo, Operand hi, Operand value)
{
Operand loop = Label();
context.MarkLabel(loop);
Operand cur = context.Load(StorageKind.GlobalMemory, lo, hi);
Operand next = op == AtomOp.Inc
? context.ConditionalSelect(context.ICompareGreaterOrEqualUnsigned(cur, value), Const(0), context.IAdd(cur, Const(1)))
: context.ConditionalSelect(context.BitwiseOr(context.ICompareEqual(cur, Const(0)), context.ICompareGreaterUnsigned(cur, value)), value, context.IAdd(cur, Const(-1)));
Operand prev = context.AtomicCompareAndSwap(StorageKind.GlobalMemory, lo, hi, cur, next);
context.BranchIfFalse(loop, context.ICompareEqual(prev, cur));
return cur;
}
// ATOMG.CAS Rd, [Ra + offset], Rb (expected), Rc (new value, 64..71) (0x3a9; refused until now): PTX atom.cas, Rd the old value. 32 bits only (73..76 = 0)
public static void AAtomgCas(EmitterContext context)
{
AmpereOp x = new(context.CurrOp);
if (x.Bits(73, 76) != 0)
{
throw AFail(context, $"ATOMG.CAS size {x.Bits(73, 76)}");
}
(Operand lo, Operand hi) = AGlobalAddress(context, x, 70, 64, 0, 71);
Operand expected = context.Copy(x.Rb >= RegisterConsts.RegisterZeroIndex ? Const(0) : Register(x.Rb, RegisterType.Gpr));
Operand value = x.Bits(64, 72) >= RegisterConsts.RegisterZeroIndex ? Const(0) : Register(x.Bits(64, 72), RegisterType.Gpr);
ASet(context, x, context.AtomicCompareAndSwap(StorageKind.GlobalMemory, lo, hi, expected, value));
}
// MEMBAR: the order of this thread's memory operations
public static void AMembar(EmitterContext context)
{
+31
View File
@@ -2,6 +2,7 @@
again without it when it fails, so what a failure reports is the plain compile's, and DMSH_PCH=0 turns it off. With a Metal compiler (each SDK skipped without one), synthetic shaders
compile to byte-identical output with and without it, in the flags of the real builds; a shader with an error raises as a plain compile does. The source goes on standard input, so a
library does not depend on its file's name. No game files."""
import ast
import os
from pathlib import Path
import shutil
@@ -148,5 +149,35 @@ class RealCompiler(Tmp):
self.assertTrue((self.tmp / 'ok.air').is_file())
class BracketDepth(Tmp):
"""-fbracket-depth=1024 in every library compile (dmsh_build.py METAL_DEPTH, ios_metal.DEPTH): Ocarina of Time's compute shaders 1f78730053feb036 and e172bd7ec218ab8e nest 259
brackets deep, past the front end's 256. The records do not name it, so it must change no output of a source within the default limit"""
DEEP = '#include <metal_stdlib>\nusing namespace metal;\nkernel void main0(device uint* o [[buffer(0)]]) { o[0] = ' + '(' * 300 + '1u' + ')' * 300 + '; }\n'
def test_the_build_and_ios_take_the_same_depth(self): # dmsh_build.py is a script, so its value is read from its source
tree = ast.parse((REPO / 'dm/gfx/tools/dmsh_build.py').read_text())
mac = next(ast.literal_eval(n.value) for n in ast.walk(tree) if isinstance(n, ast.Assign) and [getattr(t, 'id', None) for t in n.targets] == ['METAL_DEPTH'])
self.assertEqual(mac, ios_metal.DEPTH)
self.assertNotIn('bracket', ios_metal.RECORD)
def check(self, metal):
deep = self.tmp / 'deep.metal'; deep.write_text(self.DEEP)
with self.assertRaises(subprocess.CalledProcessError): subprocess.run([*metal, '-x', 'metal', str(deep), '-o', str(self.tmp / 'deep0.air')], check=True, capture_output=True)
dmsh_pch.compile(metal + ios_metal.DEPTH, str(deep), str(self.tmp / 'deep.air'))
self.assertTrue((self.tmp / 'deep.air').is_file())
for name, body in SHADERS.items(): # within the limit: the same bytes
src = self.tmp / f'{name}.metal'; src.write_text('#include <metal_stdlib>\nusing namespace metal;\n' + body)
out = []
for extra in ([], ios_metal.DEPTH):
with open(src, 'rb') as f: out.append(subprocess.run([*metal, *extra, '-x', 'metal', '-', '-o', '-'], stdin=f, check=True, capture_output=True).stdout)
self.assertEqual(out[0], out[1], name)
@unittest.skipUnless(has_sdk('macosx'), 'no macOS Metal compiler')
def test_mac(self): self.check(MAC)
@unittest.skipUnless(has_sdk('iphoneos'), 'no iOS Metal compiler')
def test_ios(self): self.check(ios_metal.METAL)
if __name__ == '__main__':
unittest.main()
+54
View File
@@ -0,0 +1,54 @@
"""shader_split: bahs_shaders finds an agl BAHS file's program entries (code offset, 0, control length, control distance) by scanning its table area, and a control section's own
words can read as one. An NVN2 section's +0x38..+0x47 (instruction length, c1 start and end, code length, here 0x100, 0, 0x100, 0x100) is such an entry: its control distance lands on
the next program's control section, its offset on that program's code, and the shader it made paired one program's control with whatever code lay there. Ocarina of Time's
agl_common.sharcb@0x357f0 gave a compute control and a vertex shader's code, whose SPH the translator read as an instruction ("Ampere instruction 481 at 0x0"); six such entries in
its agl and terrain files, none ever loaded. The terrain file's lowest one also kept bahs_variations from finding the binary array, so tera_common gave no variation pairs. No game files."""
import struct
import sys
import unittest
from pathlib import Path
REPO = Path(__file__).resolve().parents[3]
sys.path.insert(0, str(REPO / 'dm/tools/fuzz'))
import fuzz_shader_split as fz # shader_split with a profile
ss = fz.ss
REGION, CODE = 0x400, 0x100 # the code region's start; each program's code area length
def nvn2_ctl(stage):
"""An NVN2 control section (0xe0 bytes): magic, version 0xc9, +0x38 instruction length, +0x40 / +0x44 c1 start and end (= the code area's length), +0x56 the stage byte"""
c = bytearray(0xe0); c[:4] = ss.CTL_MAGIC; c[4:8] = b'\xc9\0\0\0'
struct.pack_into('<4I', c, 0x38, CODE, 0, CODE, CODE); c[0x56] = stage
return c
def bahs():
"""Two vertex programs: entries at 0x100 and 0x238, each with its control 0x68 after it (0x168, 0x2a0), code at the region's +0 and +0x100. A's control words at
0x1a0 read (0x100, 0, 0x100, 0x100): an entry whose control is B's (0x1a0 + 0x100) and whose code is B's"""
d = bytearray(REGION + 2 * CODE)
struct.pack_into('<II', d, 0x18, 2 * CODE, REGION) # code region length, its start
for entry, off in ((0x100, 0), (0x238, CODE)):
struct.pack_into('<IIIi', d, entry, off, 0, 0xe0, 0x68)
d[entry + 0x68:entry + 0x68 + 0xe0] = nvn2_ctl(0)
code = bytearray(CODE); struct.pack_into('<I', code, 0, 0x000c0481 + off) # an SPH, vertex (word 0: type 1, stage 1 in bits 10..13), told apart by its offset
d[REGION + off:REGION + off + CODE] = code
assert struct.unpack_from('<IIIi', d, 0x1a0) == (CODE, 0, CODE, CODE) and 0x1a0 + CODE == 0x2a0
return bytes(d)
class ControlWordsAreNoEntry(unittest.TestCase):
def test_only_the_two_programs(self):
got = ss.bahs_shaders(bahs(), 'f.sharcb')
self.assertEqual([w for w, *_ in got], ['f.sharcb#BAHS@0x100', 'f.sharcb#BAHS@0x238'])
self.assertEqual([st for _, st, _, _ in got], ['vs', 'vs'])
def test_the_false_entry_is_a_candidate_without_the_rule(self): # the scan's own checks take it: the rule is what leaves it out
d = bahs()
off, z, csz, rel = struct.unpack_from('<IIIi', d, 0x1a0)
c = 0x1a0 + rel
self.assertTrue(ss.nvn2_ctl(d[c:c + csz]) and not z and off % 0x100 == 0 and ss.check('f', 'vs', d[c:c + csz], d[REGION + off:REGION + off + CODE]) is None)
if __name__ == '__main__':
unittest.main()
+3
View File
@@ -746,6 +746,7 @@ One line per symptom in the [subsystem references](../reference/): what you see
- the shader split stops on one archive with a Python traceback (an `IndexError` or `struct.error` naming no file), or a reader's `[RED]` line about a format it does not know, and nothing is written; the NSP script loses the build at the split. → [A file no reader reads](../reference/shaders.md#a-file-no-reader-reads)
- a black screen after the loading text; the split prints `[RED] /init.dict: the index (… header 04 04 03 00 …) is not in the layout of Luigi's Mansion 3's archives` for 878 of 879 archives and keeps only the 40 shaders of `main`, and the run prints `[RED] shader … is not in the shader map` for the programs the game draws with. → [Next Level Games archives of revision 4](../reference/shaders.md#next-level-games-archives-of-revision-4)
- the split leaves out archives whose members do not overlap: `[RED] <file>/<member>.szs/#7: the archive members add up to more than 16 times the file (members that overlap)`, then `[RED] <n> file(s) could not be read`, and a registered profile's build stops there. → [A Yaz0 member that expands is not overlap](../reference/shaders.md#a-yaz0-member-that-expands-is-not-overlap)
- the shader build fails one agl or terrain shader no run ever asks for, with `Ampere instruction 481 at 0x0 (000000000000000000000000020c0481) is not implemented` (a vertex shader's SPH read as an instruction); in the map, a shader whose control stage disagrees with its code (a compute control with a vertex SPH, a pixel control with a vertex SPH) and whose stored control section is longer than the file's real ones (0x200, 0x1100, 0x1400 against 0xe0). Also: no `pso_pairs.tsv` rows from a file whose lowest such entry hides its binary array. → [A control section's words read as a BAHS entry](../reference/shaders.md#a-control-sections-words-read-as-a-bahs-entry)
- `shader_split.py` finds 0 shaders in a RomFS of zstd files named `.zst`. → [Zstd files recognised by their magic](../reference/shaders.md#zstd-files-recognised-by-their-magic)
- the game asks for shaders the map does not have (`[RED] shader ... is not in the shader map`, hundreds of lines), and the split finds far fewer shaders than the game uses (121 against 27,288 on Kirby and the Forgotten Land). → [HAL's `.cmp` containers: a size-prefixed frame](../reference/shaders.md#hals-cmp-containers-a-size-prefixed-frame)
- the split finds almost no shaders and reports `[RED] /Archive/<name>.bea: entry 0 @0x4854535341 is not an ASST entry (its shaders are left out)` for every archive (`… file(s) could not be read`); the "offset" is the bytes `ASSTH`. → [Bezel Engine 2.9 archives keep their entries inline](../reference/shaders.md#bezel-engine-29-archives-keep-their-entries-inline)
@@ -807,6 +808,7 @@ One line per symptom in the [subsystem references](../reference/): what you see
- a simulation or filter that reads neighbouring texels misbehaves though every constant is right. In the translated MSL a variable is declared with no value and read at once (`int _139; int _141 = _139;`), used as a coordinate. On Ocarina of Time: grass whose blades shift at 10 Hz, with a 6-frame cycle in the depth buffer and a wind velocity texture of strong stripes. → [Dead-code removal dropped a coordinate of a multi-output instruction](../reference/shaders.md#dead-code-removal-dropped-a-coordinate-of-a-multi-output-instruction)
- the ground kept stale 32×32 blocks where the G-buffer draw failed the depth test: blocks of a stale image where a depth pre-pass and a later pass with other vertex shaders meet (Odyssey: 32×32 blocks on every fourth frame). → [Position invariance across shaders](../reference/shaders.md#position-invariance-across-shaders)
- making a pipeline archive prints `Max Unstruct ID 758 in function agc.main in shader 13941 exceeds supported limit`, and one pipeline takes many minutes, in `metal-tt` offline or in the host's prebuild on the device (`Preparing pipelines` holding one count for minutes). The line is a note, not an error: `metal-tt` goes on, exits 0 and writes that pipeline into the archive. → [Front end at -O1: Apple's control-flow lowering](../reference/shaders.md#front-end-at--o1-apples-control-flow-lowering)
- the shader build prints `fatal error: bracket nesting level exceeded maximum of 256` and `<key>.metal: does not compile`, and the shader is left out. → [Bracket nesting past the front end's 256](../reference/shaders.md#bracket-nesting-past-the-front-ends-256)
- the half of Mario facing the camera's left was white (GitHub issue 72, on an iPhone). → [min, max and clamp with a NaN operand](../reference/shaders.md#min-max-and-clamp-with-a-nan-operand)
- a pipeline red line for a float output meeting an integer attachment (the red line prints the row to add); a BC encoder's pipeline fails. → [Integer fragment outputs declared by hand](../reference/shaders.md#integer-fragment-outputs-declared-by-hand)
- `failed to create render pipeline … output of type float4 is not compatible with a MTLPixelFormatR32Uint color attachment` (or `MTLPixelFormatRGBA16Uint`); every draw into the target skipped. → [Integer entry points for integer colour outputs](../reference/shaders.md#integer-entry-points-for-integer-colour-outputs)
@@ -855,6 +857,7 @@ One line per symptom in the [subsystem references](../reference/): what you see
- `[RED] shader <key>_b reflection conversion failed: fetch call 0: frag_pos uniform reference out of range`; the shader does not load and its draws are skipped. → [Uniform references past the first kilobyte](../reference/shaders.md#uniform-references-past-the-first-kilobyte)
- the GPU hangs (`kIOGPUCommandBufferCallbackErrorHang`) from the first 3D scene on, or frames of about 88 ms, in a shader with a half-float loop. → [HADD2 and HMUL2 with an immediate](../reference/shaders.md#hadd2-and-hmul2-with-an-immediate)
- wrong shading where a shader needs a cross product or a 2D rotation of half pairs; on Eden-NS2, which first read the mode as a plain negation of the high lane, sun and cloud shadows were lost. → [HFMA2 .H0_NH1](../reference/shaders.md#hfma2-h0_nh1)
- a global load, store or atomic at the wrong address in code that uses `desc[URb][Ra.64]` (the descriptor's value added to the address); a shader with `ATOMG.CAS` refused (`Ampere instruction 3a9 ... is not implemented`); an `ATOMG.INC` / `ATOMG.DEC` / `RED.INC` / `RED.DEC` with no effect. → [Global memory: descriptors, ATOMG.CAS, INC / DEC](../reference/shaders.md#global-memory-descriptors-atomgcas-inc--dec)
- none in the log: everything drawn with an engine's scene data lands on the first instance's transform, or at nothing. In the MSL, a bounds-checked read has a constant index (`vp_s2._m0[0]`) just after a comparison of the register it should use. → [A guarded load whose destination is its address](../reference/shaders.md#a-guarded-load-whose-destination-is-its-address)
- the scene goes white with a yellow fringe: a few objects hold the largest value their target can, and bloom spreads it over the picture. Clamping a shader's terms one by one finds a value that is a register's stale contents. Or characters lit from an environment cube turn bright white in certain places only, and the cube's mean is far above its value elsewhere. → [A deferred write under a false guard](../reference/shaders.md#a-deferred-write-under-a-false-guard)
- `Ampere instruction f63` (or `f6c`, `364`, `367`) `is not implemented`, or `SURED form 0310e000`, in the build. → [Ampere forms with a handle in a register, and SURED's other operations](../reference/shaders.md#ampere-forms-with-a-handle-in-a-register-and-sureds-other-operations)
+1
View File
@@ -291,6 +291,7 @@ A decoder hands out as many outputs as it has slots, and while every slot is tak
- **Symptom:** a movie stays black with the game waiting behind it, the decoder made and no `first picture` line (`Submit…InputBuffer` never called). Or `[RED] nn::codec VP9: Corrupt frame detected`, then `Keyframe / intra-only frame required`, each time about 6 s into a movie or after skipping in one.
- **Cause:** [Mario Tennis Fever](../../dm/games/0400D4201C6EA000/README.md)'s player sends one packet per signal of the event it counts, and ignores `DecodeAsync`'s result (`nro0+0xd16130`), so each signal has to mean room for a packet. The host signalled at `Initialize`, which the player clears and drops while it is not started, and then only at releases. So nothing came after `Start`, and it never sent a packet. With a signal at `Start`, it then got one per release while a seek held back the samples, its count grew, and the host's refusal of a packet with 4 pictures waiting lost a frame for good: libvpx found everything after it corrupt until the next key frame.
- **Fix:** `Start…Decoder` signals (`cv_dec_start`). After that the event rises when a packet was taken or room came back, not at every release (`drain`), and goes down at 4 pictures waiting, while packets are refused only at 12 (`CV_READY`, `CV_HOLD`), so a signal in flight still finds room.
- **A refusal is no fault:** the refusal returns nn::codec 3603, which `NintendoSDK_movie` expects: `detail::SubmitDecoderInputBuffer` turns exactly that result into its own retry code 0x7a, which `VideoDecoder::DecodeAsync` hands back to its player, and aborts on any other failure (Ocarina of Time's `subsdk0` +0x10fd20, +0x103840). It is logged as `nn::codec <codec>: busy (result 3603), a packet refused …`, no longer as a red line (Ocarina of Time AV1, Kirby Air Riders VP9: 4 a run, movies play). A picture the host has to drop still prints `[RED] … one dropped`.
- **Check:** `t_codec_video`.
- **Found on:** [Mario Tennis Fever](../../dm/games/0400D4201C6EA000/README.md), every movie.
+24
View File
@@ -74,6 +74,14 @@ Finding, keying and translating shaders (`dm/gfx/tools/shader_split.py`, `dmsh_b
- **Pairing:** control sections are shared between programs, so pair by entry, never by searching for code near a control.
- **Found on:** [Super Mario 3D World + Bowser's Fury](../../dm/games/010028600EBDA000/README.md) (BAHS version 9).
### A control section's words read as a BAHS entry
- **Symptom:** the shader build fails one agl or terrain shader no run ever asks for, with `Ampere instruction 481 at 0x0 (000000000000000000000000020c0481) is not implemented` (a vertex shader's SPH read as an instruction); in the map, a shader whose control stage disagrees with its code (a compute control with a vertex SPH, a pixel control with a vertex SPH) and whose stored control section is longer than the file's real ones (0x200, 0x1100, 0x1400 against 0xe0). Also: no `pso_pairs.tsv` rows from a file whose lowest such entry hides its binary array.
- **Cause:** `bahs_shaders` finds the entries by scanning the table area 4 bytes at a time. An NVN2 control section's +0x38..+0x47 (instruction length, c1 start and end, code length: `L, 0, L, L`) reads as an entry `{code offset L, 0, control size L, control L bytes on}`. When L is a multiple of 0x100 and a later program's control section lies L bytes on, every check passes: the shader pairs that control with whatever code lies at L in the code region. `bahs_variations` finds the binary array at the lowest entry taken minus 0x18, so such an entry below the real ones also hid that file's variation pairs.
- **Fix:** an entry that lies inside a control section another entry names, measured by that section's own length (`ctl_len`, 0x48 key bytes for NVN2) rather than the length an entry claims, is dropped. Whether a false entry's section is genuine does not matter, as its first 0x48 bytes are a real control section.
- **Found on:** [The Legend of Zelda: Ocarina of Time](../../dm/games/0400486024DEC000/README.md): six such shaders in `agl_common`, `agl_technique`, `agl_technique_pfx` and `tera_common`, none of them ever loaded; one failed the build. `tera_common` gave 175 variation pairs once its false entry was gone. [Splatoon Raiders](../../dm/games/0400380020056000/README.md)' map holds the same three agl keys (`68bbe98b3bfd9876`, `18be578dfdaaffa0`, `7a4936fccf82094e`); it, Mario Kart World and Donkey Kong Bananza need their tables split again.
- **Check:** `dm/tools/tests/test_split_bahs_entries.py` (two programs and the false entry between them, taken on `main`).
### Zstd files recognised by their magic
- **Symptom:** `shader_split.py` finds 0 shaders in a RomFS of zstd files named `.zst`.
@@ -709,6 +717,14 @@ Finding, keying and translating shaders (`dm/gfx/tools/shader_split.py`, `dmsh_b
- **Found on:** [Super Mario Odyssey](../../dm/games/0100000000010000/README.md#files-and-shaders), [issue #276](https://github.com/seedds/nxnative/issues/276): the float body of `alRenderMaterialUber` (fragment `007d7e411ef14ebd`, 16,227 `if`s in one function) took 24.6 minutes and 17.3 MB of `g13s` code at `-O2`, 31 s and 1.3 MB at `-O1`. Its `-O1` graph still goes past the budget (642), at that small cost.
- **Check:** random samples of archive bases from seven games (Odyssey, Tears of the Kingdom, Breath of the Wild, Kirby, Luigi's Mansion 3, Wonder, Pikmin 4; 22 to 400 each) compile at `-O1` to vertex and fragment code within a few percent of `-O2` (Odyssey 400 bases: −0.9% / +0.01%; TotK: +0.1% / −1.0%; Kirby: −3.1% / +0.07%), with no `Max Unstruct ID` note at either level, and the front end is faster. Odyssey's full `g13s` archive of 32,864 bases builds in 15.6 minutes (exit 0); its Cap Kingdom frames 4,200 to 6,600 match `-O2` except for scattered differences of at most 3 of 255 in three of nine frames, and their GPU time per frame (`DM_NVN_GPUPROF=every:150`, three runs each on an M-series `g18g`) has medians of 4.76 to 5.05 ms at `-O1` and 4.75 to 4.83 ms at `-O2`, within run-to-run noise.
### Bracket nesting past the front end's 256
- **Symptom:** the shader build prints `fatal error: bracket nesting level exceeded maximum of 256` and `<key>.metal: does not compile`, and the shader is left out.
- **Cause:** a translated expression nests deeper than the Metal front end's default limit of 256 brackets. Ocarina of Time's compute shaders `1f78730053feb036` and `e172bd7ec218ab8e` (3.5 MB of MSL each) reach 259.
- **Fix:** every library compile passes `-fbracket-depth=1024` (`dmsh_build.py` `METAL_DEPTH`, `ios_metal.py` `DEPTH`). A source within the old limit compiles to the same bytes with the flag, on macOS and iOS. Like the precompiled header, the flag is not in the compile records, so the Metal cache keeps every library already compiled.
- **Found on:** Ocarina of Time (Switch 2, `0400486024DEC000`, PR #1299); both shaders now compile.
- **Check:** `test_shader_pch.py` (`BracketDepth`: 300 nested brackets fail without the flag and compile with it, the test shaders' bytes are unchanged, and both builds take the same depth).
### min, max and clamp with a NaN operand
- **Symptom:** the half of Mario facing the camera's left was white (GitHub issue 72, on an iPhone).
@@ -1124,6 +1140,14 @@ Finding, keying and translating shaders (`dm/gfx/tools/shader_split.py`, `dmsh_b
- **Found on:** [Pokémon Pokopia](../../dm/games/0400A3A01EE4C000/README.md): 10,177 instructions in 7,590 programs. The fix made no visible difference in its tutorial area.
- **Check:** `DMSH_TEST_XLATE=<translator> python3 dm/gfx/tests/test_dmsh_ampere_mem.py`.
### Global memory: descriptors, ATOMG.CAS, INC / DEC
- **Symptom:** a global load, store or atomic at the wrong address in code that uses `desc[URb][Ra.64]` (the descriptor's value added to the address); a shader with `ATOMG.CAS` refused (`Ampere instruction 3a9 ... is not implemented`); an `ATOMG.INC` / `ATOMG.DEC` / `RED.INC` / `RED.DEC` with no effect.
- **Cause:** `AGlobalAddress` added the uniform register in every uniform form. nvdisasm (sm_86) names two forms: `[Ra.64+URb]`, where URb is part of the address, and `desc[URb][Ra.64]` (bit 76 of LDG / STG, bit 71 of ATOMG / RED), where it is a memory descriptor (the compiler's cache policy) and the address is Ra.64 alone. Unreal Engine 5.4's bounded read (`LDG.!P0 R5, [R5 + UR4]`, `GuardedWrites`) is the first form and is unchanged. Opcode 0x3a9 was not registered; INC and DEC have no case in `EmitAtomicOp`.
- **Fix:** `AGlobalAddress` takes the form's descriptor bit; `AAtomgCas` (0x3a9, 32 bits: Rb expected, Rc at 64 the new value, the old value returned); `AGlobalIncDec`, a compare-and-swap loop as ATOMS's, for ATOMG and RED.
- **Check:** `DMSH_TEST_XLATE=<translator> python3 dm/gfx/tests/test_dmsh_ampere_alu.py` (`GlobalMemory`: the three fail on `main`). A GPU cross-check of 300 LDG / STG / ATOMG / RED from an nvdisasm-validated corpus (sm_86 and sm_80 compiled code), as one-thread compute shaders through a gmem_map the harness builds as the host does (`dmsh_abi.h` `DMSH_GMEM_MAP_*`), production options: 135 identical to 300. Which forms NVN's compiler emits for games is not known here: the descriptor form is CUDA's usual one, and no game note in this repository shows it.
- **Found on:** cross-checking the translator against nvdisasm and a reference interpreter; no game run.
### A guarded load whose destination is its address
- **Symptom:** none in the log: everything drawn with an engine's scene data lands on the first instance's transform, or at nothing. In the MSL, a bounds-checked read has a constant index (`vp_s2._m0[0]`) just after a comparison of the register it should use.