Add support for ES3 MSAA.

R=robertphillips@google.com, jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/23404002

git-svn-id: http://skia.googlecode.com/svn/trunk/include@11124 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/gl/GrGLConfig.h b/gpu/gl/GrGLConfig.h
index 1f7c9e2..0da2c0b 100644
--- a/gpu/gl/GrGLConfig.h
+++ b/gpu/gl/GrGLConfig.h
@@ -170,6 +170,15 @@
     #define GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE       0
 #endif
 
+// We now have a separate GrGLInterface function pointer entry for the IMG/EXT version of
+// glRenderbufferStorageMultisampled. However, Chrome is setting the one we now use for
+// ES3 MSAA to point to the IMG/EXT function. This macro exists to make Skia ignore the
+// ES3 MSAA and instead use the IMG/EXT version with the old function pointer entry. It will
+// be removed as soon as Chrome is updated to set the new function pointer.
+#if !defined(GR_GL_IGNORE_ES3_MSAA)
+    #define GR_GL_IGNORE_ES3_MSAA 0
+#endif
+
 /**
  * There is a strange bug that occurs on Macs with NVIDIA GPUs. We don't
  * fully understand it. When (element) array buffers are continually
diff --git a/gpu/gl/GrGLConfig_chrome.h b/gpu/gl/GrGLConfig_chrome.h
index e08692f..fe35783 100644
--- a/gpu/gl/GrGLConfig_chrome.h
+++ b/gpu/gl/GrGLConfig_chrome.h
@@ -41,4 +41,8 @@
 // (const char* const instead of char**).
 #define GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE       1
 
+#if !defined(GR_GL_IGNORE_ES3_MSAA)
+    #define GR_GL_IGNORE_ES3_MSAA 1
+#endif
+
 #endif
diff --git a/gpu/gl/GrGLInterface.h b/gpu/gl/GrGLInterface.h
index 67d6840..de1b291 100644
--- a/gpu/gl/GrGLInterface.h
+++ b/gpu/gl/GrGLInterface.h
@@ -229,7 +229,31 @@
     GLPtr<GrGLReadBufferProc> fReadBuffer;
     GLPtr<GrGLReadPixelsProc> fReadPixels;
     GLPtr<GrGLRenderbufferStorageProc> fRenderbufferStorage;
+
+#if !GR_GL_IGNORE_ES3_MSAA
+    //  On OpenGL ES there are multiple incompatible extensions that add support for MSAA
+    //  and ES3 adds MSAA support to the standard. On an ES3 driver we may still use the
+    //  older extensions for performance reasons or due to ES3 driver bugs. We want the function
+    //  that creates the GrGLInterface to provide all available functions and internally
+    //  we will select among them. They all have a method called glRenderbufferStorageMultisample*.
+    //  So we have separate function pointers for GL_IMG/EXT_multisampled_to_texture,
+    //  GL_CHROMIUM/ANGLE_framebuffer_multisample/ES3, and GL_APPLE_framebuffer_multisample
+    //  variations.
+    //
+    //  If a driver supports multiple GL_ARB_framebuffer_multisample-style extensions then we will
+    //  assume the function pointers for the standard (or equivalent GL_ARB) version have
+    //  been preferred over GL_EXT, GL_CHROMIUM, or GL_ANGLE variations that have reduced
+    //  functionality.
+
+    //  GL_EXT_multisampled_render_to_texture (preferred) or GL_IMG_multisampled_render_to_texture
+    GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2EXT;
+    //  GL_APPLE_framebuffer_multisample
+    GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2APPLE;
+#endif
+    //  This is used to store the pointer for GL_ARB/EXT/ANGLE/CHROMIUM_framebuffer_multisample or
+    //  the standard function in ES3+ or GL 3.0+.
     GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisample;
+
     GLPtr<GrGLRenderbufferStorageMultisampleCoverageProc> fRenderbufferStorageMultisampleCoverage;
     GLPtr<GrGLResolveMultisampleFramebufferProc> fResolveMultisampleFramebuffer;
     GLPtr<GrGLScissorProc> fScissor;