VertexRoutine code for Transform Feedback

This cl adds the code that actually performs the copy of the
vertex shader outputs into transform feedback buffers. It
also contains a fix for symmetricNormalizedDepth, which must
be computed after the information was copied into the
transform feedback buffers, when transform feedback is active.

Change-Id: I418f94a15b9425bba0905c840f8cf4828233d0fb
Reviewed-on: https://swiftshader-review.googlesource.com/5172
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/VertexProcessor.cpp b/src/Renderer/VertexProcessor.cpp
index 90c954f..73f277b 100644
--- a/src/Renderer/VertexProcessor.cpp
+++ b/src/Renderer/VertexProcessor.cpp
@@ -839,7 +839,7 @@
 		routineCache = new RoutineCache<State>(clamp(cacheSize, 1, 65536), precacheVertex ? "sw-vertex" : 0);
 	}
 
-	const VertexProcessor::State VertexProcessor::update()
+	const VertexProcessor::State VertexProcessor::update(DrawType drawType)
 	{
 		if(isFixedFunction())
 		{
@@ -912,6 +912,11 @@
 		state.transformFeedbackQueryEnabled = context->transformFeedbackQueryEnabled;
 		state.transformFeedbackEnabled = context->transformFeedbackEnabled;
 
+		// Note: Quads aren't handled for verticesPerPrimitive, but verticesPerPrimitive is used for transform feedback,
+		//       which is an OpenGL ES 3.0 feature, and OpenGL ES 3.0 doesn't support quads as a primitive type.
+		DrawType type = static_cast<DrawType>(static_cast<unsigned int>(drawType) & 0xF);
+		state.verticesPerPrimitive = 1 + (type >= DRAW_LINELIST) + (type >= DRAW_TRIANGLELIST);
+
 		for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
 		{
 			state.input[i].type = context->input[i].type;