From 877802bef264e900d02aa5468d442423a060b8e5 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 27 May 2019 13:23:29 +0100 Subject: [PATCH] Check descriptor indexing test doesn't overflow physical device limits --- util/test/demos/vk/vk_descriptor_index.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/util/test/demos/vk/vk_descriptor_index.cpp b/util/test/demos/vk/vk_descriptor_index.cpp index c36a7a7c6..95e236bfe 100644 --- a/util/test/demos/vk/vk_descriptor_index.cpp +++ b/util/test/demos/vk/vk_descriptor_index.cpp @@ -225,6 +225,20 @@ void main() VulkanGraphicsTest::Prepare(argc, argv); + if(!Avail.empty()) + return; + + VkPhysicalDeviceProperties props; + vkGetPhysicalDeviceProperties(phys, &props); + + // lazy - we could reduce this limit to a couple by not using combined image samplers + if(props.limits.maxDescriptorSetSamplers < DESC_ARRAY1_SIZE + DESC_ARRAY2_SIZE) + Avail = "maxDescriptorSetSamplers " + std::to_string(props.limits.maxDescriptorSetSamplers) + + " is insufficient"; + else if(props.limits.maxDescriptorSetSampledImages < DESC_ARRAY1_SIZE + DESC_ARRAY2_SIZE) + Avail = "maxDescriptorSetSampledImages " + + std::to_string(props.limits.maxDescriptorSetSampledImages) + " is insufficient"; + if(!Avail.empty()) return;