Repository navigation
Runtime: size the bindless set's arrays from the device's descriptor limits - #1199
Conversation
…limits Set 0's 2D, sampler and storage arrays were constexpr (4096 2D images, 1024 samplers, 256 per storage array): one full D3D12 sampler heap (2048) did not fit and bind_image/bind_sampler fell back. They are now sized once, when the device creates the set, from the update-after-bind or plain limits: today's sizes as the floor, then samplers up to min(4096, maxSamplerAllocationCount - 64), 2D images up to 65536, storage up to 4096. Sizing at creation keeps the set layout fixed for the pipelines built on it.
|
Tested ea512f2 on NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 Home 25H2 (26200.9974), VS 2022 Build Tools, Vulkan SDK 1.4.363.1: pass.
AI-assisted. No game files. |
|
AI-assisted review of
The D3D12 capacity block still needs a capacity guard for lower-limit hardware. Intel and the standalone Vulkan test's plain configuration remain unverified by this run. |
|
Tested AI-assisted (Claude Code): it built the branch, ran the tests and wrote this comment.
|
|
Tested ea512f2 on AMD Radeon RX 9070 (RDNA4), AMD 26.11.2 (LLPC), Windows 11 Pro 26300, MSVC 14.44, The device's update-after-bind limits are effectively unbounded: That's the first device in the PR where the sampler count isn't clamped by I also read
The branch also merges cleanly with AI-assisted (Claude Code). |
Set 0's 2D image, sampler and storage arrays were
constexpr: 4096 sampled 2D images, 1024 samplers and 256 per storage array. One full D3D12 shader-visible sampler heap holds 2048 samplers, and the game streams far more than 4096 textures. Past those sizes,bind_image/bind_samplerlogged "array is full" and shaders read the fallback.docs/d3d12_vulkan.mdsaid to grow the set by recreating it, but that would invalidate every pipeline layout built onbindless_set_layout(). So the device now sizes the arrays once, when it creates the set. The translator declares runtime arrays, so no shader changes.bindless::size_bindings(vulkan_bindless.h) is a pure function overVkPhysicalDeviceLimitsand the Vulkan 1.1/1.2 properties.maxSamplerAllocationCount− 64), 2D images up to 65536 and storage arrays up to 4096 each, leaving 64 of each limit for other sets.maxSamplerAllocationCountis 4000), 4096 storage indices in 2D. That's 93,793 descriptors, about 3–6 MiB. The device prints the counts it chose, one line per device.vk_pipeline_check's fixed counts (runtime arrays);root_signature.cpp's 4096 sanity bound.BindlessSet::allocate()is still a linear scan.maind3d12_descriptor_test)vk_bindless_teststep 9, a 2D image past 5000 others and a sampler past 2100add_imagereturns 0 past 4096Tests, on Windows 11 with an RTX 5070 (621.24),
LEONIDA_VK_VALIDATION=1andLEONIDA_D3D12=vulkan:bindless_sizing: synthetic limits for an RTX 5070-like device, a device exactly at today's sizes (gives today's set), a small device below them (clamped), UAB vs plain limits, andmaxPerSetDescriptorsat 1024 and 30000.vk_bindless_teststep 9 and thed3d12_descriptor_testcapacity block: both fail onmainand pass with this change.Not checked: AMD and Intel Windows drivers. If one reports a
maxPerSetDescriptorsbelow about 94k, growth stops there, andd3d12_descriptor_test's new block (5001 SRVs) isn't gated on the set's capacity. A test on those GPUs would help. #773 (D3D-78) edits the same table andstorage_indices, which this replaces withstorage_capacity(). Whichever lands second rebases; itsdim_1d_arrayneeds adding toimage_capacity/storage_capacity/size_bindings.AI-assisted.