Avoid broadcasting data fields to 4-wide vectors

To avoid repeated broadcasting of scalars to vectors we stored some
data in pre-broadcasted 4-wide vector fields. On modern CPUs such
broadcasts no longer consumes valuable cycles, and by storing this data
in scalar fields instead we save on memory consumption and bandwidth.
This also enables scaling to arbitrary SIMD width.

Bug: b/237494823
Change-Id: I5d1db08318452f2a90050ba2ba37751eed8f3121
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/66770
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/PixelProgram.cpp b/src/Pipeline/PixelProgram.cpp
index 44e478e..cfdf2d2 100644
--- a/src/Pipeline/PixelProgram.cpp
+++ b/src/Pipeline/PixelProgram.cpp
@@ -83,8 +83,8 @@
 	//  the x and y components of FragCoord reflect the location of the center of the fragment."
 	if(state.sampleShadingEnabled && state.multiSampleCount > 1)
 	{
-		x0 = Constants::VkSampleLocations4[samples[0]][0];
-		y0 = Constants::VkSampleLocations4[samples[0]][1];
+		x0 = VkSampleLocations4[samples[0]][0];
+		y0 = VkSampleLocations4[samples[0]][1];
 		x1 = 1.0f + x0;
 		y1 = 1.0f + y0;
 	}
@@ -188,9 +188,9 @@
 		ASSERT(samples.size() == 1);
 		int sampleId = samples[0];
 		routine.getVariable(it->second.Id)[it->second.FirstComponent + 0] =
-		    SIMD::Float((state.multiSampleCount > 1) ? Constants::VkSampleLocations4[sampleId][0] : 0.5f);
+		    SIMD::Float((state.multiSampleCount > 1) ? VkSampleLocations4[sampleId][0] : 0.5f);
 		routine.getVariable(it->second.Id)[it->second.FirstComponent + 1] =
-		    SIMD::Float((state.multiSampleCount > 1) ? Constants::VkSampleLocations4[sampleId][1] : 0.5f);
+		    SIMD::Float((state.multiSampleCount > 1) ? VkSampleLocations4[sampleId][1] : 0.5f);
 	}
 
 	// Note: all lanes initially active to facilitate derivatives etc. Actual coverage is