, minDepthBounds (0.0f)
, maxDepthBounds (1.0f)
, forceGeometryShader (false)
- , testExtendedDynamicStateVersion(TEST_VERSION_extended_dynamic_state)
- , testExtendedDynamicState2LogicOp(false)
- , testExtendedDynamicState2PatchControlPoints(false)
- , useIndexBuffer (false)
- , useTessellation (false)
- , vertexFactory (vertexFactory_)
+ , singleVertex (false)
+ , singleVertexDrawCount (0)
, vertexDataOffset (0ull)
, vertexDataExtraBytes (0ull)
+ , vertexGenerator (makeVertexGeneratorConfig(staticVertexGenerator, dynamicVertexGenerator))
, cullModeConfig (static_cast<vk::VkCullModeFlags>(vk::VK_CULL_MODE_NONE))
, frontFaceConfig (vk::VK_FRONT_FACE_COUNTER_CLOCKWISE)
- // By default we will use a triangle fan with 6 vertices that could be wrongly interpreted as a triangle list with 2 triangles.
- , topologyConfig (vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN)
+ // By default we will use a triangle strip with 6 vertices that could be wrongly interpreted as a triangle list with 2 triangles.
+ , topologyConfig (vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP)
, viewportConfig (ViewportVec(1u, vk::makeViewport(kFramebufferWidth, kFramebufferHeight)))
, scissorConfig (ScissorVec(1u, vk::makeRect2D(kFramebufferWidth, kFramebufferHeight)))
// By default, the vertex stride is the size of a vertex according to the chosen vertex type.
dsImageViews.emplace_back(vk::makeImageView(vkd, device, img->get(), vk::VK_IMAGE_VIEW_TYPE_2D, dsFormatInfo->imageFormat, dsSubresourceRange));
// Vertex buffer.
- const auto topologyClass = getTopologyClass(m_testConfig.topologyConfig.staticValue);
- const std::vector<deUint32> indices { 0, 1, 2, 3, 0xFFFFFFFF, 4, 5, 0, 3 };
- std::vector<tcu::Vec2> vertices;
- const auto topologyClass = getTopologyClass(m_testConfig.topologyConfig.staticValue);
- std::vector<de::MovePtr<GeometryVertex>> vertexPtrs;
++ const auto topologyClass = getTopologyClass(m_testConfig.topologyConfig.staticValue);
++ std::vector<tcu::Vec2> vertices;
+ std::vector<deUint32> indices{ 0, 1, 2, 3, 0xFFFFFFFF, 2, 3, 4, 5 };
if (topologyClass == TopologyClass::TRIANGLE)
{
- // Full-screen triangle fan with 6 vertices.
+ // Full-screen triangle strip with 6 vertices.
//
- // 4 3 2
+ // 0 2 4
// +-------+-------+
- // |X X X|
- // | X X X |
- // | X X X |
+ // | XX X|
+ // | X X X |
+ // | X X X |
// | X X X |
- // | X X X |
- // | X X X |
- // | XXX |
+ // | X X X |
+ // | X X X |
+ // |X XX |
// +-------+-------+
- // 5 0 1
- // 1 3 5
-
- vertexPtrs.push_back(m_testConfig.vertexFactory(tcu::Vec2(-1.0f, -1.0f)));
- vertexPtrs.push_back(m_testConfig.vertexFactory(tcu::Vec2(-1.0f, 1.0f)));
- vertexPtrs.push_back(m_testConfig.vertexFactory(tcu::Vec2( 0.0f, -1.0f)));
- vertexPtrs.push_back(m_testConfig.vertexFactory(tcu::Vec2( 0.0f, 1.0f)));
- vertexPtrs.push_back(m_testConfig.vertexFactory(tcu::Vec2( 1.0f, -1.0f)));
- vertexPtrs.push_back(m_testConfig.vertexFactory(tcu::Vec2( 1.0f, 1.0f)));
++ // 1 3 5
+ vertices.reserve(6u);
- vertices.push_back(tcu::Vec2( 0.0f, 1.0f));
- vertices.push_back(tcu::Vec2( 1.0f, 1.0f));
- vertices.push_back(tcu::Vec2( 1.0f, -1.0f));
- vertices.push_back(tcu::Vec2( 0.0f, -1.0f));
+ vertices.push_back(tcu::Vec2(-1.0f, -1.0f));
+ vertices.push_back(tcu::Vec2(-1.0f, 1.0f));
++ vertices.push_back(tcu::Vec2( 0.0f, -1.0f));
++ vertices.push_back(tcu::Vec2( 0.0f, 1.0f));
++ vertices.push_back(tcu::Vec2( 1.0f, -1.0f));
++ vertices.push_back(tcu::Vec2( 1.0f, 1.0f));
}
else if (topologyClass == TopologyClass::PATCH)
{
}
}
- std::vector<GeometryVertex*> vertexRawPtrs;
- vertexRawPtrs.reserve(vertexPtrs.size());
- std::transform(begin(vertexPtrs), end(vertexPtrs), std::back_inserter(vertexRawPtrs),
- [](const de::MovePtr<GeometryVertex>& p) { return p.get(); });
+ if (m_testConfig.singleVertex)
+ vertices.resize(1);
- // Reversed vertices, except for the first one (0, 5, 4, 3, 2, 1): clockwise mesh for triangles. Not to be used with lines.
+ // Reversed vertices order in triangle strip (1, 0, 3, 2, 5, 4)
- std::vector<GeometryVertex*> reversedVertexRawPtrs;
+ std::vector<tcu::Vec2> rvertices;
if (topologyClass == TopologyClass::TRIANGLE)
{
- reversedVertexRawPtrs =
- {
- vertexRawPtrs[1],
- vertexRawPtrs[0],
- vertexRawPtrs[3],
- vertexRawPtrs[2],
- vertexRawPtrs[5],
- vertexRawPtrs[4],
- };
+ DE_ASSERT(!vertices.empty());
- rvertices.reserve(vertices.size());
- rvertices.push_back(vertices[0]);
- std::copy_n(vertices.rbegin(), vertices.size() - 1u, std::back_inserter(rvertices));
++ rvertices.reserve(6u);
++ rvertices.push_back(vertices[1]);
++ rvertices.push_back(vertices[0]);
++ rvertices.push_back(vertices[3]);
++ rvertices.push_back(vertices[2]);
++ rvertices.push_back(vertices[5]);
++ rvertices.push_back(vertices[4]);
}
- if (topologyClass == TopologyClass::LINE)
+ if (topologyClass != TopologyClass::TRIANGLE)
{
for (const auto& mesh : m_testConfig.meshParams)
{
vk::VkPrimitiveTopology dynamicVal;
} kTopologyCases[] =
{
- { vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN },
- { vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST, vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP },
- { vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST },
+ { vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP },
+ { vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST, vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP },
++ { vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST },
};
- for (int topoCaseIdx = 0; topoCaseIdx < DE_LENGTH_OF_ARRAY(kTopologyCases); ++topoCaseIdx)
+ for (const auto& kTopologyCase : kTopologyCases)
{
TestConfig config(baseConfig);
- config.forceGeometryShader = forceGeometryShader;
- config.topologyConfig.staticValue = kTopologyCases[topoCaseIdx].staticVal;
- config.topologyConfig.dynamicValue = tcu::just<vk::VkPrimitiveTopology>(kTopologyCases[topoCaseIdx].dynamicVal);
+ config.forceGeometryShader = forceGeometryShader;
+ config.topologyConfig.staticValue = kTopologyCase.staticVal;
+ config.topologyConfig.dynamicValue = tcu::just<vk::VkPrimitiveTopology>(kTopologyCase.dynamicVal);
+ config.patchControlPointsConfig.staticValue = (config.needsTessellation() ? 3u : 1u);
const std::string className = topologyClassName(getTopologyClass(config.topologyConfig.staticValue));
const std::string name = "topology_" + className + (forceGeometryShader ? "_geom" : "");