Fixes geometry shader invocation dependency

dEQP-VK.tessellation.invariance.* updates a SSBO
expecting the implementation to execute the GS
once per primitive. Changes the test to allow
multiple invocations.

Components: Vulkan
VK-GL-CTS Issue: 1281

Affects:
dEQP-VK.tessellation.invariance.*

Change-Id: I6ed17a8afb413587bb38487ec9952f569a250193
diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp
index 471b602..5aa9fd4 100644
--- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp
+++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp
@@ -55,6 +55,7 @@
 
 enum Constants
 {
+	NUM_EXTRA_TESS_GEOM_INVOCATIONS = 4, // Need to set this value properly to allocate enough memory to store vertices data
 	NUM_TESS_LEVELS = 6,  // two inner and four outer levels
 };
 
@@ -588,7 +589,7 @@
 	, m_vertexFormat						(VK_FORMAT_R32_SFLOAT)
 	, m_vertexStride						(tcu::getPixelSize(mapVkFormat(m_vertexFormat)))
 	, m_edgeDescriptions					(outerEdgeDescriptions(m_caseDef.primitiveType))
-	, m_maxNumPrimitivesInDrawCall			(computeMaxPrimitiveCount(m_numPatchesToDraw, caseDef.primitiveType, caseDef.spacingMode, caseDef.usePointMode, m_singleOuterEdgeLevels))
+	, m_maxNumPrimitivesInDrawCall			(NUM_EXTRA_TESS_GEOM_INVOCATIONS * computeMaxPrimitiveCount(m_numPatchesToDraw, caseDef.primitiveType, caseDef.spacingMode, caseDef.usePointMode, m_singleOuterEdgeLevels))
 	, m_vertexDataSizeBytes					(NUM_TESS_LEVELS * m_numPatchesToDraw * m_vertexStride)
 	, m_vertexBuffer						(m_context.getDeviceInterface(), m_context.getDevice(), m_context.getDefaultAllocator(),
 											makeBufferCreateInfo(m_vertexDataSizeBytes, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT), MemoryRequirement::HostVisible)
@@ -682,7 +683,7 @@
 	DE_ASSERT(result.numPrimitives <= m_maxNumPrimitivesInDrawCall);
 
 	tcu::TestLog& log = m_context.getTestContext().getLog();
-	if (result.numPrimitives != result.refNumPrimitives)
+	if (result.numPrimitives < result.refNumPrimitives)
 	{
 		logPrimitiveCountError(log, m_numPatchesToDraw, result.numPrimitives, result.refNumPrimitives, patchTessLevels);
 		result.success = false;
@@ -750,8 +751,6 @@
 			int primitiveNdx = 0;
 			for (int patchNdx = 0; patchNdx < m_numPatchesToDraw; ++patchNdx)
 			{
-				DE_ASSERT(primitiveNdx < result.numPrimitives);
-
 				const float* const	innerLevels	= &patchTessLevels[NUM_TESS_LEVELS*patchNdx + 0];
 				const float* const	outerLevels	= &patchTessLevels[NUM_TESS_LEVELS*patchNdx + 2];
 
@@ -1350,6 +1349,9 @@
 		}
 	}
 
+	// Allow for more primitievs in case tessellation/geometry has extra invocations
+	maxNumPrimitivesPerPatch *= NUM_EXTRA_TESS_GEOM_INVOCATIONS;
+
 	// Vertex input attributes buffer: to pass tessellation levels
 
 	const VkFormat     vertexFormat        = VK_FORMAT_R32_SFLOAT;
@@ -1475,9 +1477,9 @@
 
 					tcu::TestLog& log = m_context.getTestContext().getLog();
 
-					if (numPrimitives != refNumPrimitives)
+					if (numPrimitives < refNumPrimitives)
 					{
-						log << tcu::TestLog::Message << "Failure: got " << numPrimitives << " primitives, but expected " << refNumPrimitives << tcu::TestLog::EndMessage;
+						log << tcu::TestLog::Message << "Failure: got " << numPrimitives << " primitives, but expected at least" << refNumPrimitives << tcu::TestLog::EndMessage;
 
 						return tcu::TestStatus::fail("Invalid set of primitives");
 					}