Repository navigation
patches: fix CPU BC texture uploads and views - #888
Conversation
Keep decoded textures off the GPU block-copy paths and map views to their unpacked formats. Add production GPU regression tests and document A15 evidence and compatibility limits.
|
Reviewed d3249e0 and obtained an independent code review. No actionable code finding remains for this focused upload/view fix. Local validation on Apple M2 Max: The reported historical A15 gameplay is useful supporting evidence, but I am not treating it as a current-pin phone run. Raw compressed-block views, encoding/readback and broader copy behavior remain outside this fix. Assigned v1.2.4 and approved the three held CI runs after review. Merge still waits for those exact-head checks and the required CI-built Mac app trial. Patch 0088 is currently the next free number on main and will be checked again at merge time. I will compare the overlapping #776 after this lands, while #446 still contains separate work. |
thehobbit85
left a comment
There was a problem hiding this comment.
Approved d3249e0. Independent code review found no actionable issue in this focused CPU-BC upload/view repair. Local patch validation passed (56 patches), and the actual production GPU regression passed 349 checks on Apple M2 Max with Metal API validation enabled. Native BC retains its existing capability/opt-in gate.
All current-head CI checks passed, including the engine/host/tool/iOS tests and app build. Maintainer app trial used tools/try-pr 888 and build 42350521347 at this exact head. NX2Apple 1.2.3 launched with bundled engine b2d46b86d03f4b03afe11ea61c67cdf00d7a5345-5e5456d86c7d. Library/Settings/Builds navigation and the manual app update check worked, and the app quit normally.
This is not a fresh current-pin phone gameplay run. The reported historical A15 evidence remains attributed to the contributor. The new local GPU regression checks this patch's current-pin production paths, while raw compressed-block views, encoding/readback and broader copy behavior remain outside the change.
Patch 0088 is the next free number on current main, so no renumbering is needed. Milestone v1.2.4. Ready for a normal GitHub merge.
|
Independent corroboration from an A15 Apple TV 4K (third generation, 64 GB), tvOS 27.2, using a custom tvOS frontend and Mario Kart 8 Deluxe 4.0.1 ( In an earlier NX2Apple-derived engine, menus rendered with severe blue/striped corruption. We independently traced the same upload issue: GPU deswizzle copied compressed BC blocks into CPU-expanded textures. A synthetic Mac reproduction forced the production CPU BC path and aborted under Metal validation with sourceBytesPerRow 16 below the decoded minimum 32. Gating the GPU upload routes for decoded BC textures fixed that reproduction (46 known-pixel checks across BC1/BC3/BC4, two mips and two array layers). The native/direct-upload suite passed 26,384 checks. After the equivalent local upload fix plus decoded view-format handling, the player confirmed that both menus and a race rendered correctly on the Apple TV. This was a separate backport against the older engine ( We checked #888 and patch 0088 and found the same upload/view mechanism already covered, with broader regression coverage. No duplicate code PR is proposed. This report was prepared with Codex from local reproduction logs and the player's device confirmation. Validation limit: menus and race visuals only; no completed-race, all-course or long-session benchmark is claimed. |
Fix or feature
What and why
Addresses #732. With the existing CPU BC compatibility option enabled on an A15, the texture descriptor allocates unpacked pixels but the GPU upload paths still copy compressed blocks. Wonder's character-selection screen becomes striped/noisy. Registered views can then request BC formats on R8/RG8/RGBA8 backing textures and abort in Metal validation.
This patch keeps CPU-decoded BC textures on the existing decode/upload path and resolves sampled, render-target and clear views to the corresponding decoded Metal formats. It preserves format-specific channel mapping, the compatibility opt-in and the native BC path.
This overlaps the upload/view portion of #446 as a small, independently tested fix on the current main pin. Raw compressed-block views, GPU BC block encoding, decoded-to-compressed readback and broader copy-path changes remain outside this PR.
Upstream status is
fork-only (declined seedds/nxnative#488), following the maintainer's explicit acceptance of that exception. This repairs the fork's existing decoder rather than submitting the declined feature upstream again.Checked
python3 tools/engine.py checkpasses, 56 patches apply to upstreamb2d46b86d03f.make -C dm/gfx/tests GAME=010015100B514000 check_t_bc_cpu, 349 checks, 0 failures, Metal API validation enabled on an Apple M4. The test includes the production implementation and forces its CPU BC path without adding production test hooks or using game assets. It checks pooled uploads/reuploads, partial blocks, three mips, two array layers, both direct-upload settings, all 16 BC format views, attachments and clears.t_bc_cpu uploadsaborts withsourceBytesPerRow(16) must be >= (28)andt_bc_cpu viewsaborts because RGBA8Unorm storage is incompatible with a BC1_RGBA view. Both modes pass after the fix.DM_FRAMEWORK_BUILD=1, 0 failures in either.scripts/regress.py check --baseline HEAD --candidate worktree --games 010015100B514000,0100646009FBE000 --quick --no-smoke. Wonder: 12,811/12,811 shaders, Dead Cells: 1,262/1,262, zero new failures, changed MSL or interface mismatches. These are the two available local NVN builds. The narrower game set is complemented by the format-level GPU regression above. This was a static comparison, not fresh full-game smoke runs.010015100B514000, 1.0.0) on iPhone 13 Pro Max / A15, iOS 27.0.1, before and after the equivalent local upload/view fix. The fixed character-selection screen ran at about 60 fps. These images are from the earlier engine, not a new full-game validation of this PR's current pin. Later levels, raw BC block encoders/readback and a fresh current-pin phone run were not tested.Screenshots
No launcher UI changes. Historical gameplay evidence for the equivalent local fix:
Before (striped rectangles around the characters):
After (same character-selection screen):
Scope
patches/, exported withtools/engine.py exportand checked withtools/engine.py check.