|
|
|
|
@ -33,12 +33,18 @@ struct StructureHelpersTest: TestSuite::Tester {
|
|
|
|
|
explicit StructureHelpersTest(); |
|
|
|
|
|
|
|
|
|
template<class T> void connect(); |
|
|
|
|
template<class T> void find(); |
|
|
|
|
template<class T> void disconnectChain(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
StructureHelpersTest::StructureHelpersTest() { |
|
|
|
|
addTests<StructureHelpersTest>({ |
|
|
|
|
&StructureHelpersTest::connect<VkDeviceCreateInfo>, |
|
|
|
|
&StructureHelpersTest::connect<VkPhysicalDeviceFeatures2>}); |
|
|
|
|
&StructureHelpersTest::connect<VkPhysicalDeviceFeatures2>, |
|
|
|
|
&StructureHelpersTest::find<VkDeviceCreateInfo>, |
|
|
|
|
&StructureHelpersTest::find<VkPhysicalDeviceFeatures2>, |
|
|
|
|
&StructureHelpersTest::disconnectChain<VkDeviceCreateInfo>, |
|
|
|
|
&StructureHelpersTest::disconnectChain<VkPhysicalDeviceFeatures2>}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class> struct Type; |
|
|
|
|
@ -77,6 +83,77 @@ template<class T> void StructureHelpersTest::connect() {
|
|
|
|
|
CORRADE_COMPARE(*next, &variableFeatures); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> void StructureHelpersTest::find() { |
|
|
|
|
typedef typename std::remove_reference<decltype(T{}.pNext)>::type NextType; |
|
|
|
|
setTestCaseTemplateName(Type<NextType>::name()); |
|
|
|
|
|
|
|
|
|
VkPhysicalDeviceVariablePointersFeatures variableFeatures{}; |
|
|
|
|
|
|
|
|
|
VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures{}; |
|
|
|
|
ycbcrFeatures.pNext = &variableFeatures; |
|
|
|
|
|
|
|
|
|
VkPhysicalDeviceMultiviewFeatures multiviewFeatures{}; |
|
|
|
|
multiviewFeatures.pNext = &ycbcrFeatures; |
|
|
|
|
|
|
|
|
|
T info{}; |
|
|
|
|
info.pNext = &multiviewFeatures; |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(const_cast<const void**>(Implementation::structureFind(info.pNext, variableFeatures)), const_cast<const void**>(&ycbcrFeatures.pNext)); |
|
|
|
|
/* It shouldn't be modifying the input in any way (heh, what the hell did
|
|
|
|
|
I manage to do here) */ |
|
|
|
|
CORRADE_COMPARE(info.pNext, &multiviewFeatures); |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(const_cast<const void**>(Implementation::structureFind(info.pNext, ycbcrFeatures)), const_cast<const void**>(&multiviewFeatures.pNext)); |
|
|
|
|
CORRADE_COMPARE(info.pNext, &multiviewFeatures); |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(const_cast<const void**>(Implementation::structureFind(info.pNext, multiviewFeatures)), const_cast<const void**>(&info.pNext)); |
|
|
|
|
CORRADE_COMPARE(info.pNext, &multiviewFeatures); |
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(Implementation::structureFind(info.pNext, info), nullptr); |
|
|
|
|
CORRADE_COMPARE(info.pNext, &multiviewFeatures); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> void StructureHelpersTest::disconnectChain() { |
|
|
|
|
typedef typename std::remove_reference<decltype(T{}.pNext)>::type NextType; |
|
|
|
|
setTestCaseTemplateName(Type<NextType>::name()); |
|
|
|
|
|
|
|
|
|
VkPhysicalDeviceFeatures2 a0{}, a1{}, a2{}, a3{}, a4{}, a5{}, a6{}, a7{}, a8{}, a9{}; |
|
|
|
|
|
|
|
|
|
VkDeviceGroupSubmitInfo out{}; |
|
|
|
|
|
|
|
|
|
int error{}; |
|
|
|
|
|
|
|
|
|
T info; |
|
|
|
|
info.pNext = &a1; |
|
|
|
|
a0.pNext = &error; |
|
|
|
|
a1.pNext = &a3; |
|
|
|
|
a2.pNext = &error; |
|
|
|
|
a3.pNext = &a4; |
|
|
|
|
a4.pNext = &a5; |
|
|
|
|
a5.pNext = &a7; |
|
|
|
|
a6.pNext = &error; |
|
|
|
|
a7.pNext = &a8; |
|
|
|
|
a8.pNext = &out; |
|
|
|
|
a9.pNext = &error; |
|
|
|
|
|
|
|
|
|
Implementation::structureDisconnectChain(info.pNext, { |
|
|
|
|
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 |
|
|
|
|
}); |
|
|
|
|
CORRADE_COMPARE(info.pNext, &out); |
|
|
|
|
|
|
|
|
|
/* Everything else should stay as it was before */ |
|
|
|
|
CORRADE_COMPARE(a0.pNext, &error); |
|
|
|
|
CORRADE_COMPARE(a1.pNext, &a3); |
|
|
|
|
CORRADE_COMPARE(a2.pNext, &error); |
|
|
|
|
CORRADE_COMPARE(a3.pNext, &a4); |
|
|
|
|
CORRADE_COMPARE(a4.pNext, &a5); |
|
|
|
|
CORRADE_COMPARE(a5.pNext, &a7); |
|
|
|
|
CORRADE_COMPARE(a6.pNext, &error); |
|
|
|
|
CORRADE_COMPARE(a7.pNext, &a8); |
|
|
|
|
CORRADE_COMPARE(a8.pNext, &out); |
|
|
|
|
CORRADE_COMPARE(a9.pNext, &error); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}}}} |
|
|
|
|
|
|
|
|
|
CORRADE_TEST_MAIN(Magnum::Vk::Test::StructureHelpersTest) |
|
|
|
|
|