Derive Rasterizer from Function<>.

Bug 22652760

Change-Id: I1a8ff978fdc7ad795e469218a931523d624e7cde
Reviewed-on: https://swiftshader-review.googlesource.com/4546
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/PixelProcessor.cpp b/src/Renderer/PixelProcessor.cpp
index e2a4764..c2c477e 100644
--- a/src/Renderer/PixelProcessor.cpp
+++ b/src/Renderer/PixelProcessor.cpp
@@ -644,7 +644,7 @@
 		factor.blendConstant4W[3][1] = blendConstantA;
 		factor.blendConstant4W[3][2] = blendConstantA;
 		factor.blendConstant4W[3][3] = blendConstantA;
-	
+
 		// FIXME: Compact into generic function   // FIXME: Clamp
 		short invBlendConstantR = iround(65535 * (1 - blendConstant.r));
 		short invBlendConstantG = iround(65535 * (1 - blendConstant.g));
@@ -680,12 +680,12 @@
 		factor.blendConstant4F[1][1] = blendConstant.g;
 		factor.blendConstant4F[1][2] = blendConstant.g;
 		factor.blendConstant4F[1][3] = blendConstant.g;
-		
+
 		factor.blendConstant4F[2][0] = blendConstant.b;
 		factor.blendConstant4F[2][1] = blendConstant.b;
 		factor.blendConstant4F[2][2] = blendConstant.b;
 		factor.blendConstant4F[2][3] = blendConstant.b;
-		
+
 		factor.blendConstant4F[3][0] = blendConstant.a;
 		factor.blendConstant4F[3][1] = blendConstant.a;
 		factor.blendConstant4F[3][2] = blendConstant.a;
@@ -700,12 +700,12 @@
 		factor.invBlendConstant4F[1][1] = 1 - blendConstant.g;
 		factor.invBlendConstant4F[1][2] = 1 - blendConstant.g;
 		factor.invBlendConstant4F[1][3] = 1 - blendConstant.g;
-		
+
 		factor.invBlendConstant4F[2][0] = 1 - blendConstant.b;
 		factor.invBlendConstant4F[2][1] = 1 - blendConstant.b;
 		factor.invBlendConstant4F[2][2] = 1 - blendConstant.b;
 		factor.invBlendConstant4F[2][3] = 1 - blendConstant.b;
-		
+
 		factor.invBlendConstant4F[3][0] = 1 - blendConstant.a;
 		factor.invBlendConstant4F[3][1] = 1 - blendConstant.a;
 		factor.invBlendConstant4F[3][2] = 1 - blendConstant.a;
@@ -873,7 +873,7 @@
 
 		state.depthOverride = context->pixelShader && context->pixelShader->depthOverride();
 		state.shaderContainsKill = context->pixelShader ? context->pixelShader->containsKill() : false;
-		
+
 		if(context->alphaTestActive())
 		{
 			state.alphaCompareMode = context->alphaCompareMode;
@@ -1026,7 +1026,7 @@
 					if(context->colorActive(color, component))
 					{
 						state.color[color].component |= 1 << component;
-						
+
 						if(point || flatShading)
 						{
 							state.color[color].flat |= 1 << component;
@@ -1038,7 +1038,7 @@
 			if(context->fogActive())
 			{
 				state.fog.component = true;
-				
+
 				if(point)
 				{
 					state.fog.flat = true;
@@ -1096,6 +1096,7 @@
 		{
 			const bool integerPipeline = (context->pixelShaderVersion() <= 0x0104);
 			Rasterizer *generator = nullptr;
+
 			if(integerPipeline)
 			{
 				generator = new PixelPipeline(state, context->pixelShader);
@@ -1104,8 +1105,9 @@
 			{
 				generator = new PixelProgram(state, context->pixelShader);
 			}
+
 			generator->generate();
-			routine = generator->getRoutine();
+			routine = (*generator)(L"PixelRoutine_%0.8X", state.shaderID);
 			delete generator;
 
 			routineCache->add(state, routine);