Fix vertex stream count and normalized data layout.

Bug swiftshader:86

Change-Id: Ide76f9e7d8c490e5057959e1a7c28dfc7119151a
Reviewed-on: https://swiftshader-review.googlesource.com/13428
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/tests/fuzzers/VertexRoutineFuzzer.cpp b/tests/fuzzers/VertexRoutineFuzzer.cpp
index edfe018..ef97774 100644
--- a/tests/fuzzers/VertexRoutineFuzzer.cpp
+++ b/tests/fuzzers/VertexRoutineFuzzer.cpp
@@ -26,6 +26,7 @@
 
 #include <cstdint>
 #include <memory>
+#include <cassert>
 
 namespace {
 
@@ -149,11 +150,13 @@
 		return 0;
 	}
 
+	constexpr int MAX_ATTRIBUTE_COMPONENTS = 4;
+
 	struct Stream
 	{
-		uint8_t count : BITS(sw::STREAMTYPE_LAST);
-		bool normalized;
-		uint8_t reserved : 8 - BITS(sw::STREAMTYPE_LAST) - 1;
+		uint8_t count : BITS(MAX_ATTRIBUTE_COMPONENTS);
+		bool normalized : 1;
+		uint8_t reserved : 8 - BITS(MAX_ATTRIBUTE_COMPONENTS) - 1;
 	};
 
 	for(int i = 0; i < sw::MAX_VERTEX_INPUTS; i++)
@@ -162,7 +165,7 @@
 		Stream stream = (Stream&)data[1 + 2 * i + 1];
 
 		if(type > sw::STREAMTYPE_LAST) return 0;
-		if(stream.count > 4) return 0;
+		if(stream.count > MAX_ATTRIBUTE_COMPONENTS) return 0;
 		if(stream.reserved != 0) return 0;
 
 		state.input[i].type = type;
@@ -199,5 +202,12 @@
 	sw::VertexProgram program(state, bytecodeShader.get());
 	program.generate();
 
+	// TODO
+//	sw::Routine *routine = program(L"VertexRoutine");
+//	assert(routine);
+//	const void *entry = routine->getEntry();
+//	assert(entry);
+//	delete routine;
+
 	return 0;
 }