From 4f574add4bfedc05c1e6451917aaa529b2c96551 Mon Sep 17 00:00:00 2001 From: Jolymmiles <75259437+Jolymmiles@users.noreply.github.com> Date: Sun, 22 Nov 2026 20:01:37 +0400 Subject: d3d12_descriptor_test: the bindless capacity check follows the set's room On MoltenVK (1.4.2, 1.4.3) the check sampled zeros: vkGetDescriptorSetLayoutSupport there accepts only layouts of fewer than maxPerSetDescriptors (1212) descriptors, so size_bindings keeps the default 4096 2D images and 1024 samplers, and the test's 5001st view and 2100th sampler were refused as the arrays filled. MoltenVK does create and sample a 65536-image, 4096-sampler set correctly (a native reproduction, and the whole test passes under Wine with growth forced), so that is MoltenVK's to fix; the runtime keeps following the driver's answer. The test now asks the set how much room it has (rt::d3d12::bindless_room, from BindlessSet::free_images and free_samplers). Where the set holds the full counts nothing changes. Where it holds fewer, the test fills each short array to its last index, checks the last view through the last sampler gives the texture, and that one more view and sampler are refused and read as the fallbacks. The device logs at startup when its set holds fewer samplers than a full shader-visible sampler heap. bindless_sizing_test gets MoltenVK's limits; vk_bindless_test checks the free counts. --- runtime/test/bindless_sizing_test.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'runtime/test/bindless_sizing_test.cpp') diff --git a/runtime/test/bindless_sizing_test.cpp b/runtime/test/bindless_sizing_test.cpp index 07715f01e..4553f25b6 100644 --- a/runtime/test/bindless_sizing_test.cpp +++ b/runtime/test/bindless_sizing_test.cpp @@ -203,6 +203,22 @@ int main() { EXPECT(totals(f).all <= 6159 || (count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024)); } + // MoltenVK 1.4.3 on an M3 Max: update-after-bind limits of 1000000 sampled images and 500000 samplers, but + // maxPerSetDescriptors 1212 and a vkGetDescriptorSetLayoutSupport that accepts only fewer descriptors than that + // (MVKDevice::getDescriptorSetLayoutSupport), though the device creates and samples far larger sets. So the + // set keeps the default counts: 1024 samplers, short of a full D3D12 sampler heap (d3d12_descriptor_test). + { + Device d = uniform(1048576, 1000000); + d.v12.maxPerStageDescriptorUpdateAfterBindSamplers = d.v12.maxDescriptorSetUpdateAfterBindSamplers = 500000; + d.limits.maxSamplerAllocationCount = 500000; + d.v11.maxPerSetDescriptors = 1212; + const auto below_1212 = [](const BindlessFeatures& candidate) { return totals(candidate).all < 1212; }; + BindlessFeatures f = with_ms(true); + EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12, below_1212)); + EXPECT(count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024 && + storage(f, D::dim_2d) == 256); + } + // The default features are today's counts, which the device-less users (vk_image_fuzz) still get. EXPECT(BindlessFeatures{}.counts == defaults); std::printf("bindless sizing: synthetic limits gave the expected counts\n"); -- cgit v1.2.3