| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 1 | /* | 
| epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 |  * Copyright 2011 Google Inc. | 
 | 3 |  * | 
 | 4 |  * Use of this source code is governed by a BSD-style license that can be | 
 | 5 |  * found in the LICENSE file. | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 6 |  */ | 
 | 7 |  | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 8 | #ifndef GrGLInterface_DEFINED | 
 | 9 | #define GrGLInterface_DEFINED | 
 | 10 |  | 
| bsalomon@google.com | 637d5e9 | 2012-05-07 21:33:56 +0000 | [diff] [blame] | 11 | #include "GrGLFunctions.h" | 
| commit-bot@chromium.org | a4de8c2 | 2013-09-09 13:38:37 +0000 | [diff] [blame] | 12 | #include "SkRefCnt.h" | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 13 |  | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 14 | //////////////////////////////////////////////////////////////////////////////// | 
 | 15 |  | 
 | 16 | /** | 
| bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 17 |  * Classifies GL contexts (currently as Desktop vs. ES2). This is a bitfield. | 
 | 18 |  * A GrGLInterface (defined below) may support multiple bindings. | 
 | 19 |  */ | 
 | 20 | enum GrGLBinding { | 
 | 21 |     kNone_GrGLBinding = 0x0, | 
 | 22 |  | 
 | 23 |     kDesktop_GrGLBinding = 0x01, | 
| bsalomon@google.com | eb17070 | 2013-08-15 18:57:53 +0000 | [diff] [blame] | 24 |     kES_GrGLBinding = 0x02,  // ES2+ only | 
| bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 25 |  | 
 | 26 |     // for iteration of GrGLBindings | 
| bsalomon@google.com | b447d21 | 2012-02-10 20:25:36 +0000 | [diff] [blame] | 27 |     kFirstGrGLBinding = kDesktop_GrGLBinding, | 
| bsalomon@google.com | eb17070 | 2013-08-15 18:57:53 +0000 | [diff] [blame] | 28 |     kLastGrGLBinding = kES_GrGLBinding | 
| bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 29 | }; | 
 | 30 |  | 
| bsalomon@google.com | 46b450a | 2013-08-15 19:45:26 +0000 | [diff] [blame] | 31 | // Temporary alias until Chromium can be updated. | 
 | 32 | static const GrGLBinding kES2_GrGLBinding = kES_GrGLBinding; | 
 | 33 |  | 
| bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 34 | //////////////////////////////////////////////////////////////////////////////// | 
 | 35 |  | 
 | 36 | /** | 
| bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 37 |  * Rather than depend on platform-specific GL headers and libraries, we require | 
 | 38 |  * the client to provide a struct of GL function pointers. This struct can be | 
 | 39 |  * specified per-GrContext as a parameter to GrContext::Create. If NULL is | 
 | 40 |  * passed to Create then the "default" GL interface is used. If the default is | 
 | 41 |  * also NULL GrContext creation will fail. | 
 | 42 |  * | 
| bsalomon@google.com | 6fb736f | 2011-09-16 18:51:57 +0000 | [diff] [blame] | 43 |  * The default interface is returned by GrGLDefaultInterface. This function's | 
| robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 44 |  * implementation is platform-specific. Several have been provided, along with | 
 | 45 |  * an implementation that simply returns NULL. It is implementation-specific | 
| bsalomon@google.com | 6fb736f | 2011-09-16 18:51:57 +0000 | [diff] [blame] | 46 |  * whether the same GrGLInterface is returned or whether a new one is created | 
 | 47 |  * at each call. Some platforms may not be able to use a single GrGLInterface | 
 | 48 |  * because extension function ptrs vary across contexts. Note that GrGLInterface | 
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 49 |  * is ref-counted. So if the same object is returned by multiple calls to | 
| bsalomon@google.com | 6fb736f | 2011-09-16 18:51:57 +0000 | [diff] [blame] | 50 |  * GrGLDefaultInterface, each should bump the ref count. | 
| bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 51 |  * | 
 | 52 |  * By defining GR_GL_PER_GL_CALL_IFACE_CALLBACK to 1 the client can specify a | 
 | 53 |  * callback function that will be called prior to each GL function call. See | 
 | 54 |  * comments in GrGLConfig.h | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 55 |  */ | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 56 |  | 
| bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 57 | struct GrGLInterface; | 
 | 58 |  | 
| bsalomon@google.com | 6fb736f | 2011-09-16 18:51:57 +0000 | [diff] [blame] | 59 | const GrGLInterface* GrGLDefaultInterface(); | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 60 |  | 
| bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 61 | /** | 
 | 62 |  * Creates a GrGLInterface for a "native" GL context (e.g. WGL on windows, | 
 | 63 |  * GLX on linux, AGL on Mac). On platforms that have context-specific function | 
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 64 |  * pointers for GL extensions (e.g. windows) the returned interface is only | 
| bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 65 |  * valid for the context that was current at creation. | 
 | 66 |  */ | 
| bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 67 | const GrGLInterface* GrGLCreateNativeInterface(); | 
 | 68 |  | 
| robertphillips@google.com | d3b9fbb | 2012-03-28 16:19:11 +0000 | [diff] [blame] | 69 | #if SK_MESA | 
| bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 70 | /** | 
 | 71 |  * Creates a GrGLInterface for an OSMesa context. | 
 | 72 |  */ | 
| bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 73 | const GrGLInterface* GrGLCreateMesaInterface(); | 
| robertphillips@google.com | d3b9fbb | 2012-03-28 16:19:11 +0000 | [diff] [blame] | 74 | #endif | 
 | 75 |  | 
 | 76 | #if SK_ANGLE | 
 | 77 | /** | 
 | 78 |  * Creates a GrGLInterface for an ANGLE context. | 
 | 79 |  */ | 
 | 80 | const GrGLInterface* GrGLCreateANGLEInterface(); | 
 | 81 | #endif | 
| bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 82 |  | 
| bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 83 | /** | 
 | 84 |  * Creates a null GrGLInterface that doesn't draw anything. Used for measuring | 
 | 85 |  * CPU overhead. | 
 | 86 |  */ | 
 | 87 | const GrGLInterface* GrGLCreateNullInterface(); | 
 | 88 |  | 
| robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 89 | /** | 
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 90 |  * Creates a debugging GrGLInterface that doesn't draw anything. Used for | 
| robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 91 |  * finding memory leaks and invalid memory accesses. | 
 | 92 |  */ | 
 | 93 | const GrGLInterface* GrGLCreateDebugInterface(); | 
 | 94 |  | 
| bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 95 | #if GR_GL_PER_GL_FUNC_CALLBACK | 
 | 96 | typedef void (*GrGLInterfaceCallbackProc)(const GrGLInterface*); | 
 | 97 | typedef intptr_t GrGLInterfaceCallbackData; | 
 | 98 | #endif | 
 | 99 |  | 
| bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 100 | /* | 
| bsalomon@google.com | cc61b17 | 2012-05-07 21:45:48 +0000 | [diff] [blame] | 101 |  * GrContext uses the following interface to make all calls into OpenGL. When a | 
 | 102 |  * GrContext is created it is given a GrGLInterface. The interface's function | 
 | 103 |  * pointers must be valid for the OpenGL context associated with the GrContext. | 
 | 104 |  * On some platforms, such as Windows, function pointers for OpenGL extensions | 
 | 105 |  * may vary between OpenGL contexts. So the caller must be careful to use a | 
 | 106 |  * GrGLInterface initialized for the correct context. All functions that should | 
 | 107 |  * be available based on the OpenGL's version and extension string must be | 
 | 108 |  * non-NULL or GrContext creation will fail. This can be tested with the | 
 | 109 |  * validate() method when the OpenGL context has been made current. | 
| bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 110 |  */ | 
| commit-bot@chromium.org | a4de8c2 | 2013-09-09 13:38:37 +0000 | [diff] [blame] | 111 | struct SK_API GrGLInterface : public SkRefCnt { | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 112 | private: | 
| bsalomon@google.com | 9c1f1ac | 2012-05-07 17:09:37 +0000 | [diff] [blame] | 113 |     // simple wrapper class that exists only to initialize a pointer to NULL | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 114 |     template <typename FNPTR_TYPE> class GLPtr { | 
 | 115 |     public: | 
 | 116 |         GLPtr() : fPtr(NULL) {} | 
 | 117 |         GLPtr operator =(FNPTR_TYPE ptr) { fPtr = ptr; return *this; } | 
 | 118 |         operator FNPTR_TYPE() const { return fPtr; } | 
 | 119 |     private: | 
 | 120 |         FNPTR_TYPE fPtr; | 
 | 121 |     }; | 
| bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 122 |  | 
| commit-bot@chromium.org | a4de8c2 | 2013-09-09 13:38:37 +0000 | [diff] [blame] | 123 |     typedef SkRefCnt INHERITED; | 
| robertphillips@google.com | 15e9d3e | 2012-06-21 20:25:03 +0000 | [diff] [blame] | 124 |  | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 125 | public: | 
| robertphillips@google.com | 15e9d3e | 2012-06-21 20:25:03 +0000 | [diff] [blame] | 126 |     SK_DECLARE_INST_COUNT(GrGLInterface) | 
 | 127 |  | 
| bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 128 |     GrGLInterface(); | 
 | 129 |  | 
| bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 130 |     // Validates that the GrGLInterface supports a binding. This means that | 
 | 131 |     // the GrGLinterface advertises the binding in fBindingsExported and all | 
| bsalomon@google.com | cc61b17 | 2012-05-07 21:45:48 +0000 | [diff] [blame] | 132 |     // the necessary function pointers have been initialized. The interface is | 
 | 133 |     // validated for the current OpenGL context. | 
| bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 134 |     bool validate(GrGLBinding binding) const; | 
 | 135 |  | 
| twiz@google.com | b65e0cb | 2011-03-18 20:41:44 +0000 | [diff] [blame] | 136 |     // Indicator variable specifying the type of GL implementation | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 137 |     // exported:  GLES2 and/or Desktop. | 
| twiz@google.com | b65e0cb | 2011-03-18 20:41:44 +0000 | [diff] [blame] | 138 |     GrGLBinding fBindingsExported; | 
 | 139 |  | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 140 |     GLPtr<GrGLActiveTextureProc> fActiveTexture; | 
 | 141 |     GLPtr<GrGLAttachShaderProc> fAttachShader; | 
 | 142 |     GLPtr<GrGLBeginQueryProc> fBeginQuery; | 
 | 143 |     GLPtr<GrGLBindAttribLocationProc> fBindAttribLocation; | 
 | 144 |     GLPtr<GrGLBindBufferProc> fBindBuffer; | 
 | 145 |     GLPtr<GrGLBindFragDataLocationProc> fBindFragDataLocation; | 
 | 146 |     GLPtr<GrGLBindFragDataLocationIndexedProc> fBindFragDataLocationIndexed; | 
 | 147 |     GLPtr<GrGLBindFramebufferProc> fBindFramebuffer; | 
 | 148 |     GLPtr<GrGLBindRenderbufferProc> fBindRenderbuffer; | 
 | 149 |     GLPtr<GrGLBindTextureProc> fBindTexture; | 
| bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 150 |     GLPtr<GrGLBindVertexArrayProc> fBindVertexArray; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 151 |     GLPtr<GrGLBlendColorProc> fBlendColor; | 
 | 152 |     GLPtr<GrGLBlendFuncProc> fBlendFunc; | 
 | 153 |     GLPtr<GrGLBlitFramebufferProc> fBlitFramebuffer; | 
 | 154 |     GLPtr<GrGLBufferDataProc> fBufferData; | 
 | 155 |     GLPtr<GrGLBufferSubDataProc> fBufferSubData; | 
 | 156 |     GLPtr<GrGLCheckFramebufferStatusProc> fCheckFramebufferStatus; | 
 | 157 |     GLPtr<GrGLClearProc> fClear; | 
 | 158 |     GLPtr<GrGLClearColorProc> fClearColor; | 
 | 159 |     GLPtr<GrGLClearStencilProc> fClearStencil; | 
| commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 160 |     GLPtr<GrGLClientActiveTextureProc> fClientActiveTexture; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 161 |     GLPtr<GrGLColorMaskProc> fColorMask; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 162 |     GLPtr<GrGLCompileShaderProc> fCompileShader; | 
 | 163 |     GLPtr<GrGLCompressedTexImage2DProc> fCompressedTexImage2D; | 
| commit-bot@chromium.org | 98168bb | 2013-04-11 22:00:34 +0000 | [diff] [blame] | 164 |     GLPtr<GrGLCopyTexSubImage2DProc> fCopyTexSubImage2D; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 165 |     GLPtr<GrGLCreateProgramProc> fCreateProgram; | 
 | 166 |     GLPtr<GrGLCreateShaderProc> fCreateShader; | 
 | 167 |     GLPtr<GrGLCullFaceProc> fCullFace; | 
 | 168 |     GLPtr<GrGLDeleteBuffersProc> fDeleteBuffers; | 
 | 169 |     GLPtr<GrGLDeleteFramebuffersProc> fDeleteFramebuffers; | 
 | 170 |     GLPtr<GrGLDeleteProgramProc> fDeleteProgram; | 
 | 171 |     GLPtr<GrGLDeleteQueriesProc> fDeleteQueries; | 
 | 172 |     GLPtr<GrGLDeleteRenderbuffersProc> fDeleteRenderbuffers; | 
 | 173 |     GLPtr<GrGLDeleteShaderProc> fDeleteShader; | 
 | 174 |     GLPtr<GrGLDeleteTexturesProc> fDeleteTextures; | 
| bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 175 |     GLPtr<GrGLDeleteVertexArraysProc> fDeleteVertexArrays; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 176 |     GLPtr<GrGLDepthMaskProc> fDepthMask; | 
 | 177 |     GLPtr<GrGLDisableProc> fDisable; | 
| commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 178 |     GLPtr<GrGLDisableClientStateProc> fDisableClientState; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 179 |     GLPtr<GrGLDisableVertexAttribArrayProc> fDisableVertexAttribArray; | 
 | 180 |     GLPtr<GrGLDrawArraysProc> fDrawArrays; | 
 | 181 |     GLPtr<GrGLDrawBufferProc> fDrawBuffer; | 
 | 182 |     GLPtr<GrGLDrawBuffersProc> fDrawBuffers; | 
 | 183 |     GLPtr<GrGLDrawElementsProc> fDrawElements; | 
 | 184 |     GLPtr<GrGLEnableProc> fEnable; | 
| commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 185 |     GLPtr<GrGLEnableClientStateProc> fEnableClientState; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 186 |     GLPtr<GrGLEnableVertexAttribArrayProc> fEnableVertexAttribArray; | 
 | 187 |     GLPtr<GrGLEndQueryProc> fEndQuery; | 
 | 188 |     GLPtr<GrGLFinishProc> fFinish; | 
 | 189 |     GLPtr<GrGLFlushProc> fFlush; | 
 | 190 |     GLPtr<GrGLFramebufferRenderbufferProc> fFramebufferRenderbuffer; | 
 | 191 |     GLPtr<GrGLFramebufferTexture2DProc> fFramebufferTexture2D; | 
| bsalomon@google.com | f3a60c0 | 2013-03-19 19:06:09 +0000 | [diff] [blame] | 192 |     GLPtr<GrGLFramebufferTexture2DMultisampleProc> fFramebufferTexture2DMultisample; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 193 |     GLPtr<GrGLFrontFaceProc> fFrontFace; | 
 | 194 |     GLPtr<GrGLGenBuffersProc> fGenBuffers; | 
 | 195 |     GLPtr<GrGLGenFramebuffersProc> fGenFramebuffers; | 
| commit-bot@chromium.org | cffff79 | 2013-07-26 16:36:04 +0000 | [diff] [blame] | 196 |     GLPtr<GrGLGenerateMipmapProc> fGenerateMipmap; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 197 |     GLPtr<GrGLGenQueriesProc> fGenQueries; | 
 | 198 |     GLPtr<GrGLGenRenderbuffersProc> fGenRenderbuffers; | 
 | 199 |     GLPtr<GrGLGenTexturesProc> fGenTextures; | 
| bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 200 |     GLPtr<GrGLGenVertexArraysProc> fGenVertexArrays; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 201 |     GLPtr<GrGLGetBufferParameterivProc> fGetBufferParameteriv; | 
 | 202 |     GLPtr<GrGLGetErrorProc> fGetError; | 
 | 203 |     GLPtr<GrGLGetFramebufferAttachmentParameterivProc> fGetFramebufferAttachmentParameteriv; | 
 | 204 |     GLPtr<GrGLGetIntegervProc> fGetIntegerv; | 
 | 205 |     GLPtr<GrGLGetQueryObjecti64vProc> fGetQueryObjecti64v; | 
 | 206 |     GLPtr<GrGLGetQueryObjectivProc> fGetQueryObjectiv; | 
 | 207 |     GLPtr<GrGLGetQueryObjectui64vProc> fGetQueryObjectui64v; | 
 | 208 |     GLPtr<GrGLGetQueryObjectuivProc> fGetQueryObjectuiv; | 
 | 209 |     GLPtr<GrGLGetQueryivProc> fGetQueryiv; | 
 | 210 |     GLPtr<GrGLGetProgramInfoLogProc> fGetProgramInfoLog; | 
 | 211 |     GLPtr<GrGLGetProgramivProc> fGetProgramiv; | 
 | 212 |     GLPtr<GrGLGetRenderbufferParameterivProc> fGetRenderbufferParameteriv; | 
 | 213 |     GLPtr<GrGLGetShaderInfoLogProc> fGetShaderInfoLog; | 
 | 214 |     GLPtr<GrGLGetShaderivProc> fGetShaderiv; | 
 | 215 |     GLPtr<GrGLGetStringProc> fGetString; | 
| bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 216 |     GLPtr<GrGLGetStringiProc> fGetStringi; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 217 |     GLPtr<GrGLGetTexLevelParameterivProc> fGetTexLevelParameteriv; | 
 | 218 |     GLPtr<GrGLGetUniformLocationProc> fGetUniformLocation; | 
 | 219 |     GLPtr<GrGLLineWidthProc> fLineWidth; | 
 | 220 |     GLPtr<GrGLLinkProgramProc> fLinkProgram; | 
| commit-bot@chromium.org | f5897f8 | 2013-09-03 17:50:50 +0000 | [diff] [blame] | 221 |     GLPtr<GrGLLoadIdentityProc> fLoadIdentity; | 
 | 222 |     GLPtr<GrGLLoadMatrixfProc> fLoadMatrixf; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 223 |     GLPtr<GrGLMapBufferProc> fMapBuffer; | 
| commit-bot@chromium.org | f5897f8 | 2013-09-03 17:50:50 +0000 | [diff] [blame] | 224 |     GLPtr<GrGLMatrixModeProc> fMatrixMode; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 225 |     GLPtr<GrGLPixelStoreiProc> fPixelStorei; | 
 | 226 |     GLPtr<GrGLQueryCounterProc> fQueryCounter; | 
 | 227 |     GLPtr<GrGLReadBufferProc> fReadBuffer; | 
 | 228 |     GLPtr<GrGLReadPixelsProc> fReadPixels; | 
 | 229 |     GLPtr<GrGLRenderbufferStorageProc> fRenderbufferStorage; | 
| commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 230 |  | 
 | 231 | #if !GR_GL_IGNORE_ES3_MSAA | 
 | 232 |     //  On OpenGL ES there are multiple incompatible extensions that add support for MSAA | 
 | 233 |     //  and ES3 adds MSAA support to the standard. On an ES3 driver we may still use the | 
 | 234 |     //  older extensions for performance reasons or due to ES3 driver bugs. We want the function | 
 | 235 |     //  that creates the GrGLInterface to provide all available functions and internally | 
 | 236 |     //  we will select among them. They all have a method called glRenderbufferStorageMultisample*. | 
 | 237 |     //  So we have separate function pointers for GL_IMG/EXT_multisampled_to_texture, | 
 | 238 |     //  GL_CHROMIUM/ANGLE_framebuffer_multisample/ES3, and GL_APPLE_framebuffer_multisample | 
 | 239 |     //  variations. | 
 | 240 |     // | 
 | 241 |     //  If a driver supports multiple GL_ARB_framebuffer_multisample-style extensions then we will | 
 | 242 |     //  assume the function pointers for the standard (or equivalent GL_ARB) version have | 
 | 243 |     //  been preferred over GL_EXT, GL_CHROMIUM, or GL_ANGLE variations that have reduced | 
 | 244 |     //  functionality. | 
 | 245 |  | 
 | 246 |     //  GL_EXT_multisampled_render_to_texture (preferred) or GL_IMG_multisampled_render_to_texture | 
 | 247 |     GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2EXT; | 
 | 248 |     //  GL_APPLE_framebuffer_multisample | 
 | 249 |     GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2APPLE; | 
 | 250 | #endif | 
 | 251 |     //  This is used to store the pointer for GL_ARB/EXT/ANGLE/CHROMIUM_framebuffer_multisample or | 
 | 252 |     //  the standard function in ES3+ or GL 3.0+. | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 253 |     GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisample; | 
| commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 254 |  | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 255 |     GLPtr<GrGLResolveMultisampleFramebufferProc> fResolveMultisampleFramebuffer; | 
 | 256 |     GLPtr<GrGLScissorProc> fScissor; | 
 | 257 |     GLPtr<GrGLShaderSourceProc> fShaderSource; | 
 | 258 |     GLPtr<GrGLStencilFuncProc> fStencilFunc; | 
 | 259 |     GLPtr<GrGLStencilFuncSeparateProc> fStencilFuncSeparate; | 
 | 260 |     GLPtr<GrGLStencilMaskProc> fStencilMask; | 
 | 261 |     GLPtr<GrGLStencilMaskSeparateProc> fStencilMaskSeparate; | 
 | 262 |     GLPtr<GrGLStencilOpProc> fStencilOp; | 
 | 263 |     GLPtr<GrGLStencilOpSeparateProc> fStencilOpSeparate; | 
| commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 264 |     GLPtr<GrGLTexGenfProc> fTexGenf; | 
 | 265 |     GLPtr<GrGLTexGenfvProc> fTexGenfv; | 
 | 266 |     GLPtr<GrGLTexGeniProc> fTexGeni; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 267 |     GLPtr<GrGLTexImage2DProc> fTexImage2D; | 
 | 268 |     GLPtr<GrGLTexParameteriProc> fTexParameteri; | 
| bsalomon@google.com | 4d063de | 2012-05-31 17:59:23 +0000 | [diff] [blame] | 269 |     GLPtr<GrGLTexParameterivProc> fTexParameteriv; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 270 |     GLPtr<GrGLTexSubImage2DProc> fTexSubImage2D; | 
 | 271 |     GLPtr<GrGLTexStorage2DProc> fTexStorage2D; | 
| robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 272 |     GLPtr<GrGLDiscardFramebufferProc> fDiscardFramebuffer; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 273 |     GLPtr<GrGLUniform1fProc> fUniform1f; | 
 | 274 |     GLPtr<GrGLUniform1iProc> fUniform1i; | 
 | 275 |     GLPtr<GrGLUniform1fvProc> fUniform1fv; | 
 | 276 |     GLPtr<GrGLUniform1ivProc> fUniform1iv; | 
 | 277 |     GLPtr<GrGLUniform2fProc> fUniform2f; | 
 | 278 |     GLPtr<GrGLUniform2iProc> fUniform2i; | 
 | 279 |     GLPtr<GrGLUniform2fvProc> fUniform2fv; | 
 | 280 |     GLPtr<GrGLUniform2ivProc> fUniform2iv; | 
 | 281 |     GLPtr<GrGLUniform3fProc> fUniform3f; | 
 | 282 |     GLPtr<GrGLUniform3iProc> fUniform3i; | 
 | 283 |     GLPtr<GrGLUniform3fvProc> fUniform3fv; | 
 | 284 |     GLPtr<GrGLUniform3ivProc> fUniform3iv; | 
 | 285 |     GLPtr<GrGLUniform4fProc> fUniform4f; | 
 | 286 |     GLPtr<GrGLUniform4iProc> fUniform4i; | 
 | 287 |     GLPtr<GrGLUniform4fvProc> fUniform4fv; | 
 | 288 |     GLPtr<GrGLUniform4ivProc> fUniform4iv; | 
 | 289 |     GLPtr<GrGLUniformMatrix2fvProc> fUniformMatrix2fv; | 
 | 290 |     GLPtr<GrGLUniformMatrix3fvProc> fUniformMatrix3fv; | 
 | 291 |     GLPtr<GrGLUniformMatrix4fvProc> fUniformMatrix4fv; | 
 | 292 |     GLPtr<GrGLUnmapBufferProc> fUnmapBuffer; | 
 | 293 |     GLPtr<GrGLUseProgramProc> fUseProgram; | 
 | 294 |     GLPtr<GrGLVertexAttrib4fvProc> fVertexAttrib4fv; | 
 | 295 |     GLPtr<GrGLVertexAttribPointerProc> fVertexAttribPointer; | 
| commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 296 |     GLPtr<GrGLVertexPointerProc> fVertexPointer; | 
| bsalomon@google.com | ba800e2 | 2012-03-29 21:04:52 +0000 | [diff] [blame] | 297 |     GLPtr<GrGLViewportProc> fViewport; | 
| bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 298 |  | 
| bsalomon@google.com | fe11cb6 | 2012-06-06 15:17:54 +0000 | [diff] [blame] | 299 |     // Experimental: Functions for GL_NV_path_rendering. These will be | 
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 300 |     // alphabetized with the above functions once this is fully supported | 
| bsalomon@google.com | fe11cb6 | 2012-06-06 15:17:54 +0000 | [diff] [blame] | 301 |     // (and functions we are unlikely to use will possibly be omitted). | 
| bsalomon@google.com | fe11cb6 | 2012-06-06 15:17:54 +0000 | [diff] [blame] | 302 |     GLPtr<GrGLPathCommandsProc> fPathCommands; | 
 | 303 |     GLPtr<GrGLPathCoordsProc> fPathCoords; | 
 | 304 |     GLPtr<GrGLPathSubCommandsProc> fPathSubCommands; | 
 | 305 |     GLPtr<GrGLPathSubCoordsProc> fPathSubCoords; | 
 | 306 |     GLPtr<GrGLPathStringProc> fPathString; | 
 | 307 |     GLPtr<GrGLPathGlyphsProc> fPathGlyphs; | 
 | 308 |     GLPtr<GrGLPathGlyphRangeProc> fPathGlyphRange; | 
 | 309 |     GLPtr<GrGLWeightPathsProc> fWeightPaths; | 
 | 310 |     GLPtr<GrGLCopyPathProc> fCopyPath; | 
 | 311 |     GLPtr<GrGLInterpolatePathsProc> fInterpolatePaths; | 
 | 312 |     GLPtr<GrGLTransformPathProc> fTransformPath; | 
 | 313 |     GLPtr<GrGLPathParameterivProc> fPathParameteriv; | 
 | 314 |     GLPtr<GrGLPathParameteriProc> fPathParameteri; | 
 | 315 |     GLPtr<GrGLPathParameterfvProc> fPathParameterfv; | 
 | 316 |     GLPtr<GrGLPathParameterfProc> fPathParameterf; | 
 | 317 |     GLPtr<GrGLPathDashArrayProc> fPathDashArray; | 
 | 318 |     GLPtr<GrGLGenPathsProc> fGenPaths; | 
 | 319 |     GLPtr<GrGLDeletePathsProc> fDeletePaths; | 
 | 320 |     GLPtr<GrGLIsPathProc> fIsPath; | 
 | 321 |     GLPtr<GrGLPathStencilFuncProc> fPathStencilFunc; | 
 | 322 |     GLPtr<GrGLPathStencilDepthOffsetProc> fPathStencilDepthOffset; | 
 | 323 |     GLPtr<GrGLStencilFillPathProc> fStencilFillPath; | 
 | 324 |     GLPtr<GrGLStencilStrokePathProc> fStencilStrokePath; | 
 | 325 |     GLPtr<GrGLStencilFillPathInstancedProc> fStencilFillPathInstanced; | 
 | 326 |     GLPtr<GrGLStencilStrokePathInstancedProc> fStencilStrokePathInstanced; | 
 | 327 |     GLPtr<GrGLPathCoverDepthFuncProc> fPathCoverDepthFunc; | 
 | 328 |     GLPtr<GrGLPathColorGenProc> fPathColorGen; | 
 | 329 |     GLPtr<GrGLPathTexGenProc> fPathTexGen; | 
 | 330 |     GLPtr<GrGLPathFogGenProc> fPathFogGen; | 
 | 331 |     GLPtr<GrGLCoverFillPathProc> fCoverFillPath; | 
 | 332 |     GLPtr<GrGLCoverStrokePathProc> fCoverStrokePath; | 
 | 333 |     GLPtr<GrGLCoverFillPathInstancedProc> fCoverFillPathInstanced; | 
 | 334 |     GLPtr<GrGLCoverStrokePathInstancedProc> fCoverStrokePathInstanced; | 
 | 335 |     GLPtr<GrGLGetPathParameterivProc> fGetPathParameteriv; | 
 | 336 |     GLPtr<GrGLGetPathParameterfvProc> fGetPathParameterfv; | 
 | 337 |     GLPtr<GrGLGetPathCommandsProc> fGetPathCommands; | 
 | 338 |     GLPtr<GrGLGetPathCoordsProc> fGetPathCoords; | 
 | 339 |     GLPtr<GrGLGetPathDashArrayProc> fGetPathDashArray; | 
 | 340 |     GLPtr<GrGLGetPathMetricsProc> fGetPathMetrics; | 
 | 341 |     GLPtr<GrGLGetPathMetricRangeProc> fGetPathMetricRange; | 
 | 342 |     GLPtr<GrGLGetPathSpacingProc> fGetPathSpacing; | 
 | 343 |     GLPtr<GrGLGetPathColorGenivProc> fGetPathColorGeniv; | 
 | 344 |     GLPtr<GrGLGetPathColorGenfvProc> fGetPathColorGenfv; | 
 | 345 |     GLPtr<GrGLGetPathTexGenivProc> fGetPathTexGeniv; | 
 | 346 |     GLPtr<GrGLGetPathTexGenfvProc> fGetPathTexGenfv; | 
 | 347 |     GLPtr<GrGLIsPointInFillPathProc> fIsPointInFillPath; | 
 | 348 |     GLPtr<GrGLIsPointInStrokePathProc> fIsPointInStrokePath; | 
 | 349 |     GLPtr<GrGLGetPathLengthProc> fGetPathLength; | 
 | 350 |     GLPtr<GrGLPointAlongPathProc> fPointAlongPath; | 
 | 351 |  | 
| bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 352 |     // Per-GL func callback | 
 | 353 | #if GR_GL_PER_GL_FUNC_CALLBACK | 
 | 354 |     GrGLInterfaceCallbackProc fCallback; | 
 | 355 |     GrGLInterfaceCallbackData fCallbackData; | 
 | 356 | #endif | 
 | 357 |  | 
| bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 358 | }; | 
| twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 359 |  | 
 | 360 | #endif |