fix(agc): read direct FMASK images from metadata snapshot #4790
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4790"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T22:02:27Z.
What
Replace the hard-coded direct FMASK
IMAGE_LOADresult with a snapshot that reads the guest FMASK and its CMASK metadata, resolves supported fast-clear and expanded-tile states, and exposes the result as a linear 32-bit image. Unsupported FMASK formats, layouts, selectors, mip states, fragment indices, and CMASK codes still throw.This carries the two FMASK layout/implementation commits from Romans Pokrovskis, preserving their original commit authorship. A separate MarcZX100 compatibility commit adapts the carried implementation to the current
GuestTextureResourcemodel and retains the current multisample-target guard.The CPU regression covers FMASK/CMASK addressing and snapshot values, including clear tiles, expanded tiles, mixed tiles/layers, and rejected metadata states. The existing Vulkan-backed
FmaskImagestest is included for hardware execution.Evidence and limits
Issue #3219 includes a Windows RTX 5080 synthetic
IMAGE_LOADreproduction: raw FMASK bytes remain unchanged while CMASK switches between expanded and fast-clear states, and the old shader output remains constant. The issue reports validation of its hardware fixture, but this PR’s Linux run did not execute the Vulkan FMASK integration test or validate GPU decoding. The console configuration, exact DCC extent, and full hardware mapping remain unconfirmed.Tested
agc_driver_graphicspassed (1/1) on currentmainbaseee496219007b05e054a469fe12330f7e38e5451a.python3 tools/check_conventions.py --base upstream/mainpassed.git diff --check upstream/main...HEADpassed.FmaskImagestest and PS5/GPU validation were not run here.Checklist
main; no open PR implements direct FMASK reads with CMASK interpretationNotImplemented_nid_no_patchImported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-13T01:41:54Z.
A hardware run of
FmaskImages, since the description says the Vulkan test and GPU decoding weren't run.Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head 4f0c50c88 merged into
main284a1c334, which passes 1020 of 1020 on both GPUs.agc_driver_fmask_images,agc_driver_graphics,agc_descriptor_pool_reset_failureandagc_compute_descriptor_layout_flagspass on both GPUs with--repeat until-fail:3. The full suite (ctest --timeout 120 --parallel 4) passes 1021 of 1021 on both.agc_driver_fmask_imagesreports13 read cases, 5 unsupported-input refusals, negative controlon both GPUs, with the same values on each. With the FMASK bytes left at76543210,cmask-fast-clear-same-address(CMASKcc) reads0, andexpanded-restored-same-address(CMASKff) reads76543210again. That is the #3219 case.mainwith onlyFmaskImages.cppadded, the test fails on both GPUs at its first FMASK case:expanded-fmask observed output differs from diagnostic prediction: lane=0 component=1 value=4275878552. That value is the0xfedcba98thatSpirvImageEmitter.cpp:1637onmainputs in the second component. The production files can't be reverted on their own, because the newFmaskTexture.cppneeds this branch'sColorTargetLayout.hpp.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:43:20Z.
Which title reads an FMASK image? #3219 is a synthetic reproduction.
cachedTexturenow rebuilds the snapshot on every lookup with a per-texel CPU loop (ShaderResources.cpp:522-540) and throws for CMASK codes other than 0xC and 0xF, where main returned a constant, so this needs a run of a title that reaches it: the ID, that it gets as far as on main, and the frame time before and after.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:12:05Z.
Thanks for running the exact head on both the RTX 4070 Laptop and Intel iGPU, including the full-suite runs and the failing-main control. That materially strengthens the hardware validation. The requested retail-title evidence is still missing: #3219's PPSA99902 data came from a diagnostic stack on a non-current base, and I do not have a current-main title run or before/after frame-time measurement for this PR. I am not claiming title compatibility or a performance result until that is measured.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T19:24:18Z.
Thanks for the dual-GPU run. This confirms the focused synthetic regression on both devices and shows the main-only control fails at the targeted FMASK case. I do not have a title that reaches this path or before/after frame-time measurements, so I cannot answer those two production-impact questions yet. The per-lookup snapshot/CPU-loop cost and unsupported CMASK modes remain limitations in the PR; the focused correctness evidence does not establish title coverage or performance.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-13T19:25:48Z.
Rebase handoff — rebased onto current
main(docs-only conflict, both entries kept), authorship unchanged.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV):tools/check_conventions.py --base origin/mainpassesmainregression (agc_driver_tessellationsegfault, #4727)To pick it up:
Head is
48e5ed990.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T01:20:47Z.
Rebased onto
mainatee9037d85154d0c840517c46c61087a736fe0641. The two documentation conflicts were resolved by retaining the updated main entries and the FMASK documentation. The existing four commits were replayed with their original authors preserved; head is30aca286c86d85e25169984fd6c53450a762d769.Linux verification on the rebased head:
cmake --build build --target agc_driver_graphics_tests --parallel 4— passedctest --test-dir build -R '^agc_driver_graphics$' --output-on-failure— passed (1/1)ctest --test-dir build -R '^agc_driver_fmask_images$' --output-on-failure— passed (1/1), using llvmpipe software Vulkangit diff --check upstream/main...HEADandpython3 tools/check_conventions.py --base upstream/main— passedThese Linux checks do not supply the requested retail-title run or before/after frame-time evidence. I still cannot claim title compatibility or performance results; the previously reported Windows dual-GPU synthetic test remains the hardware evidence.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T04:41:30Z.
Closing: no title is known to reach this. With the queue at 480+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-19T10:34:25Z.
Native-owner-only follow-up qualified (2026-10-19): one focused fork commit, main88a6, exposes expanded indices only for an exact tracked native8x DCC/CMASK owner. It preserves your attribution/coauthor trailer for shared descriptor normalization and excludes the standalone compressed decoder. New direct/registered/prepared/invalidation checks pass three processes per actual NVIDIA/AMD GPU. Full builds pass; the total matrix has36 passes and nine unchanged AMD #7936 baseline failures, zero VUID/errors/warnings.
Native-owner-only PR #7948 is now open after the same creation request succeeded on retry. It is separate from your standalone decoder; no decoder PR/reopen was created. Your standalone metadata-decoding topic remains separate. Maintained evidence, remaining gaps and conditional Sonic context. AI-assisted: yes (Codex).
Local adaptation and title attempt — 2026-10-19
@MarcZX10 @oneandonlydean the metadata-aware subset is now adapted locally on main5c6c and merged #6674, preserving Romans Pokrovskis' original work and MarcZX10's compatibility attribution. Fork branch; no competing upstream PR or reopen here.
Main/focused/integration:36 repeated passes (18 host-GPU,18 CPU), plus6 expected main capability refusals, on verified RTX5080/Radeon with Khronos validation and no VUID/errors/warnings. The focused fixture checks unchanged-address CMASK transitions, mixed tiles/layers and unsupported codes.
The same-parent Sonic title attempt gets past the FMASK compiler refusal but stops at our native color-snapshot stack's unsupported-tiling/metadata guard. Both parent/child end with black captures and no menu; the exact snapshot condition remains unidentified. This does not yet establish a title unblock, completed title FMASK decoding or before/after frame-time evidence. Complete pins, logs, attribution, analysis limits and results. The per-lookup CPU snapshot cost and console layout evidence remain limitations. AI-assisted: yes, Codex.
Prior mainb7 title evidence and coordination
@MarcZX10 @oneandonlydean following the closing request for a title ID/log: Sonic Unleashed Recompiled PPSA99902 / 01.003.000 now reaches this compressed-FMASK path with unmodified mainb7a75819f3 runtime libraries, from a clean separate source/build:
Natural0xC0000409 after22.334s; inspected startup logos and final black capture, no menu/gameplay. RTX5080, driver610.62/32.0.16.1062, Windows11 Enterprise26200; Khronos1.4.363 loaded. All127 archived/build libraries match;145 prior runtime/user-data files restored,562 expected hashes independently verified. This retains oura515 converted application/guest libc and original assets/configs; it is not a fresh main conversion. Main also logs10
mipLevels-00958errors and10fragment-output warnings, so no validation-clean claim. Log SHA256032e204589003ffa11dabc710b7500f60a39d342e13d89071082834bd9249870.The composed 115d integration, incorporating the same main, reaches the same refusal at NOW LOADING after30.448s with0VUID/errors/warnings. Both replays end before the menu without input or a harness timeout. The elapsed times are not a performance comparison.
Merged #6674 now handles uncompressed FMASK and explicitly rejects CMASK compression, so the older implementation needs a focused adaptation on top of that work. We updated #3219 to describe the remaining gap and #7260 with exact pins/results. Mainc82ffb0f20 landed after the tests without changing this materializer; it was not replayed.
Would you like to revive/adapt the compressed-metadata subset here? I can validate an updated head against this title. I have not reopened your PR or published a competing copy. Romans Pokrovskis' original work and your compatibility work should retain their attribution. These observations establish the startup path only; they do not test the old4790 head, its runtime cost, or before/after frame times.
AI-assisted validation/report: yes, Codex.
Pull request closed