deqp-vk-draw: split indirect_draw tests into groups depending on `drawIndirectFirstIn...
authorscygan <slawomir.cygan@intel.com>
Fri, 8 Apr 2016 16:10:18 +0000 (18:10 +0200)
committerPyry Haulos <phaulos@google.com>
Tue, 19 Apr 2016 19:25:57 +0000 (12:25 -0700)
external/vulkancts/data/vulkan/draw/VertexFetchInstanced.vert [new file with mode: 0644]
external/vulkancts/data/vulkan/draw/VertexFetchInstancedFirstInstance.vert [moved from external/vulkancts/data/vulkan/draw/VertexFetchWithInstance.vert with 100% similarity]
external/vulkancts/modules/vulkan/draw/vktDrawIndexedTest.cpp
external/vulkancts/modules/vulkan/draw/vktDrawIndirectTest.cpp
external/vulkancts/modules/vulkan/draw/vktDrawSimpleTest.cpp
external/vulkancts/mustpass/1.0.0/vk-default.txt

diff --git a/external/vulkancts/data/vulkan/draw/VertexFetchInstanced.vert b/external/vulkancts/data/vulkan/draw/VertexFetchInstanced.vert
new file mode 100644 (file)
index 0000000..e694f60
--- /dev/null
@@ -0,0 +1,14 @@
+#version 430
+
+layout(location = 0) in vec4 in_position;
+layout(location = 1) in vec4 in_color;
+
+layout(location = 0) out vec4 out_color;
+
+void main() {
+       vec2 perVertex = vec2(in_position.x, in_position.y);
+       vec2 perInstance[6]     = vec2[6](vec2(0.0, 0.0), vec2(0.3, 0.0), vec2(0.0, -0.3),vec2(0.3, -0.3), vec2(0.7, -0.7), vec2(-0.75, 0.8));
+
+       gl_Position = vec4(perVertex + perInstance[gl_InstanceIndex], 0.0, 1.0);
+       out_color = in_color;
+}
\ No newline at end of file
index 401187a..caa0344 100644 (file)
@@ -353,7 +353,7 @@ void DrawIndexedTests::init (void)
        addChild(new InstanceFactory<DrawIndexed>(m_testCtx, "draw_indexed_triangle_list", "Draws indexed triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
        addChild(new InstanceFactory<DrawIndexed>(m_testCtx, "draw_indexed_triangle_strip", "Draws indexed triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
 
-       shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetchWithInstance.vert";
+       shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetchInstancedFirstInstance.vert";
        shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/draw/VertexFetch.frag";
 
        addChild(new InstanceFactory<DrawInstancedIndexed>(m_testCtx, "draw_instanced_indexed_triangle_list", "Draws indexed triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
index 93e2c8f..d3522f9 100644 (file)
@@ -71,6 +71,19 @@ protected:
        deUint32                                                                m_drawIndirectMaxCount;
 };
 
+struct FirtsInstanceSupported
+{
+       static deUint32 getFirstInstance        (void)                                                                                  { return 2; }
+       static bool             isTestSupported         (const vk::VkPhysicalDeviceFeatures& features)  { return features.drawIndirectFirstInstance == vk::VK_TRUE; }
+};
+
+struct FirtsInstanceNotSupported
+{
+       static deUint32 getFirstInstance        (void)                                                                                  { return 0; }
+       static bool             isTestSupported         (const vk::VkPhysicalDeviceFeatures& features)  { return true; }
+};
+
+template<class FirstInstanceSupport>
 class IndirectDrawInstanced : public IndirectDraw
 {
 public:
@@ -316,12 +329,18 @@ tcu::TestStatus IndirectDraw::iterate (void)
 
 }
 
-IndirectDrawInstanced::IndirectDrawInstanced (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology)
+template<class FirstInstanceSupport>
+IndirectDrawInstanced<FirstInstanceSupport>::IndirectDrawInstanced (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology)
        : IndirectDraw  (context, shaders, topology)
 {
+       if (!FirstInstanceSupport::isTestSupported(m_context.getDeviceFeatures()))
+       {
+               throw tcu::NotSupportedError("Required 'drawIndirectFirstInstance' feature is not supported");
+       }
 }
 
-tcu::TestStatus IndirectDrawInstanced::iterate (void)
+template<class FirstInstanceSupport>
+tcu::TestStatus IndirectDrawInstanced<FirstInstanceSupport>::iterate (void)
 {
        tcu::TestLog &log = m_context.getTestContext().getLog();
        const vk::VkQueue queue = m_context.getUniversalQueue();
@@ -333,17 +352,17 @@ tcu::TestStatus IndirectDrawInstanced::iterate (void)
                        vk::VkDrawIndirectCommand drawCmd[] =
                        {
                                {
-                                       3,              //vertexCount
-                                       4,              //instanceCount
-                                       2,              //firstVertex
-                                       2               //firstInstance
+                                       3,                                                                                      //vertexCount
+                                       4,                                                                                      //instanceCount
+                                       2,                                                                                      //firstVertex
+                                       FirstInstanceSupport::getFirstInstance()        //firstInstance
                                },
                                { (deUint32)-4, (deUint32)-2, (deUint32)-11, (deUint32)-9 }, // junk (stride)
                                {
-                                       3,              //vertexCount
-                                       4,              //instanceCount
-                                       5,              //firstVertex
-                                       2               //firstInstance
+                                       3,                                                                                      //vertexCount
+                                       4,                                                                                      //instanceCount
+                                       5,                                                                                      //firstVertex
+                                       FirstInstanceSupport::getFirstInstance()        //firstInstance
                                }
                        };
                        m_indirectDrawCmd.push_back(drawCmd[0]);
@@ -356,17 +375,17 @@ tcu::TestStatus IndirectDrawInstanced::iterate (void)
                        vk::VkDrawIndirectCommand drawCmd[] =
                        {
                                {
-                                       4,              //vertexCount
-                                       4,              //instanceCount
-                                       2,              //firstVertex
-                                       2               //firstInstance
+                                       4,                                                                                      //vertexCount
+                                       4,                                                                                      //instanceCount
+                                       2,                                                                                      //firstVertex
+                                       FirstInstanceSupport::getFirstInstance()        //firstInstance
                                },
                                { (deUint32)-4, (deUint32)-2, (deUint32)-11, (deUint32)-9 },
                                {
-                                       4,              //vertexCount
-                                       4,              //instanceCount
-                                       6,              //firstVertex
-                                       2               //firstInstance
+                                       4,                                                                                      //vertexCount
+                                       4,                                                                                      //instanceCount
+                                       6,                                                                                      //firstVertex
+                                       FirstInstanceSupport::getFirstInstance()        //firstInstance
                                }
                        };
                        m_indirectDrawCmd.push_back(drawCmd[0]);
@@ -511,16 +530,37 @@ void IndirectDrawTests::init (void)
 {
        ShaderMap shaderPaths;
        shaderPaths[glu::SHADERTYPE_VERTEX]             = "vulkan/draw/VertexFetch.vert";
-       shaderPaths[glu::SHADERTYPE_FRAGMENT]    = "vulkan/draw/VertexFetch.frag";
+       shaderPaths[glu::SHADERTYPE_FRAGMENT]   = "vulkan/draw/VertexFetch.frag";
 
-       addChild(new InstanceFactory<IndirectDraw>(m_testCtx, "indirect_draw_triangle_list", "Draws triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
-       addChild(new InstanceFactory<IndirectDraw>(m_testCtx, "indirect_draw_triangle_strip", "Draws triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
+       tcu::TestCaseGroup* indirectDrawGroup   = new tcu::TestCaseGroup(m_testCtx, "indirect_draw", "Draws geometry");
+       {
+               indirectDrawGroup->addChild(new InstanceFactory<IndirectDraw>(m_testCtx, "triangle_list", "Draws triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
+               indirectDrawGroup->addChild(new InstanceFactory<IndirectDraw>(m_testCtx, "triangle_strip", "Draws triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
+       }
+       addChild(indirectDrawGroup);
 
-       shaderPaths[glu::SHADERTYPE_VERTEX]             = "vulkan/draw/VertexFetchWithInstance.vert";
-       shaderPaths[glu::SHADERTYPE_FRAGMENT]   = "vulkan/draw/VertexFetch.frag";
 
-       addChild(new InstanceFactory<IndirectDrawInstanced>(m_testCtx, "indirect_draw_instanced_triangle_list", "Draws an instanced triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
-       addChild(new InstanceFactory<IndirectDrawInstanced>(m_testCtx, "indirect_draw_instanced_triangle_strip", "Draws an instanced triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
+       tcu::TestCaseGroup* indirectDrawInstancedGroup  = new tcu::TestCaseGroup(m_testCtx, "indirect_draw_instanced", "Draws an instanced geometry");
+       {
+               tcu::TestCaseGroup*     noFirstInstanceGroup    = new tcu::TestCaseGroup(m_testCtx, "no_first_instance", "Use 0 as firstInstance");
+               {
+                       shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetchInstanced.vert";
+
+                       noFirstInstanceGroup->addChild(new InstanceFactory<IndirectDrawInstanced<FirtsInstanceNotSupported> >(m_testCtx, "triangle_list", "Draws an instanced triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
+                       noFirstInstanceGroup->addChild(new InstanceFactory<IndirectDrawInstanced<FirtsInstanceNotSupported> >(m_testCtx, "triangle_strip", "Draws an instanced triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
+               }               
+               indirectDrawInstancedGroup->addChild(noFirstInstanceGroup);
+
+               tcu::TestCaseGroup*     firstInstanceGroup              = new tcu::TestCaseGroup(m_testCtx, "first_instance", "Use drawIndirectFirstInstance optional feature");
+               {
+                       shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetchInstancedFirstInstance.vert";
+
+                       firstInstanceGroup->addChild(new InstanceFactory<IndirectDrawInstanced<FirtsInstanceSupported> >(m_testCtx, "triangle_list", "Draws an instanced triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
+                       firstInstanceGroup->addChild(new InstanceFactory<IndirectDrawInstanced<FirtsInstanceSupported> >(m_testCtx, "triangle_strip", "Draws an instanced triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
+               }
+               indirectDrawInstancedGroup->addChild(firstInstanceGroup);
+       }
+       addChild(indirectDrawInstancedGroup);
 }
 
 }      // DrawTests
index 0f5fbd9..cde11f5 100644 (file)
@@ -332,7 +332,7 @@ void SimpleDrawTests::init (void)
        addChild(new InstanceFactory<SimpleDraw>(m_testCtx, "simple_draw_triangle_list", "Draws triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
        addChild(new InstanceFactory<SimpleDraw>(m_testCtx, "simple_draw_triangle_strip", "Draws triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
 
-       shaderPaths[glu::SHADERTYPE_VERTEX]             = "vulkan/draw/VertexFetchWithInstance.vert";
+       shaderPaths[glu::SHADERTYPE_VERTEX]             = "vulkan/draw/VertexFetchInstancedFirstInstance.vert";
        shaderPaths[glu::SHADERTYPE_FRAGMENT]   = "vulkan/draw/VertexFetch.frag";
 
        addChild(new InstanceFactory<SimpleDrawInstanced>(m_testCtx, "simple_draw_instanced_triangle_list", "Draws an instanced triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
index a113df4..8c89acc 100644 (file)
@@ -79339,10 +79339,12 @@ dEQP-VK.draw.indexed_draw.draw_indexed_triangle_list
 dEQP-VK.draw.indexed_draw.draw_indexed_triangle_strip
 dEQP-VK.draw.indexed_draw.draw_instanced_indexed_triangle_list
 dEQP-VK.draw.indexed_draw.draw_instanced_indexed_triangle_strip
-dEQP-VK.draw.indirect_draw.indirect_draw_triangle_list
-dEQP-VK.draw.indirect_draw.indirect_draw_triangle_strip
-dEQP-VK.draw.indirect_draw.indirect_draw_instanced_triangle_list
-dEQP-VK.draw.indirect_draw.indirect_draw_instanced_triangle_strip
+dEQP-VK.draw.indirect_draw.indirect_draw.triangle_list
+dEQP-VK.draw.indirect_draw.indirect_draw.triangle_strip
+dEQP-VK.draw.indirect_draw.indirect_draw_instanced.no_first_instance.triangle_list
+dEQP-VK.draw.indirect_draw.indirect_draw_instanced.no_first_instance.triangle_strip
+dEQP-VK.draw.indirect_draw.indirect_draw_instanced.first_instance.triangle_list
+dEQP-VK.draw.indirect_draw.indirect_draw_instanced.first_instance.triangle_strip
 dEQP-VK.compute.basic.empty_shader
 dEQP-VK.compute.basic.ubo_to_ssbo_single_invocation
 dEQP-VK.compute.basic.ubo_to_ssbo_single_group