blob: d46aaa755f48c83680707af0e3c8ccd82c63df2a [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
twiz@google.com59a190b2011-03-14 21:23:01 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
twiz@google.com59a190b2011-03-14 21:23:01 +00007 */
8
9
twiz@google.com59a190b2011-03-14 21:23:01 +000010#include "GrTypes.h"
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000011#include "GrGLInterface.h"
12#include "GrGLDefines.h"
twiz@google.com59a190b2011-03-14 21:23:01 +000013
14#include <stdio.h>
15
bsalomon@google.com56bfc5a2011-09-01 13:28:16 +000016#if GR_GL_PER_GL_FUNC_CALLBACK
17namespace {
18void GrGLDefaultInterfaceCallback(const GrGLInterface*) {}
19}
20#endif
21
bsalomon@google.comc82b8892011-09-22 14:10:33 +000022GrGLVersion GrGLGetVersionFromString(const char* versionString) {
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +000023 if (NULL == versionString) {
24 GrAssert(!"NULL GL version string.");
25 return 0;
26 }
27
bsalomon@google.comc82b8892011-09-22 14:10:33 +000028 int major, minor;
twiz@google.com0f31ca72011-03-18 17:38:11 +000029
bsalomon@google.comc82b8892011-09-22 14:10:33 +000030 int n = sscanf(versionString, "%d.%d", &major, &minor);
twiz@google.com0f31ca72011-03-18 17:38:11 +000031 if (2 == n) {
bsalomon@google.comc82b8892011-09-22 14:10:33 +000032 return GR_GL_VER(major, minor);
twiz@google.com59a190b2011-03-14 21:23:01 +000033 }
twiz@google.com0f31ca72011-03-18 17:38:11 +000034
twiz@google.com59a190b2011-03-14 21:23:01 +000035 char profile[2];
twiz@google.com0f31ca72011-03-18 17:38:11 +000036 n = sscanf(versionString, "OpenGL ES-%c%c %d.%d", profile, profile+1,
bsalomon@google.comc82b8892011-09-22 14:10:33 +000037 &major, &minor);
38 if (4 == n) {
39 return GR_GL_VER(major, minor);
40 }
41
42 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor);
43 if (2 == n) {
44 return GR_GL_VER(major, minor);
twiz@google.com59a190b2011-03-14 21:23:01 +000045 }
twiz@google.com0f31ca72011-03-18 17:38:11 +000046
bsalomon@google.comc82b8892011-09-22 14:10:33 +000047 return 0;
twiz@google.com59a190b2011-03-14 21:23:01 +000048}
49
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +000050GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) {
51 if (NULL == versionString) {
52 GrAssert(!"NULL GLSL version string.");
53 return 0;
54 }
55
56 int major, minor;
57
58 int n = sscanf(versionString, "%d.%d", &major, &minor);
59 if (2 == n) {
60 return GR_GLSL_VER(major, minor);
61 }
62
63 n = sscanf(versionString, "OpenGL ES GLSL ES %d.%d", &major, &minor);
64 if (2 == n) {
65 return GR_GLSL_VER(major, minor);
66 }
67 return 0;
68}
69
bsalomon@google.comc82b8892011-09-22 14:10:33 +000070bool GrGLHasExtensionFromString(const char* ext, const char* extensionString) {
twiz@google.com59a190b2011-03-14 21:23:01 +000071 int extLength = strlen(ext);
72
73 while (true) {
74 int n = strcspn(extensionString, " ");
75 if (n == extLength && 0 == strncmp(ext, extensionString, n)) {
76 return true;
77 }
78 if (0 == extensionString[n]) {
79 return false;
80 }
81 extensionString += n+1;
82 }
83
84 return false;
85}
86
bsalomon@google.comc82b8892011-09-22 14:10:33 +000087bool GrGLHasExtension(const GrGLInterface* gl, const char* ext) {
bsalomon@google.comdca4aab2011-09-06 19:05:24 +000088 const GrGLubyte* glstr;
89 GR_GL_CALL_RET(gl, glstr, GetString(GR_GL_EXTENSIONS));
bsalomon@google.comc82b8892011-09-22 14:10:33 +000090 return GrGLHasExtensionFromString(ext, (const char*) glstr);
twiz@google.com59a190b2011-03-14 21:23:01 +000091}
92
bsalomon@google.comc82b8892011-09-22 14:10:33 +000093GrGLVersion GrGLGetVersion(const GrGLInterface* gl) {
bsalomon@google.comdca4aab2011-09-06 19:05:24 +000094 const GrGLubyte* v;
95 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION));
bsalomon@google.comc82b8892011-09-22 14:10:33 +000096 return GrGLGetVersionFromString((const char*) v);
bsalomon@google.com2c17fcd2011-07-06 17:47:02 +000097}
98
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +000099GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface* gl) {
100 const GrGLubyte* v;
101 GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION));
102 return GrGLGetGLSLVersionFromString((const char*) v);
103}
104
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000105GrGLInterface::GrGLInterface() {
106 fBindingsExported = (GrGLBinding)0;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000107
108 fActiveTexture = NULL;
109 fAttachShader = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000110 fBeginQuery = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000111 fBindAttribLocation = NULL;
112 fBindBuffer = NULL;
bsalomon@google.combc5cf512011-09-21 16:21:07 +0000113 fBindFragDataLocation = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000114 fBindTexture = NULL;
115 fBlendColor = NULL;
116 fBlendFunc = NULL;
117 fBufferData = NULL;
118 fBufferSubData = NULL;
119 fClear = NULL;
120 fClearColor = NULL;
121 fClearStencil = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000122 fColorMask = NULL;
123 fColorPointer = NULL;
124 fCompileShader = NULL;
125 fCompressedTexImage2D = NULL;
126 fCreateProgram = NULL;
127 fCreateShader = NULL;
128 fCullFace = NULL;
129 fDeleteBuffers = NULL;
130 fDeleteProgram = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000131 fDeleteQueries = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000132 fDeleteShader = NULL;
133 fDeleteTextures = NULL;
134 fDepthMask = NULL;
135 fDisable = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000136 fDisableVertexAttribArray = NULL;
137 fDrawArrays = NULL;
138 fDrawBuffer = NULL;
139 fDrawBuffers = NULL;
140 fDrawElements = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000141 fEndQuery = NULL;
142 fFinish = NULL;
143 fFlush = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000144 fEnable = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000145 fEnableVertexAttribArray = NULL;
146 fFrontFace = NULL;
147 fGenBuffers = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000148 fGenQueries = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000149 fGenTextures = NULL;
150 fGetBufferParameteriv = NULL;
151 fGetError = NULL;
152 fGetIntegerv = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000153 fGetQueryiv = NULL;
154 fGetQueryObjecti64v = NULL;
155 fGetQueryObjectiv = NULL;
156 fGetQueryObjectui64v = NULL;
157 fGetQueryObjectuiv = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000158 fGetProgramInfoLog = NULL;
159 fGetProgramiv = NULL;
160 fGetShaderInfoLog = NULL;
161 fGetShaderiv = NULL;
162 fGetString = NULL;
163 fGetTexLevelParameteriv = NULL;
164 fGetUniformLocation = NULL;
165 fLineWidth = NULL;
166 fLinkProgram = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000167 fPixelStorei = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000168 fQueryCounter = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000169 fReadBuffer = NULL;
170 fReadPixels = NULL;
171 fScissor = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000172 fShaderSource = NULL;
173 fStencilFunc = NULL;
174 fStencilFuncSeparate = NULL;
175 fStencilMask = NULL;
176 fStencilMaskSeparate = NULL;
177 fStencilOp = NULL;
178 fStencilOpSeparate = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000179 fTexImage2D = NULL;
180 fTexParameteri = NULL;
181 fTexSubImage2D = NULL;
182 fUniform1f = NULL;
183 fUniform1i = NULL;
184 fUniform1fv = NULL;
185 fUniform1iv = NULL;
186 fUniform2f = NULL;
187 fUniform2i = NULL;
188 fUniform2fv = NULL;
189 fUniform2iv = NULL;
190 fUniform3f = NULL;
191 fUniform3i = NULL;
192 fUniform3fv = NULL;
193 fUniform3iv = NULL;
194 fUniform4f = NULL;
195 fUniform4i = NULL;
196 fUniform4fv = NULL;
197 fUniform4iv = NULL;
198 fUniformMatrix2fv = NULL;
199 fUniformMatrix3fv = NULL;
200 fUniformMatrix4fv = NULL;
201 fUseProgram = NULL;
202 fVertexAttrib4fv = NULL;
203 fVertexAttribPointer = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000204 fViewport = NULL;
205 fBindFramebuffer = NULL;
206 fBindRenderbuffer = NULL;
207 fCheckFramebufferStatus = NULL;
208 fDeleteFramebuffers = NULL;
209 fDeleteRenderbuffers = NULL;
210 fFramebufferRenderbuffer = NULL;
211 fFramebufferTexture2D = NULL;
212 fGenFramebuffers = NULL;
213 fGenRenderbuffers = NULL;
214 fGetFramebufferAttachmentParameteriv = NULL;
215 fGetRenderbufferParameteriv = NULL;
216 fRenderbufferStorage = NULL;
217 fRenderbufferStorageMultisample = NULL;
218 fBlitFramebuffer = NULL;
219 fResolveMultisampleFramebuffer = NULL;
220 fMapBuffer = NULL;
221 fUnmapBuffer = NULL;
222 fBindFragDataLocationIndexed = NULL;
bsalomon@google.com56bfc5a2011-09-01 13:28:16 +0000223
224#if GR_GL_PER_GL_FUNC_CALLBACK
225 fCallback = GrGLDefaultInterfaceCallback;
226 fCallbackData = 0;
227#endif
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000228}
229
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000230bool GrGLInterface::validate() const {
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000231
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000232 bool isDesktop = this->supportsDesktop();
233
234 bool isES2 = this->supportsES2();
235
236 if (isDesktop == isES2) {
237 // must have one, don't support both in same interface
238 return false;
239 }
240
241 // functions that are always required
242 if (NULL == fActiveTexture ||
243 NULL == fAttachShader ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000244 NULL == fBindAttribLocation ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000245 NULL == fBindBuffer ||
246 NULL == fBindTexture ||
247 NULL == fBlendFunc ||
248 NULL == fBufferData ||
249 NULL == fBufferSubData ||
250 NULL == fClear ||
251 NULL == fClearColor ||
252 NULL == fClearStencil ||
253 NULL == fColorMask ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000254 NULL == fCompileShader ||
255 NULL == fCreateProgram ||
256 NULL == fCreateShader ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000257 NULL == fCullFace ||
258 NULL == fDeleteBuffers ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000259 NULL == fDeleteProgram ||
260 NULL == fDeleteShader ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000261 NULL == fDeleteTextures ||
262 NULL == fDepthMask ||
263 NULL == fDisable ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000264 NULL == fDisableVertexAttribArray ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000265 NULL == fDrawArrays ||
266 NULL == fDrawElements ||
267 NULL == fEnable ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000268 NULL == fEnableVertexAttribArray ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000269 NULL == fFrontFace ||
270 NULL == fGenBuffers ||
271 NULL == fGenTextures ||
272 NULL == fGetBufferParameteriv ||
273 NULL == fGetError ||
274 NULL == fGetIntegerv ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000275 NULL == fGetProgramInfoLog ||
276 NULL == fGetProgramiv ||
277 NULL == fGetShaderInfoLog ||
278 NULL == fGetShaderiv ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000279 NULL == fGetString ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000280 NULL == fGetUniformLocation ||
281 NULL == fLinkProgram ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000282 NULL == fPixelStorei ||
283 NULL == fReadPixels ||
284 NULL == fScissor ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000285 NULL == fShaderSource ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000286 NULL == fStencilFunc ||
287 NULL == fStencilMask ||
288 NULL == fStencilOp ||
289 NULL == fTexImage2D ||
290 NULL == fTexParameteri ||
291 NULL == fTexSubImage2D ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000292 NULL == fUniform1f ||
293 NULL == fUniform1i ||
294 NULL == fUniform1fv ||
295 NULL == fUniform1iv ||
296 NULL == fUniform2f ||
297 NULL == fUniform2i ||
298 NULL == fUniform2fv ||
299 NULL == fUniform2iv ||
300 NULL == fUniform3f ||
301 NULL == fUniform3i ||
302 NULL == fUniform3fv ||
303 NULL == fUniform3iv ||
304 NULL == fUniform4f ||
305 NULL == fUniform4i ||
306 NULL == fUniform4fv ||
307 NULL == fUniform4iv ||
308 NULL == fUniformMatrix2fv ||
309 NULL == fUniformMatrix3fv ||
310 NULL == fUniformMatrix4fv ||
311 NULL == fUseProgram ||
312 NULL == fVertexAttrib4fv ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000313 NULL == fVertexAttribPointer ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000314 NULL == fViewport ||
315 NULL == fBindFramebuffer ||
316 NULL == fBindRenderbuffer ||
317 NULL == fCheckFramebufferStatus ||
318 NULL == fDeleteFramebuffers ||
319 NULL == fDeleteRenderbuffers ||
bsalomon@google.com373a6632011-10-19 20:43:20 +0000320 NULL == fFinish ||
321 NULL == fFlush ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000322 NULL == fFramebufferRenderbuffer ||
323 NULL == fFramebufferTexture2D ||
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000324 NULL == fGetFramebufferAttachmentParameteriv ||
325 NULL == fGetRenderbufferParameteriv ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000326 NULL == fGenFramebuffers ||
327 NULL == fGenRenderbuffers ||
328 NULL == fRenderbufferStorage) {
329 return false;
330 }
331
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000332 const char* ext;
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000333 GrGLVersion glVer = GrGLGetVersion(this);
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000334 ext = (const char*)fGetString(GR_GL_EXTENSIONS);
335
336 // Now check that baseline ES/Desktop fns not covered above are present
337 // and that we have fn pointers for any advertised extensions that we will
338 // try to use.
339
340 // these functions are part of ES2, we assume they are available
341 // On the desktop we assume they are available if the extension
342 // is present or GL version is high enough.
343 if ((kES2_GrGLBinding & fBindingsExported)) {
344 if (NULL == fBlendColor ||
345 NULL == fStencilFuncSeparate ||
346 NULL == fStencilMaskSeparate ||
347 NULL == fStencilOpSeparate) {
348 return false;
349 }
350 } else if (kDesktop_GrGLBinding == fBindingsExported) {
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000351 if (glVer >= GR_GL_VER(2,0)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000352 if (NULL == fStencilFuncSeparate ||
353 NULL == fStencilMaskSeparate ||
354 NULL == fStencilOpSeparate) {
355 return false;
356 }
357 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000358 if (glVer >= GR_GL_VER(3,0) && NULL == fBindFragDataLocation) {
bsalomon@google.combc5cf512011-09-21 16:21:07 +0000359 return false;
360 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000361 if (glVer >= GR_GL_VER(2,0) ||
362 GrGLHasExtensionFromString("GL_ARB_draw_buffers", ext)) {
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000363 if (NULL == fDrawBuffers) {
364 return false;
365 }
366 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000367 if (glVer >= GR_GL_VER(1,4) ||
368 GrGLHasExtensionFromString("GL_EXT_blend_color", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000369 if (NULL == fBlendColor) {
370 return false;
371 }
372 }
bsalomon@google.com373a6632011-10-19 20:43:20 +0000373 if (glVer >= GR_GL_VER(1,5) ||
374 GrGLHasExtensionFromString("GL_ARB_occlusion_query", ext)) {
375 if (NULL == fGenQueries ||
376 NULL == fDeleteQueries ||
377 NULL == fBeginQuery ||
378 NULL == fEndQuery ||
379 NULL == fGetQueryiv ||
380 NULL == fGetQueryObjectiv ||
381 NULL == fGetQueryObjectuiv) {
382 return false;
383 }
384 }
385 if (glVer >= GR_GL_VER(3,3) ||
386 GrGLHasExtensionFromString("GL_ARB_timer_query", ext) ||
387 GrGLHasExtensionFromString("GL_EXT_timer_query", ext)) {
388 if (NULL == fGetQueryObjecti64v ||
389 NULL == fGetQueryObjectui64v) {
390 return false;
391 }
392 }
393 if (glVer >= GR_GL_VER(3,3) ||
394 GrGLHasExtensionFromString("GL_ARB_timer_query", ext)) {
395 if (NULL == fQueryCounter) {
396 return false;
397 }
398 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000399 }
400
401 // optional function on desktop before 1.3
402 if (kDesktop_GrGLBinding != fBindingsExported ||
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000403 (glVer >= GR_GL_VER(1,3) ||
404 GrGLHasExtensionFromString("GL_ARB_texture_compression", ext))) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000405 if (NULL == fCompressedTexImage2D) {
406 return false;
407 }
408 }
409
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000410 // part of desktop GL, but not ES
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000411 if (kDesktop_GrGLBinding == fBindingsExported &&
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000412 (NULL == fLineWidth ||
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000413 NULL == fGetTexLevelParameteriv ||
bsalomon@google.comc49d66b2011-08-03 14:22:30 +0000414 NULL == fDrawBuffer ||
415 NULL == fReadBuffer)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000416 return false;
417 }
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000418
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000419 // FBO MSAA
420 if (kDesktop_GrGLBinding == fBindingsExported) {
421 // GL 3.0 and the ARB extension have multisample + blit
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000422 if (glVer >= GR_GL_VER(3,0) || GrGLHasExtensionFromString("GL_ARB_framebuffer_object", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000423 if (NULL == fRenderbufferStorageMultisample ||
424 NULL == fBlitFramebuffer) {
425 return false;
426 }
427 } else {
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000428 if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit", ext) &&
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000429 NULL == fBlitFramebuffer) {
430 return false;
431 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000432 if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample", ext) &&
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000433 NULL == fRenderbufferStorageMultisample) {
434 return false;
435 }
436 }
437 } else {
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000438 if (GrGLHasExtensionFromString("GL_CHROMIUM_framebuffer_multisample", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000439 if (NULL == fRenderbufferStorageMultisample ||
440 NULL == fBlitFramebuffer) {
441 return false;
442 }
443 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000444 if (GrGLHasExtensionFromString("GL_APPLE_framebuffer_multisample", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000445 if (NULL == fRenderbufferStorageMultisample ||
446 NULL == fResolveMultisampleFramebuffer) {
447 return false;
448 }
449 }
450 }
451
452 // On ES buffer mapping is an extension. On Desktop
453 // buffer mapping was part of original VBO extension
454 // which we require.
455 if (kDesktop_GrGLBinding == fBindingsExported ||
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000456 GrGLHasExtensionFromString("GL_OES_mapbuffer", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000457 if (NULL == fMapBuffer ||
458 NULL == fUnmapBuffer) {
459 return false;
460 }
461 }
462
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000463 // Dual source blending
464 if (kDesktop_GrGLBinding == fBindingsExported &&
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000465 (glVer >= GR_GL_VER(3,3) ||
466 GrGLHasExtensionFromString("GL_ARB_blend_func_extended", ext))) {
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000467 if (NULL == fBindFragDataLocationIndexed) {
468 return false;
469 }
470 }
471
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000472 return true;
473}
474