fix(agc): preserve array slice XOR in color target views #4551
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4551"
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 eljackjoestar-cmd on 2026-10-12T15:30:47Z.
What
Collapsed color array views move the surface address to the selected slice but lose that slice's contribution to the XOR swizzle equation. A draw can look correct in its separate 2D render image while publication and a subsequent array read place its texels at the wrong addresses. Lost Soul Aside's reflection cube then reads green clear values from packed mip tails, producing flashing green lighting.
Fold the selected slice's equation bits into
pipeBankXorwhenCB_COLOR_ATTRIB3represents the view as a shifted 2D surface. Full-array and volume views retain their existing addressing. The regression extends the existing R32 R_X native test to collapsed slices 1, 2 and 3, checking the array read, untouched neighbouring slices, publication and re-upload.Addresses #4387. Main now includes #4318 (D_X color support) and #4328 (nonresident packed tails); neither implements the collapsed-view slice-XOR correction. The rebased fixture retains both R_X/D_X full-array transport cases and adds R_X collapsed slices 1/2/3. This change uses the existing swizzle equations and adds no shader instruction semantics.
Tested
Windows 11 x64, WinLibs GCC 15.2, Release, NVIDIA RTX 5070; isolated branch rebased onto main
fc1f063f5, emulator SPIRV-Tools disabled.fc1f063f5.agc_driver_array_layer_targetandagc_driver_graphicspass without skips in 5.40 s, retaining full-array and collapsed-slice 1/2/3 coverage. Conventions and whitespace checks pass. The earlier negative control failed on slice 1 without this fix; it was not repeated for this rebase.No game run was repeated for this rebase. The debt diff contains only the collapsed-color-array entry; all other entries match this main. The debt entry follows the new layout in
docs/dev/debt/libSceAgcDriver.md. No game shaders, requests, assets, capture hooks or trace files are committed.Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-12T15:43:23Z.
I checked the overlap with my #4318. The runtime fixes are independent, but both extend
ArrayLayerTarget.cppby changingDecodeTarget,DrawSliceandRun: yours adds collapsed slices, mine adds the swizzle mode. The current guide asks us to agree an order for this test conflict.I propose #4551 first, #4318 afterward. I will mark #4318 as depending on #4551 for fixture sequencing and rebase its regression to keep your R_X collapsed-slice 1/2/3 checks plus our R_X/D_X full-array transport checks. I have already rebased #4318's unchanged three commits onto
d592d54e; Windows full-build/retests are running, and no new validation result is claimed yet. Does this order work for you?Imported from boykopovar/AnyPS5. Originally posted by eljackjoestar-cmd on 2026-10-12T15:45:12Z.
Yes, that order works: #4551 first, then #4318. The runtime changes are independent; the dependency is for sequencing the shared
ArrayLayerTarget.cppfixture changes.Please keep the R_X collapsed-slice 1/2/3 checks alongside your R_X/D_X full-array transport checks when rebasing. #4551 has passed the native array-target and graphics tests on Windows/RTX 5070. Its
Depends onremainsnone, and I will record that #4318 follows this PR for the fixture update.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T17:30:32Z.
Small conventions catch — full suite is green locally (957/957, Linux/RADV), but
tools/check_conventions.pyfails with[binary]ondocs/dev/TechnicalDebt.md: the file contains one invalid UTF-8 byte.At byte 191725,
slices 1\x963(the Lost Soul Aside entry) uses a Windows-1252 en-dash (0x96) — it needs the UTF-8 encoding (–=0xE2 0x80 0x93), or a plain ASCII hyphen. One-character fix:Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-12T22:27:52Z.
Tested on Linux, RX 7600 (RADV NAVI33, Mesa 25.2.8) with Disney Epic Mickey: Rebrushed (PPSA15657). It's the same bug as Lost Soul Aside's, and this PR fixes it there too.
Root cause, found independently in Mickey before I saw this PR:
CB_COLOR0_VIEWslice start = max = face, whileCB_COLOR0_ATTRIB3=0x4dc6c000declares no array (depth 0).SW_64KB_R_X, so mips 1 to 7 sit in each face's 64 KiB mip tail.With this PR's
State.cppchange applied alone (my own local fix removed) on my Mickey test bed:My local fix took a different route: it gave such a view
arrayLastSlice = slice, so the draw used the resident array image. It worked in the game too. Folding the slice intopipeBankXorkeeps the existing 2D path and is the smaller change.One problem in the diff:
docs/dev/debt/libSceAgcDriver.mdre-encodes characters on lines this PR doesn't otherwise change:⌊becomes⌊,×becomes×and±becomes±. It looks like a UTF-8 file was saved as Windows-1252. Those lines should probably keep main's text.I haven't run
agc_driver_array_layer_targeton Linux yet: the newer main needslibxrandr-dev, which this machine is missing. I'll follow up with that result.Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-12T23:06:45Z.
Follow-up: the regression tests on Linux, RX 7600 (RADV NAVI33, Mesa 25.2.8), at head
ff4b7d901.agc_driver_array_layer_targetandagc_driver_graphicspass.State.cppfrom main,agc_driver_array_layer_targetfails at the collapsed slice 1. The message isslice 1 read through the array after the draw: texel (0, 0) reads 0x5a5a5a5a, expected 0x3e800000, the same mismatch you saw on NVIDIA.agcctests pass: 449 run, the usual 2 skipped (ngg_vertex_wave_reduction,oversized_dispatch).Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:43:36Z.
docs/dev/debt/libSceAgcDriver.mdre-encodes three entries this PR doesn't otherwise change (partial rect-list primitives, thenullDescriptorplaceholder image and the shader float mode):⌊becomes⌊,×becomes×and±becomes±, as johnmaia noted. Please restore main's text for those lines and keep only the new entry.Imported from boykopovar/AnyPS5. Originally posted by eljackjoestar-cmd on 2026-10-13T03:16:23Z.
Restored the partial rect-list, nullDescriptor placeholder image and shader float-mode entries byte-for-byte from main. The documentation diff now contains only the new collapsed color array views entry. Conventions and whitespace checks pass; runtime code is unchanged.
Imported from boykopovar/AnyPS5. Originally posted by eljackjoestar-cmd on 2026-10-13T08:09:26Z.
Rebased onto main
fc1f063f5, preserving main’s updated depth-storage documentation and keeping only the collapsed-color-array debt entry in this PR’s documentation diff. Full Windows Release build passes;agc_driver_array_layer_targetandagc_driver_graphicsboth pass without skips in 5.40 s. Conventions and whitespace checks pass. No new game-runtime claim is made for this rebase. The agreed #4551-before-#4318 fixture order is retained.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:32:29Z.
Checked the slice-XOR fold against the swizzle equations used by the detile shader (
slice << 24), and the new R_X collapsed slice 1/2/3 checks. Without theState.cppchangeagc_driver_array_layer_targetfails (negative control); with it, it passes together with the rest of the libSceAgcDriver tests on the rebase (onlyagc_driver_tessellationcrashes, also on main). The only conflict withmainwas the adjacent line indocs/dev/debt/libSceAgcDriver.md; I rebased and kept your entry. Merging once the full build is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T14:35:05Z.
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.
main)core/libs/prx/libSceAgcDriver/tests/execution/ArrayLayerTarget.cppL168, L175, L179, L183, L210, L249, L256-261, L282-283docs/dev/debt/libSceAgcDriver.mdL30