twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | |
tomhudson@google.com | 6bf38b5 | 2012-02-14 15:11:59 +0000 | [diff] [blame] | 9 | #include "gl/GrGLInterface.h" |
bsalomon@google.com | 9c1f1ac | 2012-05-07 17:09:37 +0000 | [diff] [blame] | 10 | #include "GrGLUtil.h" |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 11 | |
| 12 | #include <stdio.h> |
| 13 | |
bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 14 | #if GR_GL_PER_GL_FUNC_CALLBACK |
| 15 | namespace { |
| 16 | void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} |
| 17 | } |
| 18 | #endif |
| 19 | |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 20 | GrGLInterface::GrGLInterface() { |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 21 | fBindingsExported = kNone_GrGLBinding; |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 22 | |
bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 23 | #if GR_GL_PER_GL_FUNC_CALLBACK |
| 24 | fCallback = GrGLDefaultInterfaceCallback; |
| 25 | fCallbackData = 0; |
| 26 | #endif |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 27 | } |
| 28 | |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 29 | bool GrGLInterface::validate(GrGLBinding binding) const { |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 30 | |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 31 | // kNone must be 0 so that the check we're about to do can never succeed if |
| 32 | // binding == kNone. |
| 33 | GR_STATIC_ASSERT(kNone_GrGLBinding == 0); |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 34 | |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 35 | if (0 == (binding & fBindingsExported)) { |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 36 | return false; |
| 37 | } |
| 38 | |
| 39 | // functions that are always required |
| 40 | if (NULL == fActiveTexture || |
| 41 | NULL == fAttachShader || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 42 | NULL == fBindAttribLocation || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 43 | NULL == fBindBuffer || |
| 44 | NULL == fBindTexture || |
| 45 | NULL == fBlendFunc || |
robertphillips@google.com | e788430 | 2012-04-18 14:39:58 +0000 | [diff] [blame] | 46 | NULL == fBlendColor || // -> GL >= 1.4, ES >= 2.0 or extension |
| 47 | NULL == fBlendEquation || // -> GL >= 1.4, ES >= 2.0 or extension |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 48 | NULL == fBufferData || |
| 49 | NULL == fBufferSubData || |
| 50 | NULL == fClear || |
| 51 | NULL == fClearColor || |
| 52 | NULL == fClearStencil || |
| 53 | NULL == fColorMask || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 54 | NULL == fCompileShader || |
| 55 | NULL == fCreateProgram || |
| 56 | NULL == fCreateShader || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 57 | NULL == fCullFace || |
| 58 | NULL == fDeleteBuffers || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 59 | NULL == fDeleteProgram || |
| 60 | NULL == fDeleteShader || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 61 | NULL == fDeleteTextures || |
| 62 | NULL == fDepthMask || |
| 63 | NULL == fDisable || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 64 | NULL == fDisableVertexAttribArray || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 65 | NULL == fDrawArrays || |
| 66 | NULL == fDrawElements || |
| 67 | NULL == fEnable || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 68 | NULL == fEnableVertexAttribArray || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 69 | NULL == fFrontFace || |
| 70 | NULL == fGenBuffers || |
| 71 | NULL == fGenTextures || |
| 72 | NULL == fGetBufferParameteriv || |
| 73 | NULL == fGetError || |
| 74 | NULL == fGetIntegerv || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 75 | NULL == fGetProgramInfoLog || |
| 76 | NULL == fGetProgramiv || |
| 77 | NULL == fGetShaderInfoLog || |
| 78 | NULL == fGetShaderiv || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 79 | NULL == fGetString || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 80 | NULL == fGetUniformLocation || |
| 81 | NULL == fLinkProgram || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 82 | NULL == fPixelStorei || |
| 83 | NULL == fReadPixels || |
| 84 | NULL == fScissor || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 85 | NULL == fShaderSource || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 86 | NULL == fStencilFunc || |
| 87 | NULL == fStencilMask || |
| 88 | NULL == fStencilOp || |
| 89 | NULL == fTexImage2D || |
| 90 | NULL == fTexParameteri || |
bsalomon@google.com | 4d063de | 2012-05-31 17:59:23 +0000 | [diff] [blame] | 91 | NULL == fTexParameteriv || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 92 | NULL == fTexSubImage2D || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 93 | NULL == fUniform1f || |
| 94 | NULL == fUniform1i || |
| 95 | NULL == fUniform1fv || |
| 96 | NULL == fUniform1iv || |
| 97 | NULL == fUniform2f || |
| 98 | NULL == fUniform2i || |
| 99 | NULL == fUniform2fv || |
| 100 | NULL == fUniform2iv || |
| 101 | NULL == fUniform3f || |
| 102 | NULL == fUniform3i || |
| 103 | NULL == fUniform3fv || |
| 104 | NULL == fUniform3iv || |
| 105 | NULL == fUniform4f || |
| 106 | NULL == fUniform4i || |
| 107 | NULL == fUniform4fv || |
| 108 | NULL == fUniform4iv || |
| 109 | NULL == fUniformMatrix2fv || |
| 110 | NULL == fUniformMatrix3fv || |
| 111 | NULL == fUniformMatrix4fv || |
| 112 | NULL == fUseProgram || |
| 113 | NULL == fVertexAttrib4fv || |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 114 | NULL == fVertexAttribPointer || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 115 | NULL == fViewport || |
| 116 | NULL == fBindFramebuffer || |
| 117 | NULL == fBindRenderbuffer || |
| 118 | NULL == fCheckFramebufferStatus || |
| 119 | NULL == fDeleteFramebuffers || |
| 120 | NULL == fDeleteRenderbuffers || |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 121 | NULL == fFinish || |
| 122 | NULL == fFlush || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 123 | NULL == fFramebufferRenderbuffer || |
| 124 | NULL == fFramebufferTexture2D || |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 125 | NULL == fGetFramebufferAttachmentParameteriv || |
| 126 | NULL == fGetRenderbufferParameteriv || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 127 | NULL == fGenFramebuffers || |
| 128 | NULL == fGenRenderbuffers || |
| 129 | NULL == fRenderbufferStorage) { |
| 130 | return false; |
| 131 | } |
| 132 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 133 | const char* ext; |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 134 | GrGLVersion glVer = GrGLGetVersion(this); |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 135 | ext = (const char*)fGetString(GR_GL_EXTENSIONS); |
| 136 | |
| 137 | // Now check that baseline ES/Desktop fns not covered above are present |
| 138 | // and that we have fn pointers for any advertised extensions that we will |
| 139 | // try to use. |
| 140 | |
| 141 | // these functions are part of ES2, we assume they are available |
| 142 | // On the desktop we assume they are available if the extension |
| 143 | // is present or GL version is high enough. |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 144 | if (kES2_GrGLBinding == binding) { |
robertphillips@google.com | e788430 | 2012-04-18 14:39:58 +0000 | [diff] [blame] | 145 | if (NULL == fStencilFuncSeparate || |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 146 | NULL == fStencilMaskSeparate || |
| 147 | NULL == fStencilOpSeparate) { |
| 148 | return false; |
| 149 | } |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 150 | } else if (kDesktop_GrGLBinding == binding) { |
robertphillips@google.com | e788430 | 2012-04-18 14:39:58 +0000 | [diff] [blame] | 151 | |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 152 | if (glVer >= GR_GL_VER(2,0)) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 153 | if (NULL == fStencilFuncSeparate || |
| 154 | NULL == fStencilMaskSeparate || |
| 155 | NULL == fStencilOpSeparate) { |
| 156 | return false; |
| 157 | } |
| 158 | } |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 159 | if (glVer >= GR_GL_VER(3,0) && NULL == fBindFragDataLocation) { |
bsalomon@google.com | bc5cf51 | 2011-09-21 16:21:07 +0000 | [diff] [blame] | 160 | return false; |
| 161 | } |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 162 | if (glVer >= GR_GL_VER(2,0) || |
| 163 | GrGLHasExtensionFromString("GL_ARB_draw_buffers", ext)) { |
bsalomon@google.com | d32c5f5 | 2011-08-02 19:29:03 +0000 | [diff] [blame] | 164 | if (NULL == fDrawBuffers) { |
| 165 | return false; |
| 166 | } |
| 167 | } |
robertphillips@google.com | e788430 | 2012-04-18 14:39:58 +0000 | [diff] [blame] | 168 | |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 169 | if (glVer >= GR_GL_VER(1,5) || |
| 170 | GrGLHasExtensionFromString("GL_ARB_occlusion_query", ext)) { |
| 171 | if (NULL == fGenQueries || |
| 172 | NULL == fDeleteQueries || |
| 173 | NULL == fBeginQuery || |
| 174 | NULL == fEndQuery || |
| 175 | NULL == fGetQueryiv || |
| 176 | NULL == fGetQueryObjectiv || |
| 177 | NULL == fGetQueryObjectuiv) { |
| 178 | return false; |
| 179 | } |
| 180 | } |
| 181 | if (glVer >= GR_GL_VER(3,3) || |
| 182 | GrGLHasExtensionFromString("GL_ARB_timer_query", ext) || |
| 183 | GrGLHasExtensionFromString("GL_EXT_timer_query", ext)) { |
| 184 | if (NULL == fGetQueryObjecti64v || |
| 185 | NULL == fGetQueryObjectui64v) { |
| 186 | return false; |
| 187 | } |
| 188 | } |
| 189 | if (glVer >= GR_GL_VER(3,3) || |
| 190 | GrGLHasExtensionFromString("GL_ARB_timer_query", ext)) { |
| 191 | if (NULL == fQueryCounter) { |
| 192 | return false; |
| 193 | } |
| 194 | } |
bsalomon@google.com | fe11cb6 | 2012-06-06 15:17:54 +0000 | [diff] [blame] | 195 | // The below two blocks are checks for functions used with |
| 196 | // GL_NV_path_rendering. We're not enforcing that they be non-NULL |
| 197 | // because they aren't actually called at this time. |
| 198 | if (false && |
bsalomon@google.com | d4340e2 | 2012-06-06 15:38:52 +0000 | [diff] [blame^] | 199 | (NULL == fMatrixMode || |
| 200 | NULL == fLoadIdentity || |
| 201 | NULL == fLoadMatrixf)) { |
bsalomon@google.com | fe11cb6 | 2012-06-06 15:17:54 +0000 | [diff] [blame] | 202 | return false; |
| 203 | } |
| 204 | if (false && GrGLHasExtensionFromString("GL_NV_path_rendering", ext)) { |
| 205 | if (NULL == fPathCommands || |
| 206 | NULL == fPathCoords || |
| 207 | NULL == fPathSubCommands || |
| 208 | NULL == fPathSubCoords || |
| 209 | NULL == fPathString || |
| 210 | NULL == fPathGlyphs || |
| 211 | NULL == fPathGlyphRange || |
| 212 | NULL == fWeightPaths || |
| 213 | NULL == fCopyPath || |
| 214 | NULL == fInterpolatePaths || |
| 215 | NULL == fTransformPath || |
| 216 | NULL == fPathParameteriv || |
| 217 | NULL == fPathParameteri || |
| 218 | NULL == fPathParameterfv || |
| 219 | NULL == fPathParameterf || |
| 220 | NULL == fPathDashArray || |
| 221 | NULL == fGenPaths || |
| 222 | NULL == fDeletePaths || |
| 223 | NULL == fIsPath || |
| 224 | NULL == fPathStencilFunc || |
| 225 | NULL == fPathStencilDepthOffset || |
| 226 | NULL == fStencilFillPath || |
| 227 | NULL == fStencilStrokePath || |
| 228 | NULL == fStencilFillPathInstanced || |
| 229 | NULL == fStencilStrokePathInstanced || |
| 230 | NULL == fPathCoverDepthFunc || |
| 231 | NULL == fPathColorGen || |
| 232 | NULL == fPathTexGen || |
| 233 | NULL == fPathFogGen || |
| 234 | NULL == fCoverFillPath || |
| 235 | NULL == fCoverStrokePath || |
| 236 | NULL == fCoverFillPathInstanced || |
| 237 | NULL == fCoverStrokePathInstanced || |
| 238 | NULL == fGetPathParameteriv || |
| 239 | NULL == fGetPathParameterfv || |
| 240 | NULL == fGetPathCommands || |
| 241 | NULL == fGetPathCoords || |
| 242 | NULL == fGetPathDashArray || |
| 243 | NULL == fGetPathMetrics || |
| 244 | NULL == fGetPathMetricRange || |
| 245 | NULL == fGetPathSpacing || |
| 246 | NULL == fGetPathColorGeniv || |
| 247 | NULL == fGetPathColorGenfv || |
| 248 | NULL == fGetPathTexGeniv || |
| 249 | NULL == fGetPathTexGenfv || |
| 250 | NULL == fIsPointInFillPath || |
| 251 | NULL == fIsPointInStrokePath || |
| 252 | NULL == fGetPathLength || |
| 253 | NULL == fPointAlongPath) { |
| 254 | return false; |
| 255 | } |
| 256 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | // optional function on desktop before 1.3 |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 260 | if (kDesktop_GrGLBinding != binding || |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 261 | (glVer >= GR_GL_VER(1,3) || |
| 262 | GrGLHasExtensionFromString("GL_ARB_texture_compression", ext))) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 263 | if (NULL == fCompressedTexImage2D) { |
| 264 | return false; |
| 265 | } |
| 266 | } |
| 267 | |
bsalomon@google.com | d32c5f5 | 2011-08-02 19:29:03 +0000 | [diff] [blame] | 268 | // part of desktop GL, but not ES |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 269 | if (kDesktop_GrGLBinding == binding && |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 270 | (NULL == fLineWidth || |
bsalomon@google.com | d32c5f5 | 2011-08-02 19:29:03 +0000 | [diff] [blame] | 271 | NULL == fGetTexLevelParameteriv || |
bsalomon@google.com | c49d66b | 2011-08-03 14:22:30 +0000 | [diff] [blame] | 272 | NULL == fDrawBuffer || |
| 273 | NULL == fReadBuffer)) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 274 | return false; |
| 275 | } |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 276 | |
bsalomon@google.com | 280e99f | 2012-01-05 16:17:38 +0000 | [diff] [blame] | 277 | // GL_EXT_texture_storage is part of desktop 4.2 |
| 278 | // There is a desktop ARB extension and an ES+desktop EXT extension |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 279 | if (kDesktop_GrGLBinding == binding) { |
bsalomon@google.com | baa9ea1 | 2012-01-06 19:05:43 +0000 | [diff] [blame] | 280 | if (glVer >= GR_GL_VER(4,2) || |
| 281 | GrGLHasExtensionFromString("GL_ARB_texture_storage", ext) || |
| 282 | GrGLHasExtensionFromString("GL_EXT_texture_storage", ext)) { |
| 283 | if (NULL == fTexStorage2D) { |
| 284 | return false; |
| 285 | } |
| 286 | } |
| 287 | } else if (GrGLHasExtensionFromString("GL_EXT_texture_storage", ext)) { |
| 288 | if (NULL == fTexStorage2D) { |
| 289 | return false; |
| 290 | } |
bsalomon@google.com | 280e99f | 2012-01-05 16:17:38 +0000 | [diff] [blame] | 291 | } |
| 292 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 293 | // FBO MSAA |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 294 | if (kDesktop_GrGLBinding == binding) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 295 | // GL 3.0 and the ARB extension have multisample + blit |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 296 | if (glVer >= GR_GL_VER(3,0) || GrGLHasExtensionFromString("GL_ARB_framebuffer_object", ext)) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 297 | if (NULL == fRenderbufferStorageMultisample || |
| 298 | NULL == fBlitFramebuffer) { |
| 299 | return false; |
| 300 | } |
| 301 | } else { |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 302 | if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit", ext) && |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 303 | NULL == fBlitFramebuffer) { |
| 304 | return false; |
| 305 | } |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 306 | if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample", ext) && |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 307 | NULL == fRenderbufferStorageMultisample) { |
| 308 | return false; |
| 309 | } |
| 310 | } |
| 311 | } else { |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 312 | if (GrGLHasExtensionFromString("GL_CHROMIUM_framebuffer_multisample", ext)) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 313 | if (NULL == fRenderbufferStorageMultisample || |
| 314 | NULL == fBlitFramebuffer) { |
| 315 | return false; |
| 316 | } |
| 317 | } |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 318 | if (GrGLHasExtensionFromString("GL_APPLE_framebuffer_multisample", ext)) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 319 | if (NULL == fRenderbufferStorageMultisample || |
| 320 | NULL == fResolveMultisampleFramebuffer) { |
| 321 | return false; |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | // On ES buffer mapping is an extension. On Desktop |
| 327 | // buffer mapping was part of original VBO extension |
| 328 | // which we require. |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 329 | if (kDesktop_GrGLBinding == binding || |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 330 | GrGLHasExtensionFromString("GL_OES_mapbuffer", ext)) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 331 | if (NULL == fMapBuffer || |
| 332 | NULL == fUnmapBuffer) { |
| 333 | return false; |
| 334 | } |
| 335 | } |
| 336 | |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 337 | // Dual source blending |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 338 | if (kDesktop_GrGLBinding == binding && |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 339 | (glVer >= GR_GL_VER(3,3) || |
| 340 | GrGLHasExtensionFromString("GL_ARB_blend_func_extended", ext))) { |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 341 | if (NULL == fBindFragDataLocationIndexed) { |
| 342 | return false; |
| 343 | } |
| 344 | } |
| 345 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 346 | return true; |
| 347 | } |
| 348 | |