blob: 9cdc9f438657d3bee1c2c3cea9738805bbdb5723 [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");
kkinnunen2ca29c02015-12-09 22:58:34 -080042 newInterface->fExtensions.remove("GL_CHROMIUM_path_rendering");
43 newInterface->fFunctions.fMatrixLoadf = nullptr;
44 newInterface->fFunctions.fMatrixLoadIdentity = nullptr;
halcanary96fcdcc2015-08-27 07:41:13 -070045 newInterface->fFunctions.fPathCommands = nullptr;
46 newInterface->fFunctions.fPathParameteri = nullptr;
47 newInterface->fFunctions.fPathParameterf = nullptr;
48 newInterface->fFunctions.fGenPaths = nullptr;
49 newInterface->fFunctions.fDeletePaths = nullptr;
50 newInterface->fFunctions.fIsPath = nullptr;
51 newInterface->fFunctions.fPathStencilFunc = nullptr;
52 newInterface->fFunctions.fStencilFillPath = nullptr;
53 newInterface->fFunctions.fStencilStrokePath = nullptr;
54 newInterface->fFunctions.fStencilFillPathInstanced = nullptr;
55 newInterface->fFunctions.fStencilStrokePathInstanced = nullptr;
56 newInterface->fFunctions.fCoverFillPath = nullptr;
57 newInterface->fFunctions.fCoverStrokePath = nullptr;
58 newInterface->fFunctions.fCoverFillPathInstanced = nullptr;
59 newInterface->fFunctions.fCoverStrokePathInstanced = nullptr;
60 newInterface->fFunctions.fStencilThenCoverFillPath = nullptr;
61 newInterface->fFunctions.fStencilThenCoverStrokePath = nullptr;
62 newInterface->fFunctions.fStencilThenCoverFillPathInstanced = nullptr;
63 newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = nullptr;
64 newInterface->fFunctions.fProgramPathFragmentInputGen = nullptr;
65 newInterface->fFunctions.fBindFragmentInputLocation = nullptr;
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000066 return newInterface;
67}
68
commit-bot@chromium.orgf5355612014-02-28 20:28:50 +000069GrGLInterface::GrGLInterface() {
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +000070 fStandard = kNone_GrGLStandard;
bsalomon@google.com0b77d682011-08-19 13:28:54 +000071
bsalomon@google.com56bfc5a2011-09-01 13:28:16 +000072#if GR_GL_PER_GL_FUNC_CALLBACK
73 fCallback = GrGLDefaultInterfaceCallback;
74 fCallbackData = 0;
75#endif
bsalomon@google.com0b77d682011-08-19 13:28:54 +000076}
77
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000078GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
bsalomon49f085d2014-09-05 13:34:00 -070079 SkASSERT(interface);
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000080
halcanary385fe4d2015-08-26 13:07:48 -070081 GrGLInterface* clone = new GrGLInterface;
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000082 clone->fStandard = interface->fStandard;
83 clone->fExtensions = interface->fExtensions;
84 clone->fFunctions = interface->fFunctions;
85#if GR_GL_PER_GL_FUNC_CALLBACK
86 clone->fCallback = interface->fCallback;
87 clone->fCallbackData = interface->fCallbackData;
88#endif
89 return clone;
90}
91
commit-bot@chromium.orge83b9b72014-05-01 19:21:41 +000092#ifdef SK_DEBUG
93 static int kIsDebug = 1;
94#else
95 static int kIsDebug = 0;
96#endif
97
98#define RETURN_FALSE_INTERFACE \
99 if (kIsDebug) { SkDebugf("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); } \
100 return false;
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000101
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000102bool GrGLInterface::validate() const {
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000103
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000104 if (kNone_GrGLStandard == fStandard) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000105 RETURN_FALSE_INTERFACE
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000106 }
skia.committer@gmail.com12eea2b2013-02-27 07:10:10 +0000107
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000108 if (!fExtensions.isInitialized()) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000109 RETURN_FALSE_INTERFACE
bsalomon@google.com1744f972013-02-26 21:46:32 +0000110 }
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000111
112 // functions that are always required
halcanary96fcdcc2015-08-27 07:41:13 -0700113 if (nullptr == fFunctions.fActiveTexture ||
114 nullptr == fFunctions.fAttachShader ||
115 nullptr == fFunctions.fBindAttribLocation ||
116 nullptr == fFunctions.fBindBuffer ||
117 nullptr == fFunctions.fBindTexture ||
118 nullptr == fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0
119 nullptr == fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0
120 nullptr == fFunctions.fBlendFunc ||
121 nullptr == fFunctions.fBufferData ||
122 nullptr == fFunctions.fBufferSubData ||
123 nullptr == fFunctions.fClear ||
124 nullptr == fFunctions.fClearColor ||
125 nullptr == fFunctions.fClearStencil ||
126 nullptr == fFunctions.fColorMask ||
127 nullptr == fFunctions.fCompileShader ||
128 nullptr == fFunctions.fCopyTexSubImage2D ||
129 nullptr == fFunctions.fCreateProgram ||
130 nullptr == fFunctions.fCreateShader ||
131 nullptr == fFunctions.fCullFace ||
132 nullptr == fFunctions.fDeleteBuffers ||
133 nullptr == fFunctions.fDeleteProgram ||
134 nullptr == fFunctions.fDeleteShader ||
135 nullptr == fFunctions.fDeleteTextures ||
136 nullptr == fFunctions.fDepthMask ||
137 nullptr == fFunctions.fDisable ||
138 nullptr == fFunctions.fDisableVertexAttribArray ||
139 nullptr == fFunctions.fDrawArrays ||
140 nullptr == fFunctions.fDrawElements ||
141 nullptr == fFunctions.fEnable ||
142 nullptr == fFunctions.fEnableVertexAttribArray ||
143 nullptr == fFunctions.fFrontFace ||
144 nullptr == fFunctions.fGenBuffers ||
145 nullptr == fFunctions.fGenTextures ||
146 nullptr == fFunctions.fGetBufferParameteriv ||
147 nullptr == fFunctions.fGenerateMipmap ||
148 nullptr == fFunctions.fGetError ||
149 nullptr == fFunctions.fGetIntegerv ||
150 nullptr == fFunctions.fGetProgramInfoLog ||
151 nullptr == fFunctions.fGetProgramiv ||
152 nullptr == fFunctions.fGetShaderInfoLog ||
153 nullptr == fFunctions.fGetShaderiv ||
154 nullptr == fFunctions.fGetString ||
155 nullptr == fFunctions.fGetUniformLocation ||
bsalomon6dc6f5f2015-06-18 09:12:16 -0700156#if 0 // Not included in Chrome yet
halcanary96fcdcc2015-08-27 07:41:13 -0700157 nullptr == fFunctions.fIsTexture ||
bsalomon6dc6f5f2015-06-18 09:12:16 -0700158#endif
halcanary96fcdcc2015-08-27 07:41:13 -0700159 nullptr == fFunctions.fLinkProgram ||
160 nullptr == fFunctions.fLineWidth ||
161 nullptr == fFunctions.fPixelStorei ||
162 nullptr == fFunctions.fReadPixels ||
163 nullptr == fFunctions.fScissor ||
164 nullptr == fFunctions.fShaderSource ||
165 nullptr == fFunctions.fStencilFunc ||
166 nullptr == fFunctions.fStencilMask ||
167 nullptr == fFunctions.fStencilOp ||
168 nullptr == fFunctions.fTexImage2D ||
169 nullptr == fFunctions.fTexParameteri ||
170 nullptr == fFunctions.fTexParameteriv ||
171 nullptr == fFunctions.fTexSubImage2D ||
172 nullptr == fFunctions.fUniform1f ||
173 nullptr == fFunctions.fUniform1i ||
174 nullptr == fFunctions.fUniform1fv ||
175 nullptr == fFunctions.fUniform1iv ||
176 nullptr == fFunctions.fUniform2f ||
177 nullptr == fFunctions.fUniform2i ||
178 nullptr == fFunctions.fUniform2fv ||
179 nullptr == fFunctions.fUniform2iv ||
180 nullptr == fFunctions.fUniform3f ||
181 nullptr == fFunctions.fUniform3i ||
182 nullptr == fFunctions.fUniform3fv ||
183 nullptr == fFunctions.fUniform3iv ||
184 nullptr == fFunctions.fUniform4f ||
185 nullptr == fFunctions.fUniform4i ||
186 nullptr == fFunctions.fUniform4fv ||
187 nullptr == fFunctions.fUniform4iv ||
188 nullptr == fFunctions.fUniformMatrix2fv ||
189 nullptr == fFunctions.fUniformMatrix3fv ||
190 nullptr == fFunctions.fUniformMatrix4fv ||
191 nullptr == fFunctions.fUseProgram ||
192 nullptr == fFunctions.fVertexAttrib1f ||
193 nullptr == fFunctions.fVertexAttrib2fv ||
194 nullptr == fFunctions.fVertexAttrib3fv ||
195 nullptr == fFunctions.fVertexAttrib4fv ||
196 nullptr == fFunctions.fVertexAttribPointer ||
197 nullptr == fFunctions.fViewport ||
198 nullptr == fFunctions.fBindFramebuffer ||
199 nullptr == fFunctions.fBindRenderbuffer ||
200 nullptr == fFunctions.fCheckFramebufferStatus ||
201 nullptr == fFunctions.fDeleteFramebuffers ||
202 nullptr == fFunctions.fDeleteRenderbuffers ||
203 nullptr == fFunctions.fFinish ||
204 nullptr == fFunctions.fFlush ||
205 nullptr == fFunctions.fFramebufferRenderbuffer ||
206 nullptr == fFunctions.fFramebufferTexture2D ||
207 nullptr == fFunctions.fGetFramebufferAttachmentParameteriv ||
208 nullptr == fFunctions.fGetRenderbufferParameteriv ||
209 nullptr == fFunctions.fGenFramebuffers ||
210 nullptr == fFunctions.fGenRenderbuffers ||
211 nullptr == fFunctions.fRenderbufferStorage) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000212 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000213 }
214
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000215 GrGLVersion glVer = GrGLGetVersion(this);
commit-bot@chromium.orgf4e67e32014-04-30 01:26:04 +0000216 if (GR_GL_INVALID_VER == glVer) {
217 RETURN_FALSE_INTERFACE
218 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000219
220 // Now check that baseline ES/Desktop fns not covered above are present
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000221 // and that we have fn pointers for any advertised fExtensions that we will
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000222 // try to use.
223
224 // these functions are part of ES2, we assume they are available
225 // On the desktop we assume they are available if the extension
226 // is present or GL version is high enough.
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000227 if (kGLES_GrGLStandard == fStandard) {
halcanary96fcdcc2015-08-27 07:41:13 -0700228 if (nullptr == fFunctions.fStencilFuncSeparate ||
229 nullptr == fFunctions.fStencilMaskSeparate ||
230 nullptr == fFunctions.fStencilOpSeparate) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000231 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000232 }
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000233 } else if (kGL_GrGLStandard == fStandard) {
robertphillips@google.come7884302012-04-18 14:39:58 +0000234
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000235 if (glVer >= GR_GL_VER(2,0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700236 if (nullptr == fFunctions.fStencilFuncSeparate ||
237 nullptr == fFunctions.fStencilMaskSeparate ||
238 nullptr == fFunctions.fStencilOpSeparate) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000239 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000240 }
241 }
halcanary96fcdcc2015-08-27 07:41:13 -0700242 if (glVer >= GR_GL_VER(3,0) && nullptr == fFunctions.fBindFragDataLocation) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000243 RETURN_FALSE_INTERFACE
bsalomon@google.combc5cf512011-09-21 16:21:07 +0000244 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000245 if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700246 if (nullptr == fFunctions.fDrawBuffers) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000247 RETURN_FALSE_INTERFACE
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000248 }
249 }
robertphillips@google.come7884302012-04-18 14:39:58 +0000250
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000251 if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700252 if (nullptr == fFunctions.fGenQueries ||
253 nullptr == fFunctions.fDeleteQueries ||
254 nullptr == fFunctions.fBeginQuery ||
255 nullptr == fFunctions.fEndQuery ||
256 nullptr == fFunctions.fGetQueryiv ||
257 nullptr == fFunctions.fGetQueryObjectiv ||
258 nullptr == fFunctions.fGetQueryObjectuiv) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000259 RETURN_FALSE_INTERFACE
bsalomon@google.com373a6632011-10-19 20:43:20 +0000260 }
261 }
262 if (glVer >= GR_GL_VER(3,3) ||
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000263 fExtensions.has("GL_ARB_timer_query") ||
264 fExtensions.has("GL_EXT_timer_query")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700265 if (nullptr == fFunctions.fGetQueryObjecti64v ||
266 nullptr == fFunctions.fGetQueryObjectui64v) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000267 RETURN_FALSE_INTERFACE
bsalomon@google.com373a6632011-10-19 20:43:20 +0000268 }
269 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000270 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700271 if (nullptr == fFunctions.fQueryCounter) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000272 RETURN_FALSE_INTERFACE
bsalomon@google.com373a6632011-10-19 20:43:20 +0000273 }
274 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000275 }
276
277 // optional function on desktop before 1.3
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000278 if (kGL_GrGLStandard != fStandard ||
bsalomon@google.com1744f972013-02-26 21:46:32 +0000279 (glVer >= GR_GL_VER(1,3)) ||
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000280 fExtensions.has("GL_ARB_texture_compression")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700281 if (nullptr == fFunctions.fCompressedTexImage2D
bsalomonc9aec1e2015-04-24 11:08:25 -0700282#if 0
halcanary96fcdcc2015-08-27 07:41:13 -0700283 || nullptr == fFunctions.fCompressedTexSubImage2D
bsalomonc9aec1e2015-04-24 11:08:25 -0700284#endif
krajcevskie1f5a232014-06-11 16:08:50 -0700285 ) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000286 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000287 }
288 }
289
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000290 // part of desktop GL, but not ES
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000291 if (kGL_GrGLStandard == fStandard &&
halcanary96fcdcc2015-08-27 07:41:13 -0700292 (nullptr == fFunctions.fGetTexLevelParameteriv ||
293 nullptr == fFunctions.fDrawBuffer ||
294 nullptr == fFunctions.fReadBuffer)) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000295 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000296 }
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000297
bsalomon@google.com280e99f2012-01-05 16:17:38 +0000298 // GL_EXT_texture_storage is part of desktop 4.2
299 // There is a desktop ARB extension and an ES+desktop EXT extension
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000300 if (kGL_GrGLStandard == fStandard) {
bsalomon@google.combaa9ea12012-01-06 19:05:43 +0000301 if (glVer >= GR_GL_VER(4,2) ||
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000302 fExtensions.has("GL_ARB_texture_storage") ||
303 fExtensions.has("GL_EXT_texture_storage")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700304 if (nullptr == fFunctions.fTexStorage2D) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000305 RETURN_FALSE_INTERFACE
bsalomon@google.combaa9ea12012-01-06 19:05:43 +0000306 }
307 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000308 } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700309 if (nullptr == fFunctions.fTexStorage2D) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000310 RETURN_FALSE_INTERFACE
bsalomon@google.combaa9ea12012-01-06 19:05:43 +0000311 }
bsalomon@google.com280e99f2012-01-05 16:17:38 +0000312 }
313
cdaltonfd4167d2015-04-21 11:45:56 -0700314 // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extensions.
315 if (kGL_GrGLStandard == fStandard) {
316 if (glVer >= GR_GL_VER(4,5) ||
317 fExtensions.has("GL_ARB_texture_barrier") ||
318 fExtensions.has("GL_NV_texture_barrier")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700319 if (nullptr == fFunctions.fTextureBarrier) {
cdaltonfd4167d2015-04-21 11:45:56 -0700320 RETURN_FALSE_INTERFACE
321 }
322 }
323 } else if (fExtensions.has("GL_NV_texture_barrier")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700324 if (nullptr == fFunctions.fTextureBarrier) {
cdaltonfd4167d2015-04-21 11:45:56 -0700325 RETURN_FALSE_INTERFACE
326 }
327 }
328
cdaltonbae6f6c2015-04-22 10:39:03 -0700329 if (fExtensions.has("GL_KHR_blend_equation_advanced") ||
330 fExtensions.has("GL_NV_blend_equation_advanced")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700331 if (nullptr == fFunctions.fBlendBarrier) {
cdaltonbae6f6c2015-04-22 10:39:03 -0700332 RETURN_FALSE_INTERFACE
333 }
334 }
335
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000336 if (fExtensions.has("GL_EXT_discard_framebuffer")) {
bsalomonc9aec1e2015-04-24 11:08:25 -0700337// FIXME: Remove this once Chromium is updated to provide this function
338#if 0
halcanary96fcdcc2015-08-27 07:41:13 -0700339 if (nullptr == fFunctions.fDiscardFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000340 RETURN_FALSE_INTERFACE
robertphillips@google.coma6ffb582013-04-29 16:50:17 +0000341 }
bsalomonc9aec1e2015-04-24 11:08:25 -0700342#endif
robertphillips@google.coma6ffb582013-04-29 16:50:17 +0000343 }
344
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000345 // FBO MSAA
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000346 if (kGL_GrGLStandard == fStandard) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000347 // GL 3.0 and the ARB extension have multisample + blit
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000348 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700349 if (nullptr == fFunctions.fRenderbufferStorageMultisample ||
350 nullptr == fFunctions.fBlitFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000351 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000352 }
353 } else {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000354 if (fExtensions.has("GL_EXT_framebuffer_blit") &&
halcanary96fcdcc2015-08-27 07:41:13 -0700355 nullptr == fFunctions.fBlitFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000356 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000357 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000358 if (fExtensions.has("GL_EXT_framebuffer_multisample") &&
halcanary96fcdcc2015-08-27 07:41:13 -0700359 nullptr == fFunctions.fRenderbufferStorageMultisample) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000360 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000361 }
362 }
363 } else {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000364 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700365 if (nullptr == fFunctions.fRenderbufferStorageMultisample ||
366 nullptr == fFunctions.fBlitFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000367 RETURN_FALSE_INTERFACE
commit-bot@chromium.orga8e5a062013-09-05 23:44:09 +0000368 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000369 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000370 if (fExtensions.has("GL_APPLE_framebuffer_multisample")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700371 if (nullptr == fFunctions.fRenderbufferStorageMultisampleES2APPLE ||
372 nullptr == fFunctions.fResolveMultisampleFramebuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000373 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000374 }
375 }
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000376 if (fExtensions.has("GL_IMG_multisampled_render_to_texture") ||
377 fExtensions.has("GL_EXT_multisampled_render_to_texture")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700378 if (nullptr == fFunctions.fRenderbufferStorageMultisampleES2EXT ||
379 nullptr == fFunctions.fFramebufferTexture2DMultisample) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000380 RETURN_FALSE_INTERFACE
bsalomon@google.comf3a60c02013-03-19 19:06:09 +0000381 }
382 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000383 }
384
385 // On ES buffer mapping is an extension. On Desktop
386 // buffer mapping was part of original VBO extension
387 // which we require.
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000388 if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700389 if (nullptr == fFunctions.fMapBuffer ||
390 nullptr == fFunctions.fUnmapBuffer) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000391 RETURN_FALSE_INTERFACE
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000392 }
393 }
394
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000395 // Dual source blending
kkinnunend94708e2015-07-30 22:47:04 -0700396 if (kGL_GrGLStandard == fStandard) {
397 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700398 if (nullptr == fFunctions.fBindFragDataLocationIndexed) {
kkinnunend94708e2015-07-30 22:47:04 -0700399 RETURN_FALSE_INTERFACE
400 }
401 }
402 } else {
403 if (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700404 if (nullptr == fFunctions.fBindFragDataLocation ||
405 nullptr == fFunctions.fBindFragDataLocationIndexed) {
kkinnunend94708e2015-07-30 22:47:04 -0700406 RETURN_FALSE_INTERFACE
407 }
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000408 }
409 }
skia.committer@gmail.com12eea2b2013-02-27 07:10:10 +0000410
kkinnunend94708e2015-07-30 22:47:04 -0700411
commit-bot@chromium.org726e6212013-08-23 20:55:46 +0000412 // glGetStringi was added in version 3.0 of both desktop and ES.
413 if (glVer >= GR_GL_VER(3, 0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700414 if (nullptr == fFunctions.fGetStringi) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000415 RETURN_FALSE_INTERFACE
bsalomon@google.com1744f972013-02-26 21:46:32 +0000416 }
417 }
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000418
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000419 if (kGL_GrGLStandard == fStandard) {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000420 if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700421 if (nullptr == fFunctions.fBindVertexArray ||
422 nullptr == fFunctions.fDeleteVertexArrays ||
423 nullptr == fFunctions.fGenVertexArrays) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000424 RETURN_FALSE_INTERFACE
bsalomon@google.comecd84842013-03-01 15:36:02 +0000425 }
426 }
427 } else {
commit-bot@chromium.org90313cc2014-01-17 15:05:38 +0000428 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700429 if (nullptr == fFunctions.fBindVertexArray ||
430 nullptr == fFunctions.fDeleteVertexArrays ||
431 nullptr == fFunctions.fGenVertexArrays) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000432 RETURN_FALSE_INTERFACE
bsalomon@google.comecd84842013-03-01 15:36:02 +0000433 }
434 }
bsalomon@google.comecd84842013-03-01 15:36:02 +0000435 }
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000436
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000437 if (fExtensions.has("GL_EXT_debug_marker")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700438 if (nullptr == fFunctions.fInsertEventMarker ||
439 nullptr == fFunctions.fPushGroupMarker ||
440 nullptr == fFunctions.fPopGroupMarker) {
commit-bot@chromium.orgadadf7c2014-03-24 19:43:02 +0000441 RETURN_FALSE_INTERFACE
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000442 }
443 }
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000444
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000445 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
446 fExtensions.has("GL_ARB_invalidate_subdata")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700447 if (nullptr == fFunctions.fInvalidateBufferData ||
448 nullptr == fFunctions.fInvalidateBufferSubData ||
449 nullptr == fFunctions.fInvalidateFramebuffer ||
450 nullptr == fFunctions.fInvalidateSubFramebuffer ||
451 nullptr == fFunctions.fInvalidateTexImage ||
452 nullptr == fFunctions.fInvalidateTexSubImage) {
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000453 RETURN_FALSE_INTERFACE;
454 }
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000455 } else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) {
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000456 // ES 3.0 adds the framebuffer functions but not the others.
halcanary96fcdcc2015-08-27 07:41:13 -0700457 if (nullptr == fFunctions.fInvalidateFramebuffer ||
458 nullptr == fFunctions.fInvalidateSubFramebuffer) {
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000459 RETURN_FALSE_INTERFACE;
460 }
461 }
commit-bot@chromium.orgbeb8b3a2014-04-15 15:37:51 +0000462
463 if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_CHROMIUM_map_sub")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700464 if (nullptr == fFunctions.fMapBufferSubData ||
465 nullptr == fFunctions.fMapTexSubImage2D ||
466 nullptr == fFunctions.fUnmapBufferSubData ||
467 nullptr == fFunctions.fUnmapTexSubImage2D) {
commit-bot@chromium.orgbeb8b3a2014-04-15 15:37:51 +0000468 RETURN_FALSE_INTERFACE;
469 }
470 }
bsalomon@google.coma34bb602014-04-01 13:07:29 +0000471
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000472 // These functions are added to the 3.0 version of both GLES and GL.
473 if (glVer >= GR_GL_VER(3,0) ||
474 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_range")) ||
475 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_range"))) {
halcanary96fcdcc2015-08-27 07:41:13 -0700476 if (nullptr == fFunctions.fMapBufferRange ||
477 nullptr == fFunctions.fFlushMappedBufferRange) {
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000478 RETURN_FALSE_INTERFACE;
479 }
480 }
kkinnunen32b9a3b2014-07-02 22:56:35 -0700481
kkinnunen32b9a3b2014-07-02 22:56:35 -0700482 if ((kGL_GrGLStandard == fStandard &&
483 (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) ||
484 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) {
halcanary96fcdcc2015-08-27 07:41:13 -0700485 if (nullptr == fFunctions.fGetProgramResourceLocation) {
kkinnunen32b9a3b2014-07-02 22:56:35 -0700486 RETURN_FALSE_INTERFACE
487 }
488 }
489
bsalomonee64d6e2014-12-03 10:46:08 -0800490 if (kGLES_GrGLStandard == fStandard || glVer >= GR_GL_VER(4,1) ||
491 fExtensions.has("GL_ARB_ES2_compatibility")) {
bsalomonc9aec1e2015-04-24 11:08:25 -0700492#if 0 // Enable this once Chrome gives us the function ptr
halcanary96fcdcc2015-08-27 07:41:13 -0700493 if (nullptr == fFunctions.fGetShaderPrecisionFormat) {
bsalomonee64d6e2014-12-03 10:46:08 -0800494 RETURN_FALSE_INTERFACE
495 }
bsalomonc9aec1e2015-04-24 11:08:25 -0700496#endif
bsalomonee64d6e2014-12-03 10:46:08 -0800497 }
498
kkinnunen6bb6d402015-07-14 10:59:23 -0700499 if (fExtensions.has("GL_NV_path_rendering") || fExtensions.has("GL_CHROMIUM_path_rendering")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700500 if (nullptr == fFunctions.fMatrixLoadf ||
501 nullptr == fFunctions.fMatrixLoadIdentity ||
502 nullptr == fFunctions.fPathCommands ||
503 nullptr == fFunctions.fPathParameteri ||
504 nullptr == fFunctions.fPathParameterf ||
505 nullptr == fFunctions.fGenPaths ||
506 nullptr == fFunctions.fDeletePaths ||
507 nullptr == fFunctions.fIsPath ||
508 nullptr == fFunctions.fPathStencilFunc ||
509 nullptr == fFunctions.fStencilFillPath ||
510 nullptr == fFunctions.fStencilStrokePath ||
511 nullptr == fFunctions.fStencilFillPathInstanced ||
512 nullptr == fFunctions.fStencilStrokePathInstanced ||
513 nullptr == fFunctions.fCoverFillPath ||
514 nullptr == fFunctions.fCoverStrokePath ||
515 nullptr == fFunctions.fCoverFillPathInstanced ||
516 nullptr == fFunctions.fCoverStrokePathInstanced
kkinnunencfe62e32015-07-01 02:58:50 -0700517#if 0
518 // List of functions that Skia uses, but which have been added since the initial release
519 // of NV_path_rendering driver. We do not want to fail interface validation due to
520 // missing features, we will just not use the extension.
521 // Update this list -> update GrGLCaps::hasPathRenderingSupport too.
halcanary96fcdcc2015-08-27 07:41:13 -0700522 || nullptr == fFunctions.fStencilThenCoverFillPath ||
523 nullptr == fFunctions.fStencilThenCoverStrokePath ||
524 nullptr == fFunctions.fStencilThenCoverFillPathInstanced ||
525 nullptr == fFunctions.fStencilThenCoverStrokePathInstanced ||
526 nullptr == fFunctions.fProgramPathFragmentInputGen
kkinnunencfe62e32015-07-01 02:58:50 -0700527#endif
528 ) {
kkinnunen32b9a3b2014-07-02 22:56:35 -0700529 RETURN_FALSE_INTERFACE
530 }
kkinnunen6bb6d402015-07-14 10:59:23 -0700531 if (fExtensions.has("GL_CHROMIUM_path_rendering")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700532 if (nullptr == fFunctions.fBindFragmentInputLocation) {
kkinnunen6bb6d402015-07-14 10:59:23 -0700533 RETURN_FALSE_INTERFACE
534 }
535 }
kkinnunen32b9a3b2014-07-02 22:56:35 -0700536 }
537
cdalton0edea2c2015-05-21 08:27:44 -0700538 if (fExtensions.has("GL_EXT_raster_multisample")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700539 if (nullptr == fFunctions.fRasterSamples) {
cdalton0edea2c2015-05-21 08:27:44 -0700540 RETURN_FALSE_INTERFACE
541 }
542 }
543
vbuzinov08b4d292015-04-01 06:29:49 -0700544 if (fExtensions.has("GL_NV_framebuffer_mixed_samples")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700545 if (nullptr == fFunctions.fCoverageModulation) {
vbuzinov08b4d292015-04-01 06:29:49 -0700546 RETURN_FALSE_INTERFACE
547 }
548 }
549
hendrikwb3f16362015-10-19 06:13:55 -0700550 if (kGL_GrGLStandard == fStandard) {
551 if (glVer >= GR_GL_VER(3,1) ||
552 fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_draw_instanced")) {
553 if (nullptr == fFunctions.fDrawArraysInstanced ||
554 nullptr == fFunctions.fDrawElementsInstanced) {
555 RETURN_FALSE_INTERFACE
556 }
557 }
558 } else if (kGLES_GrGLStandard == fStandard) {
559 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instanced")) {
560 if (nullptr == fFunctions.fDrawArraysInstanced ||
561 nullptr == fFunctions.fDrawElementsInstanced) {
562 RETURN_FALSE_INTERFACE
563 }
564 }
cdalton626e1ff2015-06-12 13:56:46 -0700565 }
566
hendrikwb3f16362015-10-19 06:13:55 -0700567 if (kGL_GrGLStandard == fStandard) {
568 if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays")) {
569 if (nullptr == fFunctions.fVertexAttribDivisor) {
570 RETURN_FALSE_INTERFACE
571 }
572 }
573 } else if (kGLES_GrGLStandard == fStandard) {
574 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arrays")) {
575 if (nullptr == fFunctions.fVertexAttribDivisor) {
576 RETURN_FALSE_INTERFACE
577 }
578 }
cdalton626e1ff2015-06-12 13:56:46 -0700579 }
580
581 if (fExtensions.has("GL_NV_bindless_texture")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700582 if (nullptr == fFunctions.fGetTextureHandle ||
583 nullptr == fFunctions.fGetTextureSamplerHandle ||
584 nullptr == fFunctions.fMakeTextureHandleResident ||
585 nullptr == fFunctions.fMakeTextureHandleNonResident ||
586 nullptr == fFunctions.fGetImageHandle ||
587 nullptr == fFunctions.fMakeImageHandleResident ||
588 nullptr == fFunctions.fMakeImageHandleNonResident ||
589 nullptr == fFunctions.fIsTextureHandleResident ||
590 nullptr == fFunctions.fIsImageHandleResident ||
591 nullptr == fFunctions.fUniformHandleui64 ||
592 nullptr == fFunctions.fUniformHandleui64v ||
593 nullptr == fFunctions.fProgramUniformHandleui64 ||
594 nullptr == fFunctions.fProgramUniformHandleui64v) {
cdalton626e1ff2015-06-12 13:56:46 -0700595 RETURN_FALSE_INTERFACE
596 }
597 }
598
599 if (kGL_GrGLStandard == fStandard && fExtensions.has("GL_EXT_direct_state_access")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700600 if (nullptr == fFunctions.fTextureParameteri ||
601 nullptr == fFunctions.fTextureParameteriv ||
602 nullptr == fFunctions.fTextureParameterf ||
603 nullptr == fFunctions.fTextureParameterfv ||
604 nullptr == fFunctions.fTextureImage1D ||
605 nullptr == fFunctions.fTextureImage2D ||
606 nullptr == fFunctions.fTextureSubImage1D ||
607 nullptr == fFunctions.fTextureSubImage2D ||
608 nullptr == fFunctions.fCopyTextureImage1D ||
609 nullptr == fFunctions.fCopyTextureImage2D ||
610 nullptr == fFunctions.fCopyTextureSubImage1D ||
611 nullptr == fFunctions.fCopyTextureSubImage2D ||
612 nullptr == fFunctions.fGetTextureImage ||
613 nullptr == fFunctions.fGetTextureParameterfv ||
614 nullptr == fFunctions.fGetTextureParameteriv ||
615 nullptr == fFunctions.fGetTextureLevelParameterfv ||
616 nullptr == fFunctions.fGetTextureLevelParameteriv) {
cdalton626e1ff2015-06-12 13:56:46 -0700617 RETURN_FALSE_INTERFACE
618 }
619 if (glVer >= GR_GL_VER(1,2)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700620 if (nullptr == fFunctions.fTextureImage3D ||
621 nullptr == fFunctions.fTextureSubImage3D ||
622 nullptr == fFunctions.fCopyTextureSubImage3D ||
623 nullptr == fFunctions.fCompressedTextureImage3D ||
624 nullptr == fFunctions.fCompressedTextureImage2D ||
625 nullptr == fFunctions.fCompressedTextureImage1D ||
626 nullptr == fFunctions.fCompressedTextureSubImage3D ||
627 nullptr == fFunctions.fCompressedTextureSubImage2D ||
628 nullptr == fFunctions.fCompressedTextureSubImage1D ||
629 nullptr == fFunctions.fGetCompressedTextureImage) {
cdalton626e1ff2015-06-12 13:56:46 -0700630 RETURN_FALSE_INTERFACE
631 }
632 }
633 if (glVer >= GR_GL_VER(1,5)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700634 if (nullptr == fFunctions.fNamedBufferData ||
635 nullptr == fFunctions.fNamedBufferSubData ||
636 nullptr == fFunctions.fMapNamedBuffer ||
637 nullptr == fFunctions.fUnmapNamedBuffer ||
638 nullptr == fFunctions.fGetNamedBufferParameteriv ||
639 nullptr == fFunctions.fGetNamedBufferPointerv ||
640 nullptr == fFunctions.fGetNamedBufferSubData) {
cdalton626e1ff2015-06-12 13:56:46 -0700641 RETURN_FALSE_INTERFACE
642 }
643 }
644 if (glVer >= GR_GL_VER(2,0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700645 if (nullptr == fFunctions.fProgramUniform1f ||
646 nullptr == fFunctions.fProgramUniform2f ||
647 nullptr == fFunctions.fProgramUniform3f ||
648 nullptr == fFunctions.fProgramUniform4f ||
649 nullptr == fFunctions.fProgramUniform1i ||
650 nullptr == fFunctions.fProgramUniform2i ||
651 nullptr == fFunctions.fProgramUniform3i ||
652 nullptr == fFunctions.fProgramUniform4i ||
653 nullptr == fFunctions.fProgramUniform1fv ||
654 nullptr == fFunctions.fProgramUniform2fv ||
655 nullptr == fFunctions.fProgramUniform3fv ||
656 nullptr == fFunctions.fProgramUniform4fv ||
657 nullptr == fFunctions.fProgramUniform1iv ||
658 nullptr == fFunctions.fProgramUniform2iv ||
659 nullptr == fFunctions.fProgramUniform3iv ||
660 nullptr == fFunctions.fProgramUniform4iv ||
661 nullptr == fFunctions.fProgramUniformMatrix2fv ||
662 nullptr == fFunctions.fProgramUniformMatrix3fv ||
663 nullptr == fFunctions.fProgramUniformMatrix4fv) {
cdalton626e1ff2015-06-12 13:56:46 -0700664 RETURN_FALSE_INTERFACE
665 }
666 }
667 if (glVer >= GR_GL_VER(2,1)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700668 if (nullptr == fFunctions.fProgramUniformMatrix2x3fv ||
669 nullptr == fFunctions.fProgramUniformMatrix3x2fv ||
670 nullptr == fFunctions.fProgramUniformMatrix2x4fv ||
671 nullptr == fFunctions.fProgramUniformMatrix4x2fv ||
672 nullptr == fFunctions.fProgramUniformMatrix3x4fv ||
673 nullptr == fFunctions.fProgramUniformMatrix4x3fv) {
cdalton626e1ff2015-06-12 13:56:46 -0700674 RETURN_FALSE_INTERFACE
675 }
676 }
677 if (glVer >= GR_GL_VER(3,0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700678 if (nullptr == fFunctions.fNamedRenderbufferStorage ||
679 nullptr == fFunctions.fGetNamedRenderbufferParameteriv ||
680 nullptr == fFunctions.fNamedRenderbufferStorageMultisample ||
681 nullptr == fFunctions.fCheckNamedFramebufferStatus ||
682 nullptr == fFunctions.fNamedFramebufferTexture1D ||
683 nullptr == fFunctions.fNamedFramebufferTexture2D ||
684 nullptr == fFunctions.fNamedFramebufferTexture3D ||
685 nullptr == fFunctions.fNamedFramebufferRenderbuffer ||
686 nullptr == fFunctions.fGetNamedFramebufferAttachmentParameteriv ||
687 nullptr == fFunctions.fGenerateTextureMipmap ||
688 nullptr == fFunctions.fFramebufferDrawBuffer ||
689 nullptr == fFunctions.fFramebufferDrawBuffers ||
690 nullptr == fFunctions.fFramebufferReadBuffer ||
691 nullptr == fFunctions.fGetFramebufferParameteriv ||
692 nullptr == fFunctions.fNamedCopyBufferSubData ||
693 nullptr == fFunctions.fVertexArrayVertexOffset ||
694 nullptr == fFunctions.fVertexArrayColorOffset ||
695 nullptr == fFunctions.fVertexArrayEdgeFlagOffset ||
696 nullptr == fFunctions.fVertexArrayIndexOffset ||
697 nullptr == fFunctions.fVertexArrayNormalOffset ||
698 nullptr == fFunctions.fVertexArrayTexCoordOffset ||
699 nullptr == fFunctions.fVertexArrayMultiTexCoordOffset ||
700 nullptr == fFunctions.fVertexArrayFogCoordOffset ||
701 nullptr == fFunctions.fVertexArraySecondaryColorOffset ||
702 nullptr == fFunctions.fVertexArrayVertexAttribOffset ||
703 nullptr == fFunctions.fVertexArrayVertexAttribIOffset ||
704 nullptr == fFunctions.fEnableVertexArray ||
705 nullptr == fFunctions.fDisableVertexArray ||
706 nullptr == fFunctions.fEnableVertexArrayAttrib ||
707 nullptr == fFunctions.fDisableVertexArrayAttrib ||
708 nullptr == fFunctions.fGetVertexArrayIntegerv ||
709 nullptr == fFunctions.fGetVertexArrayPointerv ||
710 nullptr == fFunctions.fGetVertexArrayIntegeri_v ||
711 nullptr == fFunctions.fGetVertexArrayPointeri_v ||
712 nullptr == fFunctions.fMapNamedBufferRange ||
713 nullptr == fFunctions.fFlushMappedNamedBufferRange) {
cdalton626e1ff2015-06-12 13:56:46 -0700714 RETURN_FALSE_INTERFACE
715 }
716 }
717 }
718
719 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
720 fExtensions.has("GL_KHR_debug")) {
halcanary96fcdcc2015-08-27 07:41:13 -0700721 if (nullptr == fFunctions.fDebugMessageControl ||
722 nullptr == fFunctions.fDebugMessageInsert ||
723 nullptr == fFunctions.fDebugMessageCallback ||
724 nullptr == fFunctions.fGetDebugMessageLog ||
725 nullptr == fFunctions.fPushDebugGroup ||
726 nullptr == fFunctions.fPopDebugGroup ||
727 nullptr == fFunctions.fObjectLabel) {
cdalton626e1ff2015-06-12 13:56:46 -0700728 RETURN_FALSE_INTERFACE
729 }
730 }
731
bsalomonb1a32ad2015-11-16 06:48:44 -0800732 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base")) {
bsalomon7ea33f52015-11-22 14:51:00 -0800733 if (nullptr == fFunctions.fEGLCreateImage ||
734 nullptr == fFunctions.fEGLDestroyImage) {
bsalomonb1a32ad2015-11-16 06:48:44 -0800735 RETURN_FALSE_INTERFACE
736 }
737 }
738
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000739 return true;
740}