Skip to content

fix(agc): import uniform initial multisample contents under a compressed CMASK - #19904

Open
xXPBSXx wants to merge 5 commits into
boykopovar:mainfrom
xXPBSXx:fix/agc-msaa-cmask-uniform-initial
Open

xXPBSXx wants to merge 5 commits into
boykopovar:mainfrom
xXPBSXx:fix/agc-msaa-cmask-uniform-initial

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What

A title run of PPSA12361 on main 7fe931bacda stops at initial multisample color contents with CMASK require a modeled metadata import (MultisampleTarget.cpp, in PrepareMultisampleTargetForDraw); three runs did (one plain, two with a read-only diagnostic added). The target that triggers it has two samples, 8 bytes per element, 512x512, no DCC and no fast clear, but a CMASK, which here only holds the compression of the fragment mask (FMASK). The diagnostic showed the color memory of that target all zero (4194304 bytes) in both runs, the FMASK not uniform in both, and the CMASK all zero in one run and mixed in the other.

This imports the initial contents of such a target when all its fragments hold one texel, as that texel (the same import as without a CMASK), and still throws when the fragments differ. For uniform contents every FMASK value that names a stored fragment reads the same texel, so the CMASK does not change the result; what the console reads where an FMASK value names no stored fragment is not known, and docs/dev/debt/libSceAgcDriver.md says so. The test commit pins a two-sample RGBA16F fixture whose CMASK is all zero and one whose CMASK is mixed (the FMASK is not uniform in both), with colour memory of one texel: it is imported as that texel and the guest bytes and the CMASK are unchanged; a counter-test with one differing fragment is refused without an owner and without byte changes.

On the same base, 7fe931bacda with the change cherry-picked, two title runs (Windows, RTX 4080 SUPER) do not show the old message and both end at the next refusal, dithered or rounded alpha-to-coverage is unsupported (register 0x2dc = 0x0001aa01). So the title moves on to its next stop; it does not produce a working frame here. On the current main 04263e4d8438 two runs without the change did not reach this target at all (no stop; the reason was not examined), so the stop could not be reproduced there; two runs with the change on that base also end at the alpha-to-coverage refusal. Whether the same draw is meant and how far the title gets in content was not measured (no picture was looked at, no input was sent).

Tested

Windows 10 Pro 10.0.19045, ANYPS5_GPU=4080 for the tests and the title runs (Selected GPU name=NVIDIA GeForce RTX 4080 SUPER in each log), relinker and all libraries built from the tree before each title run (411 libraries on 7fe931bacda, 413 on 04263e4d8438). The unit tests ran on the heads of this pull request, on base upstream/main 04263e4d8438, one run per arm, on 14 November 2026; after the full build of the last head (ninja returning 0) the five tests passed once more.

State agc_driver_sample_multisample_target_tests initial-contents tests (5)
test commit only 4 of 5 pass; agc_driver_native_color_initial_uniform_cmask fails with initial multisample color contents with CMASK require a modeled metadata import, the counter-test ..._cmask_refusal passes
with the fix and the documentation 5 of 5 pass

The validation layer was inserted into each test process (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, 5 of 5 processes per log) for the same pair on two GPUs, with the heads before this branch's last rewrite, which differ from the heads of this pull request only by one comment line removed from the test file (git diff --stat: one line in SampleMultisampleTarget.cpp; the fix and the debt entry are unchanged): RTX 4080 SUPER (driver 32.0.16.1074) and Radeon RX 6400 (driver 32.0.21033.3005), driver versions as reported by Windows. The test commit alone gives 4 of 5 and the fix 5 of 5 on both; no log line contains VUID (0 lines in each of the four logs). The GPU was shared with a running title (about 87 % load), and this says nothing about other tests or other draws. tools/check_conventions.py --base upstream/main passes with no error and no warning (the changed entry is 998 characters, up from 673). Not tested: Linux, macOS, the CI runner, a console (the entry stays unmeasured there), other titles, a title run on the current main that reaches this target, and the frame the title would draw after its next stop.

Overlap: the 144 other open pull requests that change MultisampleTarget.cpp, SampleMultisampleTarget.cpp, agc_driver_sample_multisample_target_tests.cmake or docs/dev/debt/libSceAgcDriver.md (found by reading the changed files of all 1543 open pull requests at about 06:07 UTC) were test-merged on 2026-11-14 at about 06:25 UTC against main ea32608486 (the branch is based on 04263e4d84); the branch merges into it without a conflict. 56 of them already conflict with main without this change and still conflict with it; 88 merge cleanly with and without it, among them #17956 (native depth owners under an initial multisampled colour import, which changes the same debt entry and MultisampleTarget.cpp, and whose tests do not test the CMASK refusal this change removes). None conflicts only with this change. One pull request opened after that scan, #20579 (fix(agc): upload initial MSAA color through an attachment fallback), also changes MultisampleTarget.cpp and SampleMultisampleTarget.cpp, but not the CMASK refusal this change removes: it adds an attachment fallback for the nonuniform upload when multisampled storage writes are missing and rewords that refusal. On 2026-11-16 at about 17:55 UTC it was test-merged with this branch (head 1cd3db531e) and with main bedf88ef89 without a conflict in either pairing, and in the merged MultisampleTarget.cpp the CMASK check stays inside the branch for nonuniform contents, as in this change; the merged result was not built or run. Whichever is merged first, the other needs no change to the refusal this change removes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none (PPSA12361 moves on to its next stop, not to a working frame)
  • GPUs tested: NVIDIA GeForce RTX 4080 SUPER (driver 32.0.16.1074) and AMD Radeon RX 6400 (driver 32.0.21033.3005, as reported by Windows), Windows 10 Pro 10.0.19045, both with the validation layer inserted and no VUID line
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

xXPBSXx and others added 3 commits November 13, 2026 17:11
…ssed CMASK

A first draw into a multisampled color target whose CB_COLOR_INFO enables
COMPRESSION but not FAST_CLEAR, without DCC, has a CMASK that holds only
FMASK compression. When every fragment in its color memory holds the same
texel, any FMASK mapping to a stored fragment reads that texel, so the
target should import as it does without a CMASK, whether that CMASK is
zero or mixed. Differing fragments under such a CMASK still refuse, which
the second test pins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sed CMASK

PrepareMultisampleTargetForDraw refused every first draw into a
multisampled color target with a CMASK and neither DCC nor FAST_CLEAR,
before looking at its color memory. Such a CMASK holds only FMASK
compression. When all fragments hold one texel, every FMASK mapping to a
stored fragment reads that texel, so the target now imports as that clear.
The refusal stays for differing fragments, whose values depend on the
FMASK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xXPBSXx

xXPBSXx commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Evidence for the title runs, listed so the numbers above can be checked. All runs: Windows 10 Pro 10.0.19045, ANYPS5_GPU=4080 (NVIDIA GeForce RTX 4080 SUPER, Selected GPU line in each log), relinker and all libraries built from the tree before the run, no input sent, 13 November 2026.

Arm Base Change Runs Result
A main 7fe931bacda (411 libraries) none 1 plain, 2 with a read-only diagnostic in PrepareMultisampleTargetForDraw all 3 end at initial multisample color contents with CMASK require a modeled metadata import, followed by the abort
B 7fe931bacda with this change cherry-picked (411 libraries) test, fix and documentation 2 no modeled metadata import line in either; both end at dithered or rounded alpha-to-coverage is unsupported (register 0x2dc = 0x0001aa01) (State.cpp), followed by the abort
control main 04263e4d8438 (413 libraries) test commit only, no fix 2 no stop in either run; the multisample target is not reached (the reason was not examined)
fix on the newer base 04263e4d8438 (413 libraries) this change 2 no modeled metadata import line; both end at the same alpha-to-coverage refusal

The diagnostic of arm A printed for the target that throws:

Run samples element bytes extent tile mode DCC fast clear colour memory CMASK (first 4096 bytes) FMASK (first 64 KiB)
diagnostic run 1 2 8 512x512 27 0 0 uniform zero, 4194304 bytes 1 distinct value (00 x 4096) 213 distinct values (00 x 32492, 40 x 3315, 3e x 3063 in the top three)
diagnostic run 2 2 8 512x512 27 0 0 uniform zero, 4194304 bytes 47 distinct values (00 x 2422, 3f x 232, 80 x 175 in the top three) 213 distinct values (00 x 32456, 40 x 3324, 3e x 3056 in the top three)

AI-assisted (Claude Code).

@tablefrogpillow

Copy link
Copy Markdown
Contributor

Ran the new agc_driver_sample_multisample_target test on Linux across three AMD RADV generations (head 1cd3db531e, ANYPS5_NO_SHADER_CACHE=1, Khronos validation layer 1.4.363):

GPU arch agc_driver_sample_multisample_target VUID-
RX Vega 56 (VEGA10) GCN5 pass 0
Radeon 680M (gfx1036) RDNA2 pass 0
RX 7900 GRE (NAVI31) RDNA3 pass 0

On RDNA2/RDNA3 the test exercises the real import path (the run reports shared-import=1 source-samples=1), not a trivial skip — so this confirms the uniform-initial-multisample-under-CMASK import works on real AMD hardware across gens, 0 VUID-. (CI's lavapipe run doesn't cover this RADV import path.)

AI-assisted: yes.

@JJenkx

JJenkx commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 1cd3db531e, merged onto main 74900e8b0f. Setup: Windows 11 Enterprise 22621, AMD RX 6700 XT, AMD driver 26.10.1, MinGW-w64 GCC 15.2 UCRT, Release.

agc_driver_sample_multisample_target:

  • GPU, through the shared Windows GPU FIFO with ANYPS5_REQUIRE_VULKAN=1 (merge 1f38863dce): passed in 3 of 3 runs. The binary matched the hash recorded at preparation, and the receipt shows exit 0 and app_count=0.
  • CPU, Vulkan hidden (merge fa24505795): skipped (it needs a device), 0 failed.

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 14, 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 6989 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L1911
PR 6995 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L1911
PR 7002 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L1911

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 6808 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 9915 core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 19557 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 21155 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 22692 core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 23252 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 24049 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp

@domx4q

domx4q commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Validation-layer run of this PR on an NVIDIA GPU under Linux, since CI covers only lavapipe.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, -DBUILD_TESTING=ON; NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684), proprietary driver 620.70.06, Vulkan 1.4.357 (loader 1.4.363), Khronos validation layer 1.4.363.1. Head 1cd3db531e merged onto main e4caa07950 (clean merge); main is the same commit built separately. Every test log reports Selected GPU name=NVIDIA GeForce RTX 4090.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
  ctest --test-dir build -R '^agc_driver_(native_color_.*|native_fmask_[28]|native_msaa_vertex_input|sample_multisample_target)$' -V
main e4caa07950 this PR
Result 14/14 pass 16/16 pass
Insert instance layer "VK_LAYER_KHRONOS_validation" 14 16
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- 0 0

The pattern selects every ctest entry of agc_driver_sample_multisample_target_tests, the executable this PR extends. agc_driver_native_color_initial_uniform_cmask and agc_driver_native_color_initial_uniform_cmask_refusal are added by this PR and do not exist on main; the other 14 pass on both. No test is skipped.

No new VUID- errors; all 16 focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head 1cd3db531ed042f1ddff0ab2f729f408c751bc41 using the pinned repo_read.py reader. I did not run commands or tests.

Results

Check Result Note
Diff and changed source passed All four changed files read
Tests not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests were run independently. I reviewed all files listed in the manifest; files.json was not available through the reader. The code paths and behavior outside the read ranges were not verified. The author reports passing tests and title runs, but those results were not independently confirmed.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 23, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@xXPBSXx

xXPBSXx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Merged main (bf2cd6bad331) into the branch to resolve a conflict in the test's argument list with --htile-hiz-patch; both arguments are kept, no other change. The head moves from 1cd3db531ed0 to 1e6b9a1b188a. The multisample test family of the target (18 tests) passes on the merge, on one RTX 4080 SUPER, without the validation layer.

AI-assisted (Claude Code).

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 23, 2026
@xXPBSXx

xXPBSXx commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Merged main (4d1fb21) into the branch; the head moves from 1e6b9a1 to 9ca1928. There was no textual conflict. The debt entry for the compressed-CMASK import is now its own fragment (add Functional) instead of an edit of the Initial multisample color draw contents entry, because main changed that entry through another fragment. No change to the code or tests of this pull request. The multisample test family of the target (18 tests) passes on the merge on one RTX 4080 SUPER, without the validation layer.

AI-assisted (Claude Code).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants