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