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 | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 10 | #include "gl/GrGLExtensions.h" |
| 11 | #include "gl/GrGLUtil.h" |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 12 | |
| 13 | #include <stdio.h> |
| 14 | |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 15 | GrGLInterface::GrGLInterface() { |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 16 | fStandard = kNone_GrGLStandard; |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 17 | } |
| 18 | |
commit-bot@chromium.org | e83b9b7 | 2014-05-01 19:21:41 +0000 | [diff] [blame] | 19 | #ifdef SK_DEBUG |
| 20 | static int kIsDebug = 1; |
| 21 | #else |
| 22 | static int kIsDebug = 0; |
| 23 | #endif |
| 24 | |
| 25 | #define RETURN_FALSE_INTERFACE \ |
| 26 | if (kIsDebug) { SkDebugf("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); } \ |
| 27 | return false; |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 28 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 29 | bool GrGLInterface::validate() const { |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 30 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 31 | if (kNone_GrGLStandard == fStandard) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 32 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 33 | } |
skia.committer@gmail.com | 12eea2b | 2013-02-27 07:10:10 +0000 | [diff] [blame] | 34 | |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 35 | if (!fExtensions.isInitialized()) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 36 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 37 | } |
bsalomon@google.com | 1dcf506 | 2011-11-14 19:29:53 +0000 | [diff] [blame] | 38 | |
| 39 | // functions that are always required |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 40 | if (!fFunctions.fActiveTexture || |
| 41 | !fFunctions.fAttachShader || |
| 42 | !fFunctions.fBindAttribLocation || |
| 43 | !fFunctions.fBindBuffer || |
| 44 | !fFunctions.fBindTexture || |
| 45 | !fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0 |
| 46 | !fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0 |
| 47 | !fFunctions.fBlendFunc || |
| 48 | !fFunctions.fBufferData || |
| 49 | !fFunctions.fBufferSubData || |
| 50 | !fFunctions.fClear || |
| 51 | !fFunctions.fClearColor || |
| 52 | !fFunctions.fClearStencil || |
| 53 | !fFunctions.fColorMask || |
| 54 | !fFunctions.fCompileShader || |
| 55 | !fFunctions.fCompressedTexImage2D || |
| 56 | !fFunctions.fCompressedTexSubImage2D || |
| 57 | !fFunctions.fCopyTexSubImage2D || |
| 58 | !fFunctions.fCreateProgram || |
| 59 | !fFunctions.fCreateShader || |
| 60 | !fFunctions.fCullFace || |
| 61 | !fFunctions.fDeleteBuffers || |
| 62 | !fFunctions.fDeleteProgram || |
| 63 | !fFunctions.fDeleteShader || |
| 64 | !fFunctions.fDeleteTextures || |
| 65 | !fFunctions.fDepthMask || |
| 66 | !fFunctions.fDisable || |
| 67 | !fFunctions.fDisableVertexAttribArray || |
| 68 | !fFunctions.fDrawArrays || |
| 69 | !fFunctions.fDrawElements || |
| 70 | !fFunctions.fEnable || |
| 71 | !fFunctions.fEnableVertexAttribArray || |
| 72 | !fFunctions.fFrontFace || |
| 73 | !fFunctions.fGenBuffers || |
| 74 | !fFunctions.fGenTextures || |
| 75 | !fFunctions.fGetBufferParameteriv || |
| 76 | !fFunctions.fGenerateMipmap || |
| 77 | !fFunctions.fGetError || |
| 78 | !fFunctions.fGetIntegerv || |
| 79 | !fFunctions.fGetProgramInfoLog || |
| 80 | !fFunctions.fGetProgramiv || |
| 81 | !fFunctions.fGetShaderInfoLog || |
| 82 | !fFunctions.fGetShaderiv || |
| 83 | !fFunctions.fGetString || |
| 84 | !fFunctions.fGetUniformLocation || |
| 85 | !fFunctions.fIsTexture || |
| 86 | !fFunctions.fLinkProgram || |
| 87 | !fFunctions.fLineWidth || |
| 88 | !fFunctions.fPixelStorei || |
| 89 | !fFunctions.fReadPixels || |
| 90 | !fFunctions.fScissor || |
| 91 | !fFunctions.fShaderSource || |
| 92 | !fFunctions.fStencilFunc || |
| 93 | !fFunctions.fStencilFuncSeparate || |
| 94 | !fFunctions.fStencilMask || |
| 95 | !fFunctions.fStencilMaskSeparate || |
| 96 | !fFunctions.fStencilOp || |
| 97 | !fFunctions.fStencilOpSeparate || |
| 98 | !fFunctions.fTexImage2D || |
| 99 | !fFunctions.fTexParameteri || |
| 100 | !fFunctions.fTexParameteriv || |
| 101 | !fFunctions.fTexSubImage2D || |
| 102 | !fFunctions.fUniform1f || |
| 103 | !fFunctions.fUniform1i || |
| 104 | !fFunctions.fUniform1fv || |
| 105 | !fFunctions.fUniform1iv || |
| 106 | !fFunctions.fUniform2f || |
| 107 | !fFunctions.fUniform2i || |
| 108 | !fFunctions.fUniform2fv || |
| 109 | !fFunctions.fUniform2iv || |
| 110 | !fFunctions.fUniform3f || |
| 111 | !fFunctions.fUniform3i || |
| 112 | !fFunctions.fUniform3fv || |
| 113 | !fFunctions.fUniform3iv || |
| 114 | !fFunctions.fUniform4f || |
| 115 | !fFunctions.fUniform4i || |
| 116 | !fFunctions.fUniform4fv || |
| 117 | !fFunctions.fUniform4iv || |
| 118 | !fFunctions.fUniformMatrix2fv || |
| 119 | !fFunctions.fUniformMatrix3fv || |
| 120 | !fFunctions.fUniformMatrix4fv || |
| 121 | !fFunctions.fUseProgram || |
| 122 | !fFunctions.fVertexAttrib1f || |
| 123 | !fFunctions.fVertexAttrib2fv || |
| 124 | !fFunctions.fVertexAttrib3fv || |
| 125 | !fFunctions.fVertexAttrib4fv || |
| 126 | !fFunctions.fVertexAttribPointer || |
| 127 | !fFunctions.fViewport || |
| 128 | !fFunctions.fBindFramebuffer || |
| 129 | !fFunctions.fBindRenderbuffer || |
| 130 | !fFunctions.fCheckFramebufferStatus || |
| 131 | !fFunctions.fDeleteFramebuffers || |
| 132 | !fFunctions.fDeleteRenderbuffers || |
| 133 | !fFunctions.fFinish || |
| 134 | !fFunctions.fFlush || |
| 135 | !fFunctions.fFramebufferRenderbuffer || |
| 136 | !fFunctions.fFramebufferTexture2D || |
| 137 | !fFunctions.fGetFramebufferAttachmentParameteriv || |
| 138 | !fFunctions.fGetRenderbufferParameteriv || |
| 139 | !fFunctions.fGenFramebuffers || |
| 140 | !fFunctions.fGenRenderbuffers || |
| 141 | !fFunctions.fRenderbufferStorage) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 142 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 143 | } |
| 144 | |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 145 | GrGLVersion glVer = GrGLGetVersion(this); |
commit-bot@chromium.org | f4e67e3 | 2014-04-30 01:26:04 +0000 | [diff] [blame] | 146 | if (GR_GL_INVALID_VER == glVer) { |
| 147 | RETURN_FALSE_INTERFACE |
| 148 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 149 | |
| 150 | // Now check that baseline ES/Desktop fns not covered above are present |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 151 | // and that we have fn pointers for any advertised fExtensions that we will |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 152 | // try to use. |
| 153 | |
| 154 | // these functions are part of ES2, we assume they are available |
| 155 | // On the desktop we assume they are available if the extension |
| 156 | // is present or GL version is high enough. |
Brian Salomon | f086167 | 2017-05-08 11:10:10 -0400 | [diff] [blame] | 157 | if (kGL_GrGLStandard == fStandard) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 158 | if (glVer >= GR_GL_VER(3,0) && !fFunctions.fBindFragDataLocation) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 159 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bc5cf51 | 2011-09-21 16:21:07 +0000 | [diff] [blame] | 160 | } |
robertphillips@google.com | e788430 | 2012-04-18 14:39:58 +0000 | [diff] [blame] | 161 | |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 162 | if (glVer >= GR_GL_VER(3,3) || |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 163 | fExtensions.has("GL_ARB_timer_query") || |
| 164 | fExtensions.has("GL_EXT_timer_query")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 165 | if (!fFunctions.fGetQueryObjecti64v || |
| 166 | !fFunctions.fGetQueryObjectui64v) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 167 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 168 | } |
| 169 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 170 | if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 171 | if (!fFunctions.fQueryCounter) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 172 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 173 | } |
| 174 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 175 | } |
| 176 | |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 177 | // part of desktop GL, but not ES |
| 178 | if (kGL_GrGLStandard == fStandard && |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 179 | (!fFunctions.fDrawBuffer || |
| 180 | !fFunctions.fPolygonMode)) { |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 181 | RETURN_FALSE_INTERFACE |
| 182 | } |
| 183 | |
| 184 | // ES 3.0 (or ES 2.0 extended) has glDrawBuffers but not glDrawBuffer |
| 185 | if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 186 | if (!fFunctions.fDrawBuffers) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 187 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 188 | } |
| 189 | } |
| 190 | |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 191 | if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 192 | if (!fFunctions.fReadBuffer) { |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 193 | RETURN_FALSE_INTERFACE |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | // glGetTexLevelParameteriv was added to ES in 3.1. |
| 198 | if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,1)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 199 | if (!fFunctions.fGetTexLevelParameteriv) { |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 200 | RETURN_FALSE_INTERFACE |
| 201 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 202 | } |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 203 | |
bsalomon@google.com | 280e99f | 2012-01-05 16:17:38 +0000 | [diff] [blame] | 204 | // GL_EXT_texture_storage is part of desktop 4.2 |
| 205 | // There is a desktop ARB extension and an ES+desktop EXT extension |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 206 | if (kGL_GrGLStandard == fStandard) { |
bsalomon@google.com | baa9ea1 | 2012-01-06 19:05:43 +0000 | [diff] [blame] | 207 | if (glVer >= GR_GL_VER(4,2) || |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 208 | fExtensions.has("GL_ARB_texture_storage") || |
| 209 | fExtensions.has("GL_EXT_texture_storage")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 210 | if (!fFunctions.fTexStorage2D) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 211 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | baa9ea1 | 2012-01-06 19:05:43 +0000 | [diff] [blame] | 212 | } |
| 213 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 214 | } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 215 | if (!fFunctions.fTexStorage2D) { |
kkinnunen | f655e93 | 2016-03-03 07:39:48 -0800 | [diff] [blame] | 216 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | baa9ea1 | 2012-01-06 19:05:43 +0000 | [diff] [blame] | 217 | } |
bsalomon@google.com | 280e99f | 2012-01-05 16:17:38 +0000 | [diff] [blame] | 218 | } |
| 219 | |
cdalton | fd4167d | 2015-04-21 11:45:56 -0700 | [diff] [blame] | 220 | // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extensions. |
| 221 | if (kGL_GrGLStandard == fStandard) { |
| 222 | if (glVer >= GR_GL_VER(4,5) || |
| 223 | fExtensions.has("GL_ARB_texture_barrier") || |
| 224 | fExtensions.has("GL_NV_texture_barrier")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 225 | if (!fFunctions.fTextureBarrier) { |
cdalton | fd4167d | 2015-04-21 11:45:56 -0700 | [diff] [blame] | 226 | RETURN_FALSE_INTERFACE |
| 227 | } |
| 228 | } |
| 229 | } else if (fExtensions.has("GL_NV_texture_barrier")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 230 | if (!fFunctions.fTextureBarrier) { |
cdalton | fd4167d | 2015-04-21 11:45:56 -0700 | [diff] [blame] | 231 | RETURN_FALSE_INTERFACE |
| 232 | } |
| 233 | } |
| 234 | |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 235 | if (fExtensions.has("GL_KHR_blend_equation_advanced") || |
| 236 | fExtensions.has("GL_NV_blend_equation_advanced")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 237 | if (!fFunctions.fBlendBarrier) { |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 238 | RETURN_FALSE_INTERFACE |
| 239 | } |
| 240 | } |
| 241 | |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 242 | if (fExtensions.has("GL_EXT_discard_framebuffer")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 243 | if (!fFunctions.fDiscardFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 244 | RETURN_FALSE_INTERFACE |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 245 | } |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 246 | } |
| 247 | |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 248 | // Required since OpenGL 1.5 and ES 3.0 or with GL_EXT_occlusion_query_boolean |
| 249 | if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0) || |
| 250 | fExtensions.has("GL_EXT_occlusion_query_boolean")) { |
| 251 | #if 0 // Not yet added to chrome's bindings. |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 252 | if (!fFunctions.fGenQueries || |
| 253 | !fFunctions.fDeleteQueries || |
| 254 | !fFunctions.fBeginQuery || |
| 255 | !fFunctions.fEndQuery || |
| 256 | !fFunctions.fGetQueryiv || |
| 257 | !fFunctions.fGetQueryObjectuiv) { |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 258 | RETURN_FALSE_INTERFACE |
| 259 | } |
| 260 | #endif |
| 261 | } |
| 262 | // glGetQueryObjectiv doesn't exist in ES. |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 263 | if (kGL_GrGLStandard == fStandard && !fFunctions.fGetQueryObjectiv) { |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 264 | RETURN_FALSE_INTERFACE |
| 265 | } |
| 266 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 267 | // FBO MSAA |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 268 | if (kGL_GrGLStandard == fStandard) { |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 269 | // GL 3.0 and the ARB extension have multisample + blit |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 270 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 271 | if (!fFunctions.fRenderbufferStorageMultisample || |
| 272 | !fFunctions.fBlitFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 273 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 274 | } |
| 275 | } else { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 276 | if (fExtensions.has("GL_EXT_framebuffer_blit") && |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 277 | !fFunctions.fBlitFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 278 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 279 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 280 | if (fExtensions.has("GL_EXT_framebuffer_multisample") && |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 281 | !fFunctions.fRenderbufferStorageMultisample) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 282 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 283 | } |
| 284 | } |
| 285 | } else { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 286 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 287 | if (!fFunctions.fRenderbufferStorageMultisample || |
| 288 | !fFunctions.fBlitFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 289 | RETURN_FALSE_INTERFACE |
commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 290 | } |
Brian Salomon | c5eceb0 | 2016-10-18 10:21:43 -0400 | [diff] [blame] | 291 | } else { |
| 292 | if (fExtensions.has("GL_ANGLE_framebuffer_multisample") && |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 293 | !fFunctions.fRenderbufferStorageMultisample) { |
Brian Salomon | c5eceb0 | 2016-10-18 10:21:43 -0400 | [diff] [blame] | 294 | RETURN_FALSE_INTERFACE |
| 295 | } |
| 296 | if (fExtensions.has("GL_ANGLE_framebuffer_blit") && |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 297 | !fFunctions.fBlitFramebuffer) { |
Brian Salomon | c5eceb0 | 2016-10-18 10:21:43 -0400 | [diff] [blame] | 298 | RETURN_FALSE_INTERFACE |
| 299 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 300 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 301 | if (fExtensions.has("GL_APPLE_framebuffer_multisample")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 302 | if (!fFunctions.fRenderbufferStorageMultisampleES2APPLE || |
| 303 | !fFunctions.fResolveMultisampleFramebuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 304 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 305 | } |
| 306 | } |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 307 | if (fExtensions.has("GL_IMG_multisampled_render_to_texture") || |
| 308 | fExtensions.has("GL_EXT_multisampled_render_to_texture")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 309 | if (!fFunctions.fRenderbufferStorageMultisampleES2EXT || |
| 310 | !fFunctions.fFramebufferTexture2DMultisample) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 311 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | f3a60c0 | 2013-03-19 19:06:09 +0000 | [diff] [blame] | 312 | } |
| 313 | } |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | // On ES buffer mapping is an extension. On Desktop |
| 317 | // buffer mapping was part of original VBO extension |
| 318 | // which we require. |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 319 | if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 320 | if (!fFunctions.fMapBuffer || |
| 321 | !fFunctions.fUnmapBuffer) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 322 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 323 | } |
| 324 | } |
| 325 | |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 326 | // Dual source blending |
kkinnunen | d94708e | 2015-07-30 22:47:04 -0700 | [diff] [blame] | 327 | if (kGL_GrGLStandard == fStandard) { |
| 328 | if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 329 | if (!fFunctions.fBindFragDataLocationIndexed) { |
kkinnunen | d94708e | 2015-07-30 22:47:04 -0700 | [diff] [blame] | 330 | RETURN_FALSE_INTERFACE |
| 331 | } |
| 332 | } |
| 333 | } else { |
| 334 | if (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 335 | if (!fFunctions.fBindFragDataLocation || |
| 336 | !fFunctions.fBindFragDataLocationIndexed) { |
kkinnunen | d94708e | 2015-07-30 22:47:04 -0700 | [diff] [blame] | 337 | RETURN_FALSE_INTERFACE |
| 338 | } |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 339 | } |
| 340 | } |
skia.committer@gmail.com | 12eea2b | 2013-02-27 07:10:10 +0000 | [diff] [blame] | 341 | |
kkinnunen | d94708e | 2015-07-30 22:47:04 -0700 | [diff] [blame] | 342 | |
commit-bot@chromium.org | 726e621 | 2013-08-23 20:55:46 +0000 | [diff] [blame] | 343 | // glGetStringi was added in version 3.0 of both desktop and ES. |
| 344 | if (glVer >= GR_GL_VER(3, 0)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 345 | if (!fFunctions.fGetStringi) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 346 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 347 | } |
| 348 | } |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 349 | |
cdalton | 793dc26 | 2016-02-08 10:11:47 -0800 | [diff] [blame] | 350 | // glVertexAttribIPointer was added in version 3.0 of both desktop and ES. |
| 351 | if (glVer >= GR_GL_VER(3, 0)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 352 | if (!fFunctions.fVertexAttribIPointer) { |
cdalton | 793dc26 | 2016-02-08 10:11:47 -0800 | [diff] [blame] | 353 | RETURN_FALSE_INTERFACE |
| 354 | } |
| 355 | } |
| 356 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 357 | if (kGL_GrGLStandard == fStandard) { |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 358 | if (glVer >= GR_GL_VER(3,1)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 359 | if (!fFunctions.fTexBuffer) { |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 360 | RETURN_FALSE_INTERFACE; |
| 361 | } |
| 362 | } |
cdalton | f8a6ce8 | 2016-04-11 13:02:05 -0700 | [diff] [blame] | 363 | if (glVer >= GR_GL_VER(4,3)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 364 | if (!fFunctions.fTexBufferRange) { |
cdalton | f8a6ce8 | 2016-04-11 13:02:05 -0700 | [diff] [blame] | 365 | RETURN_FALSE_INTERFACE; |
| 366 | } |
| 367 | } |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 368 | } else { |
| 369 | if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_OES_texture_buffer") || |
| 370 | fExtensions.has("GL_EXT_texture_buffer")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 371 | if (!fFunctions.fTexBuffer || |
| 372 | !fFunctions.fTexBufferRange) { |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 373 | RETURN_FALSE_INTERFACE; |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | if (kGL_GrGLStandard == fStandard) { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 379 | if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 380 | if (!fFunctions.fBindVertexArray || |
| 381 | !fFunctions.fDeleteVertexArrays || |
| 382 | !fFunctions.fGenVertexArrays) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 383 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 384 | } |
| 385 | } |
| 386 | } else { |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 387 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 388 | if (!fFunctions.fBindVertexArray || |
| 389 | !fFunctions.fDeleteVertexArrays || |
| 390 | !fFunctions.fGenVertexArrays) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 391 | RETURN_FALSE_INTERFACE |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 392 | } |
| 393 | } |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 394 | } |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 395 | |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 396 | if (fExtensions.has("GL_EXT_debug_marker")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 397 | if (!fFunctions.fInsertEventMarker || |
| 398 | !fFunctions.fPushGroupMarker || |
| 399 | !fFunctions.fPopGroupMarker) { |
commit-bot@chromium.org | adadf7c | 2014-03-24 19:43:02 +0000 | [diff] [blame] | 400 | RETURN_FALSE_INTERFACE |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 401 | } |
| 402 | } |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 403 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 404 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || |
| 405 | fExtensions.has("GL_ARB_invalidate_subdata")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 406 | if (!fFunctions.fInvalidateBufferData || |
| 407 | !fFunctions.fInvalidateBufferSubData || |
| 408 | !fFunctions.fInvalidateFramebuffer || |
| 409 | !fFunctions.fInvalidateSubFramebuffer || |
| 410 | !fFunctions.fInvalidateTexImage || |
| 411 | !fFunctions.fInvalidateTexSubImage) { |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 412 | RETURN_FALSE_INTERFACE; |
| 413 | } |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 414 | } else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) { |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 415 | // ES 3.0 adds the framebuffer functions but not the others. |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 416 | if (!fFunctions.fInvalidateFramebuffer || |
| 417 | !fFunctions.fInvalidateSubFramebuffer) { |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 418 | RETURN_FALSE_INTERFACE; |
| 419 | } |
| 420 | } |
commit-bot@chromium.org | beb8b3a | 2014-04-15 15:37:51 +0000 | [diff] [blame] | 421 | |
| 422 | if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_CHROMIUM_map_sub")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 423 | if (!fFunctions.fMapBufferSubData || |
| 424 | !fFunctions.fMapTexSubImage2D || |
| 425 | !fFunctions.fUnmapBufferSubData || |
| 426 | !fFunctions.fUnmapTexSubImage2D) { |
commit-bot@chromium.org | beb8b3a | 2014-04-15 15:37:51 +0000 | [diff] [blame] | 427 | RETURN_FALSE_INTERFACE; |
| 428 | } |
| 429 | } |
bsalomon@google.com | a34bb60 | 2014-04-01 13:07:29 +0000 | [diff] [blame] | 430 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 431 | // These functions are added to the 3.0 version of both GLES and GL. |
| 432 | if (glVer >= GR_GL_VER(3,0) || |
| 433 | (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_range")) || |
| 434 | (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_range"))) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 435 | if (!fFunctions.fMapBufferRange || |
| 436 | !fFunctions.fFlushMappedBufferRange) { |
kkinnunen | f655e93 | 2016-03-03 07:39:48 -0800 | [diff] [blame] | 437 | RETURN_FALSE_INTERFACE; |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 438 | } |
| 439 | } |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 440 | |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 441 | if ((kGL_GrGLStandard == fStandard && |
cdalton | eb79eea | 2016-02-26 10:39:34 -0800 | [diff] [blame] | 442 | (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_texture_multisample"))) || |
| 443 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 444 | if (!fFunctions.fGetMultisamplefv) { |
cdalton | eb79eea | 2016-02-26 10:39:34 -0800 | [diff] [blame] | 445 | RETURN_FALSE_INTERFACE |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | if ((kGL_GrGLStandard == fStandard && |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 450 | (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) || |
| 451 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 452 | if (!fFunctions.fGetProgramResourceLocation) { |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 453 | RETURN_FALSE_INTERFACE |
| 454 | } |
| 455 | } |
| 456 | |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 457 | if (kGLES_GrGLStandard == fStandard || glVer >= GR_GL_VER(4,1) || |
| 458 | fExtensions.has("GL_ARB_ES2_compatibility")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 459 | if (!fFunctions.fGetShaderPrecisionFormat) { |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 460 | RETURN_FALSE_INTERFACE |
| 461 | } |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 462 | } |
| 463 | |
kkinnunen | 6bb6d40 | 2015-07-14 10:59:23 -0700 | [diff] [blame] | 464 | if (fExtensions.has("GL_NV_path_rendering") || fExtensions.has("GL_CHROMIUM_path_rendering")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 465 | if (!fFunctions.fMatrixLoadf || |
| 466 | !fFunctions.fMatrixLoadIdentity || |
| 467 | !fFunctions.fPathCommands || |
| 468 | !fFunctions.fPathParameteri || |
| 469 | !fFunctions.fPathParameterf || |
| 470 | !fFunctions.fGenPaths || |
| 471 | !fFunctions.fDeletePaths || |
| 472 | !fFunctions.fIsPath || |
| 473 | !fFunctions.fPathStencilFunc || |
| 474 | !fFunctions.fStencilFillPath || |
| 475 | !fFunctions.fStencilStrokePath || |
| 476 | !fFunctions.fStencilFillPathInstanced || |
| 477 | !fFunctions.fStencilStrokePathInstanced || |
| 478 | !fFunctions.fCoverFillPath || |
| 479 | !fFunctions.fCoverStrokePath || |
| 480 | !fFunctions.fCoverFillPathInstanced || |
| 481 | !fFunctions.fCoverStrokePathInstanced |
kkinnunen | cfe62e3 | 2015-07-01 02:58:50 -0700 | [diff] [blame] | 482 | #if 0 |
| 483 | // List of functions that Skia uses, but which have been added since the initial release |
| 484 | // of NV_path_rendering driver. We do not want to fail interface validation due to |
| 485 | // missing features, we will just not use the extension. |
| 486 | // Update this list -> update GrGLCaps::hasPathRenderingSupport too. |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 487 | || !fFunctions.fStencilThenCoverFillPath || |
| 488 | !fFunctions.fStencilThenCoverStrokePath || |
| 489 | !fFunctions.fStencilThenCoverFillPathInstanced || |
| 490 | !fFunctions.fStencilThenCoverStrokePathInstanced || |
| 491 | !fFunctions.fProgramPathFragmentInputGen |
kkinnunen | cfe62e3 | 2015-07-01 02:58:50 -0700 | [diff] [blame] | 492 | #endif |
| 493 | ) { |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 494 | RETURN_FALSE_INTERFACE |
| 495 | } |
kkinnunen | 6bb6d40 | 2015-07-14 10:59:23 -0700 | [diff] [blame] | 496 | if (fExtensions.has("GL_CHROMIUM_path_rendering")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 497 | if (!fFunctions.fBindFragmentInputLocation) { |
kkinnunen | 6bb6d40 | 2015-07-14 10:59:23 -0700 | [diff] [blame] | 498 | RETURN_FALSE_INTERFACE |
| 499 | } |
| 500 | } |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 501 | } |
| 502 | |
cdalton | 0edea2c | 2015-05-21 08:27:44 -0700 | [diff] [blame] | 503 | if (fExtensions.has("GL_EXT_raster_multisample")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 504 | if (!fFunctions.fRasterSamples) { |
cdalton | 0edea2c | 2015-05-21 08:27:44 -0700 | [diff] [blame] | 505 | RETURN_FALSE_INTERFACE |
| 506 | } |
| 507 | } |
| 508 | |
kkinnunen | ea40943 | 2015-12-10 01:21:59 -0800 | [diff] [blame] | 509 | if (fExtensions.has("GL_NV_framebuffer_mixed_samples") || |
| 510 | fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 511 | if (!fFunctions.fCoverageModulation) { |
vbuzinov | 08b4d29 | 2015-04-01 06:29:49 -0700 | [diff] [blame] | 512 | RETURN_FALSE_INTERFACE |
| 513 | } |
| 514 | } |
| 515 | |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 516 | if (kGL_GrGLStandard == fStandard) { |
| 517 | if (glVer >= GR_GL_VER(3,1) || |
| 518 | fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_draw_instanced")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 519 | if (!fFunctions.fDrawArraysInstanced || |
| 520 | !fFunctions.fDrawElementsInstanced) { |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 521 | RETURN_FALSE_INTERFACE |
| 522 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 523 | } |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 524 | } else if (kGLES_GrGLStandard == fStandard) { |
kkinnunen | f655e93 | 2016-03-03 07:39:48 -0800 | [diff] [blame] | 525 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instanced")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 526 | if (!fFunctions.fDrawArraysInstanced || |
| 527 | !fFunctions.fDrawElementsInstanced) { |
kkinnunen | f655e93 | 2016-03-03 07:39:48 -0800 | [diff] [blame] | 528 | RETURN_FALSE_INTERFACE |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 529 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 530 | } |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 531 | } |
| 532 | |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 533 | if (kGL_GrGLStandard == fStandard) { |
| 534 | if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 535 | if (!fFunctions.fVertexAttribDivisor) { |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 536 | RETURN_FALSE_INTERFACE |
| 537 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 538 | } |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 539 | } else if (kGLES_GrGLStandard == fStandard) { |
kkinnunen | f655e93 | 2016-03-03 07:39:48 -0800 | [diff] [blame] | 540 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arrays")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 541 | if (!fFunctions.fVertexAttribDivisor) { |
kkinnunen | f655e93 | 2016-03-03 07:39:48 -0800 | [diff] [blame] | 542 | RETURN_FALSE_INTERFACE |
hendrikw | b3f1636 | 2015-10-19 06:13:55 -0700 | [diff] [blame] | 543 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 544 | } |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 545 | } |
| 546 | |
csmartdalton | 5cebf8c | 2016-06-03 08:28:47 -0700 | [diff] [blame] | 547 | if ((kGL_GrGLStandard == fStandard && |
| 548 | (glVer >= GR_GL_VER(4,0) || fExtensions.has("GL_ARB_draw_indirect"))) || |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 549 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 550 | if (!fFunctions.fDrawArraysIndirect || |
| 551 | !fFunctions.fDrawElementsIndirect) { |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 552 | RETURN_FALSE_INTERFACE |
| 553 | } |
| 554 | } |
| 555 | |
csmartdalton | 5cebf8c | 2016-06-03 08:28:47 -0700 | [diff] [blame] | 556 | if ((kGL_GrGLStandard == fStandard && |
| 557 | (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_multi_draw_indirect"))) || |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 558 | (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_multi_draw_indirect"))) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 559 | if (!fFunctions.fMultiDrawArraysIndirect || |
| 560 | !fFunctions.fMultiDrawElementsIndirect) { |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 561 | RETURN_FALSE_INTERFACE |
| 562 | } |
| 563 | } |
| 564 | |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 565 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || |
| 566 | fExtensions.has("GL_KHR_debug")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 567 | if (!fFunctions.fDebugMessageControl || |
| 568 | !fFunctions.fDebugMessageInsert || |
| 569 | !fFunctions.fDebugMessageCallback || |
| 570 | !fFunctions.fGetDebugMessageLog || |
| 571 | !fFunctions.fPushDebugGroup || |
| 572 | !fFunctions.fPopDebugGroup || |
| 573 | !fFunctions.fObjectLabel) { |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 574 | RETURN_FALSE_INTERFACE |
| 575 | } |
| 576 | } |
| 577 | |
csmartdalton | 9bc1187 | 2016-08-09 12:42:47 -0700 | [diff] [blame] | 578 | if (fExtensions.has("GL_EXT_window_rectangles")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 579 | if (!fFunctions.fWindowRectangles) { |
csmartdalton | 9bc1187 | 2016-08-09 12:42:47 -0700 | [diff] [blame] | 580 | RETURN_FALSE_INTERFACE |
| 581 | } |
| 582 | } |
| 583 | |
ethannicholas | 28ef445 | 2016-03-25 09:26:03 -0700 | [diff] [blame] | 584 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,0)) || |
| 585 | fExtensions.has("GL_ARB_sample_shading")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 586 | if (!fFunctions.fMinSampleShading) { |
ethannicholas | 28ef445 | 2016-03-25 09:26:03 -0700 | [diff] [blame] | 587 | RETURN_FALSE_INTERFACE |
| 588 | } |
bsalomon | 23c4f1a | 2016-07-19 06:21:55 -0700 | [diff] [blame] | 589 | } else if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_OES_sample_shading")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 590 | if (!fFunctions.fMinSampleShading) { |
ethannicholas | 28ef445 | 2016-03-25 09:26:03 -0700 | [diff] [blame] | 591 | RETURN_FALSE_INTERFACE |
| 592 | } |
| 593 | } |
| 594 | |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 595 | if (kGL_GrGLStandard == fStandard) { |
| 596 | if (glVer >= GR_GL_VER(3, 2) || fExtensions.has("GL_ARB_sync")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 597 | if (!fFunctions.fFenceSync || |
Greg Daniel | 6bd729d | 2017-07-31 09:38:23 -0400 | [diff] [blame] | 598 | !fFunctions.fIsSync || |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 599 | !fFunctions.fClientWaitSync || |
| 600 | !fFunctions.fWaitSync || |
| 601 | !fFunctions.fDeleteSync) { |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 602 | RETURN_FALSE_INTERFACE |
| 603 | } |
| 604 | } |
| 605 | } else if (kGLES_GrGLStandard == fStandard) { |
Brian Osman | 93a2346 | 2017-06-21 15:13:39 -0400 | [diff] [blame] | 606 | if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_APPLE_sync")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 607 | if (!fFunctions.fFenceSync || |
Greg Daniel | 6bd729d | 2017-07-31 09:38:23 -0400 | [diff] [blame] | 608 | !fFunctions.fIsSync || |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 609 | !fFunctions.fClientWaitSync || |
| 610 | !fFunctions.fWaitSync || |
| 611 | !fFunctions.fDeleteSync) { |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 612 | RETURN_FALSE_INTERFACE |
| 613 | } |
| 614 | } |
| 615 | } |
| 616 | |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 617 | if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base")) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 618 | if (!fFunctions.fEGLCreateImage || |
| 619 | !fFunctions.fEGLDestroyImage) { |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 620 | RETURN_FALSE_INTERFACE |
| 621 | } |
| 622 | } |
| 623 | |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 624 | // glDrawRangeElements was added to ES in 3.0. |
| 625 | if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0)) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 626 | if (!fFunctions.fDrawRangeElements) { |
bsalomon | fc9527a | 2016-08-29 09:18:39 -0700 | [diff] [blame] | 627 | RETURN_FALSE_INTERFACE; |
| 628 | } |
| 629 | } |
| 630 | |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 631 | // getInternalformativ was added in GL 4.2, ES 3.0, and with extension ARB_internalformat_query |
| 632 | if ((kGL_GrGLStandard == fStandard && |
| 633 | (glVer >= GR_GL_VER(4,2) || fExtensions.has("GL_ARB_internalformat_query"))) || |
| 634 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0))) { |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 635 | if (!fFunctions.fGetInternalformativ) { |
Greg Daniel | 6bd729d | 2017-07-31 09:38:23 -0400 | [diff] [blame] | 636 | RETURN_FALSE_INTERFACE; |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 637 | } |
| 638 | } |
| 639 | |
Ethan Nicholas | d1b2eec | 2017-11-01 15:45:43 -0400 | [diff] [blame] | 640 | if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,1)) || |
| 641 | (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0))) { |
| 642 | if (!fFunctions.fGetProgramBinary || |
| 643 | !fFunctions.fProgramBinary || |
| 644 | !fFunctions.fProgramParameteri) { |
| 645 | RETURN_FALSE_INTERFACE; |
| 646 | } |
| 647 | } |
| 648 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 649 | return true; |
| 650 | } |