Derive VertexRoutine from Function<>.

Bug 22652760

Change-Id: I48e9e1f3ff677429eff1aea2f80b1e384a537a14
Reviewed-on: https://swiftshader-review.googlesource.com/4557
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/Shader/VertexRoutine.hpp b/src/Shader/VertexRoutine.hpp
index 26663d7..55b1018 100644
--- a/src/Shader/VertexRoutine.hpp
+++ b/src/Shader/VertexRoutine.hpp
@@ -19,7 +19,7 @@
 
 namespace sw
 {
-	class VertexRoutine
+	class VertexRoutine : public Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)>
 	{
 	protected:
 		struct Registers
@@ -31,7 +31,7 @@
 			{
 				loopDepth = -1;
 				enableStack[0] = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
-				
+
 				if(shader && shader->containsBreakInstruction())
 				{
 					enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
@@ -71,31 +71,30 @@
 			Int instanceID;
 		};
 
+		Registers r;
+
 	public:
 		VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader);
 
 		virtual ~VertexRoutine();
 
 		void generate();
-		Routine *getRoutine();
 
 	protected:
 		const VertexProcessor::State &state;
 		const VertexShader *const shader;
 
-	private:		
+	private:
 		virtual void pipeline(Registers &r) = 0;
 
 		typedef VertexProcessor::State::Input Stream;
-		
+
 		Vector4f readStream(Registers &r, Pointer<Byte> &buffer, UInt &stride, const Stream &stream, const UInt &index);
 		void readInput(Registers &r, UInt &index);
 		void computeClipFlags(Registers &r);
 		void postTransform(Registers &r);
 		void writeCache(Pointer<Byte> &cacheLine, Registers &r);
 		void writeVertex(Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
-
-		Routine *routine;
 	};
 }