Make GrGLShaderVar objects aware of whether they are uniform, varying, or
attribute varibles. Extract GLSL generation enum and utility function into
new GrGLSL header.



git-svn-id: http://skia.googlecode.com/svn/trunk@2827 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrGLSL.cpp b/src/gpu/GrGLSL.cpp
new file mode 100644
index 0000000..1062c81
--- /dev/null
+++ b/src/gpu/GrGLSL.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrGLSL.h"
+
+GrGLSLGeneration GetGLSLGeneration(GrGLBinding binding,
+                                   const GrGLInterface* gl) {
+    GrGLSLVersion ver = GrGLGetGLSLVersion(gl);
+    switch (binding) {
+        case kDesktop_GrGLBinding:
+            GrAssert(ver >= GR_GLSL_VER(1,10));
+            if (ver >= GR_GLSL_VER(1,50)) {
+                return k150_GLSLGeneration;
+            } else if (ver >= GR_GLSL_VER(1,30)) {
+                return k130_GLSLGeneration;
+            } else {
+                return k110_GLSLGeneration;
+            }
+        case kES2_GrGLBinding:
+            // version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL
+            GrAssert(ver >= GR_GL_VER(1,00));
+            return k110_GLSLGeneration;
+        default:
+            GrCrash("Unknown GL Binding");
+            return k110_GLSLGeneration; // suppress warning
+    }
+}
+