fix(agc): preserve registered array slices on CPU write-back #6367
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6367"
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 Zenodeon on 2026-10-15T13:20:50Z.
What
Preserve GPU results during CPU write-back when the selected texture-array slice is registered but unused slices in the descriptor extend outside registered memory.
For example, only slice 0 of a four-slice array may be registered and have pending results.
StorageTexture::writeBackLayerspreviously checked registration of the entire declared image and discarded slice 0's valid results because the unused slices were unregistered. It also refreshed unsaved guest bytes outside the ranges being stored.Validate each retained write-back range instead, and intersect unsaved snapshot reads with those ranges. Keep the existing overhang handling and drop behavior when an actual destination has been unregistered. No public API or shader-semantic changes; no title-specific checks.
The regression registers only the first or last slice while keeping the complete backing allocation mapped. It checks the drawn pixels and untouched unused slices. A separate retirement case unregisters the active allocation before flushing and verifies that no stale results are written.
SuperTuxKart PPSA69421 supplied real two-slice descriptors whose active first slice fits its registered allocation while the entire descriptor does not. This PR does not claim a title unblock, a black-rendering correction, or a performance improvement.
Related work checked before publication: #6202 scopes refresh and adds independent coverage in the same test file; #6197 changes import selection, including within
writeBackLayers; #6280 changes mip handling within that function; #6246 adds an allocation lease for idle stores. None implements this retained-range registration check or snapshot-read intersection. These are independent mechanisms; retain their changes and this regression when reconciling textual conflicts. No dependency on those PRs or the shader experiment tracked by #1413.Tested
Based on upstream
main73e924acd4; PR commit540c3a10c6.Windows (10.0.26200), Intel Core i7-13700, 32 GiB RAM, NVIDIA RTX 4070 12 GiB, driver 591.86. GCC 15.2.0, Ninja, Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON; checked-out submodule revisions match the repository gitlinks. Rebuilt the completelibstarget and focused test binaries; preserved a complete 126-library runtime snapshot with SHA-256 hashes locally.Texture.cpp,agc_driver_array_layer_targetfails in 1.56 s:ANYPS5_GPU=RTX 4070andANYPS5_REQUIRE_VULKAN=1:agc_storage_kept_unit_settle,agc_storage_upload_lifetime,agc_storage_upload_failure,agc_storage_split_writeback,agc_host_import_retirement,agc_storage_cpu_snapshot;agc_driver_graphics,agc_driver_array_layer_target,agc_driver_depth_fast_clear,agc_driver_depth_fast_clear_submit,agc_driver_depth_storage,agc_driver_depth_storage_reuse,agc_driver_storage_one_slice_alias,agc_driver_storage_write_back_overhang.python tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpass; tracked working tree clean.Remaining validation: fresh standalone SuperTuxKart and vkQuake baseline/candidate comparisons, a completed race, controls/audio checks on this candidate, and a 15-minute stability run. Earlier successful interactive rendering/controls/audio used a separate experimental runtime and are not acceptance evidence for this PR. Linux, lavapipe and other GPU vendors have not been tested locally. No speed claim or performance acceptance result.
Checklist
main; no other open PR implements the same fix (related function/file overlap listed above).mdfiles, images, logs or game files added to the repositoryExtended validation remains pending; this PR makes no title-unblock or performance claim.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T13:26:42Z.
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.cppL311core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppL5143-5145Some 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.
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppImported from boykopovar/AnyPS5. Originally posted by romainveurrier on 2026-10-16T21:41:55Z.
Heads-up from #6960 : it also changes
writeBackLayers' read of unsaved guest bytes on the CPU path. It moves the read before the keep decision, because the store now uses a compare-exchange against those bytes, and reading them after the decision lets a CPU store made in between pass as the expected value. Your PR can go first; I'll rebase and keep your registered-range restriction, applied to that earlier read.