blob: b70e2074e7ddef6b9d857c76c0091be3f67cc409 [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;
107 fNPOTRenderTargetSupport = kProbe_GrGLCapability;
108 fMinRenderTargetHeight = kProbe_GrGLCapability;
109 fMinRenderTargetWidth = kProbe_GrGLCapability;
110
111 fActiveTexture = NULL;
112 fAttachShader = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000113 fBeginQuery = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000114 fBindAttribLocation = NULL;
115 fBindBuffer = NULL;
bsalomon@google.combc5cf512011-09-21 16:21:07 +0000116 fBindFragDataLocation = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000117 fBindTexture = NULL;
118 fBlendColor = NULL;
119 fBlendFunc = NULL;
120 fBufferData = NULL;
121 fBufferSubData = NULL;
122 fClear = NULL;
123 fClearColor = NULL;
124 fClearStencil = NULL;
125 fClientActiveTexture = NULL;
126 fColor4ub = NULL;
127 fColorMask = NULL;
128 fColorPointer = NULL;
129 fCompileShader = NULL;
130 fCompressedTexImage2D = NULL;
131 fCreateProgram = NULL;
132 fCreateShader = NULL;
133 fCullFace = NULL;
134 fDeleteBuffers = NULL;
135 fDeleteProgram = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000136 fDeleteQueries = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000137 fDeleteShader = NULL;
138 fDeleteTextures = NULL;
139 fDepthMask = NULL;
140 fDisable = NULL;
141 fDisableClientState = NULL;
142 fDisableVertexAttribArray = NULL;
143 fDrawArrays = NULL;
144 fDrawBuffer = NULL;
145 fDrawBuffers = NULL;
146 fDrawElements = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000147 fEndQuery = NULL;
148 fFinish = NULL;
149 fFlush = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000150 fEnable = NULL;
151 fEnableClientState = NULL;
152 fEnableVertexAttribArray = NULL;
153 fFrontFace = NULL;
154 fGenBuffers = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000155 fGenQueries = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000156 fGenTextures = NULL;
157 fGetBufferParameteriv = NULL;
158 fGetError = NULL;
159 fGetIntegerv = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000160 fGetQueryiv = NULL;
161 fGetQueryObjecti64v = NULL;
162 fGetQueryObjectiv = NULL;
163 fGetQueryObjectui64v = NULL;
164 fGetQueryObjectuiv = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000165 fGetProgramInfoLog = NULL;
166 fGetProgramiv = NULL;
167 fGetShaderInfoLog = NULL;
168 fGetShaderiv = NULL;
169 fGetString = NULL;
170 fGetTexLevelParameteriv = NULL;
171 fGetUniformLocation = NULL;
172 fLineWidth = NULL;
173 fLinkProgram = NULL;
174 fLoadMatrixf = NULL;
175 fMatrixMode = NULL;
176 fPixelStorei = NULL;
177 fPointSize = NULL;
bsalomon@google.comf97c1942011-10-19 21:35:26 +0000178 fQueryCounter = NULL;
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000179 fReadBuffer = NULL;
180 fReadPixels = NULL;
181 fScissor = NULL;
182 fShadeModel = NULL;
183 fShaderSource = NULL;
184 fStencilFunc = NULL;
185 fStencilFuncSeparate = NULL;
186 fStencilMask = NULL;
187 fStencilMaskSeparate = NULL;
188 fStencilOp = NULL;
189 fStencilOpSeparate = NULL;
190 fTexCoordPointer = NULL;
191 fTexEnvi = NULL;
192 fTexImage2D = NULL;
193 fTexParameteri = NULL;
194 fTexSubImage2D = NULL;
195 fUniform1f = NULL;
196 fUniform1i = NULL;
197 fUniform1fv = NULL;
198 fUniform1iv = NULL;
199 fUniform2f = NULL;
200 fUniform2i = NULL;
201 fUniform2fv = NULL;
202 fUniform2iv = NULL;
203 fUniform3f = NULL;
204 fUniform3i = NULL;
205 fUniform3fv = NULL;
206 fUniform3iv = NULL;
207 fUniform4f = NULL;
208 fUniform4i = NULL;
209 fUniform4fv = NULL;
210 fUniform4iv = NULL;
211 fUniformMatrix2fv = NULL;
212 fUniformMatrix3fv = NULL;
213 fUniformMatrix4fv = NULL;
214 fUseProgram = NULL;
215 fVertexAttrib4fv = NULL;
216 fVertexAttribPointer = NULL;
217 fVertexPointer = NULL;
218 fViewport = NULL;
219 fBindFramebuffer = NULL;
220 fBindRenderbuffer = NULL;
221 fCheckFramebufferStatus = NULL;
222 fDeleteFramebuffers = NULL;
223 fDeleteRenderbuffers = NULL;
224 fFramebufferRenderbuffer = NULL;
225 fFramebufferTexture2D = NULL;
226 fGenFramebuffers = NULL;
227 fGenRenderbuffers = NULL;
228 fGetFramebufferAttachmentParameteriv = NULL;
229 fGetRenderbufferParameteriv = NULL;
230 fRenderbufferStorage = NULL;
231 fRenderbufferStorageMultisample = NULL;
232 fBlitFramebuffer = NULL;
233 fResolveMultisampleFramebuffer = NULL;
234 fMapBuffer = NULL;
235 fUnmapBuffer = NULL;
236 fBindFragDataLocationIndexed = NULL;
bsalomon@google.com56bfc5a2011-09-01 13:28:16 +0000237
238#if GR_GL_PER_GL_FUNC_CALLBACK
239 fCallback = GrGLDefaultInterfaceCallback;
240 fCallbackData = 0;
241#endif
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000242}
243
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000244bool GrGLInterface::validate() const {
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000245
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000246 bool isDesktop = this->supportsDesktop();
247
248 bool isES2 = this->supportsES2();
249
250 if (isDesktop == isES2) {
251 // must have one, don't support both in same interface
252 return false;
253 }
254
255 // functions that are always required
256 if (NULL == fActiveTexture ||
257 NULL == fAttachShader ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000258 NULL == fBindAttribLocation ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000259 NULL == fBindBuffer ||
260 NULL == fBindTexture ||
261 NULL == fBlendFunc ||
262 NULL == fBufferData ||
263 NULL == fBufferSubData ||
264 NULL == fClear ||
265 NULL == fClearColor ||
266 NULL == fClearStencil ||
267 NULL == fColorMask ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000268 NULL == fCompileShader ||
269 NULL == fCreateProgram ||
270 NULL == fCreateShader ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000271 NULL == fCullFace ||
272 NULL == fDeleteBuffers ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000273 NULL == fDeleteProgram ||
274 NULL == fDeleteShader ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000275 NULL == fDeleteTextures ||
276 NULL == fDepthMask ||
277 NULL == fDisable ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000278 NULL == fDisableVertexAttribArray ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000279 NULL == fDrawArrays ||
280 NULL == fDrawElements ||
281 NULL == fEnable ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000282 NULL == fEnableVertexAttribArray ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000283 NULL == fFrontFace ||
284 NULL == fGenBuffers ||
285 NULL == fGenTextures ||
286 NULL == fGetBufferParameteriv ||
287 NULL == fGetError ||
288 NULL == fGetIntegerv ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000289 NULL == fGetProgramInfoLog ||
290 NULL == fGetProgramiv ||
291 NULL == fGetShaderInfoLog ||
292 NULL == fGetShaderiv ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000293 NULL == fGetString ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000294 NULL == fGetUniformLocation ||
295 NULL == fLinkProgram ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000296 NULL == fPixelStorei ||
297 NULL == fReadPixels ||
298 NULL == fScissor ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000299 NULL == fShaderSource ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000300 NULL == fStencilFunc ||
301 NULL == fStencilMask ||
302 NULL == fStencilOp ||
303 NULL == fTexImage2D ||
304 NULL == fTexParameteri ||
305 NULL == fTexSubImage2D ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000306 NULL == fUniform1f ||
307 NULL == fUniform1i ||
308 NULL == fUniform1fv ||
309 NULL == fUniform1iv ||
310 NULL == fUniform2f ||
311 NULL == fUniform2i ||
312 NULL == fUniform2fv ||
313 NULL == fUniform2iv ||
314 NULL == fUniform3f ||
315 NULL == fUniform3i ||
316 NULL == fUniform3fv ||
317 NULL == fUniform3iv ||
318 NULL == fUniform4f ||
319 NULL == fUniform4i ||
320 NULL == fUniform4fv ||
321 NULL == fUniform4iv ||
322 NULL == fUniformMatrix2fv ||
323 NULL == fUniformMatrix3fv ||
324 NULL == fUniformMatrix4fv ||
325 NULL == fUseProgram ||
326 NULL == fVertexAttrib4fv ||
bsalomon@google.com1dcf5062011-11-14 19:29:53 +0000327 NULL == fVertexAttribPointer ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000328 NULL == fViewport ||
329 NULL == fBindFramebuffer ||
330 NULL == fBindRenderbuffer ||
331 NULL == fCheckFramebufferStatus ||
332 NULL == fDeleteFramebuffers ||
333 NULL == fDeleteRenderbuffers ||
bsalomon@google.com373a6632011-10-19 20:43:20 +0000334 NULL == fFinish ||
335 NULL == fFlush ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000336 NULL == fFramebufferRenderbuffer ||
337 NULL == fFramebufferTexture2D ||
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000338 NULL == fGetFramebufferAttachmentParameteriv ||
339 NULL == fGetRenderbufferParameteriv ||
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000340 NULL == fGenFramebuffers ||
341 NULL == fGenRenderbuffers ||
342 NULL == fRenderbufferStorage) {
343 return false;
344 }
345
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000346 const char* ext;
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000347 GrGLVersion glVer = GrGLGetVersion(this);
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000348 ext = (const char*)fGetString(GR_GL_EXTENSIONS);
349
350 // Now check that baseline ES/Desktop fns not covered above are present
351 // and that we have fn pointers for any advertised extensions that we will
352 // try to use.
353
354 // these functions are part of ES2, we assume they are available
355 // On the desktop we assume they are available if the extension
356 // is present or GL version is high enough.
357 if ((kES2_GrGLBinding & fBindingsExported)) {
358 if (NULL == fBlendColor ||
359 NULL == fStencilFuncSeparate ||
360 NULL == fStencilMaskSeparate ||
361 NULL == fStencilOpSeparate) {
362 return false;
363 }
364 } else if (kDesktop_GrGLBinding == fBindingsExported) {
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000365 if (glVer >= GR_GL_VER(2,0)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000366 if (NULL == fStencilFuncSeparate ||
367 NULL == fStencilMaskSeparate ||
368 NULL == fStencilOpSeparate) {
369 return false;
370 }
371 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000372 if (glVer >= GR_GL_VER(3,0) && NULL == fBindFragDataLocation) {
bsalomon@google.combc5cf512011-09-21 16:21:07 +0000373 return false;
374 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000375 if (glVer >= GR_GL_VER(2,0) ||
376 GrGLHasExtensionFromString("GL_ARB_draw_buffers", ext)) {
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000377 if (NULL == fDrawBuffers) {
378 return false;
379 }
380 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000381 if (glVer >= GR_GL_VER(1,4) ||
382 GrGLHasExtensionFromString("GL_EXT_blend_color", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000383 if (NULL == fBlendColor) {
384 return false;
385 }
386 }
bsalomon@google.com373a6632011-10-19 20:43:20 +0000387 if (glVer >= GR_GL_VER(1,5) ||
388 GrGLHasExtensionFromString("GL_ARB_occlusion_query", ext)) {
389 if (NULL == fGenQueries ||
390 NULL == fDeleteQueries ||
391 NULL == fBeginQuery ||
392 NULL == fEndQuery ||
393 NULL == fGetQueryiv ||
394 NULL == fGetQueryObjectiv ||
395 NULL == fGetQueryObjectuiv) {
396 return false;
397 }
398 }
399 if (glVer >= GR_GL_VER(3,3) ||
400 GrGLHasExtensionFromString("GL_ARB_timer_query", ext) ||
401 GrGLHasExtensionFromString("GL_EXT_timer_query", ext)) {
402 if (NULL == fGetQueryObjecti64v ||
403 NULL == fGetQueryObjectui64v) {
404 return false;
405 }
406 }
407 if (glVer >= GR_GL_VER(3,3) ||
408 GrGLHasExtensionFromString("GL_ARB_timer_query", ext)) {
409 if (NULL == fQueryCounter) {
410 return false;
411 }
412 }
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000413 }
414
415 // optional function on desktop before 1.3
416 if (kDesktop_GrGLBinding != fBindingsExported ||
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000417 (glVer >= GR_GL_VER(1,3) ||
418 GrGLHasExtensionFromString("GL_ARB_texture_compression", ext))) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000419 if (NULL == fCompressedTexImage2D) {
420 return false;
421 }
422 }
423
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000424 // part of desktop GL, but not ES
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000425 if (kDesktop_GrGLBinding == fBindingsExported &&
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000426 (NULL == fLineWidth ||
bsalomon@google.comd32c5f52011-08-02 19:29:03 +0000427 NULL == fGetTexLevelParameteriv ||
bsalomon@google.comc49d66b2011-08-03 14:22:30 +0000428 NULL == fDrawBuffer ||
429 NULL == fReadBuffer)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000430 return false;
431 }
bsalomon@google.comcee661a2011-07-26 12:32:36 +0000432
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000433 // FBO MSAA
434 if (kDesktop_GrGLBinding == fBindingsExported) {
435 // GL 3.0 and the ARB extension have multisample + blit
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000436 if (glVer >= GR_GL_VER(3,0) || GrGLHasExtensionFromString("GL_ARB_framebuffer_object", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000437 if (NULL == fRenderbufferStorageMultisample ||
438 NULL == fBlitFramebuffer) {
439 return false;
440 }
441 } else {
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000442 if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit", ext) &&
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000443 NULL == fBlitFramebuffer) {
444 return false;
445 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000446 if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample", ext) &&
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000447 NULL == fRenderbufferStorageMultisample) {
448 return false;
449 }
450 }
451 } else {
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000452 if (GrGLHasExtensionFromString("GL_CHROMIUM_framebuffer_multisample", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000453 if (NULL == fRenderbufferStorageMultisample ||
454 NULL == fBlitFramebuffer) {
455 return false;
456 }
457 }
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000458 if (GrGLHasExtensionFromString("GL_APPLE_framebuffer_multisample", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000459 if (NULL == fRenderbufferStorageMultisample ||
460 NULL == fResolveMultisampleFramebuffer) {
461 return false;
462 }
463 }
464 }
465
466 // On ES buffer mapping is an extension. On Desktop
467 // buffer mapping was part of original VBO extension
468 // which we require.
469 if (kDesktop_GrGLBinding == fBindingsExported ||
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000470 GrGLHasExtensionFromString("GL_OES_mapbuffer", ext)) {
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000471 if (NULL == fMapBuffer ||
472 NULL == fUnmapBuffer) {
473 return false;
474 }
475 }
476
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000477 // Dual source blending
478 if (kDesktop_GrGLBinding == fBindingsExported &&
bsalomon@google.comc82b8892011-09-22 14:10:33 +0000479 (glVer >= GR_GL_VER(3,3) ||
480 GrGLHasExtensionFromString("GL_ARB_blend_func_extended", ext))) {
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000481 if (NULL == fBindFragDataLocationIndexed) {
482 return false;
483 }
484 }
485
bsalomon@google.combf2a4692011-05-04 12:35:39 +0000486 return true;
487}
488