fix(agc): find a shader's ShaderData binding by its number when image tables are appended #20067
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20067"
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 freneza on 2026-11-14T14:43:44Z.
What
ShaderResources::shaderDataAllocationmatched the program's ShaderData binding to a resource binding by its index in the two lists. The lists only line up until the first image table.ShaderResourcesskips theImageTable/ImageStorageTableprogram bindings and appends their resource bindings at the end. In a shader that binds an image table before its ShaderData, the index therefore lands on another binding. A thread-dimension dispatch (DISPATCH_INDIRECT with thread counts) of such a shader then aborts withVulkan dispatch: a thread-dimension dispatch has no ShaderData thread limit.This PR finds the resource binding by its binding number instead: the same
layout.binding, in a set that is not a table set (set < 0). The checks that follow (one allocation, host-side, with a buffer) are unchanged.agc_driver_image_table_variantsgains a case. It compiles its image-table shader with partial thread groups and ShaderData instead of push data, and checks that the ShaderData binding comes after the image table. It then dispatches the shader indirectly with 64 and with 35 threads in a 64-thread group. Lanes inside the limit must sample the right texel, and lanes past it must not run.Tested
Linux (Bazzite 45, Fedora 44 toolbox), GCC, Release. Each arm ran
agc_driver_image_table_variants,agc_driver_indirect_thread_dimensionsandagc_driver_indirect_thread_dimensions_cpu3 times, from the same build tree on the same GPU, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest --test-dir build -R '^agc_driver_(image_table_variants|indirect_thread_dimensions|indirect_thread_dimensions_cpu)$' -V:VUID-linesmain3ffcba66e0+ the new test casea thread-dimension dispatch has no ShaderData thread limitInsert instance layer "VK_LAYER_KHRONOS_validation", and none containswas not found but was requested by env var VK_INSTANCE_LAYERS. The layer isvulkan-validation-layers1.4.341.0x120aec1a00, 14 program bindings) aborted with the message above. A local diagnostic showedShaderData at binding 13 with 0 allocations. With this change the same dispatches ran in game and the 12 car compute pipelines were created. The title still stops later, on the call-table limit discussed in #13538.Checklist
main; no other open PR implements the same functions.pr_overlap.py --names shaderDataAllocation: none.--branchlists only file-level overlaps onShaderResources.cppandImageTableVariants.cpp.NotImplemented_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
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T15:33:00Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the code read supports the binding lookup fix, and the author reports passing targeted GPU tests.
What I ran
Reviewed head
402e1af06ddf019851caac695e24cb29ee78307ausing the prepared diff andrepo_read.py. No tests or builds were run. The author-reported test results are not runs performed in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Read
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpparound the changed function and binding construction,core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpparound a caller, andcore/libs/prx/libSceAgcDriver/tests/execution/ImageTableVariants.cpparound the changed test.files.jsonwas unavailable through the reader, so the reviewed/excluded file inventory could not be confirmed. The complete 7,388-lineShaderResources.cppwas not read; other code paths and reported hardware results were not independently verified.To get this to a good state
Nothing is required. The author-reported targeted test results are useful supporting evidence.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T06:34:33Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and added regression test support the stated fix.
What I ran
Reviewed head
0c3160a61fd272990d7cdbfca135d6c0eeaba242. No commands or tests were run; the Linux GPU test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run here. The described Linux GPU runs and validation-layer output were not independently verified. The changed file
core/libs/prx/libSceAgcDriver/tests/execution/ImageTableVariants.cppwas read, including all added lines; it is the only file listed as reviewed. The implementation filescore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp, and existing test context incore/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppwere read as context, not as changed files. No files were excluded by the manifest.To get this to a good state
Nothing is required.