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 | |
| 8 | |
tomhudson@google.com | 6bf38b5 | 2012-02-14 15:11:59 +0000 | [diff] [blame] | 9 | #include "gl/GrGLInterface.h" |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 10 | #include "gl/GrGLExtensions.h" |
| 11 | #include "gl/GrGLUtil.h" |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 12 | |
| 13 | #include <stdio.h> |
| 14 | |
bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 15 | #if GR_GL_PER_GL_FUNC_CALLBACK |
| 16 | namespace { |
| 17 | void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} |
| 18 | } |
| 19 | #endif |
| 20 | |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 21 | const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interface, |
| 22 | GrGLInsertEventMarkerProc insertEventMarkerFn, |
| 23 | GrGLPushGroupMarkerProc pushGroupMarkerFn, |
| 24 | GrGLPopGroupMarkerProc popGroupMarkerFn) { |
| 25 | GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
| 26 | |
| 27 | if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) { |
| 28 | newInterface->fExtensions.add("GL_EXT_debug_marker"); |
| 29 | } |
| 30 | |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 31 | newInterface->fFunctions.fInsertEventMarker = insertEventMarkerFn; |
| 32 | newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn; |
| 33 | newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn; |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 34 | |
| 35 | return newInterface; |
| 36 | } |
| 37 | |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 38 | const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { |
| 39 | GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
| 40 | |
| 41 | newInterface->fExtensions.remove("GL_NV_path_rendering"); |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 42 | newInterface->fFunctions.fPathCommands = NULL; |
| 43 | newInterface->fFunctions.fPathCoords = NULL; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 44 | newInterface->fFunctions.fPathParameteri = NULL; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 45 | newInterface->fFunctions.fPathParameterf = NULL; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 46 | newInterface->fFunctions.fGenPaths = NULL; |
| 47 | newInterface->fFunctions.fDeletePaths = NULL; |
cdalton | 8dd90cb | 2014-07-17 09:28:36 -0700 | [diff] [blame] | 48 | newInterface->fFunctions.fIsPath = NULL; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 49 | newInterface->fFunctions.fPathStencilFunc = NULL; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 50 | newInterface->fFunctions.fStencilFillPath = NULL; |
| 51 | newInterface->fFunctions.fStencilStrokePath = NULL; |
| 52 | newInterface->fFunctions.fStencilFillPathInstanced = NULL; |
| 53 | newInterface->fFunctions.fStencilStrokePathInstanced = NULL; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 54 | newInterface->fFunctions.fPathTexGen = NULL; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 55 | newInterface->fFunctions.fCoverFillPath = NULL; |
| 56 | newInterface->fFunctions.fCoverStrokePath = NULL; |
| 57 | newInterface->fFunctions.fCoverFillPathInstanced = NULL; |
| 58 | newInterface->fFunctions.fCoverStrokePathInstanced = NULL; |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 59 | newInterface->fFunctions.fStencilThenCoverFillPath = NULL; |
| 60 | newInterface->fFunctions.fStencilThenCoverStrokePath = NULL; |
| 61 | newInterface->fFunctions.fStencilThenCoverFillPathInstanced = NULL; |
| 62 | newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = NULL; |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 63 | newInterface->fFunctions.fProgramPathFragmentInputGen = NULL; |
cdalton | 149b3ec | 2014-09-17 09:19:18 -0700 | [diff] [blame] | 64 | newInterface->fFunctions.fPathMemoryGlyphIndexArray = NULL; |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 65 | return newInterface; |
| 66 | } |
| 67 | |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 68 | GrGLInterface::GrGLInterface() { |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 69 | fStandard = kNone_GrGLStandard; |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 70 | |
bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 71 | #if GR_GL_PER_GL_FUNC_CALLBACK |
| 72 | fCallback = GrGLDefaultInterfaceCallback; |
| 73 | fCallbackData = 0; |
| 74 | #endif |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 75 | } |
| 76 | |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 77 | GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 78 | SkASSERT(interface); |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 79 | |
| 80 | GrGLInterface* clone = SkNEW(GrGLInterface); |
| 81 | clone->fStandard = interface->fStandard; |
| 82 | clone->fExtensions = interface->fExtensions; |
| 83 | clone->fFunctions = interface->fFunctions; |
| 84 | #if GR_GL_PER_GL_FUNC_CALLBACK |
| 85 | clone->fCallback = interface->fCallback; |
| 86 | clone->fCallbackData = interface->fCallbackData; |
| 87 | #endif |
| 88 | return clone; |
| 89 | } |
| 90 | |
commit-bot@chromium.org | e83b9b7 | 2014-05-01 19:21:41 +0000 | [diff] [blame] | 91 | #ifdef SK_DEBUG |
| 92 | static int kIsDebug = 1; |
| 93 | #else |
| 94 | static int kIsDebug = 0; |
| 95 | #endif |
| 96 | |
| 97 | #define RETURN_FALSE_INTERFACE \ |
| 98 | if (kIsDebug) { SkDebugf("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); } \ |
| 99 | return false; |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 100 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 101 | bool GrGLInterface::validate() const { |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 102 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 103 | if (kNone_GrGLStandard == fStandard) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 104 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 105 | } |
skia.committer@gmail.com | 12eea2b | 2013-02-27 07:10:10 +0000 | [diff] [blame] | 106 | |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 107 | if (!fExtensions.isInitialized()) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 108 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 109 | } |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 110 | |
| 111 | // functions that are always required |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 112 | if (NULL == fFunctions.fActiveTexture || |
| 113 | NULL == fFunctions.fAttachShader || |
| 114 | NULL == fFunctions.fBindAttribLocation || |
| 115 | NULL == fFunctions.fBindBuffer || |
| 116 | NULL == fFunctions.fBindTexture || |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 117 | NULL == fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0 |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 118 | NULL == fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0 |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 119 | NULL == fFunctions.fBlendFunc || |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 120 | NULL == fFunctions.fBufferData || |
| 121 | NULL == fFunctions.fBufferSubData || |
| 122 | NULL == fFunctions.fClear || |
| 123 | NULL == fFunctions.fClearColor || |
| 124 | NULL == fFunctions.fClearStencil || |
| 125 | NULL == fFunctions.fColorMask || |
| 126 | NULL == fFunctions.fCompileShader || |
| 127 | NULL == fFunctions.fCopyTexSubImage2D || |
| 128 | NULL == fFunctions.fCreateProgram || |
| 129 | NULL == fFunctions.fCreateShader || |
| 130 | NULL == fFunctions.fCullFace || |
| 131 | NULL == fFunctions.fDeleteBuffers || |
| 132 | NULL == fFunctions.fDeleteProgram || |
| 133 | NULL == fFunctions.fDeleteShader || |
| 134 | NULL == fFunctions.fDeleteTextures || |
| 135 | NULL == fFunctions.fDepthMask || |
| 136 | NULL == fFunctions.fDisable || |
| 137 | NULL == fFunctions.fDisableVertexAttribArray || |
| 138 | NULL == fFunctions.fDrawArrays || |
| 139 | NULL == fFunctions.fDrawElements || |
| 140 | NULL == fFunctions.fEnable || |
| 141 | NULL == fFunctions.fEnableVertexAttribArray || |
| 142 | NULL == fFunctions.fFrontFace || |
| 143 | NULL == fFunctions.fGenBuffers || |
| 144 | NULL == fFunctions.fGenTextures || |
| 145 | NULL == fFunctions.fGetBufferParameteriv || |
| 146 | NULL == fFunctions.fGenerateMipmap || |
| 147 | NULL == fFunctions.fGetError || |
| 148 | NULL == fFunctions.fGetIntegerv || |
| 149 | NULL == fFunctions.fGetProgramInfoLog || |
| 150 | NULL == fFunctions.fGetProgramiv || |
| 151 | NULL == fFunctions.fGetShaderInfoLog || |
| 152 | NULL == fFunctions.fGetShaderiv || |
| 153 | NULL == fFunctions.fGetString || |
| 154 | NULL == fFunctions.fGetUniformLocation || |
bsalomon | 6dc6f5f | 2015-06-18 09:12:16 -0700 | [diff] [blame^] | 155 | #if 0 // Not included in Chrome yet |
| 156 | NULL == fFunctions.fIsTexture || |
| 157 | #endif |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 158 | NULL == fFunctions.fLinkProgram || |
| 159 | NULL == fFunctions.fLineWidth || |
| 160 | NULL == fFunctions.fPixelStorei || |
| 161 | NULL == fFunctions.fReadPixels || |
| 162 | NULL == fFunctions.fScissor || |
| 163 | NULL == fFunctions.fShaderSource || |
| 164 | NULL == fFunctions.fStencilFunc || |
| 165 | NULL == fFunctions.fStencilMask || |
| 166 | NULL == fFunctions.fStencilOp || |
| 167 | NULL == fFunctions.fTexImage2D || |
| 168 | NULL == fFunctions.fTexParameteri || |
| 169 | NULL == fFunctions.fTexParameteriv || |
| 170 | NULL == fFunctions.fTexSubImage2D || |
| 171 | NULL == fFunctions.fUniform1f || |
| 172 | NULL == fFunctions.fUniform1i || |
| 173 | NULL == fFunctions.fUniform1fv || |
| 174 | NULL == fFunctions.fUniform1iv || |
| 175 | NULL == fFunctions.fUniform2f || |
| 176 | NULL == fFunctions.fUniform2i || |
| 177 | NULL == fFunctions.fUniform2fv || |
| 178 | NULL == fFunctions.fUniform2iv || |
| 179 | NULL == fFunctions.fUniform3f || |
| 180 | NULL == fFunctions.fUniform3i || |
| 181 | NULL == fFunctions.fUniform3fv || |
| 182 | NULL == fFunctions.fUniform3iv || |
| 183 | NULL == fFunctions.fUniform4f || |
| 184 | NULL == fFunctions.fUniform4i || |
| 185 | NULL == fFunctions.fUniform4fv || |
| 186 | NULL == fFunctions.fUniform4iv || |
| 187 | NULL == fFunctions.fUniformMatrix2fv || |
| 188 | NULL == fFunctions.fUniformMatrix3fv || |
| 189 | NULL == fFunctions.fUniformMatrix4fv || |
| 190 | NULL == fFunctions.fUseProgram || |
egdaniel | 27c1521 | 2014-10-24 15:00:50 -0700 | [diff] [blame] | 191 | NULL == fFunctions.fVertexAttrib1f || |
| 192 | NULL == fFunctions.fVertexAttrib2fv || |
| 193 | NULL == fFunctions.fVertexAttrib3fv || |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 194 | NULL == fFunctions.fVertexAttrib4fv || |
| 195 | NULL == fFunctions.fVertexAttribPointer || |
| 196 | NULL == fFunctions.fViewport || |
| 197 | NULL == fFunctions.fBindFramebuffer || |
| 198 | NULL == fFunctions.fBindRenderbuffer || |
| 199 | NULL == fFunctions.fCheckFramebufferStatus || |
| 200 | NULL == fFunctions.fDeleteFramebuffers || |
| 201 | NULL == fFunctions.fDeleteRenderbuffers || |
| 202 | NULL == fFunctions.fFinish || |
| 203 | NULL == fFunctions.fFlush || |
| 204 | NULL == fFunctions.fFramebufferRenderbuffer || |
| 205 | NULL == fFunctions.fFramebufferTexture2D || |
| 206 | NULL == fFunctions.fGetFramebufferAttachmentParameteriv || |
| 207 | NULL == fFunctions.fGetRenderbufferParameteriv || |
| 208 | NULL == fFunctions.fGenFramebuffers || |
| 209 | NULL == fFunctions.fGenRenderbuffers || |
| 210 | NULL == fFunctions.fRenderbufferStorage) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 211 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 212 | } |
| 213 | |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 214 | GrGLVersion glVer = GrGLGetVersion(this); |
commit-bot@chromium.org | f4e67e3 | 2014-04-30 01:26:04 +0000 | [diff] [blame] | 215 | if (GR_GL_INVALID_VER == glVer) { |
| 216 | RETURN_FALSE_INTERFACE |
| 217 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 218 | |
| 219 | // Now check that baseline ES/Desktop fns not covered above are present |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 220 | // and that we have fn pointers for any advertised fExtensions that we will |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 221 | // try to use. |
| 222 | |
| 223 | // these functions are part of ES2, we assume they are available |
| 224 | // On the desktop we assume they are available if the extension |
| 225 | // is present or GL version is high enough. |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 226 | if (kGLES_GrGLStandard == fStandard) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 227 | if (NULL == fFunctions.fStencilFuncSeparate || |
| 228 | NULL == fFunctions.fStencilMaskSeparate || |
| 229 | NULL == fFunctions.fStencilOpSeparate) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 230 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 231 | } |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 232 | } else if (kGL_GrGLStandard == fStandard) { |
robertphillips@google.com | e788430 | 2012-04-18 14:39:58 +0000 | [diff] [blame] | 233 | |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 234 | if (glVer >= GR_GL_VER(2,0)) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 235 | if (NULL == fFunctions.fStencilFuncSeparate || |
| 236 | NULL == fFunctions.fStencilMaskSeparate || |
| 237 | NULL == fFunctions.fStencilOpSeparate) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 238 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 239 | } |
| 240 | } |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 241 | if (glVer >= GR_GL_VER(3,0) && NULL == fFunctions.fBindFragDataLocation) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 242 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bc5cf51 | 2011-09-21 16:21:07 +0000 | [diff] [blame] | 243 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 244 | if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 245 | if (NULL == fFunctions.fDrawBuffers) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 246 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | d32c5f5 | 2011-08-02 19:29:03 +0000 | [diff] [blame] | 247 | } |
| 248 | } |
robertphillips@google.com | e788430 | 2012-04-18 14:39:58 +0000 | [diff] [blame] | 249 | |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 250 | if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 251 | if (NULL == fFunctions.fGenQueries || |
| 252 | NULL == fFunctions.fDeleteQueries || |
| 253 | NULL == fFunctions.fBeginQuery || |
| 254 | NULL == fFunctions.fEndQuery || |
| 255 | NULL == fFunctions.fGetQueryiv || |
| 256 | NULL == fFunctions.fGetQueryObjectiv || |
| 257 | NULL == fFunctions.fGetQueryObjectuiv) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 258 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 259 | } |
| 260 | } |
| 261 | if (glVer >= GR_GL_VER(3,3) || |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 262 | fExtensions.has("GL_ARB_timer_query") || |
| 263 | fExtensions.has("GL_EXT_timer_query")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 264 | if (NULL == fFunctions.fGetQueryObjecti64v || |
| 265 | NULL == fFunctions.fGetQueryObjectui64v) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 266 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 267 | } |
| 268 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 269 | if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 270 | if (NULL == fFunctions.fQueryCounter) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 271 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 272 | } |
| 273 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | // optional function on desktop before 1.3 |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 277 | if (kGL_GrGLStandard != fStandard || |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 278 | (glVer >= GR_GL_VER(1,3)) || |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 279 | fExtensions.has("GL_ARB_texture_compression")) { |
krajcevski | e1f5a23 | 2014-06-11 16:08:50 -0700 | [diff] [blame] | 280 | if (NULL == fFunctions.fCompressedTexImage2D |
bsalomon | c9aec1e | 2015-04-24 11:08:25 -0700 | [diff] [blame] | 281 | #if 0 |
krajcevski | e1f5a23 | 2014-06-11 16:08:50 -0700 | [diff] [blame] | 282 | || NULL == fFunctions.fCompressedTexSubImage2D |
bsalomon | c9aec1e | 2015-04-24 11:08:25 -0700 | [diff] [blame] | 283 | #endif |
krajcevski | e1f5a23 | 2014-06-11 16:08:50 -0700 | [diff] [blame] | 284 | ) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 285 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 286 | } |
| 287 | } |
| 288 | |
bsalomon@google.com | d32c5f5 | 2011-08-02 19:29:03 +0000 | [diff] [blame] | 289 | // part of desktop GL, but not ES |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 290 | if (kGL_GrGLStandard == fStandard && |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 291 | (NULL == fFunctions.fGetTexLevelParameteriv || |
| 292 | NULL == fFunctions.fDrawBuffer || |
| 293 | NULL == fFunctions.fReadBuffer)) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 294 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 295 | } |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 296 | |
bsalomon@google.com | 280e99f | 2012-01-05 16:17:38 +0000 | [diff] [blame] | 297 | // GL_EXT_texture_storage is part of desktop 4.2 |
| 298 | // There is a desktop ARB extension and an ES+desktop EXT extension |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 299 | if (kGL_GrGLStandard == fStandard) { |
bsalomon@google.com | baa9ea1 | 2012-01-06 19:05:43 +0000 | [diff] [blame] | 300 | if (glVer >= GR_GL_VER(4,2) || |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 301 | fExtensions.has("GL_ARB_texture_storage") || |
| 302 | fExtensions.has("GL_EXT_texture_storage")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 303 | if (NULL == fFunctions.fTexStorage2D) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 304 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | baa9ea1 | 2012-01-06 19:05:43 +0000 | [diff] [blame] | 305 | } |
| 306 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 307 | } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 308 | if (NULL == fFunctions.fTexStorage2D) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 309 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | baa9ea1 | 2012-01-06 19:05:43 +0000 | [diff] [blame] | 310 | } |
bsalomon@google.com | 280e99f | 2012-01-05 16:17:38 +0000 | [diff] [blame] | 311 | } |
| 312 | |
cdalton | fd4167d | 2015-04-21 11:45:56 -0700 | [diff] [blame] | 313 | // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extensions. |
| 314 | if (kGL_GrGLStandard == fStandard) { |
| 315 | if (glVer >= GR_GL_VER(4,5) || |
| 316 | fExtensions.has("GL_ARB_texture_barrier") || |
| 317 | fExtensions.has("GL_NV_texture_barrier")) { |
| 318 | if (NULL == fFunctions.fTextureBarrier) { |
| 319 | RETURN_FALSE_INTERFACE |
| 320 | } |
| 321 | } |
| 322 | } else if (fExtensions.has("GL_NV_texture_barrier")) { |
| 323 | if (NULL == fFunctions.fTextureBarrier) { |
| 324 | RETURN_FALSE_INTERFACE |
| 325 | } |
| 326 | } |
| 327 | |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 328 | if (fExtensions.has("GL_KHR_blend_equation_advanced") || |
| 329 | fExtensions.has("GL_NV_blend_equation_advanced")) { |
| 330 | if (NULL == fFunctions.fBlendBarrier) { |
| 331 | RETURN_FALSE_INTERFACE |
| 332 | } |
| 333 | } |
| 334 | |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 335 | if (fExtensions.has("GL_EXT_discard_framebuffer")) { |
bsalomon | c9aec1e | 2015-04-24 11:08:25 -0700 | [diff] [blame] | 336 | // FIXME: Remove this once Chromium is updated to provide this function |
| 337 | #if 0 |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 338 | if (NULL == fFunctions.fDiscardFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 339 | RETURN_FALSE_INTERFACE |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 340 | } |
bsalomon | c9aec1e | 2015-04-24 11:08:25 -0700 | [diff] [blame] | 341 | #endif |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 342 | } |
| 343 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 344 | // FBO MSAA |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 345 | if (kGL_GrGLStandard == fStandard) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 346 | // GL 3.0 and the ARB extension have multisample + blit |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 347 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 348 | if (NULL == fFunctions.fRenderbufferStorageMultisample || |
| 349 | NULL == fFunctions.fBlitFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 350 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 351 | } |
| 352 | } else { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 353 | if (fExtensions.has("GL_EXT_framebuffer_blit") && |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 354 | NULL == fFunctions.fBlitFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 355 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 356 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 357 | if (fExtensions.has("GL_EXT_framebuffer_multisample") && |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 358 | NULL == fFunctions.fRenderbufferStorageMultisample) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 359 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 360 | } |
| 361 | } |
| 362 | } else { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 363 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 364 | if (NULL == fFunctions.fRenderbufferStorageMultisample || |
| 365 | NULL == fFunctions.fBlitFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 366 | RETURN_FALSE_INTERFACE |
commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 367 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 368 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 369 | if (fExtensions.has("GL_APPLE_framebuffer_multisample")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 370 | if (NULL == fFunctions.fRenderbufferStorageMultisampleES2APPLE || |
| 371 | NULL == fFunctions.fResolveMultisampleFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 372 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 373 | } |
| 374 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 375 | if (fExtensions.has("GL_IMG_multisampled_render_to_texture") || |
| 376 | fExtensions.has("GL_EXT_multisampled_render_to_texture")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 377 | if (NULL == fFunctions.fRenderbufferStorageMultisampleES2EXT || |
| 378 | NULL == fFunctions.fFramebufferTexture2DMultisample) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 379 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | f3a60c0 | 2013-03-19 19:06:09 +0000 | [diff] [blame] | 380 | } |
| 381 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | // On ES buffer mapping is an extension. On Desktop |
| 385 | // buffer mapping was part of original VBO extension |
| 386 | // which we require. |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 387 | if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 388 | if (NULL == fFunctions.fMapBuffer || |
| 389 | NULL == fFunctions.fUnmapBuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 390 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 391 | } |
| 392 | } |
| 393 | |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 394 | // Dual source blending |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 395 | if (kGL_GrGLStandard == fStandard && |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 396 | (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended"))) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 397 | if (NULL == fFunctions.fBindFragDataLocationIndexed) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 398 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 399 | } |
| 400 | } |
skia.committer@gmail.com | 12eea2b | 2013-02-27 07:10:10 +0000 | [diff] [blame] | 401 | |
commit-bot@chromium.org | 726e621 | 2013-08-23 20:55:46 +0000 | [diff] [blame] | 402 | // glGetStringi was added in version 3.0 of both desktop and ES. |
| 403 | if (glVer >= GR_GL_VER(3, 0)) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 404 | if (NULL == fFunctions.fGetStringi) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 405 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 406 | } |
| 407 | } |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 408 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 409 | if (kGL_GrGLStandard == fStandard) { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 410 | if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 411 | if (NULL == fFunctions.fBindVertexArray || |
| 412 | NULL == fFunctions.fDeleteVertexArrays || |
| 413 | NULL == fFunctions.fGenVertexArrays) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 414 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 415 | } |
| 416 | } |
| 417 | } else { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 418 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) { |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 419 | if (NULL == fFunctions.fBindVertexArray || |
| 420 | NULL == fFunctions.fDeleteVertexArrays || |
| 421 | NULL == fFunctions.fGenVertexArrays) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 422 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 423 | } |
| 424 | } |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 425 | } |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 426 | |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 427 | if (fExtensions.has("GL_EXT_debug_marker")) { |
| 428 | if (NULL == fFunctions.fInsertEventMarker || |
| 429 | NULL == fFunctions.fPushGroupMarker || |
| 430 | NULL == fFunctions.fPopGroupMarker) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 431 | RETURN_FALSE_INTERFACE |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 432 | } |
| 433 | } |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 434 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 435 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || |
| 436 | fExtensions.has("GL_ARB_invalidate_subdata")) { |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 437 | if (NULL == fFunctions.fInvalidateBufferData || |
| 438 | NULL == fFunctions.fInvalidateBufferSubData || |
| 439 | NULL == fFunctions.fInvalidateFramebuffer || |
| 440 | NULL == fFunctions.fInvalidateSubFramebuffer || |
| 441 | NULL == fFunctions.fInvalidateTexImage || |
| 442 | NULL == fFunctions.fInvalidateTexSubImage) { |
| 443 | RETURN_FALSE_INTERFACE; |
| 444 | } |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 445 | } else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) { |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 446 | // ES 3.0 adds the framebuffer functions but not the others. |
| 447 | if (NULL == fFunctions.fInvalidateFramebuffer || |
| 448 | NULL == fFunctions.fInvalidateSubFramebuffer) { |
| 449 | RETURN_FALSE_INTERFACE; |
| 450 | } |
| 451 | } |
commit-bot@chromium.org | beb8b3a | 2014-04-15 15:37:51 +0000 | [diff] [blame] | 452 | |
| 453 | if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_CHROMIUM_map_sub")) { |
| 454 | if (NULL == fFunctions.fMapBufferSubData || |
| 455 | NULL == fFunctions.fMapTexSubImage2D || |
| 456 | NULL == fFunctions.fUnmapBufferSubData || |
| 457 | NULL == fFunctions.fUnmapTexSubImage2D) { |
| 458 | RETURN_FALSE_INTERFACE; |
| 459 | } |
| 460 | } |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 461 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 462 | // These functions are added to the 3.0 version of both GLES and GL. |
| 463 | if (glVer >= GR_GL_VER(3,0) || |
| 464 | (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_range")) || |
| 465 | (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_range"))) { |
| 466 | if (NULL == fFunctions.fMapBufferRange || |
| 467 | NULL == fFunctions.fFlushMappedBufferRange) { |
| 468 | RETURN_FALSE_INTERFACE; |
| 469 | } |
| 470 | } |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 471 | |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 472 | if ((kGL_GrGLStandard == fStandard && |
| 473 | (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) || |
| 474 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
| 475 | if (NULL == fFunctions.fGetProgramResourceLocation) { |
| 476 | RETURN_FALSE_INTERFACE |
| 477 | } |
| 478 | } |
| 479 | |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 480 | if (kGLES_GrGLStandard == fStandard || glVer >= GR_GL_VER(4,1) || |
| 481 | fExtensions.has("GL_ARB_ES2_compatibility")) { |
bsalomon | c9aec1e | 2015-04-24 11:08:25 -0700 | [diff] [blame] | 482 | #if 0 // Enable this once Chrome gives us the function ptr |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 483 | if (NULL == fFunctions.fGetShaderPrecisionFormat) { |
| 484 | RETURN_FALSE_INTERFACE |
| 485 | } |
bsalomon | c9aec1e | 2015-04-24 11:08:25 -0700 | [diff] [blame] | 486 | #endif |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 487 | } |
| 488 | |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 489 | if (fExtensions.has("GL_NV_path_rendering")) { |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 490 | if (NULL == fFunctions.fMatrixLoadf || |
| 491 | NULL == fFunctions.fMatrixLoadIdentity || |
| 492 | NULL == fFunctions.fPathCommands || |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 493 | NULL == fFunctions.fPathCoords || |
| 494 | NULL == fFunctions.fPathParameteri || |
| 495 | NULL == fFunctions.fPathParameterf || |
| 496 | NULL == fFunctions.fGenPaths || |
| 497 | NULL == fFunctions.fDeletePaths || |
cdalton | 8dd90cb | 2014-07-17 09:28:36 -0700 | [diff] [blame] | 498 | NULL == fFunctions.fIsPath || |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 499 | NULL == fFunctions.fPathStencilFunc || |
| 500 | NULL == fFunctions.fStencilFillPath || |
| 501 | NULL == fFunctions.fStencilStrokePath || |
| 502 | NULL == fFunctions.fStencilFillPathInstanced || |
| 503 | NULL == fFunctions.fStencilStrokePathInstanced || |
| 504 | NULL == fFunctions.fCoverFillPath || |
| 505 | NULL == fFunctions.fCoverStrokePath || |
| 506 | NULL == fFunctions.fCoverFillPathInstanced || |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 507 | NULL == fFunctions.fCoverStrokePathInstanced) { |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 508 | RETURN_FALSE_INTERFACE |
| 509 | } |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 510 | if (kGL_GrGLStandard == fStandard) { |
| 511 | // Some methods only exist on desktop |
| 512 | if (NULL == fFunctions.fPathTexGen) { |
| 513 | RETURN_FALSE_INTERFACE |
| 514 | } |
| 515 | } else { |
| 516 | // All additions through v1.3 exist on GLES |
| 517 | if (NULL == fFunctions.fStencilThenCoverFillPath || |
| 518 | NULL == fFunctions.fStencilThenCoverStrokePath || |
| 519 | NULL == fFunctions.fStencilThenCoverFillPathInstanced || |
| 520 | NULL == fFunctions.fStencilThenCoverStrokePathInstanced || |
cdalton | 149b3ec | 2014-09-17 09:19:18 -0700 | [diff] [blame] | 521 | NULL == fFunctions.fProgramPathFragmentInputGen || |
| 522 | NULL == fFunctions.fPathMemoryGlyphIndexArray) { |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 523 | RETURN_FALSE_INTERFACE |
| 524 | } |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 525 | } |
| 526 | } |
| 527 | |
cdalton | 0edea2c | 2015-05-21 08:27:44 -0700 | [diff] [blame] | 528 | if (fExtensions.has("GL_EXT_raster_multisample")) { |
| 529 | if (NULL == fFunctions.fRasterSamples) { |
| 530 | RETURN_FALSE_INTERFACE |
| 531 | } |
| 532 | } |
| 533 | |
vbuzinov | 08b4d29 | 2015-04-01 06:29:49 -0700 | [diff] [blame] | 534 | if (fExtensions.has("GL_NV_framebuffer_mixed_samples")) { |
| 535 | if (NULL == fFunctions.fCoverageModulation) { |
| 536 | RETURN_FALSE_INTERFACE |
| 537 | } |
| 538 | } |
| 539 | |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 540 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1)) || |
| 541 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) || |
| 542 | fExtensions.has("GL_ARB_draw_instanced") || |
| 543 | fExtensions.has("GL_EXT_draw_instanced")) { |
| 544 | if (NULL == fFunctions.fDrawArraysInstanced || |
| 545 | NULL == fFunctions.fDrawElementsInstanced) { |
| 546 | RETURN_FALSE_INTERFACE |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,2)) || |
| 551 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) || |
| 552 | fExtensions.has("GL_ARB_instanced_arrays") || |
| 553 | fExtensions.has("GL_EXT_instanced_arrays")) { |
| 554 | if (NULL == fFunctions.fVertexAttribDivisor) { |
| 555 | RETURN_FALSE_INTERFACE |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | if (fExtensions.has("GL_NV_bindless_texture")) { |
| 560 | if (NULL == fFunctions.fGetTextureHandle || |
| 561 | NULL == fFunctions.fGetTextureSamplerHandle || |
| 562 | NULL == fFunctions.fMakeTextureHandleResident || |
| 563 | NULL == fFunctions.fMakeTextureHandleNonResident || |
| 564 | NULL == fFunctions.fGetImageHandle || |
| 565 | NULL == fFunctions.fMakeImageHandleResident || |
| 566 | NULL == fFunctions.fMakeImageHandleNonResident || |
| 567 | NULL == fFunctions.fIsTextureHandleResident || |
| 568 | NULL == fFunctions.fIsImageHandleResident || |
| 569 | NULL == fFunctions.fUniformHandleui64 || |
| 570 | NULL == fFunctions.fUniformHandleui64v || |
| 571 | NULL == fFunctions.fProgramUniformHandleui64 || |
| 572 | NULL == fFunctions.fProgramUniformHandleui64v) { |
| 573 | RETURN_FALSE_INTERFACE |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | if (kGL_GrGLStandard == fStandard && fExtensions.has("GL_EXT_direct_state_access")) { |
| 578 | if (NULL == fFunctions.fTextureParameteri || |
| 579 | NULL == fFunctions.fTextureParameteriv || |
| 580 | NULL == fFunctions.fTextureParameterf || |
| 581 | NULL == fFunctions.fTextureParameterfv || |
| 582 | NULL == fFunctions.fTextureImage1D || |
| 583 | NULL == fFunctions.fTextureImage2D || |
| 584 | NULL == fFunctions.fTextureSubImage1D || |
| 585 | NULL == fFunctions.fTextureSubImage2D || |
| 586 | NULL == fFunctions.fCopyTextureImage1D || |
| 587 | NULL == fFunctions.fCopyTextureImage2D || |
| 588 | NULL == fFunctions.fCopyTextureSubImage1D || |
| 589 | NULL == fFunctions.fCopyTextureSubImage2D || |
| 590 | NULL == fFunctions.fGetTextureImage || |
| 591 | NULL == fFunctions.fGetTextureParameterfv || |
| 592 | NULL == fFunctions.fGetTextureParameteriv || |
| 593 | NULL == fFunctions.fGetTextureLevelParameterfv || |
| 594 | NULL == fFunctions.fGetTextureLevelParameteriv) { |
| 595 | RETURN_FALSE_INTERFACE |
| 596 | } |
| 597 | if (glVer >= GR_GL_VER(1,2)) { |
| 598 | if (NULL == fFunctions.fTextureImage3D || |
| 599 | NULL == fFunctions.fTextureSubImage3D || |
| 600 | NULL == fFunctions.fCopyTextureSubImage3D || |
| 601 | NULL == fFunctions.fCompressedTextureImage3D || |
| 602 | NULL == fFunctions.fCompressedTextureImage2D || |
| 603 | NULL == fFunctions.fCompressedTextureImage1D || |
| 604 | NULL == fFunctions.fCompressedTextureSubImage3D || |
| 605 | NULL == fFunctions.fCompressedTextureSubImage2D || |
| 606 | NULL == fFunctions.fCompressedTextureSubImage1D || |
| 607 | NULL == fFunctions.fGetCompressedTextureImage) { |
| 608 | RETURN_FALSE_INTERFACE |
| 609 | } |
| 610 | } |
| 611 | if (glVer >= GR_GL_VER(1,5)) { |
| 612 | if (NULL == fFunctions.fNamedBufferData || |
| 613 | NULL == fFunctions.fNamedBufferSubData || |
| 614 | NULL == fFunctions.fMapNamedBuffer || |
| 615 | NULL == fFunctions.fUnmapNamedBuffer || |
| 616 | NULL == fFunctions.fGetNamedBufferParameteriv || |
| 617 | NULL == fFunctions.fGetNamedBufferPointerv || |
| 618 | NULL == fFunctions.fGetNamedBufferSubData) { |
| 619 | RETURN_FALSE_INTERFACE |
| 620 | } |
| 621 | } |
| 622 | if (glVer >= GR_GL_VER(2,0)) { |
| 623 | if (NULL == fFunctions.fProgramUniform1f || |
| 624 | NULL == fFunctions.fProgramUniform2f || |
| 625 | NULL == fFunctions.fProgramUniform3f || |
| 626 | NULL == fFunctions.fProgramUniform4f || |
| 627 | NULL == fFunctions.fProgramUniform1i || |
| 628 | NULL == fFunctions.fProgramUniform2i || |
| 629 | NULL == fFunctions.fProgramUniform3i || |
| 630 | NULL == fFunctions.fProgramUniform4i || |
| 631 | NULL == fFunctions.fProgramUniform1fv || |
| 632 | NULL == fFunctions.fProgramUniform2fv || |
| 633 | NULL == fFunctions.fProgramUniform3fv || |
| 634 | NULL == fFunctions.fProgramUniform4fv || |
| 635 | NULL == fFunctions.fProgramUniform1iv || |
| 636 | NULL == fFunctions.fProgramUniform2iv || |
| 637 | NULL == fFunctions.fProgramUniform3iv || |
| 638 | NULL == fFunctions.fProgramUniform4iv || |
| 639 | NULL == fFunctions.fProgramUniformMatrix2fv || |
| 640 | NULL == fFunctions.fProgramUniformMatrix3fv || |
| 641 | NULL == fFunctions.fProgramUniformMatrix4fv) { |
| 642 | RETURN_FALSE_INTERFACE |
| 643 | } |
| 644 | } |
| 645 | if (glVer >= GR_GL_VER(2,1)) { |
| 646 | if (NULL == fFunctions.fProgramUniformMatrix2x3fv || |
| 647 | NULL == fFunctions.fProgramUniformMatrix3x2fv || |
| 648 | NULL == fFunctions.fProgramUniformMatrix2x4fv || |
| 649 | NULL == fFunctions.fProgramUniformMatrix4x2fv || |
| 650 | NULL == fFunctions.fProgramUniformMatrix3x4fv || |
| 651 | NULL == fFunctions.fProgramUniformMatrix4x3fv) { |
| 652 | RETURN_FALSE_INTERFACE |
| 653 | } |
| 654 | } |
| 655 | if (glVer >= GR_GL_VER(3,0)) { |
| 656 | if (NULL == fFunctions.fNamedRenderbufferStorage || |
| 657 | NULL == fFunctions.fGetNamedRenderbufferParameteriv || |
| 658 | NULL == fFunctions.fNamedRenderbufferStorageMultisample || |
| 659 | NULL == fFunctions.fCheckNamedFramebufferStatus || |
| 660 | NULL == fFunctions.fNamedFramebufferTexture1D || |
| 661 | NULL == fFunctions.fNamedFramebufferTexture2D || |
| 662 | NULL == fFunctions.fNamedFramebufferTexture3D || |
| 663 | NULL == fFunctions.fNamedFramebufferRenderbuffer || |
| 664 | NULL == fFunctions.fGetNamedFramebufferAttachmentParameteriv || |
| 665 | NULL == fFunctions.fGenerateTextureMipmap || |
| 666 | NULL == fFunctions.fFramebufferDrawBuffer || |
| 667 | NULL == fFunctions.fFramebufferDrawBuffers || |
| 668 | NULL == fFunctions.fFramebufferReadBuffer || |
| 669 | NULL == fFunctions.fGetFramebufferParameteriv || |
| 670 | NULL == fFunctions.fNamedCopyBufferSubData || |
| 671 | NULL == fFunctions.fVertexArrayVertexOffset || |
| 672 | NULL == fFunctions.fVertexArrayColorOffset || |
| 673 | NULL == fFunctions.fVertexArrayEdgeFlagOffset || |
| 674 | NULL == fFunctions.fVertexArrayIndexOffset || |
| 675 | NULL == fFunctions.fVertexArrayNormalOffset || |
| 676 | NULL == fFunctions.fVertexArrayTexCoordOffset || |
| 677 | NULL == fFunctions.fVertexArrayMultiTexCoordOffset || |
| 678 | NULL == fFunctions.fVertexArrayFogCoordOffset || |
| 679 | NULL == fFunctions.fVertexArraySecondaryColorOffset || |
| 680 | NULL == fFunctions.fVertexArrayVertexAttribOffset || |
| 681 | NULL == fFunctions.fVertexArrayVertexAttribIOffset || |
| 682 | NULL == fFunctions.fEnableVertexArray || |
| 683 | NULL == fFunctions.fDisableVertexArray || |
| 684 | NULL == fFunctions.fEnableVertexArrayAttrib || |
| 685 | NULL == fFunctions.fDisableVertexArrayAttrib || |
| 686 | NULL == fFunctions.fGetVertexArrayIntegerv || |
| 687 | NULL == fFunctions.fGetVertexArrayPointerv || |
| 688 | NULL == fFunctions.fGetVertexArrayIntegeri_v || |
| 689 | NULL == fFunctions.fGetVertexArrayPointeri_v || |
| 690 | NULL == fFunctions.fMapNamedBufferRange || |
| 691 | NULL == fFunctions.fFlushMappedNamedBufferRange) { |
| 692 | RETURN_FALSE_INTERFACE |
| 693 | } |
| 694 | } |
| 695 | } |
| 696 | |
| 697 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || |
| 698 | fExtensions.has("GL_KHR_debug")) { |
| 699 | if (NULL == fFunctions.fDebugMessageControl || |
| 700 | NULL == fFunctions.fDebugMessageInsert || |
| 701 | NULL == fFunctions.fDebugMessageCallback || |
| 702 | NULL == fFunctions.fGetDebugMessageLog || |
| 703 | NULL == fFunctions.fPushDebugGroup || |
| 704 | NULL == fFunctions.fPopDebugGroup || |
| 705 | NULL == fFunctions.fObjectLabel) { |
| 706 | RETURN_FALSE_INTERFACE |
| 707 | } |
| 708 | } |
| 709 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 710 | return true; |
| 711 | } |