Repository navigation
A vertex library with layer entry points of its own gets bases for its main0 pairs: Ocarina of Time's 230 ms camera-turn hitch in Hyrule Field goes to 39 ms - #2065
Conversation
…s main0 pairs: pso_offline.py and the host prebuild looked for render_target_array_index anywhere in the library, not in the entry the pair uses, as the shader loader does, so Ocarina of Time's effect vertex shaders (no stage inputs, no stand-in) were compiled at their first draw: a 230 ms frame at a camera turn in Hyrule Field, 39 ms after (M6, 2,675 more bases) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ayer entry points of its own gets bases for its main0 pairs: Ocarina of Time's 230 ms camera-turn hitch in Hyrule Field goes to kept both sides of dm/games/0400486024DEC000/README.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
I reviewed this against an independent local audit that found the same library-wide layer detection gap. The host/offline planner change also passes our complete graphics suite on a local OOT integration, with unchanged shader outputs; that integration result is supporting evidence, not an exact-branch gameplay measurement of this PR. I prepared a small test-only follow-up on your exact It makes the negative control actually write On Apple M4 Max / macOS 27.2 / Xcode 27.2:
Feel free to cherry-pick the test commit. No game files, extracted shaders, saves or private diagnostic captures are included. No other-game or iOS execution is claimed. |
…out), and the host and pso_offline.py read nothing else for it: a library with layer entry points of its own gets bases for its main0 pairs, and Ocarina of Time's 230 ms camera-turn hitch in Hyrule Field goes to 39 ms (PR #2065); chain d403eb0683df Three places guessed the layer from the library's bytes (render_target_array_index anywhere in the file), each in its own way. shader_load excepted a library with layer entry points (entry_layer, main0_l: they alone write the layer, main0 writes none); pre_desc and pso_offline.py did not, and left every pair of such a shader out of the device prebuild and the bundled archive. Ocarina of Time's effect vertex shaders have no stage inputs and so no stand-in: each pair was compiled at its first draw (34-74 ms per pipeline). dmsh_build.py layer_out: main0's output writes render_target_array_index. The vertex reflection and the geometry output reader's (<key>_bgv) carry "layer_out": true then; layer entry points do not count. shader_load, pre_desc and pso_offline.py plan read it; t_lib_layer, its two byte scans and pso_offline's LAYER scan go. So do the two retries that rebuilt a pipeline after Metal refused it naming render_target_array_index (the draw and the background prewarm, Pokémon Legends: Z-A's layered full-screen passes): they stood in for the fact the reflection did not hold. Measured by the PR on its form of the rule (same bases): Ocarina v131072, M6, field-run, two runs each: archive bases 30,690 -> 33,365, worst frame 230.3 / 234.1 ms -> 38.8 / 39.6 ms, pipeline waits over 20 ms 4 / 4 -> 0 / 0. Not re-measured on this form. Checks: test_dmsh_layer_out.py (new), test_pso_offline.py, test_docs.py and the other tool tests (106 OK); t_pso_bundle 71, t_pso_warm 123, t_pso_archive 230, t_geometry 1,929 checks, 0 failed; lint_c tidy: nothing above the baseline. Regression: not run on this form (skipped by choice). The PR's regress check of its form passed on Ocarina and Smash (all shaders built, 0 changed MSL, interface clean). Octopath Traveler II (198 shaders with layer entry points, 29 geometry readers) and Z-A (the retries' case) are the games to check on this chain. Co-authored-by: Ray McDonald <54215218+Raymon82777@users.noreply.github.com>
|
Thanks: the diagnosis and the measurements were right, and they landed in 5e1c1ae (with you as co-author), in a different form. Instead of a third copy of the loader's rule, whether a vertex shader writes the layer is now in its reflection:
Your bench routes, the reference entry (rewritten for the new fix), the Ocarina note line and the test cases are kept; Not re-measured on this form: the bases should be the same as with your rule, but if you rebuild Ocarina on the new chain, a |
…ed commit, which the next merge brings Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Conflicts resolved by hand: - seedds#2085, seedds#2078 and seedds#2065 came back from upstream as reworked commits (6f50de0, 12a44e0, 5e1c1ae): our three merges were reverted first, so the merge brings upstream's version instead of two copies. - GPU copies into a texture (copy_b2t, mirror_rb_land, nvn_obj.h): upstream's seedds#1310 rework (mspan_t, pkg_copy_absorb, for the readback case) and our seedds#2077 (mirror_rb_own, gsb_mark, for a texture the GPU owns) cover different cases and both stay: own = !rb is taken before the synchronous mirror, so the two paths exclude each other. mirror_rb_own passes no span. - loader.c: upstream's render-scale parse with the stub's largest scale (Hades II) and our graphics-scale tier block. t_readback.m: upstream's additive tests added to ours. pso_offline.py: its header comment. Docs and tables keep both sides; DM_RENDER_SCALE rows, render_base and the settings table take upstream's Hades II range plus our text. - dmsh_chain.h regenerated; .github/workflows/tests.yml follows upstream (a test list). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
seedds#1901 seedds#1459 seedds#1928 seedds#1942 seedds#1940 seedds#1952 seedds#1611 seedds#2065 seedds#2083 seedds#2008 seedds#2079 seedds#2022 seedds#2075 seedds#2077 seedds#2020 seedds#2021 onto main 04811a6 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014eD437mxrMnW2UwLZhpwc7 Upstream pull requests applied in this commit (their authors' work, brought onto this tree with a three-way merge; the description is in each PR): - seedds#1459 by PromethOps (open): DM_UPSCALER=metalfx takes agl's agl_ndsr_vr.pck networks too, and a variant with no curve and no power is drawn as one colour space: Ocarina of Time's upscaler is MetalFX's - seedds#1611 by Esteban-V (open): An argument block whose only change is a uniform buffer is patched instead of encoded again - seedds#1774 by uncraftablexd (closed): Compute threads that exit before a barrier keep arriving at it, and every shader loop has a cap (GPU hang defences), chain change - seedds#1824 by cocoman93 (open): Clamp texel fetches past a sampled 2D texture's edge: no hard edge in Ocarina of Time's mist - seedds#1901 by FifteenPen (open): The game's compute dispatches with no game barrier between them run side by side (profile key dispatch_overlap, on for Ocarina of Time): Kokiri Forest GPU p50 15.63 → 14.76 ms - seedds#1928 by FeReuss (open): Ocarina of Time: enc_thread on, the replay encodes on a thread of its own - seedds#1929 by FeReuss (open): Unused border corrections are compiled out of pipelines that bind no sampler with a twin (function constant DMSH_BORDER_FC) - seedds#1930 by FeReuss (open): A float add to storage memory with no result read is one native atomic add instead of a compare-and-swap loop - seedds#1940 by uncraftablexd (open): A prewarm list's lines after its #@after_first_frame line are built after the first frame, in the background, instead of in the prepare step (issue seedds#1747) - seedds#1942 by uncraftablexd (open): Frame step: late frames with the GPU idle do not step up, and a longer hold the GPU does not explain is probed - seedds#1952 by AdyaGMD (open): Compute moves ahead of scene passes past occlusion queries and conditional rendering; clears wait across dispatches - seedds#2008 by bquilty25 (open): nvn: reactive memory watchdog, 16-way view cache, and texture upload batching - seedds#2020 by padsiwono (open): Ocarina of Time v131072: Output Native draws the full output size instead of the game's 80 % frame (`DM_OUTPUT`) - seedds#2021 by padsiwono (open): Ocarina of Time v131072 renders at the launcher's Resolution (`DM_RENDER_SIZE`), docked - seedds#2022 by sleepyeyedjoe (closed): Ocarina of Time: large models no longer go black for one frame twice, 4–5 frames apart, when the game streams new textures into them (a texture ID a shader has read keeps its read mark when it gets another texture) - seedds#2030 by humanperzeus (open): A NaN colour at alpha 0 is returned as 0, as NVIDIA's blender takes a zero factor: Ocarina of Time's white clouds over the ferns are gone - seedds#2035 by Know-It-All-Brother (open): The shader build runs as worker processes, and no shader waits for a batch (Ocarina of Time's cold Mac map: 3,002 s to 1,298 s) - seedds#2065 by Raymon82777 (closed): A vertex library with layer entry points of its own gets bases for its main0 pairs: Ocarina of Time's 230 ms camera-turn hitch in Hyrule Field goes to 39 ms - seedds#2075 by sleepyeyedjoe (closed): Ocarina of Time: a patch of scenery no longer draws dark for one frame when the game gives it a sharper texture (a pool texture the walk does not make holds a stand-in of its own colours until its first read) - seedds#2077 by roandegraaf (closed): Ocarina of Time: fix the "plaid" terrain / missing texture tiles (GPU-drawn textures now reach the storage the game copies) - seedds#2079 by uncraftablexd (open): Render pipelines that share a vertex function are taken from the archive or compiled one at a time: the AGX driver crashes in createVertexProgramVariant's completion block - seedds#2083 by FifteenPen (closed): Ocarina of Time's prewarm list gets 41 more task / mesh pipelines from later play
What
A vertex library with layer entry points of its own (
entry_layerin its reflection,main0_l) writesrender_target_array_indexonly in those entries; itsmain0writes none. The shader loader already takes the layer from the entry it uses (shader_load,layer_out). The offline archive (pso_offline.py,writes_layer) and the device prebuild (pre_desc) instead looked for the layer anywhere in the library, so every pair of such a shader was left out of both.Ocarina of Time's effect vertex shaders are such libraries and have no stage inputs, so no stand-in pipeline either: each pair was compiled at its first draw while the frame waited (34-74 ms per pipeline). Both places now follow the loader's rule. A library without layer entry points whose code writes the layer is still left out.
No shader or chain change; the pipeline archive is rebuilt. A host with this fix and an archive built before it finds bases the archive lacks, distrusts it, and builds the prebuild on the device in the background, as for any incomplete archive.
Measured
Ocarina of Time v131072, Apple M6 (applegpu_g18g), macOS 27.2,
bench.pyroutefield-run(added here: a Hyrule Field save, camera turn at about 105 s), two runs each,DM_PSO_WAITLOG=1:The stall at the camera turn (210-214 ms at 105.5 s, and a 50 ms frame after it) is gone. A 39 ms frame at about 117 s remains (one pipeline of 15-20 ms, under the wait log's threshold), recorded as open in the reference entry. Measured on a branch with an earlier main; the change applied here unmodified.
Checks
dm/tools/tests/test_pso_offline.py: a library withentry_layergets itsmain0base (withtest_docs.py: 51 tests, OK).t_pso_bundle: the prebuild gives such a library'smain0a base, and a library whosemain0writes the layer gets none (71 checks, 0 failed).scripts/regress.py check --games 0400486024DEC000,01006A800016E000against04811a63: PASS on both (Ocarina 42,848/42,848 shaders, Smash 35,012/35,012; 0 newly failing, 0 changed MSL, interface 0 new / 0 known). Neither game has asmoke.tsvhere, so this run is the static part only; the runtime evidence is the bench above.Docs
docs/reference/shaders.md"Vertex shaders with layer entry points left out of the prebuild", the Ocarina note's "Found on this game", the symptom index, and thefield-run/field-stillbench routes.🤖 Generated with Claude Code