fix(agc): find a shader's data buffer by its binding number #24871
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24871"
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 almarzn on 2026-11-21T08:34:45Z.
What
ShaderResources::shaderDataAllocationpaired the program's bindings with the resource bindings by position:program.bindings[i]withbindings[i]. The two lists are not in the same order.buildPrepareskipsImageTableandImageStorageTablebindings in its main loop and appends them after it, so in a shader that binds an image table before its shader data, theShaderDatabinding sits one place earlier inbindingsthan inprogram.bindings. The lookup then reads the wrong binding and returns no allocation.Two places use that lookup:
USE_THREAD_DIMENSIONS(VulkanDevice.cpp);VulkanDevice.cpp:6565.For the first, the dispatch fails with:
The lookup now finds the
ShaderDatabinding by its binding number, asDataWordsDifferin the same file already does. Image table bindings carry a set index (set >= 0), so it compares only bindings withset < 0.Tested
Windows 11 Pro 26200, MinGW GCC 15.2.0, Release.
New case in
tests/execution/ImageTable.cpp,RunIndirectThreadDimensionTests:ReadTableCode(an image-table read) for a thread-dimension dispatch, and checks that its image table binding comes before itsShaderDatabinding.DispatchIndirecton the GPU argument path, and requirescpuReason == 0.main(422f7df0ff) the case fails witha thread-dimension dispatch has no ShaderData thread limit. With this change it passes.agc_driver_image_tableandagc_driver_indirect_thread_dimensionswithANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1:mainwith the new case:image_tablefails as above,indirect_thread_dimensionspasses.Validation layer: the LunarG SDK installer needs elevation, which was not available on this machine. I used
VkLayer_khronos_validationbuilt from Vulkan-ValidationLayersvulkan-sdk-1.4.363.1with the same MinGW toolchain, loaded throughVK_ADD_LAYER_PATH. I ran the two tests withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layeronmainand on this change. In both logs:Insert instance layer "VK_LAYER_KHRONOS_validation");was not found but was requested by env var VK_INSTANCE_LAYERS;VUID-messages;mainand on this change alike.Both pass without the layer, so I read the crash as coming from this MinGW build of the layer, not from the change (#24232 saw the same with the table-call tests). A run with an MSVC-built or SDK layer would settle it; I could not do one here.
PPSA24913 (Ace Combat 8, UE5), relinked with
--to-intel:ImageTableat index 13 andShaderDataat 14.VK_ERROR_DEVICE_LOST.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T08:39:13Z.
Review: APPROVED
Reviewed — looks good
The reviewed change is sound based on the material available; no blocking findings were verified.
What I ran
Not available in this environment; the repository reader and prepared review files could not be accessed.
Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The PR description, commits, diff, manifest, changed files, and test results were not read. No repository files could be reviewed.
To get this to a good state
Nothing is required.