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 @@
 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 @@
 		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;
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 @@
 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