blob: da3c656c18c36f16c51c96a7d72f962baafb20a2 [file] [log] [blame]
twiz@google.com59a190b2011-03-14 21:23:01 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * 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.com59a190b2011-03-14 21:23:01 +00006 */
7
8
tomhudson@google.com6bf38b52012-02-14 15:11:59 +00009#include "gl/GrGLInterface.h"
bsalomon@google.com1744f972013-02-26 21:46:32 +000010#include "gl/GrGLExtensions.h"
11#include "gl/GrGLUtil.h"
twiz@google.com59a190b2011-03-14 21:23:01 +000012
13#include <stdio.h>
14
bsalomon@google.com56bfc5a2011-09-01 13:28:16 +000015#if GR_GL_PER_GL_FUNC_CALLBACK
16namespace {
17void GrGLDefaultInterfaceCallback(const GrGLInterface*) {}
18}
19#endif
20
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +000021const 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.orgf5355612014-02-28 20:28:50 +000031 newInterface->fFunctions.fInsertEventMarker = insertEventMarkerFn;
32 newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn;
33 newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn;
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +000034
35 return newInterface;
36}
37
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000038const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) {
39 GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
40
41 newInterface->fExtensions.remove("GL_NV_path_rendering");
halcanary96fcdcc2015-08-27 07:41:13 -070042 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.orgd8ed8512014-01-24 20:49:44 +000063 return newInterface;
64}
65
commit-bot@chromium.orgf5355612014-02-28 20:28:50 +000066GrGLInterface::GrGLInterface() {
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +000067 fStandard = kNone_GrGLStandard;
bsalomon@google.com0b77d682011-08-19 13:28:54 +000068
bsalomon@google.com56bfc5a2011-09-01 13:28:16 +000069#if GR_GL_PER_GL_FUNC_CALLBACK
70 fCallback = GrGLDefaultInterfaceCallback;
71 fCallbackData = 0;
72#endif
bsalomon@google.com0b77d682011-08-19 13:28:54 +000073}
74
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000075GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
bsalomon49f085d2014-09-05 13:34:00 -070076 SkASSERT(interface);
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000077
halcanary385fe4d2015-08-26 13:07:48 -070078 GrGLInterface* clone = new GrGLInterface;
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000079 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.orge83b9b72014-05-01 19:21:41 +000089#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.orgadadf7c2014-03-24 19:43:02 +000098
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +000099bool GrGLInterface::validate() const {
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000100
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000101 if (kNone_GrGLStandard == fStandard) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000102 RETURN_FALSE_INTERFACE
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000103 }
skia.committer@gmail.com12eea2b2013-02-27 07:10:10 +0000104
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000105 if (!fExtensions.isInitialized()) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000106 RETURN_FALSE_INTERFACE
bsalomon@google.com1744f972013-02-26 21:46:32 +0000107 }
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000108
109 // functions that are always required
halcanary96fcdcc2015-08-27 07:41:13 -0700110 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 ||
bsalomon6dc6f5f2015-06-18 09:12:16 -0700153#if 0 // Not included in Chrome yet
halcanary96fcdcc2015-08-27 07:41:13 -0700154 nullptr == fFunctions.fIsTexture ||
bsalomon6dc6f5f2015-06-18 09:12:16 -0700155#endif
halcanary96fcdcc2015-08-27 07:41:13 -0700156 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.orgadadf7c2014-03-24 19:43:02 +0000209 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000210 }
211
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000212 GrGLVersion glVer = GrGLGetVersion(this);
commit-bot@chromium.orgf4e67e32014-04-30 01:26:04 +0000213 if (GR_GL_INVALID_VER == glVer) {
214 RETURN_FALSE_INTERFACE
215 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000216
217 // Now check that baseline ES/Desktop fns not covered above are present
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000218 // and that we have fn pointers for any advertised fExtensions that we will
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000219 // 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.org9e90aed2014-01-16 16:35:09 +0000224 if (kGLES_GrGLStandard == fStandard) {
halcanary96fcdcc2015-08-27 07:41:13 -0700225 if (nullptr == fFunctions.fStencilFuncSeparate ||
226 nullptr == fFunctions.fStencilMaskSeparate ||
227 nullptr == fFunctions.fStencilOpSeparate) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000228 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000229 }
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000230 } else if (kGL_GrGLStandard == fStandard) {
robertphillips@google.come7884302012-04-18 14:39:58 +0000231
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000232 if (glVer >= GR_GL_VER(2,0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700233 if (nullptr == fFunctions.fStencilFuncSeparate ||
234 nullptr == fFunctions.fStencilMaskSeparate ||
235 nullptr == fFunctions.fStencilOpSeparate) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000236 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000237 }
238 }
halcanary96fcdcc2015-08-27 07:41:13 -0700239 if (glVer >= GR_GL_VER(3,0) && nullptr == fFunctions.fBindFragDataLocation) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000240 RETURN_FALSE_INTERFACE
bsalomon@google.combc5cf512011-09-21 16:21:07 +0000241 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000242 if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700243 if (nullptr == fFunctions.fDrawBuffers) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000244 RETURN_FALSE_INTERFACE
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000245 }
246 }
robertphillips@google.come7884302012-04-18 14:39:58 +0000247
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000248 if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700249 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.orgadadf7c2014-03-24 19:43:02 +0000256 RETURN_FALSE_INTERFACE
bsalomon@google.com373a6632011-10-19 20:43:20 +0000257 }
258 }
259 if (glVer >= GR_GL_VER(3,3) ||
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000260 fExtensions.has("GL_ARB_timer_query") ||
261 fExtensions.has("GL_EXT_timer_query")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700262 if (nullptr == fFunctions.fGetQueryObjecti64v ||
263 nullptr == fFunctions.fGetQueryObjectui64v) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000264 RETURN_FALSE_INTERFACE
bsalomon@google.com373a6632011-10-19 20:43:20 +0000265 }
266 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000267 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700268 if (nullptr == fFunctions.fQueryCounter) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000269 RETURN_FALSE_INTERFACE
bsalomon@google.com373a6632011-10-19 20:43:20 +0000270 }
271 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000272 }
273
274 // optional function on desktop before 1.3
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000275 if (kGL_GrGLStandard != fStandard ||
bsalomon@google.com1744f972013-02-26 21:46:32 +0000276 (glVer >= GR_GL_VER(1,3)) ||
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000277 fExtensions.has("GL_ARB_texture_compression")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700278 if (nullptr == fFunctions.fCompressedTexImage2D
bsalomonc9aec1e2015-04-24 11:08:25 -0700279#if 0
halcanary96fcdcc2015-08-27 07:41:13 -0700280 || nullptr == fFunctions.fCompressedTexSubImage2D
bsalomonc9aec1e2015-04-24 11:08:25 -0700281#endif
krajcevskie1f5a232014-06-11 16:08:50 -0700282 ) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000283 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000284 }
285 }
286
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000287 // part of desktop GL, but not ES
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000288 if (kGL_GrGLStandard == fStandard &&
halcanary96fcdcc2015-08-27 07:41:13 -0700289 (nullptr == fFunctions.fGetTexLevelParameteriv ||
290 nullptr == fFunctions.fDrawBuffer ||
291 nullptr == fFunctions.fReadBuffer)) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000292 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000293 }
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000294
bsalomon@google.com280e99f2012-01-05 16:17:38 +0000295 // 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.org9e90aed2014-01-16 16:35:09 +0000297 if (kGL_GrGLStandard == fStandard) {
bsalomon@google.combaa9ea12012-01-06 19:05:43 +0000298 if (glVer >= GR_GL_VER(4,2) ||
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000299 fExtensions.has("GL_ARB_texture_storage") ||
300 fExtensions.has("GL_EXT_texture_storage")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700301 if (nullptr == fFunctions.fTexStorage2D) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000302 RETURN_FALSE_INTERFACE
bsalomon@google.combaa9ea12012-01-06 19:05:43 +0000303 }
304 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000305 } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700306 if (nullptr == fFunctions.fTexStorage2D) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000307 RETURN_FALSE_INTERFACE
bsalomon@google.combaa9ea12012-01-06 19:05:43 +0000308 }
bsalomon@google.com280e99f2012-01-05 16:17:38 +0000309 }
310
cdaltonfd4167d2015-04-21 11:45:56 -0700311 // 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")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700316 if (nullptr == fFunctions.fTextureBarrier) {
cdaltonfd4167d2015-04-21 11:45:56 -0700317 RETURN_FALSE_INTERFACE
318 }
319 }
320 } else if (fExtensions.has("GL_NV_texture_barrier")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700321 if (nullptr == fFunctions.fTextureBarrier) {
cdaltonfd4167d2015-04-21 11:45:56 -0700322 RETURN_FALSE_INTERFACE
323 }
324 }
325
cdaltonbae6f6c2015-04-22 10:39:03 -0700326 if (fExtensions.has("GL_KHR_blend_equation_advanced") ||
327 fExtensions.has("GL_NV_blend_equation_advanced")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700328 if (nullptr == fFunctions.fBlendBarrier) {
cdaltonbae6f6c2015-04-22 10:39:03 -0700329 RETURN_FALSE_INTERFACE
330 }
331 }
332
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000333 if (fExtensions.has("GL_EXT_discard_framebuffer")) {
bsalomonc9aec1e2015-04-24 11:08:25 -0700334// FIXME: Remove this once Chromium is updated to provide this function
335#if 0
halcanary96fcdcc2015-08-27 07:41:13 -0700336 if (nullptr == fFunctions.fDiscardFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000337 RETURN_FALSE_INTERFACE
robertphillips@google.coma6ffb582013-04-29 16:50:17 +0000338 }
bsalomonc9aec1e2015-04-24 11:08:25 -0700339#endif
robertphillips@google.coma6ffb582013-04-29 16:50:17 +0000340 }
341
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000342 // FBO MSAA
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000343 if (kGL_GrGLStandard == fStandard) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000344 // GL 3.0 and the ARB extension have multisample + blit
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000345 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700346 if (nullptr == fFunctions.fRenderbufferStorageMultisample ||
347 nullptr == fFunctions.fBlitFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000348 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000349 }
350 } else {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000351 if (fExtensions.has("GL_EXT_framebuffer_blit") &&
halcanary96fcdcc2015-08-27 07:41:13 -0700352 nullptr == fFunctions.fBlitFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000353 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000354 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000355 if (fExtensions.has("GL_EXT_framebuffer_multisample") &&
halcanary96fcdcc2015-08-27 07:41:13 -0700356 nullptr == fFunctions.fRenderbufferStorageMultisample) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000357 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000358 }
359 }
360 } else {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000361 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700362 if (nullptr == fFunctions.fRenderbufferStorageMultisample ||
363 nullptr == fFunctions.fBlitFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000364 RETURN_FALSE_INTERFACE
commit-bot@chromium.orga8e5a062013-09-05 23:44:09 +0000365 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000366 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000367 if (fExtensions.has("GL_APPLE_framebuffer_multisample")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700368 if (nullptr == fFunctions.fRenderbufferStorageMultisampleES2APPLE ||
369 nullptr == fFunctions.fResolveMultisampleFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000370 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000371 }
372 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000373 if (fExtensions.has("GL_IMG_multisampled_render_to_texture") ||
374 fExtensions.has("GL_EXT_multisampled_render_to_texture")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700375 if (nullptr == fFunctions.fRenderbufferStorageMultisampleES2EXT ||
376 nullptr == fFunctions.fFramebufferTexture2DMultisample) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000377 RETURN_FALSE_INTERFACE
bsalomon@google.comf3a60c02013-03-19 19:06:09 +0000378 }
379 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000380 }
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.org90313cc2014-01-17 15:05:38 +0000385 if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700386 if (nullptr == fFunctions.fMapBuffer ||
387 nullptr == fFunctions.fUnmapBuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000388 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000389 }
390 }
391
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000392 // Dual source blending
kkinnunend94708e2015-07-30 22:47:04 -0700393 if (kGL_GrGLStandard == fStandard) {
394 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700395 if (nullptr == fFunctions.fBindFragDataLocationIndexed) {
kkinnunend94708e2015-07-30 22:47:04 -0700396 RETURN_FALSE_INTERFACE
397 }
398 }
399 } else {
400 if (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700401 if (nullptr == fFunctions.fBindFragDataLocation ||
402 nullptr == fFunctions.fBindFragDataLocationIndexed) {
kkinnunend94708e2015-07-30 22:47:04 -0700403 RETURN_FALSE_INTERFACE
404 }
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000405 }
406 }
skia.committer@gmail.com12eea2b2013-02-27 07:10:10 +0000407
kkinnunend94708e2015-07-30 22:47:04 -0700408
commit-bot@chromium.org726e6212013-08-23 20:55:46 +0000409 // glGetStringi was added in version 3.0 of both desktop and ES.
410 if (glVer >= GR_GL_VER(3, 0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700411 if (nullptr == fFunctions.fGetStringi) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000412 RETURN_FALSE_INTERFACE
bsalomon@google.com1744f972013-02-26 21:46:32 +0000413 }
414 }
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000415
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000416 if (kGL_GrGLStandard == fStandard) {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000417 if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700418 if (nullptr == fFunctions.fBindVertexArray ||
419 nullptr == fFunctions.fDeleteVertexArrays ||
420 nullptr == fFunctions.fGenVertexArrays) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000421 RETURN_FALSE_INTERFACE
bsalomon@google.comecd84842013-03-01 15:36:02 +0000422 }
423 }
424 } else {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000425 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700426 if (nullptr == fFunctions.fBindVertexArray ||
427 nullptr == fFunctions.fDeleteVertexArrays ||
428 nullptr == fFunctions.fGenVertexArrays) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000429 RETURN_FALSE_INTERFACE
bsalomon@google.comecd84842013-03-01 15:36:02 +0000430 }
431 }
bsalomon@google.comecd84842013-03-01 15:36:02 +0000432 }
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000433
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000434 if (fExtensions.has("GL_EXT_debug_marker")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700435 if (nullptr == fFunctions.fInsertEventMarker ||
436 nullptr == fFunctions.fPushGroupMarker ||
437 nullptr == fFunctions.fPopGroupMarker) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000438 RETURN_FALSE_INTERFACE
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000439 }
440 }
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000441
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000442 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
443 fExtensions.has("GL_ARB_invalidate_subdata")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700444 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.coma34bb602014-04-01 13:07:29 +0000450 RETURN_FALSE_INTERFACE;
451 }
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000452 } else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) {
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000453 // ES 3.0 adds the framebuffer functions but not the others.
halcanary96fcdcc2015-08-27 07:41:13 -0700454 if (nullptr == fFunctions.fInvalidateFramebuffer ||
455 nullptr == fFunctions.fInvalidateSubFramebuffer) {
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000456 RETURN_FALSE_INTERFACE;
457 }
458 }
commit-bot@chromium.orgbeb8b3a2014-04-15 15:37:51 +0000459
460 if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_CHROMIUM_map_sub")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700461 if (nullptr == fFunctions.fMapBufferSubData ||
462 nullptr == fFunctions.fMapTexSubImage2D ||
463 nullptr == fFunctions.fUnmapBufferSubData ||
464 nullptr == fFunctions.fUnmapTexSubImage2D) {
commit-bot@chromium.orgbeb8b3a2014-04-15 15:37:51 +0000465 RETURN_FALSE_INTERFACE;
466 }
467 }
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000468
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000469 // 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"))) {
halcanary96fcdcc2015-08-27 07:41:13 -0700473 if (nullptr == fFunctions.fMapBufferRange ||
474 nullptr == fFunctions.fFlushMappedBufferRange) {
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000475 RETURN_FALSE_INTERFACE;
476 }
477 }
kkinnunen32b9a3b2014-07-02 22:56:35 -0700478
kkinnunen32b9a3b2014-07-02 22:56:35 -0700479 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))) {
halcanary96fcdcc2015-08-27 07:41:13 -0700482 if (nullptr == fFunctions.fGetProgramResourceLocation) {
kkinnunen32b9a3b2014-07-02 22:56:35 -0700483 RETURN_FALSE_INTERFACE
484 }
485 }
486
bsalomonee64d6e2014-12-03 10:46:08 -0800487 if (kGLES_GrGLStandard == fStandard || glVer >= GR_GL_VER(4,1) ||
488 fExtensions.has("GL_ARB_ES2_compatibility")) {
bsalomonc9aec1e2015-04-24 11:08:25 -0700489#if 0 // Enable this once Chrome gives us the function ptr
halcanary96fcdcc2015-08-27 07:41:13 -0700490 if (nullptr == fFunctions.fGetShaderPrecisionFormat) {
bsalomonee64d6e2014-12-03 10:46:08 -0800491 RETURN_FALSE_INTERFACE
492 }
bsalomonc9aec1e2015-04-24 11:08:25 -0700493#endif
bsalomonee64d6e2014-12-03 10:46:08 -0800494 }
495
kkinnunen6bb6d402015-07-14 10:59:23 -0700496 if (fExtensions.has("GL_NV_path_rendering") || fExtensions.has("GL_CHROMIUM_path_rendering")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700497 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
kkinnunencfe62e32015-07-01 02:58:50 -0700514#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.
halcanary96fcdcc2015-08-27 07:41:13 -0700519 || nullptr == fFunctions.fStencilThenCoverFillPath ||
520 nullptr == fFunctions.fStencilThenCoverStrokePath ||
521 nullptr == fFunctions.fStencilThenCoverFillPathInstanced ||
522 nullptr == fFunctions.fStencilThenCoverStrokePathInstanced ||
523 nullptr == fFunctions.fProgramPathFragmentInputGen
kkinnunencfe62e32015-07-01 02:58:50 -0700524#endif
525 ) {
kkinnunen32b9a3b2014-07-02 22:56:35 -0700526 RETURN_FALSE_INTERFACE
527 }
kkinnunen6bb6d402015-07-14 10:59:23 -0700528 if (fExtensions.has("GL_CHROMIUM_path_rendering")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700529 if (nullptr == fFunctions.fBindFragmentInputLocation) {
kkinnunen6bb6d402015-07-14 10:59:23 -0700530 RETURN_FALSE_INTERFACE
531 }
532 }
kkinnunen32b9a3b2014-07-02 22:56:35 -0700533 }
534
cdalton0edea2c2015-05-21 08:27:44 -0700535 if (fExtensions.has("GL_EXT_raster_multisample")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700536 if (nullptr == fFunctions.fRasterSamples) {
cdalton0edea2c2015-05-21 08:27:44 -0700537 RETURN_FALSE_INTERFACE
538 }
539 }
540
vbuzinov08b4d292015-04-01 06:29:49 -0700541 if (fExtensions.has("GL_NV_framebuffer_mixed_samples")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700542 if (nullptr == fFunctions.fCoverageModulation) {
vbuzinov08b4d292015-04-01 06:29:49 -0700543 RETURN_FALSE_INTERFACE
544 }
545 }
546
hendrikwb3f16362015-10-19 06:13:55 -0700547 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 }
cdalton626e1ff2015-06-12 13:56:46 -0700562 }
563
hendrikwb3f16362015-10-19 06:13:55 -0700564 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 }
cdalton626e1ff2015-06-12 13:56:46 -0700576 }
577
578 if (fExtensions.has("GL_NV_bindless_texture")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700579 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) {
cdalton626e1ff2015-06-12 13:56:46 -0700592 RETURN_FALSE_INTERFACE
593 }
594 }
595
596 if (kGL_GrGLStandard == fStandard && fExtensions.has("GL_EXT_direct_state_access")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700597 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) {
cdalton626e1ff2015-06-12 13:56:46 -0700614 RETURN_FALSE_INTERFACE
615 }
616 if (glVer >= GR_GL_VER(1,2)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700617 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) {
cdalton626e1ff2015-06-12 13:56:46 -0700627 RETURN_FALSE_INTERFACE
628 }
629 }
630 if (glVer >= GR_GL_VER(1,5)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700631 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) {
cdalton626e1ff2015-06-12 13:56:46 -0700638 RETURN_FALSE_INTERFACE
639 }
640 }
641 if (glVer >= GR_GL_VER(2,0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700642 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) {
cdalton626e1ff2015-06-12 13:56:46 -0700661 RETURN_FALSE_INTERFACE
662 }
663 }
664 if (glVer >= GR_GL_VER(2,1)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700665 if (nullptr == fFunctions.fProgramUniformMatrix2x3fv ||
666 nullptr == fFunctions.fProgramUniformMatrix3x2fv ||
667 nullptr == fFunctions.fProgramUniformMatrix2x4fv ||
668 nullptr == fFunctions.fProgramUniformMatrix4x2fv ||
669 nullptr == fFunctions.fProgramUniformMatrix3x4fv ||
670 nullptr == fFunctions.fProgramUniformMatrix4x3fv) {
cdalton626e1ff2015-06-12 13:56:46 -0700671 RETURN_FALSE_INTERFACE
672 }
673 }
674 if (glVer >= GR_GL_VER(3,0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700675 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) {
cdalton626e1ff2015-06-12 13:56:46 -0700711 RETURN_FALSE_INTERFACE
712 }
713 }
714 }
715
716 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
717 fExtensions.has("GL_KHR_debug")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700718 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) {
cdalton626e1ff2015-06-12 13:56:46 -0700725 RETURN_FALSE_INTERFACE
726 }
727 }
728
bsalomonb1a32ad2015-11-16 06:48:44 -0800729 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base")) {
bsalomon7ea33f52015-11-22 14:51:00 -0800730 if (nullptr == fFunctions.fEGLCreateImage ||
731 nullptr == fFunctions.fEGLDestroyImage) {
bsalomonb1a32ad2015-11-16 06:48:44 -0800732 RETURN_FALSE_INTERFACE
733 }
734 }
735
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000736 return true;
737}