Test draw commands with instanceCount == 0
authorPaavo Pessi <paavo.pessi@siru.fi>
Fri, 25 Aug 2017 10:58:00 +0000 (13:58 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 31 Aug 2017 11:59:01 +0000 (07:59 -0400)
The existing instanced rendering tests iterate through multiple
instanceCount and firstInstance values in a single test case.
Iterations with instanceCount == 0 were added to the existing
tests.

dEQP Reference Renderer was modified to allow draw commands
with instanceCount == 0.

Affects:

dEQP-VK.draw.instanced.*

Components: Vulkan, Framework

VK-GL-CTS issue: 619
VK-GL-CTS public issue: 19

Change-Id: I6153924ba4b27bbf7205a635a24543a85990c384

external/vulkancts/modules/vulkan/draw/vktDrawInstancedTests.cpp
framework/referencerenderer/rrRenderer.cpp

index 13b80e3..d446468 100644 (file)
@@ -434,7 +434,7 @@ InstancedDrawInstance::InstancedDrawInstance(Context &context, TestParams params
 tcu::TestStatus InstancedDrawInstance::iterate()
 {
        const vk::VkQueue               queue                                   = m_context.getUniversalQueue();
-       static const deUint32   instanceCounts[]                = { 1, 2, 4, 20 };
+       static const deUint32   instanceCounts[]                = { 0, 1, 2, 4, 20 };
        static const deUint32   firstInstanceIndices[]  = { 0, 1, 3, 4, 20 };
 
        qpTestResult                    res                                             = QP_TEST_RESULT_PASS;
@@ -452,9 +452,11 @@ tcu::TestStatus InstancedDrawInstance::iterate()
                const deUint32 instanceCount = instanceCounts[instanceCountNdx];
                for (int firstInstanceIndexNdx = 0; firstInstanceIndexNdx < firstInstanceIndicesCount; firstInstanceIndexNdx++)
                {
-                       const deUint32 firstInstance = firstInstanceIndices[firstInstanceIndexNdx];
+                       // Prepare vertex data for at least one instance
+                       const deUint32                          prepareCount                    = de::max(instanceCount, 1u);
+                       const deUint32                          firstInstance                   = firstInstanceIndices[firstInstanceIndexNdx];
 
-                       prepareVertexData(instanceCount, firstInstance);
+                       prepareVertexData(prepareCount, firstInstance);
                        const de::SharedPtr<Buffer>     vertexBuffer                    = createAndUploadBuffer(m_data, m_vk, m_context);
                        const de::SharedPtr<Buffer>     instancedVertexBuffer   = createAndUploadBuffer(m_instancedColor, m_vk, m_context);
                        de::SharedPtr<Buffer>           indexBuffer;
index 5dd13be..c46227b 100644 (file)
@@ -1509,7 +1509,7 @@ void drawAsPrimitives (const RenderState& state, const RenderTarget& renderTarge
 bool isValidCommand (const DrawCommand& command, int numInstances)
 {
        // numInstances should be valid
-       if (numInstances < 1)
+       if (numInstances < 0)
                return false;
 
        // Shaders should have the same varyings