Adds a build flag for GL to never use vertex attributes that don't have per-vertex values.
Also promotes the ATTRIBUTE_MATRIX flag that was local to cpp files to the public config file.

Review URL: http://codereview.appspot.com/4434057/

git-svn-id: http://skia.googlecode.com/svn/trunk@1155 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrConfig.h b/gpu/include/GrConfig.h
index 6f519b5..8b8b280 100644
--- a/gpu/include/GrConfig.h
+++ b/gpu/include/GrConfig.h
@@ -120,6 +120,8 @@
 typedef unsigned short uint16_t;
 typedef int int32_t;
 typedef unsigned uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
 #else
 /*
  *  Include stdint.h with defines that trigger declaration of C99 limit/const
diff --git a/gpu/include/GrDrawTarget.h b/gpu/include/GrDrawTarget.h
index 349cafd..038e776 100644
--- a/gpu/include/GrDrawTarget.h
+++ b/gpu/include/GrDrawTarget.h
@@ -498,7 +498,7 @@
         kHighVertexLayoutBit = kDummyVertexLayoutBit - 1
     };
     // make sure we haven't exceeded the number of bits in GrVertexLayout.
-    GR_STATIC_ASSERT(kHighVertexLayoutBit < (1 << 8*sizeof(GrVertexLayout)));
+    GR_STATIC_ASSERT(kHighVertexLayoutBit < ((uint64_t)1 << 8*sizeof(GrVertexLayout)));
 
     /**
      * There are three paths for specifying geometry (vertices and optionally
diff --git a/gpu/include/GrGLConfig.h b/gpu/include/GrGLConfig.h
index 0502332..18cc049 100644
--- a/gpu/include/GrGLConfig.h
+++ b/gpu/include/GrGLConfig.h
@@ -53,23 +53,46 @@
  *
  * GR_GL_CHECK_ERROR_START: controls the initial value of gCheckErrorGL
  * when GR_GL_CHECK_ERROR is 1.  Defaults to 1.
+ *
+ * GR_GL_NO_CONSTANT_ATTRIBUTES: if this evaluates to true then the GL backend
+ * will use uniforms instead of attributes in all cases when there is not
+ * per-vertex data. This is important when the underlying GL implementation
+ * doesn't actually support immediate style attribute values (e.g. when 
+ * the GL stream is converted to DX as in ANGLE on Chrome). Defaults to 0.
+ *
+ * GR_GL_ATTRIBUTE_MATRICES: If changing uniforms is very expensive it may be
+ * faster to use vertex attributes for matrices (set via glVertexAttrib3fv). 
+ * Setting this build flag enables this behavior. GR_GL_NO_CONSTANT_ATTRIBUTES
+ * must not be set since this uses constant attributes for the matrices. 
+ * Defaults to 0.
  */
 
-
 #if !defined(GR_GL_LOG_CALLS)
-    #define GR_GL_LOG_CALLS             0
+    #define GR_GL_LOG_CALLS                 0
 #endif
 
 #if !defined(GR_GL_LOG_CALLS_START)
-    #define GR_GL_LOG_CALLS_START       0
+    #define GR_GL_LOG_CALLS_START           0
 #endif
 
 #if !defined(GR_GL_CHECK_ERROR)
-    #define GR_GL_CHECK_ERROR           GR_DEBUG
+    #define GR_GL_CHECK_ERROR               GR_DEBUG
 #endif
 
 #if !defined(GR_GL_CHECK_ERROR_START)
-    #define GR_GL_CHECK_ERROR_START     1
+    #define GR_GL_CHECK_ERROR_START         1
+#endif
+
+#if !defined(GR_GL_NO_CONSTANT_ATTRIBUTES)
+    #define GR_GL_NO_CONSTANT_ATTRIBUTES    0
+#endif
+
+#if !defined(GR_GL_ATTRIBUTE_MATRICES)
+    #define GR_GL_ATTRIBUTE_MATRICES        0
+#endif
+
+#if(GR_GL_NO_CONSTANT_ATTRIBUTES) && (GR_GL_ATTRIBUTE_MATRICES)
+    #error "Cannot combine GR_GL_NO_CONSTANT_ATTRIBUTES and GR_GL_ATTRIBUTE_MATRICES"
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/gpu/include/GrGLConfig_chrome.h b/gpu/include/GrGLConfig_chrome.h
index 08f7547..738e801 100644
--- a/gpu/include/GrGLConfig_chrome.h
+++ b/gpu/include/GrGLConfig_chrome.h
@@ -2,9 +2,12 @@
 #define GrGLConfig_chrome_DEFINED
 
 // chrome always assumes BGRA
-#define GR_GL_32BPP_COLOR_FORMAT    GR_GL_BGRA
+#define GR_GL_32BPP_COLOR_FORMAT        GR_GL_BGRA
 
 // glGetError() forces a sync with gpu process on chrome
-#define GR_GL_CHECK_ERROR_START     0
+#define GR_GL_CHECK_ERROR_START         0
+
+// ANGLE creates a temp VB for vertex attributes not specified per-vertex.
+#define GR_GL_NO_CONSTANT_ATTRIBUTES    GR_WIN32_BUILD
 
 #endif
diff --git a/gpu/include/GrTypes.h b/gpu/include/GrTypes.h
index fb62333..9d1c5e3 100644
--- a/gpu/include/GrTypes.h
+++ b/gpu/include/GrTypes.h
@@ -202,7 +202,7 @@
  * Type used to describe format of vertices in arrays
  * Values are defined in GrDrawTarget
  */
-typedef uint16_t GrVertexLayout;
+typedef int GrVertexLayout;
 
 /**
 * Geometric primitives used for drawing.