Skip to content

feat(agc): expose expanded FMASK for tracked native owners - #7948

Merged
oneandonlydean merged 8 commits into
boykopovar:mainfrom
Amoenus:codex/feat-native-owner-fmask
Oct 22, 2026
Merged

oneandonlydean merged 8 commits into
boykopovar:mainfrom
Amoenus:codex/feat-native-owner-fmask

Conversation

@Amoenus

@Amoenus Amoenus commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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:

FMASK CMASK compression is not implemented

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 head 6dd3501fba885b468d1b17602dd794290975caf8 retains the explicit fixture-lambda capture and adds the reviewed eight-sample capability gate to qualified rebase 70bc319c34c0cf0b4695deb043d32bfb9c529f8c. Production is unchanged. Thanks @blawesom for identifying the Linux journal size guard:

  • The FMASK address/XOR locate resources; the pipeline key does not use them. Canonicalization and the existing explicit codec strip these locations. Update the Linux state-size guard to 800, retaining the wire format/version. Eight-sample tests check stripped locations, relocation-invariant keys/encoded bytes and recipe round trips.
  • Main's merged fix(agc): reimport a multisampled target recreated with another pipe-bank XOR #7641 added target recreation. Reset this PR's optional FMASK range when recreating a target, so a removed association cannot leave a stale write refusal. The regression recreates without FMASK, writes the former range, draws and checks regular/array sampled output.

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 b8c6a94572314facbb39cf067cd25be867e6a741 incorporates main 8499ea52e571b0edfc1feecfd3f6b9944012b359, preserving published 6dd3501fba as 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 framebufferColorSampleCounts lacks VK_SAMPLE_COUNT_8_BIT, and print the requested skipped, the device does not ... reason. Production and the eight-sample positive assertions are unchanged.

  • The context copy is scoped before 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 reported VUID-vkDestroyDevice-device-05137 and crashed during teardown. The submitted scope correction removes that regression.
  • Windows changed-fixture target rebuild passes. 18 fresh passes on this submitted head: native FMASK, native MSAA vertex input and sample-target, each 3/3 on NVIDIA RTX 5080 (610.62) and AMD Radeon Graphics (32.0.21036.18), Windows 11 Enterprise 26200. Required Vulkan, loaded Khronos 1.4.363, app shader cache/journal disabled, verbose serial CTest: no VUIDs, validation errors/warnings, skips or timeouts. Driver caches uncontrolled; loader notices retained.
  • An isolated harness compiled from the exact new guard passes 16 synthetic feature/sample-mask combinations, including storage support with only 1 | 4 color samples. Synthetic skipped JUnit passes both Linux and Windows check_skips.py policies. These controls are not a fresh full-fixture Linux/lavapipe runtime result.
  • Conventions/whitespace pass. Cppcheck then clang-tidy complete in 9.555 analyzer seconds, without parser/configuration failures or timeouts. One unchanged allocation warning remains; the allocation is checked before memset. No selected clang-tidy diagnostic, suppressions or auto-fixes.
  • Clean source merge against main 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 failed agc_driver_sgpr_pattern_fill_keys, which this fixture-only patch does not address. No new title or performance claim.
Previous fixture capture correction at ed373fa

Previous fixture capture correction: ed373faf9e3635a3bba9c3b9d85d39f5000a3d5a. The Linux CI failure at 70bc319c34 merged onto main 1a48337f13 is an uncaptured sentinel in the nested refusal-output predicate. Explicit [sentinel] capture fixes that compiler error; no production code changes.

  • Linux GCC 13.3 exact before/after fixture compilation, with this head's actual headers and existing Linux generated include paths: original fixture fails with exactly the CI capture error; corrected fixture compiles. This is full-translation-unit syntax compilation, not a fresh Linux full build/link/runtime result.
  • The changed Windows fixture target rebuilds successfully. 18 fresh physical-GPU passes: native FMASK, native MSAA vertex input and sample-target, each 3/3 on RTX 5080 and 3/3 on Radeon Graphics. Required Vulkan, loaded Khronos 1.4.363, application cache/journal disabled, verbose serial CTest. Zero VUIDs/validation errors/warnings, skips or timeouts; driver caches uncontrolled and existing loader notices retained.
  • Cppcheck then clang-tidy for the changed translation unit complete in 10.309 s without parser/configuration failures/timeouts. One unchanged allocation advisory remains (the fixture checks allocation before memset); clang-tidy reports no selected diagnostic. No suppressions, auto-fixes or whole-codebase clean claim.
  • Conventions and whitespace pass. Clean source merge at newer main 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 control 5f7aa5570c, same machine and physical GPUs:

Selection, three fresh processes per group Main Change
CPU/mock: journal, graphics, shader memory, request serializer 12 pass 12 pass
RTX 5080: cached-image guard, raw FMASK reads, sampled multisample target, GPU journal 12 pass 12 pass
Radeon Graphics: same shared groups 12 pass 12 pass
RTX 5080: new native FMASK fixture Not registered 3 pass
Radeon Graphics: new native FMASK fixture Not registered 3 pass
  • Full Windows default build and explicit libs, relinker and 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.
  • Shared GPU runs use verbose CTest, required Vulkan and the loaded Khronos 1.4.363 validation layer. Physical adapter identities verified: zero VUIDs or validation errors/warnings across 54 positive GPU executions, plus 24 CPU/mock passes. No skips or timeouts; each test remains below 30 seconds. Application shader cache and pipeline journal are disabled except in the GPU journal fixture, which intentionally enables both in a unique temporary directory to test cold recording/replay. Driver caches are uncontrolled. The new cached-image guard exercises compute/draw sampled and storage cases plus native multisample table validation. Its storage cases use the full proof because those image pages are compared rather than watched; no fast-proof coverage is claimed for those cases. Installed GalaxyOverlay layer-name warnings and requested-layer notices remain in the Vulkan-loader logs; shared-group counts match main and change.
  • Earlier capability control, main d50: dd4d1f4142 adds only native-fixture registration and the preceding compatible fixture to main d50, leaving production unchanged. It fails 3/3 per GPU at the compression refusal above. These are six expected failing controls; an absent test on literal main is not counted as a pass. The newer recreation case requires this PR's target fields and is tested separately.
  • Earlier recreation fault control: 150d6657e5, same regression without the one-line reset, fails 3/3 per GPU at the stale resident-FMASK write refusal. 3d7b744a8e passes 3/3 per GPU. Fixture blobs are identical; the production delta is exactly fmaskRange.reset();. All twelve processes have zero Vulkan diagnostics, skips or timeouts.
  • Native-fixture coverage retains direct/registered/prepared dispatches, expanded indices and selectors, repeated lookup, native-sample/metadata preservation, wrong descriptors/extent, recipe exclusion and same-value metadata invalidation before ordinary and prepared dispatches.
  • Linux journal correction, retained pins: Ubuntu 24.04/GCC 13.3, base 1d41645527. de02d8c791 fails the actual journal compilation at 800 == 784; fa9f22290d compiles. At 00215dbf82, 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.
  • Retained static analysis at 3d7b744a8e/main d50ec76da0: 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 7526640c3c1c5ea236c33b43b854681e8d169745 merges 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

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6612 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L38-39
PR 6959 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L38
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 8115 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L38
PR 8223 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L648-649
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp L11, L19, L123, L125, L127, L140, L142, L148, L217
PR 8429 core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp L142-143
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L230-232
PR 8564 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L70
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L38
PR 9077 docs/dev/debt/libSceAgcDriver.md L158-159
PR 9186 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L648-649
PR 9431 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 9432 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 9450 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L38
PR 9489 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L38
PR 9672 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 9673 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 9674 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 9675 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 9676 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92
PR 9700 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L70
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L38
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L1878-1879
PR 9842 core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp L92

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 907 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6169 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6194 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6223 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6292 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6488 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 6501 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6615 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6741 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6788 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6946 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6971 core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7550 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 7618 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7684 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7689 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7705 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7803 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7893 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8026 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 8077 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 8105 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8281 docs/dev/debt/libSceAgcDriver.md
PR 8395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8424 docs/dev/debt/libSceAgcDriver.md
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8527 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 8552 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 8625 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 8672 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8998 core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 8999 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9020 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9335 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9356 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9533 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9592 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9717 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9721 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9742 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9748 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/libSceAgcDriver.md

@blawesom

Copy link
Copy Markdown
Contributor

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 vs main's newer collectBlocks) is resolved as a union, but the result does not build yet, and the reason is a real integration gap in the PR:

main's 4aafda8e3 ("journal the pipelines of a run and build them ahead on the next one") added PipelineJournal.cpp's size guards after your branch point: static_assert(sizeof(State) == 784, "State changed: update CanonicalPipelineState and the recipe codec"). Your State.hpp additions (fmaskAddress, fmaskPipeBankXor — 784 → 800) trip it. The assertion is doing its job: the two new fields need to be added to CanonicalPipelineState (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):

git fetch https://github.com/blawesom/AnyPS5 rebase/7948
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 0def9ceed — builds cleanly up to the one assertion above.

@Amoenus

Amoenus commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Latest fixture correction: 6dd3501fba, addressing the llvmpipe review. Skip native FMASK before drawing when multisampled storage is unavailable or framebufferColorSampleCounts lacks VK_SAMPLE_COUNT_8_BIT, and print the requested skipped, the device does not ... reason. Production and the eight-sample positive assertions are unchanged.

  • The context copy is scoped before 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 reported VUID-vkDestroyDevice-device-05137 and crashed during teardown. The submitted scope correction removes that regression.
  • Windows changed-fixture target rebuild passes. 18 fresh passes on this submitted head: native FMASK, native MSAA vertex input and sample-target, each 3/3 on NVIDIA RTX 5080 (610.62) and AMD Radeon Graphics (32.0.21036.18), Windows 11 Enterprise 26200. Required Vulkan, loaded Khronos 1.4.363, app shader cache/journal disabled, verbose serial CTest: no VUIDs, validation errors/warnings, skips or timeouts. Driver caches uncontrolled; loader notices retained.
  • An isolated harness compiled from the exact new guard passes 16 synthetic feature/sample-mask combinations, including storage support with only 1 | 4 color samples. Synthetic skipped JUnit passes both Linux and Windows check_skips.py policies. These controls are not a fresh full-fixture Linux/lavapipe runtime result.
  • Conventions/whitespace pass. Cppcheck then clang-tidy complete in 9.555 analyzer seconds, without parser/configuration failures or timeouts. One unchanged allocation warning remains; the allocation is checked before memset. No selected clang-tidy diagnostic, suppressions or auto-fixes.
  • Clean source merge against main 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 failed agc_driver_sgpr_pattern_fill_keys, which this fixture-only patch does not address. No new title or performance claim.
Previous fixture capture correction at ed373fa

@oneandonlydean Linux fixture compile correction: ed373faf9e3635a3bba9c3b9d85d39f5000a3d5a. The failed CI job used 70bc319c34 merged onto main 1a48337f13; GCC 13 rejects the uncaptured sentinel in 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 main 5f7aa5570c333997f650fc4d9ea5d7f80a89b510. The PR description has the full matrix and retained controls.

  • The Linux state-size guard is 800. FMASK address/XOR locate resources and remain excluded from the pipeline key, canonical state and explicit recipe codec; the wire version is unchanged. Eight-sample tests verify stripped locations, relocation-invariant keys/bytes and round trips.
  • Main's target-recreation path exposed stale bookkeeping in this PR. Recreating a target now resets the optional FMASK range. The regression recreates without FMASK, writes the former range and checks regular/array sampled output. The identical earlier fixture fails without the reset and passes with it; those negative-control results retain their original commit pins in the description.
  • Fresh Windows comparison: full candidate default and explicit libraries/relinker/fixture builds pass. Literal main passes 36/36 selected executions; this head passes the same 36 plus six new native-FMASK executions. Total: 24 CPU/mock and 54 verified physical-GPU passes. NVIDIA RTX 5080/610.62 and AMD Radeon Graphics/32.0.21036.18, Windows 11 Enterprise 26200, loaded Khronos 1.4.363. Zero VUIDs or Khronos validation errors/warnings, no test skips/timeouts.
  • The new cached-image guard is included on both sides. Compute/draw storage-image cases use the full proof because their pages are compared rather than watched; no fast-proof coverage is claimed there. Loader notices remain and match across shared groups. The GPU journal fixture intentionally enables an isolated temporary cache/journal; the other selected GPU fixtures disable both. Driver caches are uncontrolled.

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 7526640c3c merges 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.

@milescoviello

Copy link
Copy Markdown
Contributor

@Amoenus Agreed on both. If #7948 lands first, I'll rebase my two:

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)

Amoenus and others added 5 commits October 20, 2026 17:10
Import an eight-fragment DCC-cleared owner with disjoint watched metadata, capture its independent CB FMASK address and XOR, and expose expanded indices only for an exact matching native view. Reject standalone compressed reads, descriptor mismatches and metadata writes. Exercise direct/registered/prepared dispatches and invalidation with a cold GPU fixture.

Descriptor metadata normalization builds on Romans Pokrovskis and MarcZX100 work in boykopovar#4790; standalone CPU decoding remains outside this change. Expanded indices follow AMD PAL c5e800072a32f68b6ccc4422936d96167c6e0728. Written with AI assistance.

Co-authored-by: MarcZX100 <marczxrr@gmail.com>
@Amoenus
Amoenus force-pushed the codex/feat-native-owner-fmask branch from 3d7b744 to 70bc319 Compare October 20, 2026 14:53
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Full CI on 70bc319 (run 39451865417) builds and passes on Windows, but the Linux build stops in this PR's test (GCC 13):

tests/execution/SampleMultisampleTarget.cpp:802:116: error: 'sentinel' is not captured
  802 |  Require(std::all_of(NativeFmaskOutput.begin(), NativeFmaskOutput.end(), [](auto word) { return word == sentinel; }), "rejected native FMASK wrote output");
tests/execution/SampleMultisampleTarget.cpp:798:36: note: 'const uint32_t& sentinel' declared here

Inside refused, which captures by reference, NativeFmaskOutput.fill(sentinel) odr-uses sentinel. 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 outside refused and compiles. Could you push that? We'll rerun CI on the new head.

@DavidAmsellem

Copy link
Copy Markdown
Contributor

First AMD-on-Linux (RADV) run of the current head, ed373faf9, built with GCC 13. The tree I built is 70bc319c3 merged onto main 6bef96df7 (clean merge) with the same one-line [sentinel] change as ed373faf9, whose diff from 70bc319c3 is 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.

  • It builds with GCC 13.3. Without the change, it stopped at the same 'sentinel' is not captured error on line 802.
  • Full suite (ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1713/1714 with this PR, against 1712/1713 on main. The one failure is the same on both, so this PR adds none: agc_driver_guest_memory_lifetime (agc_driver_guest_memory_lifetime fails on RADV since the host-import cut larger-side keep (16473dbbe, #6499 family) #7784).
  • Comparing the JUnit output with main: the new agc_driver_native_fmask runs and passes, and agc_driver_sample_multisample_target passes. No other entry is added, and none is skipped or removed.
  • With the Khronos validation layer, neither test adds a VUID. The only message is VkDeviceCreateInfo-pNext-pNext, which my older 1.3.275 layer prints for every device because it doesn't know maintenance8.

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Linux CI (run 39466527758 on ed373fa) fails the new agc_driver_native_fmask on llvmpipe in 0.11 s:

AGC graphics: the device cannot render color with the target's sample count

The fixture hard-codes an 8-sample target (color.samples == 8u, SampleMultisampleTarget.cpp in NativeFmask), but llvmpipe's framebufferColorSampleCounts is only 1 | 4 (Mesa 25.2.8 / LLVM 20.1.2, the CI driver). So MultisampleTarget.cpp:122 throws at the first Draw. The --native-fmask branch in main() only returns VulkanTestSkipped when storageImageMultisample is 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.py accepts as a device limitation, for example:

const auto& context = AgcDriver::VulkanDeviceTestAccess::ContextOf(*device);
if (!context.storageImageMultisample || (context.limits.framebufferColorSampleCounts & VK_SAMPLE_COUNT_8_BIT) == 0) {
    std::puts("native FMASK skipped, the device does not render or store 8-sample color");
    return VulkanTestSkipped;
}

(The text needs skipped, followed by one of the DEVICE_LIMITATION phrases, 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.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 20, 2026
@Amoenus

Amoenus commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@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_keys failure in the preceding run.

@oneandonlydean
oneandonlydean merged commit a62feec into boykopovar:main Oct 22, 2026
11 of 12 checks passed
EagleBearerYS added a commit to EagleBearerYS/AnyPS5 that referenced this pull request Oct 22, 2026
…MASK range

boykopovar#7948 tracks the FMASK of an eight-fragment DCC target and requires it to
be write-watched at the initial import ("native FMASK contents require
watched guest memory") and at each reuse ("native FMASK sampling requires
watched guest memory"). In Linux comparison mode a host import over the
FMASK unwatches it, so the target is refused one check after the color,
DCC and CMASK ranges that the previous commit accepts.

Treat an FMASK range that a compared host import covers
(ComparedHostImportCovers) as the color and metadata ranges are treated:
keep a copy and its NewestStamp at the initial import, skip it in the
import's UnchangedSinceAll, and at reuse require the stamp and the bytes
to be unchanged, comparing them at most once per collect epoch. An
explicitly unwatched FMASK range is still refused.

Four-sample targets take no FMASK range, so this changes nothing for them.

Refs boykopovar#9724
adriadam10 pushed a commit to EagleBearerYS/AnyPS5 that referenced this pull request Oct 23, 2026
…al multisampled DCC import

boykopovar#7948 requires the FMASK of an eight-fragment DCC target to be
write-watched at the initial import and at each reuse. On Windows an
FMASK in a host import whose deferred settle has not run yet is still
compared, so the target is refused with "native FMASK contents require
watched guest memory" after the previous commit has settled its color and
metadata ranges.

Call WatchedAfterSettle for the FMASK range at both checks, as the initial
import already does for the color, DCC and CMASK ranges. A range that is
unwatched without an import awaiting its read is still refused, and
nothing changes off Windows.

Four-sample targets take no FMASK range, so this changes nothing for them.

Refs boykopovar#9724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants