fix(agc): preserve proven base formatted buffer read extents #14944
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14944"
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 arcwiser on 2026-11-02T03:01:40Z.
What
A nonempty, stride-zero
RGB32_FLOATbuffer withOOB_SELECT=2can be bound as an SSBO with onlyNumRecordsbytes. A base formatted read then returns X correctly while Vulkan robust access replaces Y and Z with zero.This change carries a narrow static proof from the resource tracker to the driver. For read-only, non-atomic, descriptor-formatted base reads whose complete unpacked 32-bit element is proven, the driver binds at least that element's byte extent. Dynamic offsets, packed or typed loads, raw vector accesses, writes, atomics and empty descriptors keep the existing bound.
The new extent participates in resource identity, queued read ranges, alias checks, moved-buffer checks and shader-disk-cache serialization. The cache format moves from 50 to 51.
Original analysis, implementation and tests are by @lgqdaxia in #14439 and commit
5fb8b2c27e; this PR preserves that commit's authorship. The issue explicitly invited others to adopt or independently upstream the candidate.Tested
Windows 11 10.0.26200, MSYS2 UCRT64 GCC 16.2.0, Release,
BUILD_TESTING=ON, NVIDIA GeForce RTX 4070 SUPER, driver 610.88,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1.Built
agc_driver_buffer_format_oob2_stride_zero_tests,agc_driver_graphics_tests,agc_shader_disk_cache_testsandagc_shader_memory_tests.Passed 5/5 focused CTests:
agc_driver_buffer_format_oob2_stride_zero,agc_driver_buffer_read_extents,agc_driver_buffer_read_extents_all_written,agc_shader_disk_cacheandagc_shader_base_formatted_read_extent.The real Vulkan regression bound the exact stride-zero format-74 OOB2 descriptor. With
NumRecords=1, it read{1.25f, -2.5f, 19.0f}as3fa00000 c0200000 41980000; the output guard stayeddeadbeef. TheNumRecords=12control returned the same values.python tools/check_conventions.py --base origin/mainandgit diff --check origin/main...HEADpass.tools/pr_overlap.py --branch fix/ssbo-oob2-read-extentcompared all 1,886 open PRs and reported expected line-level conflicts across shared AGC/recompiler files; it failed closed on several heads it could not confirm. Exact open-PR searches forbufferReadExtent, base formatted read extents and the stride-zero OOB2 SSBO case found no implementation of this behavior.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)Imported from boykopovar/AnyPS5. Originally posted by mashingaan on 2026-11-02T11:23:36Z.
Review: CHANGES_REQUESTED
The exact hosted Windows run fails in agc_driver_key_miss. Its synthetic shader-key builder still emits the old format. Please update the fixture for the added bufferReadExtent length and tenth flags block, then rerun the focused hosted check.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-06T21:53:54Z.
Review: CHANGES_REQUESTED
Checked the diff against the exact-head Build run and current
main:agc_driver_key_missfails on Windows (run 41380807522,***Failed).LabelShaderKeynow expects a tenth flags block and thebufferReadExtentlength word, but the synthetic key incore/libs/prx/libSceAgcDriver/tests/KeyMiss.cpp:33still pushes 9 flag blocks (flags < 9) and no extents. Update the fixture. This is the same point @mashingaan raised.main:Graphics/include/ShaderResources.hpp,Graphics/src/ShaderResources.cpp,tests/ShaderMemory.cpp,core/shader/recompiler/ShaderDiskCache.cpp,ShaderDiskCache.hppanddocs/dev/debt/libSceAgcDriver.md. These are code conflicts in the buffer-size path (guestBufferBytes/addGuestBuffer) and the cache format, so please rebase and re-check thatGuestBufferBytesis still used at every site that readdescriptor.GetSize()onmain. Also take the next freeFormatVersionafter the rebase.agc_driver_key_miss,agc_shader_disk_cache, the new read-extent tests) and push so the Build run covers the new head.The design looks sound to me (static proof only for complete unpacked 32-bit base reads, existing bound kept for writes, atomics, packed or typed loads and dynamic offsets). Once the Build is green I will measure the OOB_SELECT=2 behaviour on the hardware oracle before merging.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T21:31:28Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the requested read-extent behavior is supported by the inspected proof, descriptor-binding, and identity paths.
What I ran
Inspected the prepared diff and source context at head
43fba79d9ae67448076de73df413eb3c3af6bba4usingrepo_read.py. No build or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build, CTests, hardware Vulkan behavior, and the full contents of
core/libs/prx/libSceAgcDriver/tests/Graphics.cppandcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwere not verified in this review. The author reports five focused CTests passing on Windows 11 with an RTX 4070 SUPER. Read:WrittenBuffers.cpp,ShaderResources.hpp,Draw.cpp,ShaderResources.cpp,ShaderDiskCache.cpp, the changed CMake files,BufferFormatOob2StrideZero.cpp,Resources.hpp,DescriptorBindingBuilder.cpp,ResourceTracker.cpp,Recompiler.cpp,Recompiler.hpp,ShaderDiskCache.cpp(recompiler),ShaderDiskCache.hpp, anddocs/dev/debt/libSceAgcDriver.md. Excluded from full-text review by bundle rule:Graphics.cppandShaderMemory.cpp.To get this to a good state
Nothing is required. The author-reported hardware regression and test results are useful optional context.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:45:23Z.
Review: COMMENTED
The trial merge onto
c1601e56d5conflicts inShaderResources.cpp, recompiler state, shader disk cache and fixture registration. Keep the static proof narrow after the rebase. Only a proven base, descriptor-formatted read should widen the range to a full element; offset, writable and atomic controls should first establish they do not get that wider read allowance. Reconcile the cache format and move the direct AGC debt edit into a fragment.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.