diff --git a/dm/gfx/tests/test_unity_known_trees.py b/dm/gfx/tests/test_unity_known_trees.py index ee1caf6956..ea74209f65 100644 --- a/dm/gfx/tests/test_unity_known_trees.py +++ b/dm/gfx/tests/test_unity_known_trees.py @@ -13,7 +13,7 @@ '2021.2': 'd8236c9bd87d85edb203acf352348124', '2022.3': 'ea424a5fc1e48db62144df956f9e1005', '6000.0': '2ec7223dce3af4232b14ae1441bd7999'} COMPUTE_HASHES = {'2017.4': '20291e020d10074c35d8286f5191593f', '2019.4': '1a95529ac2eb1a97cd9d2a4356bd722f', - '2021.3': 'abd9135b8ce83d043fef4e9ec7f53366', '2022.3': 'bfdf63ab0ce84d5a2c765ee560d90fe7'} + '2021.3': 'abd9135b8ce83d043fef4e9ec7f53366', '2022.3': 'bfdf63ab0ce84d5a2c765ee560d90fe7', '6000.3': '43a0948a3f403068c0b31bff90ba0c9a'} class KnownTreeTests(unittest.TestCase): diff --git a/dm/gfx/tools/unityfs.py b/dm/gfx/tools/unityfs.py index bd936629b2..8793193f96 100644 --- a/dm/gfx/tools/unityfs.py +++ b/dm/gfx/tools/unityfs.py @@ -262,6 +262,11 @@ class NoTree(ValueError): # Return of the Obra Dinn's stripped built-ins use this hash; its internalskinning object (12 kernels) reads to its exact end. COMPUTE_2017_4 = COMPUTE_2019_4.replace('int samplerBindPoint; int texDimension', 'ComputeBufferCounter counter') + \ 'ComputeBufferCounter: int bindpoint; int offset\n' +# Unity 6000.3.11f1 (Hello Kitty Party Land: its stripped built-ins in Data/Resources/unity default resources, GPU skinning among them, and Data/globalgamemanagers.assets carry no +# type trees): AssetRipper's StructsDump/release/6000.3.11f1.dump, class 72, checked node for node with the alignment flags. 2022.3's layout with a resType per resource and +# threadGroupSize a staticvector again +COMPUTE_6000_3 = COMPUTE_2022_3.replace('int texDimension', 'int texDimension; int resType').replace( + 'vector~ threadGroupSize', 'staticvector~ threadGroupSize') CLASS_COMPUTE_SHADER = 72 KNOWN_TREES = {(CLASS_SHADER, bytes.fromhex('ea424a5fc1e48db62144df956f9e1005')): ('Shader', SHADER_2022_3), (CLASS_SHADER, bytes.fromhex('d8236c9bd87d85edb203acf352348124')): ('Shader', SHADER_2021_2), @@ -270,6 +275,7 @@ class NoTree(ValueError): (CLASS_SHADER, bytes.fromhex('ed2a06ce7fb8203f6efb5ab5e0ce20d5')): ('Shader', SHADER_2019_4), (CLASS_SHADER, bytes.fromhex('8db760073e1392061e4a36995f0735af')): ('Shader', SHADER_2018_3), (CLASS_SHADER, bytes.fromhex('266d53113fa30d2b858f2768f92eaa14')): ('Shader', SHADER_2017_4), + (CLASS_COMPUTE_SHADER, bytes.fromhex('43a0948a3f403068c0b31bff90ba0c9a')): ('ComputeShader', COMPUTE_6000_3), (CLASS_COMPUTE_SHADER, bytes.fromhex('bfdf63ab0ce84d5a2c765ee560d90fe7')): ('ComputeShader', COMPUTE_2022_3), (CLASS_COMPUTE_SHADER, bytes.fromhex('abd9135b8ce83d043fef4e9ec7f53366')): ('ComputeShader', COMPUTE_2021_3), (CLASS_COMPUTE_SHADER, bytes.fromhex('1a95529ac2eb1a97cd9d2a4356bd722f')): ('ComputeShader', COMPUTE_2019_4), diff --git a/docs/reference/shaders.md b/docs/reference/shaders.md index d275f71316..1736620472 100644 --- a/docs/reference/shaders.md +++ b/docs/reference/shaders.md @@ -338,6 +338,7 @@ Finding, keying and translating shaders (`dm/gfx/tools/shader_split.py`, `dmsh_b - **Older layouts:** Unity 2019.4 stores each kernel's code directly, without `uniqueVariants` or `variantMap`. `unity_compute` accepts that form too, and `COMPUTE_2019_4` supplies the stripped-file layout. Found on [Pokémon Brilliant Diamond](../../dm/games/0100000011D90000/README.md) (2019.4.27f1); its missing runtime shader is the built-in GPU skinning kernel. The layout matches the release dump's 116 nodes and alignment flags, and both built-in compute objects decode to their exact ends. - **Unity 2021.3:** `COMPUTE_2021_3` covers stripped class 72 hash `abd9135b8ce83d043fef4e9ec7f53366`, matching all 144 nodes and alignment flags in [AssetRipper's 2021.3.18f1 release tree](https://github.com/AssetRipper/TypeTreeDumps/blob/main/StructsDump/release/2021.3.18f1.dump). Kernel parents use `variantMap`, global and local keywords; each kernel holds byte-vector code, a `staticvector` thread group size and signed 64-bit requirements. Unlike 2022.3 there are no `uniqueVariants`, `variantIndices` or dynamic keywords; both versions store code as bytes. `resourcesResolved` aligns after every platform variant, including when another platform follows. The synthetic tests cover two platforms, multiple keyword variants, byte-code padding, exact object consumption and shader provenance. Found on Shin chan: Shiro and the Coal Town (Unity 2021.3.18f1): [PR #440](https://github.com/seedds/nxnative/pull/440) reports recovered GPU skinning kernels and correctly rendered characters on the iPhone; that gameplay result has not been independently repeated here. - **Unity 2017.4:** [Return of the Obra Dinn](../../dm/games/010032E00E6E2000/README.md) needs hash `20291e02…` for stripped `internalskinning` objects. `COMPUTE_2017_4` restores the nested buffer-counter fields; all 120 nodes and alignment flags match the release dump. The game note records the object census and exact-end checks. +- **Unity 6000.3:** Hello Kitty Party Land (Unity 6000.3.11f1, provisional profile) needs hash `43a0948a…`: its characters drew as huge stretched triangles, with `[RED] … unity default resources: ComputeShader objects that no bundle lends a type tree to and unityfs.py has no layout for` in the split and `the dispatched program has no compute shader` in the run, since the built-in `Internal-Skinning` kernels were left out. `COMPUTE_6000_3` is the 2022.3 layout with an `int resType` after each resource's `texDimension` and `threadGroupSize` a `staticvector` again; it matches all 159 nodes and alignment flags of [AssetRipper's 6000.3.11f1 release tree](https://github.com/AssetRipper/TypeTreeDumps/blob/main/StructsDump/release/6000.3.11f1.dump). All 11 objects in `Resources/unity default resources` and `globalgamemanagers.assets` read to their exact ends (`Internal-Skinning` 40 kernels, `Internal-BlendShape` 9); the split finds 92 compute shaders instead of 1, and the Mac app draws the characters right. - **Registered tables after a reader update:** a newly supported layout can add kernels to an existing game's shader map. For registered module builds, the NSP script permits a shader-only derived profile only when every original shader's package, stage and source, every original fact and every evidence pair remain unchanged (package indices may move), and every added shader is compute with matching key/source evidence from `unity_compute`. Each added kernel must also have its fact row. Registered settings, build rows and cuts are retained; the repository tables are not edited. A cached comparison pins the registered tables, split inputs and comparison code. Deleted or changed original rows, graphics additions and additions without reader evidence still stop the build. The incremental-build tests cover acceptance, rejection and cache invalidation. - **Note:** a file whose `ComputeShader` has no tree still goes to the second pass; if it has none there either, the split prints a `[RED]` line and leaves its kernels out instead of stopping. The original bring-up omitted stripped objects in [Cuphead](../../dm/games/0100A5C00D162000/README.md) (2), [Fire Emblem Engage](../../dm/games/0100A6301214E000/README.md) (4) and [Raging Loop](../../dm/games/010020400E1C2000/README.md) (2 built-ins; no compute dispatched). Their type hashes were not recorded, so their compatibility with the newer layouts remains unchecked. Unity 2017.4.9f1, 2017.4.17f1 and 2017.4.28f1's published class 72 release dumps are identical, but that does not establish the hashes in Cuphead or AI: THE SOMNIUM FILES.