From 26d74d7bab61444b64dc504dec819ee5c85d2ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 10 Jul 2024 13:07:59 +0200 Subject: [PATCH] Vk: reorder test cases to match call order. --- src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp | 36 ++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp b/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp index 720ca16e3..f5b0b8161 100644 --- a/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp +++ b/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp @@ -247,6 +247,24 @@ void DescriptorPoolVkTest::allocateVariableCount() { } } +void DescriptorPoolVkTest::allocateVariableCountFreeDescriptorSet() { + if(!(_deviceVariableDescriptorCount.enabledFeatures() & DeviceFeature::DescriptorBindingVariableDescriptorCount)) + CORRADE_SKIP("DeviceFeature::DescriptorBindingVariableDescriptorCount not supported, can't test."); + + DescriptorSetLayout layout{_deviceVariableDescriptorCount, DescriptorSetLayoutCreateInfo{ + {{0, DescriptorType::UniformBuffer, 4, ~ShaderStages{}, DescriptorSetLayoutBinding::Flag::VariableDescriptorCount}} + }}; + + DescriptorPool pool{_deviceVariableDescriptorCount, DescriptorPoolCreateInfo{1, { + {DescriptorType::UniformBuffer, 4} + }, DescriptorPoolCreateInfo::Flag::FreeDescriptorSet}}; + + DescriptorSet allocated = pool.allocate(layout, 4); + CORRADE_VERIFY(allocated.handle()); + /* vkFreeDescriptorSets() gets called on destruction */ + CORRADE_COMPARE(allocated.handleFlags(), HandleFlag::DestroyOnDestruction); +} + void DescriptorPoolVkTest::allocateVariableCountFail() { if(!(_deviceVariableDescriptorCount.enabledFeatures() & DeviceFeature::DescriptorBindingVariableDescriptorCount)) CORRADE_SKIP("DeviceFeature::DescriptorBindingVariableDescriptorCount not supported, can't test."); @@ -277,24 +295,6 @@ void DescriptorPoolVkTest::allocateVariableCountFail() { } } -void DescriptorPoolVkTest::allocateVariableCountFreeDescriptorSet() { - if(!(_deviceVariableDescriptorCount.enabledFeatures() & DeviceFeature::DescriptorBindingVariableDescriptorCount)) - CORRADE_SKIP("DeviceFeature::DescriptorBindingVariableDescriptorCount not supported, can't test."); - - DescriptorSetLayout layout{_deviceVariableDescriptorCount, DescriptorSetLayoutCreateInfo{ - {{0, DescriptorType::UniformBuffer, 4, ~ShaderStages{}, DescriptorSetLayoutBinding::Flag::VariableDescriptorCount}} - }}; - - DescriptorPool pool{_deviceVariableDescriptorCount, DescriptorPoolCreateInfo{1, { - {DescriptorType::UniformBuffer, 4} - }, DescriptorPoolCreateInfo::Flag::FreeDescriptorSet}}; - - DescriptorSet allocated = pool.allocate(layout, 4); - CORRADE_VERIFY(allocated.handle()); - /* vkFreeDescriptorSets() gets called on destruction */ - CORRADE_COMPARE(allocated.handleFlags(), HandleFlag::DestroyOnDestruction); -} - void DescriptorPoolVkTest::reset() { DescriptorSetLayout layout{device(), DescriptorSetLayoutCreateInfo{ {{0, DescriptorType::UniformBuffer}}