Clean up interface component counting and reduce to spec minimum

This will halve the size of the input and output arrays used to communicate with the shader.
This is likely to have been already cleaned up by llvm, but better to not make the mess to start with.

Bug: b/125909515
Change-Id: I960647f808b722fe8ad38ff716df1461e1eae4ef
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33788
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Device/Config.hpp b/src/Device/Config.hpp
index ecadc59..3203c14 100644
--- a/src/Device/Config.hpp
+++ b/src/Device/Config.hpp
@@ -49,14 +49,6 @@
 	{
 		OUTLINE_RESOLUTION = 8192,   // Maximum vertical resolution of the render target
 		MIPMAP_LEVELS = 14,
-		FRAGMENT_UNIFORM_VECTORS = 264,
-		VERTEX_UNIFORM_VECTORS = 259,
-		MAX_VERTEX_INPUTS = 32,
-		MAX_VERTEX_OUTPUTS = 34,
-		MAX_FRAGMENT_INPUTS = 32,
-		MAX_FRAGMENT_UNIFORM_BLOCKS = 12,
-		MAX_VERTEX_UNIFORM_BLOCKS = 12,
-		MAX_UNIFORM_BUFFER_BINDINGS = MAX_FRAGMENT_UNIFORM_BLOCKS + MAX_VERTEX_UNIFORM_BLOCKS,   // Limited to 127 by SourceParameter.bufferIndex in Shader.hpp
 		MAX_UNIFORM_BLOCK_SIZE = 16384,
 		MAX_CLIP_PLANES = 6,
 		MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 64,
@@ -65,8 +57,7 @@
 		MAX_PROGRAM_TEXEL_OFFSET = 7,
 		MAX_TEXTURE_LOD = MIPMAP_LEVELS - 2,   // Trilinear accesses lod+1
 		RENDERTARGETS = 8,
-		NUM_TEMPORARY_REGISTERS = 4096,
-		MAX_INTERFACE_COMPONENTS = 32 * 4,  // Must be multiple of 4 for 16-byte alignment.
+		MAX_INTERFACE_COMPONENTS = 16 * 4,  // Must be multiple of 4 for 16-byte alignment.
 	};
 }
 
diff --git a/src/Device/Context.cpp b/src/Device/Context.cpp
index 08b7139..ef3e123 100644
--- a/src/Device/Context.cpp
+++ b/src/Device/Context.cpp
@@ -86,7 +86,7 @@
 	void Context::init()
 	{
 		// Set vertex streams to null stream
-		for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
+		for(int i = 0; i < MAX_INTERFACE_COMPONENTS/4; i++)
 		{
 			input[i].defaults();
 		}
diff --git a/src/Device/Context.hpp b/src/Device/Context.hpp
index 0957aeb..9a2864a 100644
--- a/src/Device/Context.hpp
+++ b/src/Device/Context.hpp
@@ -81,7 +81,7 @@
 
 		vk::DescriptorSet::Bindings descriptorSets = {};
 		vk::DescriptorSet::DynamicOffsets descriptorDynamicOffsets = {};
-		Stream input[MAX_VERTEX_INPUTS];
+		Stream input[MAX_INTERFACE_COMPONENTS / 4];
 		void *indexBuffer;
 
 		vk::ImageView *renderTarget[RENDERTARGETS];
diff --git a/src/Device/Renderer.cpp b/src/Device/Renderer.cpp
index ddba431..7c5e8b7 100644
--- a/src/Device/Renderer.cpp
+++ b/src/Device/Renderer.cpp
@@ -363,7 +363,7 @@
 		ASSERT(!draw->events);
 		draw->events = events;
 
-		for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
+		for(int i = 0; i < MAX_INTERFACE_COMPONENTS/4; i++)
 		{
 			data->input[i] = context->input[i].buffer;
 			data->stride[i] = context->input[i].vertexStride;
diff --git a/src/Device/Renderer.hpp b/src/Device/Renderer.hpp
index 85367f1..d666339 100644
--- a/src/Device/Renderer.hpp
+++ b/src/Device/Renderer.hpp
@@ -52,8 +52,8 @@
 		vk::DescriptorSet::Bindings descriptorSets = {};
 		vk::DescriptorSet::DynamicOffsets descriptorDynamicOffsets = {};
 
-		const void *input[MAX_VERTEX_INPUTS];
-		unsigned int stride[MAX_VERTEX_INPUTS];
+		const void *input[MAX_INTERFACE_COMPONENTS / 4];
+		unsigned int stride[MAX_INTERFACE_COMPONENTS / 4];
 		const void *indices;
 
 		int instanceID;
diff --git a/src/Device/VertexProcessor.cpp b/src/Device/VertexProcessor.cpp
index 76daf76..e8796c3 100644
--- a/src/Device/VertexProcessor.cpp
+++ b/src/Device/VertexProcessor.cpp
@@ -79,7 +79,7 @@
 
 		state.shaderID = context->vertexShader->getSerialID();
 
-		for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
+		for(int i = 0; i < MAX_INTERFACE_COMPONENTS / 4; i++)
 		{
 			state.input[i].type = context->input[i].type;
 			state.input[i].count = context->input[i].count;
diff --git a/src/Device/VertexProcessor.hpp b/src/Device/VertexProcessor.hpp
index ce91582..20bd0c8 100644
--- a/src/Device/VertexProcessor.hpp
+++ b/src/Device/VertexProcessor.hpp
@@ -70,7 +70,7 @@
 				unsigned int attribType : BITS(SpirvShader::ATTRIBTYPE_LAST);
 			};
 
-			Input input[MAX_VERTEX_INPUTS];
+			Input input[MAX_INTERFACE_COMPONENTS / 4];
 		};
 
 		struct State : States