Move AttribType enum to SpirvShader

We're about to remove VertexShader, but we still care about types of
vertex attributes.

Bug: b/120799499

Change-Id: I80bed181479651e9d2470b81c7223e3381fbf4a7
Reviewed-on: https://swiftshader-review.googlesource.com/c/23708
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Device/VertexProcessor.cpp b/src/Device/VertexProcessor.cpp
index 9fc7308..7f7d265 100644
--- a/src/Device/VertexProcessor.cpp
+++ b/src/Device/VertexProcessor.cpp
@@ -412,7 +412,7 @@
 			state.input[i].type = context->input[i].type;
 			state.input[i].count = context->input[i].count;
 			state.input[i].normalized = context->input[i].normalized;
-			state.input[i].attribType = context->vertexShader ? context->vertexShader->getAttribType(i) : VertexShader::ATTRIBTYPE_FLOAT;
+			state.input[i].attribType = context->vertexShader ? context->vertexShader->getAttribType(i) : SpirvShader::ATTRIBTYPE_FLOAT;
 		}
 
 		for(unsigned int i = 0; i < VERTEX_TEXTURE_IMAGE_UNITS; i++)
diff --git a/src/Device/VertexProcessor.hpp b/src/Device/VertexProcessor.hpp
index 83383e3..7a14864 100644
--- a/src/Device/VertexProcessor.hpp
+++ b/src/Device/VertexProcessor.hpp
@@ -19,6 +19,7 @@
 #include "Context.hpp"
 #include "RoutineCache.hpp"
 #include "Pipeline/VertexShader.hpp"
+#include "Pipeline/SpirvShader.hpp"
 
 namespace sw
 {
@@ -73,7 +74,7 @@
 				StreamType type    : BITS(STREAMTYPE_LAST);
 				unsigned int count : 3;
 				bool normalized    : 1;
-				unsigned int attribType : BITS(VertexShader::ATTRIBTYPE_LAST);
+				unsigned int attribType : BITS(SpirvShader::ATTRIBTYPE_LAST);
 			};
 
 			struct Output
diff --git a/src/Pipeline/SpirvShader.hpp b/src/Pipeline/SpirvShader.hpp
index 4a7d249..0d64a0e 100644
--- a/src/Pipeline/SpirvShader.hpp
+++ b/src/Pipeline/SpirvShader.hpp
@@ -137,6 +137,15 @@
 			return modes;
 		}
 
+		enum AttribType : unsigned char
+		{
+			ATTRIBTYPE_FLOAT,
+			ATTRIBTYPE_INT,
+			ATTRIBTYPE_UINT,
+
+			ATTRIBTYPE_LAST = ATTRIBTYPE_UINT
+		};
+
 	private:
 		const int serialID;
 		static volatile int serialCounter;
diff --git a/src/Pipeline/VertexRoutine.cpp b/src/Pipeline/VertexRoutine.cpp
index 9a82819..1db071b 100644
--- a/src/Pipeline/VertexRoutine.cpp
+++ b/src/Pipeline/VertexRoutine.cpp
@@ -143,7 +143,7 @@
 		Pointer<Byte> source2 = source1 + (!textureSampling ? stride : 0);
 		Pointer<Byte> source3 = source2 + (!textureSampling ? stride : 0);
 
-		bool isNativeFloatAttrib = (stream.attribType == VertexShader::ATTRIBTYPE_FLOAT) || stream.normalized;
+		bool isNativeFloatAttrib = (stream.attribType == SpirvShader::ATTRIBTYPE_FLOAT) || stream.normalized;
 
 		switch(stream.type)
 		{
@@ -174,13 +174,13 @@
 
 					switch(stream.attribType)
 					{
-					case VertexShader::ATTRIBTYPE_INT:
+					case SpirvShader::ATTRIBTYPE_INT:
 						if(stream.count >= 1) v.x = As<Float4>(Int4(v.x));
 						if(stream.count >= 2) v.x = As<Float4>(Int4(v.y));
 						if(stream.count >= 3) v.x = As<Float4>(Int4(v.z));
 						if(stream.count >= 4) v.x = As<Float4>(Int4(v.w));
 						break;
-					case VertexShader::ATTRIBTYPE_UINT:
+					case SpirvShader::ATTRIBTYPE_UINT:
 						if(stream.count >= 1) v.x = As<Float4>(UInt4(v.x));
 						if(stream.count >= 2) v.x = As<Float4>(UInt4(v.y));
 						if(stream.count >= 3) v.x = As<Float4>(UInt4(v.z));
diff --git a/src/Pipeline/VertexShader.cpp b/src/Pipeline/VertexShader.cpp
index 425ed4d..50e33c0 100644
--- a/src/Pipeline/VertexShader.cpp
+++ b/src/Pipeline/VertexShader.cpp
@@ -33,7 +33,7 @@
 		for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
 		{
 			input[i] = Semantic();
-			attribType[i] = ATTRIBTYPE_FLOAT;
+			attribType[i] = SpirvShader::ATTRIBTYPE_FLOAT;
 		}
 
 		if(vs)   // Make a copy
@@ -70,7 +70,7 @@
 		for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
 		{
 			input[i] = Semantic();
-			attribType[i] = ATTRIBTYPE_FLOAT;
+			attribType[i] = SpirvShader::ATTRIBTYPE_FLOAT;
 		}
 
 		optimize();
@@ -157,7 +157,7 @@
 		return textureSampling;
 	}
 
-	void VertexShader::setInput(int inputIdx, const sw::Shader::Semantic& semantic, AttribType aType)
+	void VertexShader::setInput(int inputIdx, const sw::Shader::Semantic& semantic, SpirvShader::AttribType aType)
 	{
 		input[inputIdx] = semantic;
 		attribType[inputIdx] = aType;
@@ -188,7 +188,7 @@
 		return input[inputIdx];
 	}
 
-	VertexShader::AttribType VertexShader::getAttribType(int inputIdx) const
+	SpirvShader::AttribType VertexShader::getAttribType(int inputIdx) const
 	{
 		return attribType[inputIdx];
 	}
diff --git a/src/Pipeline/VertexShader.hpp b/src/Pipeline/VertexShader.hpp
index fc0a405..c6ae335 100644
--- a/src/Pipeline/VertexShader.hpp
+++ b/src/Pipeline/VertexShader.hpp
@@ -16,6 +16,7 @@
 #define sw_VertexShader_hpp
 
 #include "Shader.hpp"
+#include "SpirvShader.hpp"
 #include "Device/Config.hpp"
 
 namespace sw
@@ -23,15 +24,6 @@
 	class VertexShader : public Shader
 	{
 	public:
-		enum AttribType : unsigned char
-		{
-			ATTRIBTYPE_FLOAT,
-			ATTRIBTYPE_INT,
-			ATTRIBTYPE_UINT,
-
-			ATTRIBTYPE_LAST = ATTRIBTYPE_UINT
-		};
-
 		explicit VertexShader(const VertexShader *vs = 0);
 		explicit VertexShader(const unsigned long *token);
 
@@ -40,7 +32,7 @@
 		static int validate(const unsigned long *const token);   // Returns number of instructions if valid
 		bool containsTextureSampling() const;
 
-		void setInput(int inputIdx, const Semantic& semantic, AttribType attribType = ATTRIBTYPE_FLOAT);
+		void setInput(int inputIdx, const Semantic& semantic, SpirvShader::AttribType attribType = SpirvShader::ATTRIBTYPE_FLOAT);
 		void setOutput(int outputIdx, int nbComponents, const Semantic& semantic);
 		void setPositionRegister(int posReg);
 		void setPointSizeRegister(int ptSizeReg);
@@ -49,7 +41,7 @@
 
 		const Semantic& getInput(int inputIdx) const;
 		const Semantic& getOutput(int outputIdx, int component) const;
-		AttribType getAttribType(int inputIndex) const;
+		SpirvShader::AttribType getAttribType(int inputIndex) const;
 		int getPositionRegister() const { return positionRegister; }
 		int getPointSizeRegister() const { return pointSizeRegister; }
 		bool isInstanceIdDeclared() const { return instanceIdDeclared; }
@@ -64,7 +56,7 @@
 		Semantic input[MAX_VERTEX_INPUTS];
 		Semantic output[MAX_VERTEX_OUTPUTS][4];
 
-		AttribType attribType[MAX_VERTEX_INPUTS];
+		SpirvShader::AttribType attribType[MAX_VERTEX_INPUTS];
 
 		int positionRegister;
 		int pointSizeRegister;