|
|
|
|
@ -53,7 +53,9 @@ struct MeshLayoutTest: TestSuite::Tester {
|
|
|
|
|
void addBinding(); |
|
|
|
|
void addInstancedBinding(); |
|
|
|
|
void addInstancedBindingDivisor(); |
|
|
|
|
void addBindingWrongOrder(); |
|
|
|
|
template<class T> void addAttribute(); |
|
|
|
|
void addAttributeWrongOrder(); |
|
|
|
|
|
|
|
|
|
void debugMeshPrimitive(); |
|
|
|
|
}; |
|
|
|
|
@ -74,8 +76,10 @@ MeshLayoutTest::MeshLayoutTest() {
|
|
|
|
|
&MeshLayoutTest::addBinding, |
|
|
|
|
&MeshLayoutTest::addInstancedBinding, |
|
|
|
|
&MeshLayoutTest::addInstancedBindingDivisor, |
|
|
|
|
&MeshLayoutTest::addBindingWrongOrder, |
|
|
|
|
&MeshLayoutTest::addAttribute<VertexFormat>, |
|
|
|
|
&MeshLayoutTest::addAttribute<Magnum::VertexFormat>, |
|
|
|
|
&MeshLayoutTest::addAttributeWrongOrder, |
|
|
|
|
|
|
|
|
|
&MeshLayoutTest::debugMeshPrimitive}); |
|
|
|
|
} |
|
|
|
|
@ -322,6 +326,23 @@ void MeshLayoutTest::addInstancedBindingDivisor() {
|
|
|
|
|
CORRADE_COMPARE(vertexDivisorInfo.pVertexBindingDivisors[1].divisor, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MeshLayoutTest::addBindingWrongOrder() { |
|
|
|
|
#ifdef CORRADE_NO_ASSERT |
|
|
|
|
CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
MeshLayout layout{MeshPrimitive::Triangles}; |
|
|
|
|
layout.addBinding(15, 23); |
|
|
|
|
|
|
|
|
|
std::ostringstream out; |
|
|
|
|
Error redirectError{&out}; |
|
|
|
|
layout.addBinding(15, 27) |
|
|
|
|
.addInstancedBinding(15, 27); |
|
|
|
|
CORRADE_COMPARE(out.str(), |
|
|
|
|
"Vk::MeshLayout::addBinding(): binding 15 can't be ordered after 15\n" |
|
|
|
|
"Vk::MeshLayout::addInstancedBinding(): binding 15 can't be ordered after 15\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> void MeshLayoutTest::addAttribute() { |
|
|
|
|
setTestCaseTemplateName(VertexFormatTraits<T>::name()); |
|
|
|
|
|
|
|
|
|
@ -341,6 +362,21 @@ template<class T> void MeshLayoutTest::addAttribute() {
|
|
|
|
|
CORRADE_COMPARE(layout.vkPipelineVertexInputStateCreateInfo().pVertexAttributeDescriptions[1].offset, 22); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MeshLayoutTest::addAttributeWrongOrder() { |
|
|
|
|
#ifdef CORRADE_NO_ASSERT |
|
|
|
|
CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
MeshLayout layout{MeshPrimitive::Triangles}; |
|
|
|
|
layout.addAttribute(5, 17, VertexFormat{}, 0); |
|
|
|
|
|
|
|
|
|
std::ostringstream out; |
|
|
|
|
Error redirectError{&out}; |
|
|
|
|
layout.addAttribute(5, 25, VertexFormat{}, 1); |
|
|
|
|
CORRADE_COMPARE(out.str(), |
|
|
|
|
"Vk::MeshLayout::addAttribute(): location 5 can't be ordered after 5\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MeshLayoutTest::debugMeshPrimitive() { |
|
|
|
|
std::ostringstream out; |
|
|
|
|
Debug{&out} << MeshPrimitive::TriangleFan << MeshPrimitive(-10007655); |
|
|
|
|
|