Add support for GL_ARB_texture_swizzle

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



git-svn-id: http://skia.googlecode.com/svn/trunk@2615 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrGpuGL.h b/src/gpu/GrGpuGL.h
index 0addf4a..3f10967 100644
--- a/src/gpu/GrGpuGL.h
+++ b/src/gpu/GrGpuGL.h
@@ -22,6 +22,7 @@
 #include "SkString.h"
 
 class GrGpuGL : public GrGpu {
+
 public:
     virtual ~GrGpuGL();
 
@@ -32,6 +33,56 @@
 protected:
     GrGpuGL(const GrGLInterface* glInterface, GrGLBinding glBinding);
 
+    struct GLCaps {
+        GLCaps()
+            // make defaults be the most restrictive
+            : fMSFBOType(kNone_MSFBO)
+            , fMaxFragmentUniformVectors(0)
+            , fRGBA8Renderbuffer(false)
+            , fBGRAFormat(false)
+            , fStencilFormats(8) // prealloc space for    stencil formats
+            , fTextureSwizzle(false) {
+            memset(fAASamples, 0, sizeof(fAASamples));
+        }
+        SkTArray<GrGLStencilBuffer::Format, true> fStencilFormats;
+    
+        enum {
+            /**
+             * no support for MSAA FBOs
+             */
+            kNone_MSFBO = 0,  
+            /**
+             * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object)
+             */
+            kDesktopARB_MSFBO,
+            /**
+             * earlier GL_EXT_framebuffer* extensions
+             */
+            kDesktopEXT_MSFBO,
+            /**
+             * GL_APPLE_framebuffer_multisample ES extension
+             */
+            kAppleES_MSFBO,
+        } fMSFBOType;
+    
+        // TODO: get rid of GrAALevel and use sample cnt directly
+        GrGLuint fAASamples[4];
+    
+        // The maximum number of fragment uniform vectors (GLES has min. 16).
+        int fMaxFragmentUniformVectors;
+    
+        // ES requires an extension to support RGBA8 in RenderBufferStorage
+        bool fRGBA8Renderbuffer;
+    
+        // Is GL_BGRA supported
+        bool fBGRAFormat;
+    
+        // GL_ARB_texture_swizzle support
+        bool fTextureSwizzle;
+    
+        void print() const;
+    } fGLCaps;
+ 
     struct {
         size_t                  fVertexOffset;
         GrVertexLayout          fVertexLayout;
@@ -69,6 +120,8 @@
         GrGLIRect   fViewportRect;
     } fHWBounds;
 
+    const GLCaps& glCaps() const { return fGLCaps; }
+
     // GrGpu overrides
     virtual void onResetContext() SK_OVERRIDE;
 
@@ -207,43 +260,6 @@
     SkString fExtensionString;
     GrGLVersion fGLVersion;
 
-    struct GLCaps {
-        // prealloc space for 8 stencil formats
-        GLCaps() : fStencilFormats(8) {}
-        SkTArray<GrGLStencilBuffer::Format, true> fStencilFormats;
-
-        enum {
-            /**
-             * no support for MSAA FBOs
-             */
-            kNone_MSFBO = 0,  
-            /**
-             * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object)
-             */
-            kDesktopARB_MSFBO,
-            /**
-             * earlier GL_EXT_framebuffer* extensions
-             */
-            kDesktopEXT_MSFBO,
-            /**
-             * GL_APPLE_framebuffer_multisample ES extension
-             */
-            kAppleES_MSFBO,
-        } fMSFBOType;
-
-        // TODO: get rid of GrAALevel and use sample cnt directly
-        GrGLuint fAASamples[4];
-
-        // The maximum number of fragment uniform vectors (GLES has min. 16).
-        int fMaxFragmentUniformVectors;
-
-        // ES requires an extension to support RGBA8 in RenderBufferStorage
-        bool fRGBA8Renderbuffer;
-
-        void print() const;
-    } fGLCaps;
-
-
     // we want to clear stencil buffers when they are created. We want to clear
     // the entire buffer even if it is larger than the color attachment. We
     // attach it to this fbo with no color attachment to do the initial clear.