Update primitive batch size calc for line/point polygon modes

https://swiftshader-review.git.corp.google.com/c/SwiftShader/+/68128
updated Renderer to move the "[pixel|setup]Processor.update()" and
"[pixel|setup]Processor.routine()" calls to avoid unnecessary work
when rasterization discard is enabled. However, this also moved the
"numPrimitivesPerBatch" adjustment for line and point polygon modes
to after where "draw->numPrimitivesPerBatch" is assigned. The
adjustment can be moved back prior to "draw->numPrimitivesPerBatch"
assignment without affecting the "update()" and "routine()" calls.

Bug: b/502745307
Tests: dEQP-VK.*
Change-Id: Ie4a5fd0f0f90212d3b97f5f503ef5eaae4ae0e05
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/77228
Presubmit-Ready: Jason Macnak <natsu@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@google.com>
Tested-by: Shahbaz Youssefi <syoussefi@google.com>
diff --git a/src/Device/Renderer.cpp b/src/Device/Renderer.cpp
index 4da09f4..4d072b0 100644
--- a/src/Device/Renderer.cpp
+++ b/src/Device/Renderer.cpp
@@ -254,6 +254,12 @@
 
 	unsigned int numPrimitivesPerBatch = MaxBatchSize / ms;
 
+	const VkPolygonMode polygonMode = preRasterizationState.getPolygonMode();
+	if(vertexInputInterfaceState.isDrawTriangle(false, polygonMode) && (polygonMode == VK_POLYGON_MODE_LINE || polygonMode == VK_POLYGON_MODE_POINT))
+	{
+		numPrimitivesPerBatch /= 3;
+	}
+
 	DrawData *data = draw->data;
 	draw->occlusionQuery = occlusionQuery;
 	draw->batchDataPool = &batchDataPool;
@@ -340,26 +346,22 @@
 
 	if(!hasRasterizerDiscard)
 	{
-		const VkPolygonMode polygonMode = preRasterizationState.getPolygonMode();
-
 		DrawCall::SetupFunction setupPrimitives = nullptr;
 		if(vertexInputInterfaceState.isDrawTriangle(false, polygonMode))
 		{
-			switch(preRasterizationState.getPolygonMode())
+			switch(polygonMode)
 			{
 			case VK_POLYGON_MODE_FILL:
 				setupPrimitives = &DrawCall::setupSolidTriangles;
 				break;
 			case VK_POLYGON_MODE_LINE:
 				setupPrimitives = &DrawCall::setupWireframeTriangles;
-				numPrimitivesPerBatch /= 3;
 				break;
 			case VK_POLYGON_MODE_POINT:
 				setupPrimitives = &DrawCall::setupPointTriangles;
-				numPrimitivesPerBatch /= 3;
 				break;
 			default:
-				UNSUPPORTED("polygon mode: %d", int(preRasterizationState.getPolygonMode()));
+				UNSUPPORTED("polygon mode: %d", int(polygonMode));
 				return;
 			}
 		}