fix(agc): bind image and sampler tables through update-after-bind limits #6647
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6647"
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 binarycleric on 2026-10-16T01:30:39Z.
What
Image and sampler table capacity came only from the regular descriptor limits. MoltenVK reports Metal's argument table limits there, below the typed heaps the tables are reserved on top of, so both capacities were 0 and every table draw or dispatch was refused with
image tables need runtimeDescriptorArray, descriptorBindingPartiallyBound and descriptorBindingVariableDescriptorCount, which the device lacks(or the sampler table equivalent), although MoltenVK has all of those features.Limits MoltenVK 1.4.2 reports on an Apple M5 Max (x86-64 under Rosetta 2):
The sampled heaps alone reserve 28 × 64 = 1792 sampled images per stage and the sampler heap 32 samplers, so
ImageTableCapacityandSamplerTableCapacitywere 0.descriptorBindingSampledImageUpdateAfterBindis supported.descriptorBindingSampledImageUpdateAfterBindis queried and enabled, and the update-after-bind limits are read when either it or the storage buffer feature is present.ImageTableUpdateAfterBind,SamplerTableUpdateAfterBind). Its binding getsVK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BITand its set layout and pool are update-after-bind ones, inShaderResourcesand inDescribeSetLayoutsalike. A table that fits the regular limits is unchanged, so devices whose regular limits already hold the tables get the same layouts as before.ValidateDescriptorLayout) and its allocation (DescriptorCache::Allocate) are checked against the update-after-bind sampled image and sampler limits when the device hasdescriptorBindingSampledImageUpdateAfterBind. The limits chapter counts the descriptors of such sets against those limits in place of the regular ones, and its footnote 9 requires them to be at least the regular ones only when the matching update-after-bind feature is supported (otherwise they can be zero). So without the feature, and for storage images, the regular limits are kept as before, and existing storage buffer update-after-bind layouts are checked as they were. Storage buffers keep their own update-after-bind flag, set only when they need it.tableUpdateAfterBindTestsinagc_driver_graphicschecks the capacities with the limits above and with large regular limits, and the layout, binding and pool flags of an image table and of a sampler table, with and without the descriptor cache; with the cache,DescribeSetLayoutsreturns the layout the build made. The existing combined update-after-bind layout case indescriptorCacheTests, a sampled image binding in an update-after-bind set on a device without update-after-bind sampled images (whose limits are left at 0), still passes unchanged, which covers the regular limits being kept there.#6402 adds
StorageTableCapacitynext to the two capacity functions this changes; the two conflict in that one hunk, and the result is a plain union. Its storage tables use the regular storage image limit, which MoltenVK also reports as 256; that would be a follow-up after both.Tested
macOS 26.6.2, Apple M5 Max, x86-64 under Rosetta 2, MoltenVK 1.4.2 and Vulkan loader 1.4.363 built from source. This
main(5d9dcc42d) does not build on macOS by itself, so the GPU tests ran on it merged with the macOS series (mugurc/AnyPS5ci/macos-series-2, cc431f831) and #6580, plus local fixes for four macOS build errors that are not part of this pull request. The cherry-picked commit here has the same changes as the tested one.agc_driver_bindless_images,agc_driver_image_sint8,agc_driver_image_table,agc_driver_image_table_cache_boundsandagc_driver_image_table_reusefailed before and pass now.cteston that tree: 63 failures before, 58 after, none new; the remaining ones are unrelated (f16/f32 float modes, geometry and cull distance capabilities, and non-GPU macOS gaps).agc_driver_graphicspasses. Removing the update-after-bind flag from the image table binding makestableUpdateAfterBindTestsfail.agc*tests on MoltenVK reports no descriptor, update-after-bind, binding flag, pipeline layout or descriptor limit messages. As a control, withdescriptorBindingSampledImageUpdateAfterBindleft disabled it reportsVUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-descriptorBindingSampledImageUpdateAfterBind-03006for the table layouts.tools/check_conventions.py --base upstream/mainpasses.Linux: an Ubuntu 26.04 x86-64 container under Rosetta 2 with GCC 15.2.0 and Mesa 26.0.8 (llvmpipe), configured and run as the Linux job does (
ANYPS5_ENABLE_SPIRV_TOOLS=ON, thelibstarget,check_test_registration.py,ANYPS5_REQUIRE_VULKAN=1,GALLIUM_OVERRIDE_CPU_CAPS=avx), onmain5d9dcc42dand onmainwith this commit and a separate, unrelated libSceNetCtl change. Both build. The 22 tests that fail onmainin that container fail the same way with the change, andagc_driver_graphicsand the image table tests pass.precise_waitfailed once in the full run and 4 of 20 runs on its own; it measures sleep precision and is outside this change.Windows was not built or tested.
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 github-actions[bot] on 2026-10-16T01:37:13Z.
Some 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/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppImported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-16T20:58:31Z.
Intel Windows data point: this also fixes image tables on an Intel UHD 770, whose Windows driver reports limits of the same shape as MoltenVK.
Intel UHD Graphics 770 (
8086:a780), driver 32.0.101.7088, Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release,BUILD_TESTING=ON, every execution test built. Base:maina7f108030+ #6452 (4fe92c9c2, needed to build on Windows); this head506d49aaamerged on top.ANYPS5_NO_SHADER_CACHE=1.descriptorBindingSampledImageUpdateAfterBindis supported.agc_driver_bindless_images,agc_driver_image_sint8,agc_driver_image_tableimage tables need runtimeDescriptorArray, descriptorBindingPartiallyBound and descriptorBindingVariableDescriptorCount, which the device lacksagc_driver_image_table_cache_bounds,agc_driver_image_table_reuse0xc0000409) on the same erroragc_driver_image_table_cache,agc_driver_graphicsbindless_imagesandimage_sint8predate the capacity check (d9e47d1e9, #757), so on Intel Windows they regressed with it.Full CTest on the UHD 770 with this PR: 1337 of 1339. The failures are
select_tests(needs symlink privilege on this machine) andagc_driver_sample_multisample_target, which fails on the base too and uses no tables. The same eight tests on an RX 9070 XT (regular limits unbounded, so the regular path): pass ×3.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T11:23:38Z.
Rebase handoff — rebased onto current
main(authorship unchanged). One conflict inShaderResources.cpp:mainevolved the limit checks intoDescriptorLimitErrorthrows while this PR computes them from the update-after-bind limits — the merged version keepsmain's error style but sources the sampler and sampled-image bounds from yoursampledUpdateAfterBind-aware locals, so the update-after-bind capacity your feature relies on is still allowed.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV):tools/check_conventions.py --base origin/mainpassesmainregression (agc_driver_tessellationsegfault, #4727), not this PRTo pick it up:
Head is
69b1a3e42.Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-17T17:15:31Z.
UHD 770 retest of @blawesom's rebase
69b1a3e42: the image-table fix still works after theShaderResources.cppconflict resolution.Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, withVkCacheemptied first.69b1a3e42fromblawesom/AnyPS5rebase/6647, merged intomain66702f1cf.main, UHD 770agc_driver_bindless_images,agc_driver_image_sint8,agc_driver_image_tableimage tables need runtimeDescriptorArray, descriptorBindingPartiallyBound and descriptorBindingVariableDescriptorCount, which the device lacks(sampler tables need …forimage_table)agc_driver_image_table_cache_bounds,agc_driver_image_table_reuse0xc0000409) on the same errorsagc_driver_image_table_cache,agc_driver_graphicsand the other tests built fromtests/Graphics.cpp, 22 in all with the rows aboveFull CTest (
--parallel 4) with the rebase merged:agc_driver_sample_multisample_targetfails (#6957, fixed by #6971). Onmainalone, the five image-table tests above fail as well.mainalone,agc_driver_quad_pixel_mask(#6255) andagc_driver_layered_volume_vertex_no_gpl(#4768).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by binarycleric on 2026-10-18T05:06:41Z.
Rebased.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T10:21:52Z.
Re-checked after the
mainchange: the only difference from the head I reviewed before is the test-list adjacency intests/Graphics.cpp, no logic change. The update-after-bind capacity and flag paths, compute capture/replay andtableUpdateAfterBindTestsstand as reviewed, and the Intel UHD 770 / RX 9070 XT (Windows) and RADV runs from @savvaniss and @blawesom cover hardware our CI doesn't; merged.