Repository navigation
[DRAFT] nvn: opt-in native-size window copy (experimental) - #1140
oliverames wants to merge 9 commits into
Conversation
|
@seedds, an update on Switch 2 games running on iPhone: I've continued testing Donkey Kong Bananza on a physical iPhone 17 Pro Max (A19 Pro, iOS 27.2). The combined local build retains a 1676×943 gameplay scene, MetalFX output at 2304×1296, and a 2346×1320 actual drawable. A 350-second movement/attack run had 33 complete reporting windows: 26 at 33.34 ms on-screen p99 and seven at 50 ms, with four dropped frames and one discarded frame reported. Thermal state stayed 0. The slow windows have nearby game-requested interval changes; this does not establish their cause. Fur shimmer remains unresolved. A separate 70-second comparison changed only DM_PRESENT_LATENCY to 2. All six complete windows had 33.34 ms p99 and no drops/discards at thermal state 1. That's a bounded result, not a sustained-performance claim or a proposed default change. I also ran the existing t_clear_ds fixture against the combined renderer in a separate signed iPhone app: all 11 cases and 59 checks passed on A19 Pro with Metal API Validation explicitly enabled. This includes the full-depth/masked-stencil cases from your landed depth-clear fix. The wrapper includes the fixture unchanged and records source hashes and GPU readback results. This is physical iPhone coverage of the shared clear paths; other titles and devices still need their own validation. These runs are from the combined local build, not this PR's exact head. This PR stays draft pending presentation lifetime/resize/finalization coverage and resolution of the upstream draw-wrapper conflict. Commit 099e3cd fixes the environment-table ordering failure; the targeted test passes locally. I'm reconciling the remaining work into focused PRs and will reuse existing contributions where the work overlaps, rather than duplicate the border proposals. |
|
The upstream conflict is resolved in c432195, preserving mesh-task dispatch and window-copy tracking. Commit 3d436cf adds 17 focused checks for window-copy target retirement, texture-object reuse, crop mapping, discarded-present cleanup and late-access/second-draw fail-stop guards. These checks passed on the physical iPhone 17 Pro Max (A19 Pro, iOS 27.2) with The fixture seeds window-copy entries and calls production ownership paths. It does not prove The longer DKB latency2 experiment also failed to establish steady pacing: a 350-second route had nine slow reporting windows at thermal state 0. Scene 1676×943, MetalFX 2304×1296 and drawable 2346×1320 remained intact. I restored default latency1 and completed another 70-second gameplay check with fresh log and memory data; it also had dips at thermal state 1. Neither setting is a sustained stability fix. These gameplay results still describe the combined local build, not this PR head. |
|
@seedds The physical iPhone regression coverage for this Switch 2 games on iPhone work now includes production The new case creates a 4×4 target for a synthetic 8×8 window, takes a present reference, queues an offscreen GPU clear/readback behind a shared-event gate, then resizes to 2×2. It checks that the old target remains registered, verifies all 16 returned pixels after releasing the gate, and verifies retirement after releasing the present reference. Run ID: Limits remain explicit: shader reflection and draw state are synthetic; the clear uses a direct Metal encoder, and release is manual after command completion. This does not test the production redirected copy draw, actual presentation, or its completion callback. No renderer or DKB settings changed, and no exact-PR-head gameplay or pacing/fur improvement is claimed. Keeping this PR draft. The generic iPhone runner is in #1153; this fixture uses the local runner's window_copy selection. |
|
@seedds: the regression now exercises the production redirected textured draw, including attachment selection and viewport scaling, then verifies all 16 pixels against a literal asymmetric color pattern. The fixture passed 31 checks with zero failures on both the Mac and the physical iPhone 17 Pro Max (Apple A19 Pro, iOS 27.2), with Metal API Validation Enabled in the device log. The three RED messages are deliberately triggered by the existing negative guard cases. This extends the Switch 2 games running on iPhone work prompted by Donkey Kong Bananza. The test may protect other titles using the same window-copy path. It does not establish game-shader equivalence, actual drawable presentation, or the production present completion callback; the PR remains draft. Reproduce the Mac check with |
|
Added the production present-completion regression in 957061c. From The test redirects the asymmetric textured draw, enqueues the window, invokes the production display-link callback with an offscreen drawable, and gates GPU execution while resizing. Completion releases the retired target without a manual release, and readback preserves all 16 expected drawable pixels. The three RED messages are expected negative-guard cases; no Metal validation errors appeared. This remains draft. The earlier 31-check fixture passed on iPhone 17 Pro Max, but this new completion case has only run on Mac. Visible screen output and real display-link scheduling remain unverified by this fixture. No renderer behavior changed in this commit. |
|
Fixed the fixture-specific findings in c4f44f2. Shader-compilation failure now releases the registered window and restores the present-list count; vertex-allocation failure goes through the existing registry cleanup. The buffering call is now checked The cleanup alone removed the The updated executable behavior passed 32 checks with Metal API validation on M2 Pro. No allocation-failure injection or new iPhone run was performed. The prepared build-04 predates this cleanup and must be rebuilt before exact-head phone verification. This PR remains draft; physical presentation and sustained gameplay gaps are unchanged. |
|
@seedds, update on the experimental Switch 2 games running on iPhone window-copy PR: current head 312d6a8 includes the shared lint prerequisite from #1164. The production offscreen draw/present/completion regression passes 32 checks with Metal validation on M2 Pro, and targeted renderer/fixture analysis passes the ratchet. A signed iPhone fixture is prepared from this exact head but has not run; older Newt evidence covers the preceding 31-check fixture. This stays draft: actual physical presentation, display-link scheduling and sustained DKB gameplay on iPhone 17 Pro Max remain gaps, and the late-access path is still explicitly fail-stop rather than a safe fallback. |
|
@seedds Physical iPhone update for the Switch 2 games running on iPhone work: the window-copy fixture built from current head The fixture exercises production target creation/reuse/resize, redirected textured draw and viewport scaling, asymmetric 16-pixel readback, gated offscreen present, and completion-driven retention/release. Reproducer: the The callback is manually invoked. This does not verify actual display-link scheduling or physical-screen output, and it is not a DKB pacing or sustained warm-gameplay result. The reusable presentation coverage may help other titles, but the feature remains experimental/draft. Our installed-artifact provenance is the recorded build/install/run-ID chain, not an independent hash read back from the phone executable. |
|
@seedds Reconciled this Switch 2 / iPhone experiment with current upstream and the repaired #1164 prerequisite at head |
|
Head a06e88c fixes the one clang-tidy finding this branch caused. Merged with main, this PR's changes to clang-tidy run 41840587830 on a06e88c now fails only on four pairs from files this PR does not touch, which also fail on main: run 41819072419 at 0b8e0dc ( |
…d cannot leave it uninitialized for the analyzer
a06e88c to
c3a677d
Compare
|
Closing this experimental prototype PR; native-size window copies require per-game heuristics and will not be pursued. |
This is an experimental, off-by-default window-copy path. For an explicitly allowlisted pure-copy shader, it redirects the final window pass into a host target sized to the drawable's letterboxed viewport, preserves the game's shader and sRGB target view, then presents that target 1:1. It removes one resample; the present draw remains.
DM_NVN_WINDOW_COPY=[verify:]<fragment key>[:<vertex key>][,...]enables it.verify:checks and logs the gates without redirecting. The change includes the coverage proof for a two-triangle quad, associatedt_covercases, and ownership through queued-present completion or drop. Each window texture gains a host target; the original full-size window texture remains allocated.Late original-window access is a fail-stop diagnostic. The redirected picture isn't copied back, so a later read can see stale contents and contaminate game state. A
[RED]stop invalidates the run; it isn't a repaired fallback. Unusual cross-submission paths haven't been formally proved, and resize/finalization still need runtime coverage.Scope and dependencies
Based on upstream main
1b94fab298fb1014314e776d33a701b5f68c6c3a, with only five changed files. Extracted from a local source snapshot based onc7ba23df. All retained hunks matched current main exactly except one context adjustment besidemtl_tex_release: current main'swas_liveoptimization is preserved. No unrelated source or upstream changes were imported.This doesn't include the drawable capture in #1136, half/byte attribute decoding in #1137, the upscaler size-transition logger, profiler counter-order fix, or DKB game note. The feature has no source dependency on #1137, but DKB's half-float/unsigned-byte quad requires #1137 to pass the proof. That dependency is separate and isn't included here. Neither existing PR was changed.
Evidence and remaining validation
The parent reported the following on an earlier local source version, before the newest late-access checks:
[RED]errors. Measured gameplay windows held 33.34 ms display intervals; a later route had 20 fps dips, so this isn't a claim of sustained performance across routes.t_cover: 31 checks passed, including 16 new quad-proof checks. These aren't GPU or lifetime tests.The latest late-access checks have since run in a combined local build on Newt, a physical iPhone 17 Pro Max running iOS 27.2. The installed executable SHA-256 was
37de3a284c1e27176d3d274fd7384ae9d99d6d6aef1659cbd7f24380866551fa, with shader chain215a6d278114. This build also includes MetalFX, border-shader optimization and mesh batching, so these results do not isolate this PR's performance effect.Two docked routes each drove 70 seconds of movement and attacks, with fresh host logs, constructor memory traces and actual-drawable PNGs. Both retained the logged 1676x943 to 2304x1296 gameplay scaler sizes and produced 2346x1320 captures with intact terrain and character detail. No window-copy fail-stop was reported. At thermal state 0, all six complete 300-frame windows had p99 33.34 ms intervals and zero drops. A repeat at thermal state 1 had three 50 ms windows, two 33.34 ms windows and one dropped frame. Sustained 30 fps remains unresolved.
A separate 70-second handheld route exercised the refusal path: the cropped scissor failed the whole-window proof, zero passes were redirected, and the ordinary crop presentation remained intact. Local evidence is recorded under
logs/dkb-sharpness-2026-11-03/inborder-summary.json,border-handheld-summary.json,border-restored-summary.json, and the corresponding logs, memory traces and PNGs.This draft was extracted and checked for file/diff scope, including the published file bytes. No build or device run was performed for this exact head, and there is no published-head regression report, GPU/lifetime test, resize/finalization runtime coverage or cross-game validation. The repository's required build, lint and selected-game regression checks remain outstanding. This isn't ready to merge.
CI prerequisite update: this head includes the reviewed shared lint repair from #1164. The updated renderer and window-copy fixture have zero file/check pairs above or below the LLVM 23.1.4 baseline. The production offscreen presentation fixture passes 32 checks with Metal API validation; 11 documentation tests, the environment-switch table and whitespace checks also pass. The three documented C-registry analyzer exceptions remain narrow and unchanged. Once #1164 lands, its prerequisite changes drop from this PR's diff. Fresh hosted CI, physical-screen/display-link behavior and exact-head gameplay remain pending; prior phone fixtures and combined DKB runs retain their recorded source identities.