upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_bindless_dimensions_test.cpp
diff options
context:
space:
mode:
authorBloh09 <104168236+Bloh09@users.noreply.github.com>2026-11-28 20:42:28 -0800
committerBloh09 <104168236+Bloh09@users.noreply.github.com>2026-11-28 20:42:28 -0800
commit0e5d2056b0c7eb5cecde9ed56829cd07109b30f7 (patch)
treeb57b5820f441cb0bf1c733f3594ad31697bc98b6 /runtime/test/vk_bindless_dimensions_test.cpp
parent3fbfcc6f8d824f3900b3b473e856ad4373f39bd8 (diff)
runtime: vk_bindless_dimensions skips on the device's limits and expects the sized 1D, 2D-array and 3D counts above its live images (CI-BINDLESS-DIMENSIONS-LIMITS-SKIP)
Diffstat (limited to 'runtime/test/vk_bindless_dimensions_test.cpp')
-rw-r--r--runtime/test/vk_bindless_dimensions_test.cpp46
1 files changed, 39 insertions, 7 deletions
diff --git a/runtime/test/vk_bindless_dimensions_test.cpp b/runtime/test/vk_bindless_dimensions_test.cpp
index 2b7863555..c3da54a03 100644
--- a/runtime/test/vk_bindless_dimensions_test.cpp
+++ b/runtime/test/vk_bindless_dimensions_test.cpp
@@ -405,16 +405,48 @@ int main() {
405 } 405 }
406 406
407 // The limits above are only the sampled-image ones; the sizing also answers to the resource and set limits (an 407 // The limits above are only the sampled-image ones; the sizing also answers to the resource and set limits (an
408 // Apple Paravirtual device under MoltenVK stops at the 256 defaults). Below live_images there is nothing to test. 408 // Apple Paravirtual device under MoltenVK stops at the 256 defaults). Whether the device holds live_images + 1 of
409 // each of the three beside what the sizing gave the rest is asked of those limits and of
410 // vkGetDescriptorSetLayoutSupport, as size_bindings' fits() does, not read back from the counts under test.
411 const auto& limits = properties.properties.limits;
412 BindlessFeatures wanted = features;
413 const std::uint32_t storage = wanted.counts[bindless::storage_binding(ImageDimension::dim_2d, 0)];
409 for (const ImageDimension dimension : 414 for (const ImageDimension dimension :
410 {ImageDimension::dim_1d, ImageDimension::dim_2d_array, ImageDimension::dim_3d}) { 415 {ImageDimension::dim_1d, ImageDimension::dim_2d_array, ImageDimension::dim_3d}) {
411 const std::uint32_t sized = features.counts[bindless::sampled_binding(dimension)]; 416 auto& sampled = wanted.counts[bindless::sampled_binding(dimension)];
412 if (sized <= live_images) { 417 sampled = std::max(sampled, live_images + 1);
413 std::printf("unsupported: the device's limits size the %s array at %u indices, too few for %u images\n", 418 // A storage array holds the 2D storage count up to its dimension's images, as size_bindings' apply(true).
414 name(dimension), sized, live_images); 419 const std::uint32_t held = std::min(storage, sampled);
415 return 77; 420 for (std::uint32_t c = 0; c < 3; ++c) wanted.counts[bindless::storage_binding(dimension, c)] = held;
416 } 421 if (bindless::r32ui_binding(dimension) != bindless::no_binding)
422 wanted.counts[bindless::r32ui_binding(dimension)] = held;
423 }
424 std::uint64_t sampled = 0, stored = 0, resources = 0, all = 0;
425 for (std::uint32_t b = 0; b < bindless::binding_count; ++b) {
426 if (!bindless::binding_enabled(b, wanted)) continue;
427 const VkDescriptorType type = bindless::bindings[b].type;
428 all += wanted.counts[b];
429 if (type == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) sampled += wanted.counts[b];
430 if (type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) stored += wanted.counts[b];
431 if (type != VK_DESCRIPTOR_TYPE_SAMPLER) resources += wanted.counts[b];
432 }
433 const std::uint32_t storage_limit = std::min(v12.maxPerStageDescriptorUpdateAfterBindStorageImages,
434 v12.maxDescriptorSetUpdateAfterBindStorageImages);
435 const std::uint32_t resource_limit =
436 v12.maxPerStageUpdateAfterBindResources -
437 std::min(v12.maxPerStageUpdateAfterBindResources, std::min(limits.maxColorAttachments, 8u));
438 const auto within = [](std::uint64_t n, std::uint32_t limit) { return n + bindless::growth_headroom <= limit; };
439 if (!within(sampled, sampled_limit) || !within(stored, storage_limit) || !within(resources, resource_limit) ||
440 all > v12.maxUpdateAfterBindDescriptorsInAllPools ||
441 (all > v11.maxPerSetDescriptors && !layout_supported(wanted))) {
442 std::printf("unsupported: the device's resource and set limits hold fewer than %u images of each dimension\n",
443 live_images + 1);
444 return 77;
417 } 445 }
446 // The device holds them, so the sizing must have given them (the 4096 1D and 3D cap this test is for).
447 for (const ImageDimension dimension :
448 {ImageDimension::dim_1d, ImageDimension::dim_2d_array, ImageDimension::dim_3d})
449 EXPECT(features.counts[bindless::sampled_binding(dimension)] > live_images);
418 450
419 const std::vector<std::uint32_t> code = load_spirv(LEONIDA_TEST_BINDLESS_DIMENSIONS_SPV); 451 const std::vector<std::uint32_t> code = load_spirv(LEONIDA_TEST_BINDLESS_DIMENSIONS_SPV);
420 EXPECT(!code.empty()); 452 EXPECT(!code.empty());