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