upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/bindless_sizing_test.cpp
diff options
context:
space:
mode:
authorJolymmiles <75259437+Jolymmiles@users.noreply.github.com>2026-11-22 20:01:37 +0400
committerJolymmiles <75259437+Jolymmiles@users.noreply.github.com>2026-11-22 20:01:37 +0400
commit4f574add4bfedc05c1e6451917aaa529b2c96551 (patch)
treebf1a5eb9e2bbbef2afc0469060c0b7eff9fd0e42 /runtime/test/bindless_sizing_test.cpp
parent4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff)
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.
Diffstat (limited to 'runtime/test/bindless_sizing_test.cpp')
-rw-r--r--runtime/test/bindless_sizing_test.cpp16
1 files changed, 16 insertions, 0 deletions
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() {
203 EXPECT(totals(f).all <= 6159 || (count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024)); 203 EXPECT(totals(f).all <= 6159 || (count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024));
204 } 204 }
205 205
206 // MoltenVK 1.4.3 on an M3 Max: update-after-bind limits of 1000000 sampled images and 500000 samplers, but
207 // maxPerSetDescriptors 1212 and a vkGetDescriptorSetLayoutSupport that accepts only fewer descriptors than that
208 // (MVKDevice::getDescriptorSetLayoutSupport), though the device creates and samples far larger sets. So the
209 // set keeps the default counts: 1024 samplers, short of a full D3D12 sampler heap (d3d12_descriptor_test).
210 {
211 Device d = uniform(1048576, 1000000);
212 d.v12.maxPerStageDescriptorUpdateAfterBindSamplers = d.v12.maxDescriptorSetUpdateAfterBindSamplers = 500000;
213 d.limits.maxSamplerAllocationCount = 500000;
214 d.v11.maxPerSetDescriptors = 1212;
215 const auto below_1212 = [](const BindlessFeatures& candidate) { return totals(candidate).all < 1212; };
216 BindlessFeatures f = with_ms(true);
217 EXPECT(bindless::size_bindings(f, d.limits, d.v11, d.v12, below_1212));
218 EXPECT(count(f, D::dim_2d) == 4096 && f.counts[bindless::sampler_binding] == 1024 &&
219 storage(f, D::dim_2d) == 256);
220 }
221
206 // The default features are today's counts, which the device-less users (vk_image_fuzz) still get. 222 // The default features are today's counts, which the device-less users (vk_image_fuzz) still get.
207 EXPECT(BindlessFeatures{}.counts == defaults); 223 EXPECT(BindlessFeatures{}.counts == defaults);
208 std::printf("bindless sizing: synthetic limits gave the expected counts\n"); 224 std::printf("bindless sizing: synthetic limits gave the expected counts\n");