feat(agc): expose expanded FMASK for tracked native owners #7948
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7948"
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 Amoenus on 2026-10-19T15:46:57Z.
What
Expose expanded FMASK indices for an exact, tracked resident native eight-fragment color target. Sonic Unleashed Recompiled (PPSA99902, #4443) needs this read; #3219 and #7260 retain the existing title context. A fixture on unchanged main production code stops with:
Capture CB FMASK base/XOR independently from color, carry CMASK separately from color DCC, and validate the resident owner, extent/subresource and disjoint watched planes. Native samples are stored independently, so their FMASK view uses expanded indices. Descriptor mismatches, metadata stores (including same-value stores), missing/ambiguous owners and unsupported layouts throw. No guest metadata publication or reusable recipe is introduced.
The expanded value follows AMD PAL c5e80007, Gfx9Fmask::GetPackedExpandedValue. This is a reference-backed host representation, not a PS5 hardware measurement; remaining gaps are in technical debt. Descriptor normalization builds on Romans Pokrovskis/MarcZX100's #4790 work, with coauthor attribution retained. Its standalone compressed decoder is not included. The general #3219 gap stays open.
Earlier qualification used main
5f7aa5570c333997f650fc4d9ea5d7f80a89b510; its head6dd3501fba885b468d1b17602dd794290975caf8retains the explicit fixture-lambda capture and adds the reviewed eight-sample capability gate to qualified rebase70bc319c34c0cf0b4695deb043d32bfb9c529f8c. Production is unchanged. Thanks @blawesom for identifying the Linux journal size guard:Related #8429 expands uncompressed FMASK storage formats and still rejects compression; it does not implement this tracked native-owner path. Shared insertion points need coordination if it merges first.
Tested
Main refresh — 2026-10-22
Current head
b8c6a94572314facbb39cf067cd25be867e6a741incorporates main8499ea52e571b0edfc1feecfd3f6b9944012b359, preserving published6dd3501fbaas an ancestor. The topic's exact added/removed lines are unchanged. Main's resident tracking, per-layer refresh, resource-cache and shader-data changes are retained. This does not incorporate #9597; the agreed #9597-before-#7948 merge order and subsequent combined-layout check still stand.Affected-library, graphics and actual execution-fixture targets rebuild on Windows 11 / WinLibs GCC 15.2 r7. 13 fresh passes: CPU graphics once; native FMASK three times per RTX 5080/Radeon Graphics; native MSAA vertex input, sample-target and readback once per GPU. The FMASK runs retain expanded-index, owner/descriptor rejection, metadata invalidation and recreation assertions. Physical devices and loaded Khronos 1.4.363 verified, required Vulkan, app shader cache/journal disabled: zero VUIDs, validation errors/warnings, skips or timeouts; every invocation below 30 s. Literal main's matching graphics, sample-target and readback groups pass with the same diagnostic counts. Other earlier paired groups retain their original pins.
Cppcheck then clang-tidy on all nine changed C++ translation units completes in 205.209 analyzer seconds without parser/configuration failures or timeouts. Eleven Cppcheck and nine clang advisories were inspected: nineteen diagnostic contexts already occur on main; the remaining checked-allocation context is unchanged from the previous published head and checks allocation before memset. No suppression, auto-fix or static-clean claim. Conventions/whitespace pass. Historical full builds, Linux/peer results and negative controls below retain their pins. No fresh title/FPS or broader compressed-FMASK/publication support is claimed.
Latest fixture correction: 6dd3501fba, addressing the llvmpipe review. Skip native FMASK before drawing when multisampled storage is unavailable or
framebufferColorSampleCountslacksVK_SAMPLE_COUNT_8_BIT, and print the requestedskipped, the device does not ...reason. Production and the eight-sample positive assertions are unchanged.NativeFmask(): that fixture resets its device internally. Keeping the context alive across the call retained its shared buffer pool; two local development runs completed the FMASK assertions but then reportedVUID-vkDestroyDevice-device-05137and crashed during teardown. The submitted scope correction removes that regression.1 | 4color samples. Synthetic skipped JUnit passes both Linux and Windowscheck_skips.pypolicies. These controls are not a fresh full-fixture Linux/lavapipe runtime result.9a97ac784da5d40cc7b7d968898ffbf5b8b5377a; that newer composition was not executed. Earlier full-build/main comparisons retain their stated pins. A fresh maintainer Linux CI run is still needed; the preceding run also failedagc_driver_sgpr_pattern_fill_keys, which this fixture-only patch does not address. No new title or performance claim.Previous fixture capture correction at
ed373faf9ePrevious fixture capture correction:
ed373faf9e3635a3bba9c3b9d85d39f5000a3d5a. The Linux CI failure at70bc319c34merged onto main1a48337f13is an uncapturedsentinelin the nested refusal-output predicate. Explicit[sentinel]capture fixes that compiler error; no production code changes.d0852defa2a5fbc7f64ab20abddb7e1c24733345; no execution claim for that newer composition. The previous full Windows build and 78-check paired-main matrix below retain their original pins; they were not repeated for this fixture-only capture correction.Windows 11 Enterprise 26200, supported WinLibs GCC 15.2.0 r7/UCRT, Release, SPIRV-Tools enabled. NVIDIA GeForce RTX 5080, driver 610.62 / 32.0.16.1062; AMD Radeon(TM) Graphics, driver 32.0.21036.18. No performance claim.
Previous rebase qualification (retained pins): head
70bc319c34, production-main control5f7aa5570c, same machine and physical GPUs:libs,relinkerand selected fixture targets pass at the tested head. Main control builds the selected fixtures and their dependencies; no full-main build or full-suite execution claim.fmaskRange.reset();. All twelve processes have zero Vulkan diagnostics, skips or timeouts.1d41645527.de02d8c791fails the actual journal compilation at800 == 784;fa9f22290dcompiles. At00215dbf82, the graphics target builds and journal, long-path journal and graphics each pass three fresh CPU/mock-Vulkan processes. State.hpp, PipelineJournal.cpp and Graphics.cpp blobs match the final head. No full Linux build or physical Linux GPU result is claimed.3d7b744a8e/maind50ec76da0: Cppcheck 2.20 then clang-tidy 23.1.3 over all nine changed C++ translation units: 192.971 analyzer seconds, no parser/configuration errors or timeouts. Ten Cppcheck findings and one clang-tidy finding were inspected. Ten had unchanged seven-line source contexts on that main base; the allocation warning overlooks this PR's throwing check directly before memset. Other findings concern batch flow, cache lifetime, pass-by-value/initialization suggestions and existing journal/timer paths. They are not suppressed or presented as a clean main analyzer result.Historical AMD DCC-clear assertion failures remain recorded in #7936; that separate matrix was not rerun for this refresh. No fresh title run, gameplay unblock, console-equivalence or FPS result is claimed. The unsupported compressed snapshot/publication cases remain explicit refusals.
Agreed integration order: #9597 before #7948, confirmed in this reply. After #9597 merges, rebase this PR, preserve both sets of target fields and update the shared State size assertion to the actual combined layout; rerun affected validation. The combination has not been tested.
Conventions and whitespace checks pass. Overlap coordination remains with #6612/#6959 (shared journal guards), #8223 (fixture edits), #8429 (complementary uncompressed decoder expansion) and our dependent publication stack. The #8429/#6612 author confirmed ordering and shared edits; combinations have not been qualified together. Merged #7650's guard/debt changes are retained, and its new cached-image regression is included in the matched runs. Already-conflicting PRs remain incompletely compared by the overlap audit.
Main advanced during qualification. Source review through
7526640c3c1c5ea236c33b43b854681e8d169745merges cleanly and leaves this patch's FMASK lookup, owner tracking, state and recipe codec unchanged. Its write-only render-pass batching and storage-cache budget changes are outside these FMASK edits. The matrix above retains its actual tested head/base; the newer merged composition was not executed. No claim of testing a later main revision is made.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-20T08:19:25Z.
Rebase handoff with a build-blocking finding you'll need to design around — rebased onto current
main(3fd1cc393, authorship unchanged). The MultisampleTarget conflict (your FMASK functions vsmain's newercollectBlocks) is resolved as a union, but the result does not build yet, and the reason is a real integration gap in the PR:main's4aafda8e3("journal the pipelines of a run and build them ahead on the next one") addedPipelineJournal.cpp's size guards after your branch point:static_assert(sizeof(State) == 784, "State changed: update CanonicalPipelineState and the recipe codec"). YourState.hppadditions (fmaskAddress,fmaskPipeBankXor— 784 → 800) trip it. The assertion is doing its job: the two new fields need to be added toCanonicalPipelineState(they plausibly identify an FMASK-using pipeline) and the recipe codec version bumped — that's a pipeline-identity decision that belongs to you, not to a rebase, especially with the serializer-version history this repo has.Everything else is resolved and the branch carries it: the union above, your State.cpp/SampleMultisampleTarget/GuestTextureResource changes applied cleanly.
To pick it up (after your canonicalization work):
Head is
0def9ceed— builds cleanly up to the one assertion above.Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-20T11:23:06Z.
Latest fixture correction: 6dd3501fba, addressing the llvmpipe review. Skip native FMASK before drawing when multisampled storage is unavailable or
framebufferColorSampleCountslacksVK_SAMPLE_COUNT_8_BIT, and print the requestedskipped, the device does not ...reason. Production and the eight-sample positive assertions are unchanged.NativeFmask(): that fixture resets its device internally. Keeping the context alive across the call retained its shared buffer pool; two local development runs completed the FMASK assertions but then reportedVUID-vkDestroyDevice-device-05137and crashed during teardown. The submitted scope correction removes that regression.1 | 4color samples. Synthetic skipped JUnit passes both Linux and Windowscheck_skips.pypolicies. These controls are not a fresh full-fixture Linux/lavapipe runtime result.9a97ac784da5d40cc7b7d968898ffbf5b8b5377a; that newer composition was not executed. Earlier full-build/main comparisons retain their stated pins. A fresh maintainer Linux CI run is still needed; the preceding run also failedagc_driver_sgpr_pattern_fill_keys, which this fixture-only patch does not address. No new title or performance claim.Previous fixture capture correction at
ed373faf9e@oneandonlydean Linux fixture compile correction:
ed373faf9e3635a3bba9c3b9d85d39f5000a3d5a. The failed CI job used70bc319c34merged onto main1a48337f13; GCC 13 rejects the uncapturedsentinelin the nested output predicate. The only change is explicit[sentinel]capture; production is unchanged.Linux GCC 13.3 reproduces the original exact fixture failure and compiles the corrected fixture with this head's actual headers. This is syntax-only translation-unit validation, not a new Linux full build or runtime result. The Windows fixture rebuilds and all three registered modes pass 3/3 on each physical GPU (18 passes, RTX 5080/610.62 and Radeon/32.0.21036.18). Khronos 1.4.363 loaded, required Vulkan, app cache/journal disabled: no VUIDs, validation errors/warnings, skips or timeouts; driver caches uncontrolled and loader notices retained.
Conventions/whitespace pass. Cppcheck/clang-tidy complete with one unchanged allocation advisory and no selected clang diagnostic. The description retains the earlier full build, paired-main matrix and controls at their actual pins. Clean source merge against
d0852defa2a5fbc7f64ab20abddb7e1c24733345, without claiming that newer composition was run. Ready for a fresh CI run on the corrected head. No fresh title or performance claim.Earlier rebase qualification at its stated pins
Thanks @blawesom — the rebase and qualification are complete at
70bc319c34c0cf0b4695deb043d32bfb9c529f8c, based on main5f7aa5570c333997f650fc4d9ea5d7f80a89b510. The PR description has the full matrix and retained controls.Linux evidence and Cppcheck/clang-tidy findings keep their earlier pins; the Linux-tested State.hpp, PipelineJournal.cpp and Graphics.cpp blobs match this head. No full Linux/GPU or fresh title/FPS claim. Main advanced during testing; source review through
7526640c3cmerges cleanly without changing the FMASK lookup/owner/state/codec edits. That newer merged composition was not executed.Overlap: @milescoviello confirmed ordering and combined edits for #8429/#6612, and offered RTX 4070 Ti validation. #6959 shares the journal guard; #8223 shares fixture edits. Our dependent publication stack will be updated after this topic. These combinations remain unqualified; already-conflicting PRs are not treated as clean overlap comparisons.
AI-assisted: yes (Codex); author responsible.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T13:45:18Z.
@Amoenus Agreed on both. If #7948 lands first, I'll rebase my two:
GuestTextureResource.cppgets the same treatment.If #8429 or #6612 lands first, the same two edits fall to you, and I'm happy to run the combination on the RTX 4070 Ti.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T16:11:49Z.
Full CI on
70bc319c34(run 39451865417) builds and passes on Windows, but the Linux build stops in this PR's test (GCC 13):Inside
refused, which captures by reference,NativeFmaskOutput.fill(sentinel)odr-usessentinel. So in the inner lambda the name refers to the outer lambda's captured reference, and GCC 13 wants it captured. Capturing it in the inner lambda ([sentinel](auto word) { ... }, or[&]) should fix it. The same pattern at line 772 is outsiderefusedand compiles. Could you push that? We'll rerun CI on the new head.Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-20T16:59:12Z.
First AMD-on-Linux (RADV) run of the current head,
ed373faf9, built with GCC 13. The tree I built is70bc319c3merged ontomain6bef96df7(clean merge) with the same one-line[sentinel]change ased373faf9, whose diff from70bc319c3is only that line. So this covers the head as it is now.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
'sentinel' is not capturederror on line 802.ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1713/1714 with this PR, against 1712/1713 onmain. The one failure is the same on both, so this PR adds none:agc_driver_guest_memory_lifetime(#7784).main: the newagc_driver_native_fmaskruns and passes, andagc_driver_sample_multisample_targetpasses. No other entry is added, and none is skipped or removed.VkDeviceCreateInfo-pNext-pNext, which my older 1.3.275 layer prints for every device because it doesn't knowmaintenance8.GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T18:06:11Z.
Linux CI (run 39466527758 on
ed373faf9e) fails the newagc_driver_native_fmaskon llvmpipe in 0.11 s:The fixture hard-codes an 8-sample target (
color.samples == 8u,SampleMultisampleTarget.cppinNativeFmask), but llvmpipe'sframebufferColorSampleCountsis only1 | 4(Mesa 25.2.8 / LLVM 20.1.2, the CI driver). SoMultisampleTarget.cpp:122throws at the firstDraw. The--native-fmaskbranch inmain()only returnsVulkanTestSkippedwhenstorageImageMultisampleis missing, and it doesn't print a skip line.Could you skip it there when the device can't render 8 color samples, with a line that
tools/check_skips.pyaccepts as a device limitation, for example:(The text needs
skipped,followed by one of theDEVICE_LIMITATIONphrases, such as "the device does not"; otherwise the Linux job fails even when the test returns 77.) The test passed on an RTX 4090 locally, so this only covers devices without 8x color.Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-20T20:13:24Z.
@oneandonlydean Thanks, addressed in 6dd3501fba: both missing multisampled storage and missing 8x color rendering now skip with the requested reason.
I scoped the context copy before
NativeFmask(), since the fixture resets its device internally. Retaining that copy across the call caused a buffer-pool teardown VUID/crash in local development; the scoped version passes.Changed-fixture build and 18 fresh GPU runs pass (three modes × three runs × RTX 5080/Radeon Graphics), with Khronos loaded and no validation errors/warnings, skips or timeouts. The exact-guard harness passes 16 synthetic capability combinations, and the skipped-JUnit control passes Linux/Windows skip policy. Conventions and analysis are checked; the maintained report retains details and earlier qualification pins.
Could you run fresh CI on this head? I have not rerun the full Linux fixture locally, and this change does not address the separate
agc_driver_sgpr_pattern_fill_keysfailure in the preceding run.