fix(agc): import undrawn R_X DCC textures and their colour-target state #21479
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21479"
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 VicRaster on 2026-11-16T08:04:46Z.
What
Sampling a multisampled SW_64KB_R_X texture with DCC that no draw has rendered to stops with
whose compression metadata over a tile mode 7 surface is not modeled. Its metadata can still hold one of the uniform clear codes that #5939 already imports for colour targets. This change imports such a texture, then lets the owner it creates become a colour target.Texture import. When no resident owner covers the texture, reuse the uniform DCC importer from #5939. The owner is built from the texture descriptor under the same watched-range, metadata-generation and unchanged-during-import checks as a colour-target owner. Known-zero metadata is settled before its generation is collected. A texture descriptor carries no register clear colour, so key 0x20 still throws, as do mixed or expanded keys, non-pipe-aligned metadata, compressed payloads, arrays and mips.
First colour-target use. A texture descriptor has no DCC control word, CMASK or FMASK. When the same surface is then bound as a colour target, the register state adds them, and the reuse check stopped with
multisampled DCC target layout or metadata changed. A commercial title samples such a surface as a cleared texture for several hundred frames and hits this on its first draw into it.When the owner came from a texture, no draw or storage write has reached it, and the address, DCC address, alpha placement, pipe alignment, tile mode, element size and pipe/bank XOR all match, it is imported again under the colour target's full layout. This uses the path #7641 added for a changed pipe/bank XOR, so the clear, CMASK, FMASK and register clear colour come from the current guest state under the usual rules. Before that, the store checks of an ordinary reuse run on the planes the texture import tracked, accepting only a landed whole-range DCC fill, so a write since the texture import still refuses. The write checks move into a helper unchanged.
Any other layout difference, an owner a draw has rendered to, and a later change on the resulting colour-target owner stay refused.
Two commits, one per step; the second has no use without the first.
Related open PRs
#20534 and #21155 (same author) change the same initial-import statements, so this branch conflicts with them textually. The resolution is mechanical: keep their committed-colour and known-zero settling for each range, which already covers this change's metadata settling. That combination was built and tested before this rebase: on #21155's earlier head
75563731, these two commits passed the same selected tests that fail without them. Whichever merges second needs that resolution.tools/pr_overlap.py --branchagainst 1,693 open PRs reports line conflicts with #19686, #20534 and #21155. It stopped without a full result because 14 others conflict with main; the bot's run on this PR lists two more, #17338 and #19557.ensureGeneralLayout()next to the changedinitialDccClear(use, true)call inRecreate, and replacesApplyFastClearwithPrepareForColorAttachmentinacquire. The conflict is textual: keep both sides. A texture owner taken over here passes throughRecreateand then the colour-attachment preparation, so with #19686 it also leaves the read-only sampled layout before its clear.MultisampleTarget.cpppatches were checked by hand against the points this branch changes: the constructor,Recreate,initialDccClear,checkDccCurrent,acquire's reuse branch andcreateFilled.createFilled's written storage call; this branch adds an unwritten-texture path.checkDccCurrent(target, false)call; that signature is unchanged.dccRangesandmetadataValidwhen preserving baselines before unwatch; both are unchanged.forgetSingleClears,discardRetiredTargets, the unmap observer andHostOnlySampleRanges. They touch none of the points above.None implements the same behaviour.
Tested
16 November 2026, Windows 11 build 26300, NVIDIA GeForce RTX 3080 Ti, driver 610.88; WinLibs GCC 15.2, Release. Khronos validation 1.4.363.1, newer than the pinned Vulkan headers.
Three arms on main
0694c4cbd6f2df1e7cc95a6681746b4de40d1e70, using the same test executables built from this branch. Only the loaded graphics library and its libc/libkernel change between arms, with hashes recorded and the candidate's restored afterwards.initial_texture_dcc_2/4/8andtexture_dcc_target_2/4/8, at the tile-mode refusal abovetexture_dcc_target_2/4/8, atmultisampled DCC target layout or metadata changedinitial_texture_dcccovers 2, 4 and 8 samples, the four fixed clear codes, both alpha positions, repeated sampling and untouched zero metadata. It also checks refusals for the register-clear key, mixed keys, unaligned metadata and a metadata store after import.texture_dcc_targetsamples an R_X DCC texture, binds it as a colour target with CMASK, FMASK, fast clear and a nonzero DCC control, and checks the samples before, after and on reuse, with guest colour and metadata unchanged. Its controls that must still refuse are: another alpha placement, a colour store and a same-value metadata store before the bind, an owner a draw has rendered to, and another DCC control on the resulting colour-target owner. The alpha-to-coverage tests, which exercise the #7641 path this shares, pass in all arms.All 26 selected tests ran in every arm; none skipped, disabled or missing. Each arm's log shows the loader inserting the Khronos layer for the 24 tests that open a device (the two alpha-to-coverage state tests do not), with no missing-layer message and no
VUID-. All three arms log the same threeUndefined-Value-ShaderOutputNotConsumed-DynamicRenderingwarnings inagc_driver_alpha_to_coverage; this change adds none.On a private integration branch carrying further local fixes, the second commit takes a commercial title past this stop at 3840x2160 in SDR and HDR10. Without it, three of three launches stopped 1.3 to 1.9 s after the intro video. With it, three of three reached the main menu and new-game setup, and one reached a loading screen. That is menus, not gameplay. No Linux or macOS run and no performance claim.
check_conventions.py --base origin/mainandcheck_main_sync.pypass.debt_fold.py --checkreports one fragment that does not apply,docs-nkwebkit-drop-readded-count-lines.md, which is already on main and untouched here.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)🤖 Generated with Claude Code
https://claude.ai/code/session_01CfHqvesLHKGJRvAoHQuocc
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T08:10:56Z.
Review: APPROVED
Reviewed — looks good
The reviewed change at
e23cc4cd5c84785531b899fa05171750c0e1a3b8has no verified blocking defects; author-reported checks passed, but I did not run them.What I ran
Read the prepared diff and all three changed files through
repo_read.py. No commands or tests were run; I did not fetch the diff again.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the test suite, build, or check behavior on hardware. I reviewed all files marked
reviewedin the manifest: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, anddocs/dev/debt/changes/fix-texture-dcc-owner.md. No files were excluded. The description reports Windows tests and limited title progress on a private integration branch; those results were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T22:53:56Z.
Review: APPROVED
Reviewed — looks good
The change was reviewed at head
8ed6ed3b4e05d9fb21926a523c53c785920bca1f; no verified blocking defects were found in the changed implementation or tests. Author-reported test results were not rerun in this review.What I ran
Read the prepared diff and all four changed files. No build or tests were run.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and runtime behavior were not independently verified. The prepared bundle contained the full text for each changed file, and all four were read:
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, anddocs/dev/debt/changes/fix-texture-dcc-owner.md. No changed files were excluded.To get this to a good state
Nothing is required.