Implemented varying packing
TRAC #11736
The OpenGL ES Shading Language 1.00 rev. 17 appendix A section 7 page 111, details how varyings should be packed into generic varying registers. To implement this the HLSL main() function is now generated and appended to the code during link time, where the packing and mapping can happen.
Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch

Author:    Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@282 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/utilities.cpp b/src/libGLESv2/utilities.cpp
index ff7f090..f584588 100644
--- a/src/libGLESv2/utilities.cpp
+++ b/src/libGLESv2/utilities.cpp
@@ -91,10 +91,12 @@
     return UniformTypeSize(UniformComponentType(type)) * UniformComponentCount(type);
 }
 
-int AttributeVectorCount(GLenum type)
+int VariableRowCount(GLenum type)
 {
     switch (type)
     {
+      case GL_NONE:
+        return 0;
       case GL_BOOL:
       case GL_FLOAT:
       case GL_INT:
@@ -108,20 +110,49 @@
       case GL_FLOAT_VEC4:
       case GL_INT_VEC4:
         return 1;
-
       case GL_FLOAT_MAT2:
         return 2;
-
       case GL_FLOAT_MAT3:
         return 3;
-
       case GL_FLOAT_MAT4:
         return 4;
-
       default:
         UNREACHABLE();
-        return 0;
     }
+
+    return 0;
+}
+
+int VariableColumnCount(GLenum type)
+{
+    switch (type)
+    {
+      case GL_NONE:
+        return 0;
+      case GL_BOOL:
+      case GL_FLOAT:
+      case GL_INT:
+        return 1;
+      case GL_BOOL_VEC2:
+      case GL_FLOAT_VEC2:
+      case GL_INT_VEC2:
+      case GL_FLOAT_MAT2:
+        return 2;
+      case GL_INT_VEC3:
+      case GL_FLOAT_VEC3:
+      case GL_BOOL_VEC3:
+      case GL_FLOAT_MAT3:
+        return 3;
+      case GL_BOOL_VEC4:
+      case GL_FLOAT_VEC4:
+      case GL_INT_VEC4:
+      case GL_FLOAT_MAT4:
+        return 4;
+      default:
+        UNREACHABLE();
+    }
+
+    return 0;
 }
 
 int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)