feat(shader): add opt-in native buffer descriptor tables #20248
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20248"
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 Queuse on 2026-11-14T22:29:19Z.
What
Add an opt-in native SSBO-array path for direct four-word buffer descriptor columns used by raw 32-bit noncoherent compute reads.
ANYPS5_BUFFER_DESCRIPTOR_TABLES=1enables it on supported hosts. Rows beyond the native capacity or storage-buffer range, byte-misaligned rows and partially mapped data retain BDA fallback. Other access modes keep their existing path.Mapped views that start at a DWORD offset now carry their actual byte adjustment in the table record, after descriptor materialization. They no longer require a push-constant or shader-data offset slot. Cache serialization retains the new metadata alongside current main's image metadata. Descriptor heap mutation during a dispatch remains unsupported and is recorded in shader debt. Related to #15780; no title compatibility or speed claim.
Integrated
mainb396d834cbat0f082a0b98. The overlap scan covered 2,393 open PRs, with 358 sharing files or exports; it reported 37 textual intersections and 103 branches that could not be compared automatically. Shared hunks and the changed buffer paths were inspected, including #9508, #28132, #28295/#28390, #28414 and the image-heap stack #20519/#28652/#28673. These combined stacks have not been built. Integration must retain the independent tracker flags, both descriptor-field sources, and both sides' cache metadata; the scan is not a blanket clearance.Tested
Windows 11 build 26300, WinLibs GCC 15.2.0 r7 UCRT Release, NVIDIA GeForce RTX 3050 Laptop GPU, driver 621.24, Khronos validation 1.4.363.0.
With
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layerandANYPS5_BUFFER_DESCRIPTOR_TABLES=1, rebuilt and ranctest --test-dir build -R '^(agc_driver_(buffer_descriptor_runtime|buffer_resource_vcc|buffer_half_straddle|image_table|image_store_float_rounding)|agc_shader_disk_cache|agc_shader_table_resolution_growth|descriptor_layout_limits)$' -V -j 1 --timeout 30on the same machine and GPU:0f082a0b98: 8/8 passed, none skipped; five validation-layer insertions, zero missing-layer warnings and zeroVUID-lines. Every test finished within 30 seconds.b396d834cb: 8/8 passed, none skipped; five validation-layer insertions, zero missing-layer warnings and zeroVUID-lines. Every test finished within 30 seconds.0f082a0b98: buffer-descriptor runtime test passed (3.01 s), with validation inserted and zeroVUID-or missing-layer warnings.a guest buffer off the storage buffer offset alignment in a shader without shader data is not implemented; the counter-loop, waterfall and direct-SSBO selection checks pass with the correction.tools/check_conventions.py --base origin/mainand PR-diff whitespace checks passed. Full hosted CI, a full Linux build, title bring-up and performance measurements have not been run on this head. Earlier independent GPU reports in the conversation apply to their stated older heads.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)Summary by CodeRabbit
ANYPS5_BUFFER_DESCRIPTOR_TABLES=1on systems that support storage-buffer non-uniform indexing.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T15:47:03Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this review; the optional point below needs confirmation before the opt-in path is relied on.
What I ran
723a2b3c4133f2d7d3ce0eacd55240bdcea6e4adusingrepo_read.pyto inspect the prepared diff and targeted source ranges.Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
enabled.shaderStorageBufferArrayDynamicIndexingis set in theVkPhysicalDeviceFeaturespassed to device creation. The opt-in path advertises that capability and emits dynamic indexing in SPIR-V (core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp:2263-2265), but the inspected initialization only assigned it when enabling the feature insidedescriptorIndexingFeatures. This may cause device creation or validation to reject the capability. The relevant feature initialization and full device-create chain were not read, so this is not a verified defect.Not verified
review/manifest.json; I read the diff and targeted source ranges, not every included file.VulkanDevice.cppandShaderResources.cppare excluded fromreview/files/for size; targeted ranges were read through the pinned reader. Other changed files and callers were not inspected, so completeness of the implementation review is not established.To get this to a good state
Nothing is required. Optional: confirm core storage-buffer dynamic indexing is enabled in the device-create feature struct, and cover that path with a validation run.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T01:03:56Z.
Review: COMMENTED
Reviewed — comments
The core buffer table lowering and dispatch paths were inspected at
dd7df7d7307cff63b61861172d3d0f15fbefed86; the review is incomplete, so a formal approval is not justified.What I ran
No commands were run. I read the prepared description, commit list, manifest, diff, and selected changed source ranges through
repo_read.py.Results
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Not verified
The review did not cover every changed file or every relevant function. Files read included
VulkanDevice.cpp,ShaderResources.cpp,BufferDescriptorRuntime.cpp,BufferTableAbi.hpp,ResourceTracker.cpp,ResourceMaterializer.cpp,SpirvRuntimeBuffer.cpp,SpirvEmitterHelpers.cpp,SpirvImageEmitter.cpp,ShaderDiskCache.cpp,ShaderDiskCachetests, and selected metadata and documentation changes. The remaining changed files and uninspected portions were not verified. Files excluded from the review bundle because they were too large wereVulkanDevice.cppandShaderResources.cpp; targeted ranges were read from the pinned head through the reader. Runtime tests, a full build, console behavior, and title performance were not verified by this review.To get this to a good state
Nothing is required. The author-reported tests and platform results remain unverified here.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T13:21:28Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: fix table-backed reads for mapped buffer views with a nonzero alignment adjustment.
What I ran
58913cf9ca1ffd7b9f8c801abd384f6139959697; no commands or tests were run by me.repo_read.py.Results
Findings
Blocking
tableMisalignment(SpirvRuntimeBuffer.cpp:213), but tablereadBuffercomputes its index from only the guest address anddynamicByteOffset(SpirvRuntimeBuffer.cpp:379-380;:361-364). For mapped views, the buffer setup may map fromaddress - adjustmentand recordsadjustment(ShaderResources.cpp:7085-7102); the table view’s adjustment is then applied to map flags (ShaderResources.cpp:6851-6854). Reads therefore need to include the low base misalignment along with that adjustment. Otherwise a descriptor whose base is dword-aligned but not aligned to the host storage-buffer offset requirement reads from the wrong dword. The added misaligned-row test exercises a base address misaligned by two bytes, which is routed to BDA fallback; it does not cover this mapped-view adjustment case. Fix: account for bothtableMisalignmentand the mapped-view adjustment when calculating the direct word index. Changed-line evidence:core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp:379-380.Non-blocking
None.
Not verified
VulkanDevice.cppandShaderResources.cppwere excluded from the prepared snapshot; I read only targeted ranges throughrepo_read.py. Other unexamined behavior in these files is not verified.To get this to a good state
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T22:54:38Z.
Review: COMMENTED
Actionable comments
MaxDirectBufferBytes.cc44e819-d39f-43be-bb47-db18a54170abReviewing files that changed from the base of the PR and between
b396d834cband0f082a0b98.core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_buffer_descriptor_runtime_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/BufferDescriptorRuntime.cppcore/shader/recompiler/BufferTableAbi.hppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hppcore/shader/recompiler/Optimization/include/Optimization/ResourceTracker.hppcore/shader/recompiler/Optimization/src/BindingAllocator.cppcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/RuntimeAbi.hppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvImageEmitter.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cppcore/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/changes/dynamic-buffer-table-20261108.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T23:13:06Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes at head
0f082a0b98df17499fc7a6098857be3f208854ffhave no verified blocking defects.What I ran
Reviewed
diff.patchand all 24 changed paths inmanifest.json; usedrepo_read.pyto inspect targeted source ranges for the large files. No merged-preview check or build was run. No tests were run locally.Results
Negative control
Not run locally; executing the test suite was not established to avoid compilation.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
Author-reported Windows and RTX 3050 test results were not independently reproduced. Title compatibility, console behavior, cross-vendor behavior, and performance were not verified. All 24 changed paths were reviewed;
files.jsonlists no filter-excluded paths. Full text for the two large changed files was not read; their changed areas were inspected with the pinned reader.To get this to a good state
No follow-up is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:21:38Z.
Review: COMMENTED
The trial merge onto
a1b75b0947was clean. I reviewed the boundary between the native read descriptor table and the BDA fallback when descriptor indexing, compatible alignment, or table capacity is unavailable. Please keep the valid, out-of-range and overflow-row cases with the generated-capability check, since inspecting the SPIR-V alone cannot confirm the runtime row selection. Paired shader and runtime buffer validation is pending.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.