Fix various issues in vertex fetch setup

There are still some minor sins in here -- we should really unfuse
attributes from buffers completely -- but this is enough to have vertex
fetch work for all per-vertex attribute scenarios.

Bug: b/124177079

Change-Id: I2a7a1a6f049aa80c1a527e9fa9643bb33701d165
Reviewed-on: https://swiftshader-review.googlesource.com/c/25448
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/VertexRoutine.cpp b/src/Pipeline/VertexRoutine.cpp
index b21186c..613ede3 100644
--- a/src/Pipeline/VertexRoutine.cpp
+++ b/src/Pipeline/VertexRoutine.cpp
@@ -88,10 +88,10 @@
 				spirvShader->inputs[i + 3].Type != SpirvShader::ATTRIBTYPE_UNUSED)
 			{
 
-				Pointer<Byte> input = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData, input) + sizeof(void *) * i);
-				UInt stride = *Pointer<UInt>(data + OFFSET(DrawData, stride) + sizeof(unsigned int) * i);
+				Pointer<Byte> input = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData, input) + sizeof(void *) * (i/4));
+				UInt stride = *Pointer<UInt>(data + OFFSET(DrawData, stride) + sizeof(unsigned int) * (i/4));
 
-				auto value = readStream(input, stride, state.input[i], index);
+				auto value = readStream(input, stride, state.input[i/4], index);
 				routine.inputs[i] = value.x;
 				routine.inputs[i+1] = value.y;
 				routine.inputs[i+2] = value.z;