From: Paavo Pessi Date: Fri, 25 Aug 2017 10:58:00 +0000 (+0300) Subject: Test draw commands with instanceCount == 0 X-Git-Tag: upstream/0.1.0~122 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=272ff10d44104eb65ebcf6f992f7a0b6290256d7;p=platform%2Fupstream%2FVK-GL-CTS.git Test draw commands with instanceCount == 0 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 --- diff --git a/external/vulkancts/modules/vulkan/draw/vktDrawInstancedTests.cpp b/external/vulkancts/modules/vulkan/draw/vktDrawInstancedTests.cpp index 13b80e3..d446468 100644 --- a/external/vulkancts/modules/vulkan/draw/vktDrawInstancedTests.cpp +++ b/external/vulkancts/modules/vulkan/draw/vktDrawInstancedTests.cpp @@ -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 vertexBuffer = createAndUploadBuffer(m_data, m_vk, m_context); const de::SharedPtr instancedVertexBuffer = createAndUploadBuffer(m_instancedColor, m_vk, m_context); de::SharedPtr indexBuffer; diff --git a/framework/referencerenderer/rrRenderer.cpp b/framework/referencerenderer/rrRenderer.cpp index 5dd13be..c46227b 100644 --- a/framework/referencerenderer/rrRenderer.cpp +++ b/framework/referencerenderer/rrRenderer.cpp @@ -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