Kevin Lubick | 5509dac | 2019-03-25 17:23:55 -0400 | [diff] [blame^] | 1 | /* |
| 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. |
| 6 | * |
| 7 | * THIS FILE IS AUTOGENERATED |
| 8 | * Make edits to tools/gpu/gl/interface/templates.go or they will |
| 9 | * be overwritten. |
| 10 | */ |
| 11 | |
| 12 | #include "gl/GrGLInterface.h" |
| 13 | #include "gl/GrGLExtensions.h" |
| 14 | #include "gl/GrGLUtil.h" |
| 15 | |
| 16 | #include <stdio.h> |
| 17 | |
| 18 | GrGLInterface::GrGLInterface() { |
| 19 | fStandard = kNone_GrGLStandard; |
| 20 | } |
| 21 | |
| 22 | #define RETURN_FALSE_INTERFACE \ |
| 23 | SkDEBUGF("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); \ |
| 24 | return false |
| 25 | |
| 26 | bool GrGLInterface::validate() const { |
| 27 | |
| 28 | if (kNone_GrGLStandard == fStandard) { |
| 29 | RETURN_FALSE_INTERFACE; |
| 30 | } |
| 31 | |
| 32 | if (!fExtensions.isInitialized()) { |
| 33 | RETURN_FALSE_INTERFACE; |
| 34 | } |
| 35 | |
| 36 | GrGLVersion glVer = GrGLGetVersion(this); |
| 37 | if (GR_GL_INVALID_VER == glVer) { |
| 38 | RETURN_FALSE_INTERFACE; |
| 39 | } |
| 40 | // Autogenerated content follows |
| 41 | if (!fFunctions.fActiveTexture || |
| 42 | !fFunctions.fAttachShader || |
| 43 | !fFunctions.fBindAttribLocation || |
| 44 | !fFunctions.fBindBuffer || |
| 45 | !fFunctions.fBindTexture || |
| 46 | !fFunctions.fBlendColor || |
| 47 | !fFunctions.fBlendEquation || |
| 48 | !fFunctions.fBlendFunc || |
| 49 | !fFunctions.fBufferData || |
| 50 | !fFunctions.fBufferSubData || |
| 51 | !fFunctions.fClear || |
| 52 | !fFunctions.fClearColor || |
| 53 | !fFunctions.fClearStencil || |
| 54 | !fFunctions.fColorMask || |
| 55 | !fFunctions.fCompileShader || |
| 56 | !fFunctions.fCompressedTexImage2D || |
| 57 | !fFunctions.fCompressedTexSubImage2D || |
| 58 | !fFunctions.fCopyTexSubImage2D || |
| 59 | !fFunctions.fCreateProgram || |
| 60 | !fFunctions.fCreateShader || |
| 61 | !fFunctions.fCullFace || |
| 62 | !fFunctions.fDeleteBuffers || |
| 63 | !fFunctions.fDeleteProgram || |
| 64 | !fFunctions.fDeleteShader || |
| 65 | !fFunctions.fDeleteTextures || |
| 66 | !fFunctions.fDepthMask || |
| 67 | !fFunctions.fDisable || |
| 68 | !fFunctions.fDisableVertexAttribArray || |
| 69 | !fFunctions.fDrawArrays || |
| 70 | !fFunctions.fDrawElements || |
| 71 | !fFunctions.fEnable || |
| 72 | !fFunctions.fEnableVertexAttribArray || |
| 73 | !fFunctions.fFinish || |
| 74 | !fFunctions.fFlush || |
| 75 | !fFunctions.fFrontFace || |
| 76 | !fFunctions.fGenBuffers || |
| 77 | !fFunctions.fGenTextures || |
| 78 | !fFunctions.fGetBufferParameteriv || |
| 79 | !fFunctions.fGetError || |
| 80 | !fFunctions.fGetIntegerv || |
| 81 | !fFunctions.fGetProgramInfoLog || |
| 82 | !fFunctions.fGetProgramiv || |
| 83 | !fFunctions.fGetShaderInfoLog || |
| 84 | !fFunctions.fGetShaderiv || |
| 85 | !fFunctions.fGetString || |
| 86 | !fFunctions.fGetUniformLocation || |
| 87 | !fFunctions.fIsTexture || |
| 88 | !fFunctions.fLineWidth || |
| 89 | !fFunctions.fLinkProgram || |
| 90 | !fFunctions.fPixelStorei || |
| 91 | !fFunctions.fReadPixels || |
| 92 | !fFunctions.fScissor || |
| 93 | !fFunctions.fShaderSource || |
| 94 | !fFunctions.fStencilFunc || |
| 95 | !fFunctions.fStencilFuncSeparate || |
| 96 | !fFunctions.fStencilMask || |
| 97 | !fFunctions.fStencilMaskSeparate || |
| 98 | !fFunctions.fStencilOp || |
| 99 | !fFunctions.fStencilOpSeparate || |
| 100 | !fFunctions.fTexImage2D || |
| 101 | !fFunctions.fTexParameterf || |
| 102 | !fFunctions.fTexParameterfv || |
| 103 | !fFunctions.fTexParameteri || |
| 104 | !fFunctions.fTexParameteriv || |
| 105 | !fFunctions.fTexSubImage2D || |
| 106 | !fFunctions.fUniform1f || |
| 107 | !fFunctions.fUniform1fv || |
| 108 | !fFunctions.fUniform1i || |
| 109 | !fFunctions.fUniform1iv || |
| 110 | !fFunctions.fUniform2f || |
| 111 | !fFunctions.fUniform2fv || |
| 112 | !fFunctions.fUniform2i || |
| 113 | !fFunctions.fUniform2iv || |
| 114 | !fFunctions.fUniform3f || |
| 115 | !fFunctions.fUniform3fv || |
| 116 | !fFunctions.fUniform3i || |
| 117 | !fFunctions.fUniform3iv || |
| 118 | !fFunctions.fUniform4f || |
| 119 | !fFunctions.fUniform4fv || |
| 120 | !fFunctions.fUniform4i || |
| 121 | !fFunctions.fUniform4iv || |
| 122 | !fFunctions.fUniformMatrix2fv || |
| 123 | !fFunctions.fUniformMatrix3fv || |
| 124 | !fFunctions.fUniformMatrix4fv || |
| 125 | !fFunctions.fUseProgram || |
| 126 | !fFunctions.fVertexAttrib1f || |
| 127 | !fFunctions.fVertexAttrib2fv || |
| 128 | !fFunctions.fVertexAttrib3fv || |
| 129 | !fFunctions.fVertexAttrib4fv || |
| 130 | !fFunctions.fVertexAttribPointer || |
| 131 | !fFunctions.fViewport) { |
| 132 | RETURN_FALSE_INTERFACE; |
| 133 | } |
| 134 | |
| 135 | if (GR_IS_GR_GL(fStandard)) { |
| 136 | if (!fFunctions.fDrawBuffer || |
| 137 | !fFunctions.fPolygonMode) { |
| 138 | RETURN_FALSE_INTERFACE; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | if ((GR_IS_GR_GL(fStandard) && ( |
| 143 | (glVer >= GR_GL_VER(3,0)))) || |
| 144 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 145 | (glVer >= GR_GL_VER(3,0))))) { |
| 146 | if (!fFunctions.fGetStringi) { |
| 147 | RETURN_FALSE_INTERFACE; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | if (GR_IS_GR_GL(fStandard) || |
| 152 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 153 | (glVer >= GR_GL_VER(3,0)) || |
| 154 | fExtensions.has("GL_OES_vertex_array_object")))) { |
| 155 | if (!fFunctions.fBindVertexArray || |
| 156 | !fFunctions.fDeleteVertexArrays || |
| 157 | !fFunctions.fGenVertexArrays) { |
| 158 | RETURN_FALSE_INTERFACE; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | if ((GR_IS_GR_GL(fStandard) && ( |
| 163 | (glVer >= GR_GL_VER(3,0)))) || |
| 164 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 165 | (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) { |
| 166 | if (!fFunctions.fBindFragDataLocation) { |
| 167 | RETURN_FALSE_INTERFACE; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | if ((GR_IS_GR_GL(fStandard) && ( |
| 172 | (glVer >= GR_GL_VER(3,3)) || |
| 173 | fExtensions.has("GL_ARB_blend_func_extended"))) || |
| 174 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 175 | (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) { |
| 176 | if (!fFunctions.fBindFragDataLocationIndexed) { |
| 177 | RETURN_FALSE_INTERFACE; |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | if ((GR_IS_GR_GL(fStandard) && ( |
| 182 | fExtensions.has("GL_KHR_blend_equation_advanced") || |
| 183 | fExtensions.has("GL_NV_blend_equation_advanced"))) || |
| 184 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 185 | fExtensions.has("GL_KHR_blend_equation_advanced") || |
| 186 | fExtensions.has("GL_NV_blend_equation_advanced")))) { |
| 187 | if (!fFunctions.fBlendBarrier) { |
| 188 | RETURN_FALSE_INTERFACE; |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | if ((GR_IS_GR_GL(fStandard) && ( |
| 193 | (glVer >= GR_GL_VER(4,4)) || |
| 194 | fExtensions.has("GL_ARB_clear_texture"))) || |
| 195 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 196 | fExtensions.has("GL_EXT_clear_texture")))) { |
| 197 | // all functions were marked optional |
| 198 | } |
| 199 | |
| 200 | if ((GR_IS_GR_GL(fStandard) && ( |
| 201 | (glVer >= GR_GL_VER(3,1)) || |
| 202 | fExtensions.has("GL_ARB_draw_instanced") || |
| 203 | fExtensions.has("GL_EXT_draw_instanced"))) || |
| 204 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 205 | (glVer >= GR_GL_VER(3,0)) || |
| 206 | fExtensions.has("GL_EXT_draw_instanced")))) { |
| 207 | if (!fFunctions.fDrawArraysInstanced || |
| 208 | !fFunctions.fDrawElementsInstanced) { |
| 209 | RETURN_FALSE_INTERFACE; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | if (GR_IS_GR_GL(fStandard) || |
| 214 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 215 | (glVer >= GR_GL_VER(3,0))))) { |
| 216 | if (!fFunctions.fDrawBuffers || |
| 217 | !fFunctions.fReadBuffer) { |
| 218 | RETURN_FALSE_INTERFACE; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | if ((GR_IS_GR_GL(fStandard) && ( |
| 223 | (glVer >= GR_GL_VER(4,0)) || |
| 224 | fExtensions.has("GL_ARB_draw_indirect"))) || |
| 225 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 226 | (glVer >= GR_GL_VER(3,1))))) { |
| 227 | if (!fFunctions.fDrawArraysIndirect || |
| 228 | !fFunctions.fDrawElementsIndirect) { |
| 229 | RETURN_FALSE_INTERFACE; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | if (GR_IS_GR_GL(fStandard) || |
| 234 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 235 | (glVer >= GR_GL_VER(3,0))))) { |
| 236 | if (!fFunctions.fDrawRangeElements) { |
| 237 | RETURN_FALSE_INTERFACE; |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | if ((GR_IS_GR_GL(fStandard) && ( |
| 242 | (glVer >= GR_GL_VER(3,2)) || |
| 243 | fExtensions.has("GL_ARB_texture_multisample"))) || |
| 244 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 245 | (glVer >= GR_GL_VER(3,1))))) { |
| 246 | if (!fFunctions.fGetMultisamplefv) { |
| 247 | RETURN_FALSE_INTERFACE; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | if (GR_IS_GR_GL(fStandard) || |
| 252 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 253 | (glVer >= GR_GL_VER(3,1))))) { |
| 254 | if (!fFunctions.fGetTexLevelParameteriv) { |
| 255 | RETURN_FALSE_INTERFACE; |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | if ((GR_IS_GR_GL(fStandard) && ( |
| 260 | (glVer >= GR_GL_VER(4,3)) || |
| 261 | fExtensions.has("GL_ARB_multi_draw_indirect"))) || |
| 262 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 263 | fExtensions.has("GL_EXT_multi_draw_indirect")))) { |
| 264 | if (!fFunctions.fMultiDrawArraysIndirect || |
| 265 | !fFunctions.fMultiDrawElementsIndirect) { |
| 266 | RETURN_FALSE_INTERFACE; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | if ((GR_IS_GR_GL(fStandard) && ( |
| 271 | (glVer >= GR_GL_VER(3,1)))) || |
| 272 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 273 | (glVer >= GR_GL_VER(3,2)) || |
| 274 | fExtensions.has("GL_OES_texture_buffer") || |
| 275 | fExtensions.has("GL_EXT_texture_buffer")))) { |
| 276 | if (!fFunctions.fTexBuffer) { |
| 277 | RETURN_FALSE_INTERFACE; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | if ((GR_IS_GR_GL(fStandard) && ( |
| 282 | (glVer >= GR_GL_VER(4,3)))) || |
| 283 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 284 | (glVer >= GR_GL_VER(3,2)) || |
| 285 | fExtensions.has("GL_OES_texture_buffer") || |
| 286 | fExtensions.has("GL_EXT_texture_buffer")))) { |
| 287 | if (!fFunctions.fTexBufferRange) { |
| 288 | RETURN_FALSE_INTERFACE; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | if ((GR_IS_GR_GL(fStandard) && ( |
| 293 | (glVer >= GR_GL_VER(4,2)) || |
| 294 | fExtensions.has("GL_ARB_texture_storage") || |
| 295 | fExtensions.has("GL_EXT_texture_storage"))) || |
| 296 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 297 | (glVer >= GR_GL_VER(3,0)) || |
| 298 | fExtensions.has("GL_EXT_texture_storage")))) { |
| 299 | if (!fFunctions.fTexStorage2D) { |
| 300 | RETURN_FALSE_INTERFACE; |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | if ((GR_IS_GR_GL(fStandard) && ( |
| 305 | (glVer >= GR_GL_VER(4,5)) || |
| 306 | fExtensions.has("GL_ARB_texture_barrier") || |
| 307 | fExtensions.has("GL_NV_texture_barrier"))) || |
| 308 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 309 | fExtensions.has("GL_NV_texture_barrier")))) { |
| 310 | if (!fFunctions.fTextureBarrier) { |
| 311 | RETURN_FALSE_INTERFACE; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 316 | fExtensions.has("GL_EXT_discard_framebuffer")))) { |
| 317 | if (!fFunctions.fDiscardFramebuffer) { |
| 318 | RETURN_FALSE_INTERFACE; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | if ((GR_IS_GR_GL(fStandard) && ( |
| 323 | (glVer >= GR_GL_VER(3,2)) || |
| 324 | fExtensions.has("GL_ARB_instanced_arrays"))) || |
| 325 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 326 | (glVer >= GR_GL_VER(3,0)) || |
| 327 | fExtensions.has("GL_EXT_instanced_arrays")))) { |
| 328 | if (!fFunctions.fVertexAttribDivisor) { |
| 329 | RETURN_FALSE_INTERFACE; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | if ((GR_IS_GR_GL(fStandard) && ( |
| 334 | (glVer >= GR_GL_VER(3,0)))) || |
| 335 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 336 | (glVer >= GR_GL_VER(3,0))))) { |
| 337 | if (!fFunctions.fVertexAttribIPointer) { |
| 338 | RETURN_FALSE_INTERFACE; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | if ((GR_IS_GR_GL(fStandard) && ( |
| 343 | (glVer >= GR_GL_VER(3,0)) || |
| 344 | fExtensions.has("GL_ARB_framebuffer_object") || |
| 345 | fExtensions.has("GL_EXT_framebuffer_object"))) || |
| 346 | GR_IS_GR_GL_ES(fStandard)) { |
| 347 | if (!fFunctions.fBindFramebuffer || |
| 348 | !fFunctions.fBindRenderbuffer || |
| 349 | !fFunctions.fCheckFramebufferStatus || |
| 350 | !fFunctions.fDeleteFramebuffers || |
| 351 | !fFunctions.fDeleteRenderbuffers || |
| 352 | !fFunctions.fFramebufferRenderbuffer || |
| 353 | !fFunctions.fFramebufferTexture2D || |
| 354 | !fFunctions.fGenFramebuffers || |
| 355 | !fFunctions.fGenRenderbuffers || |
| 356 | !fFunctions.fGenerateMipmap || |
| 357 | !fFunctions.fGetFramebufferAttachmentParameteriv || |
| 358 | !fFunctions.fGetRenderbufferParameteriv || |
| 359 | !fFunctions.fRenderbufferStorage) { |
| 360 | RETURN_FALSE_INTERFACE; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | if ((GR_IS_GR_GL(fStandard) && ( |
| 365 | (glVer >= GR_GL_VER(3,0)) || |
| 366 | fExtensions.has("GL_ARB_framebuffer_object") || |
| 367 | fExtensions.has("GL_EXT_framebuffer_blit"))) || |
| 368 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 369 | (glVer >= GR_GL_VER(3,0)) || |
| 370 | fExtensions.has("GL_CHROMIUM_framebuffer_multisample") || |
| 371 | fExtensions.has("GL_ANGLE_framebuffer_blit")))) { |
| 372 | if (!fFunctions.fBlitFramebuffer) { |
| 373 | RETURN_FALSE_INTERFACE; |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | if ((GR_IS_GR_GL(fStandard) && ( |
| 378 | (glVer >= GR_GL_VER(3,0)) || |
| 379 | fExtensions.has("GL_ARB_framebuffer_object") || |
| 380 | fExtensions.has("GL_EXT_framebuffer_multisample"))) || |
| 381 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 382 | (glVer >= GR_GL_VER(3,0)) || |
| 383 | fExtensions.has("GL_CHROMIUM_framebuffer_multisample") || |
| 384 | fExtensions.has("GL_ANGLE_framebuffer_multisample")))) { |
| 385 | if (!fFunctions.fRenderbufferStorageMultisample) { |
| 386 | RETURN_FALSE_INTERFACE; |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 391 | fExtensions.has("GL_CHROMIUM_map_sub")))) { |
| 392 | if (!fFunctions.fMapBufferSubData || |
| 393 | !fFunctions.fMapTexSubImage2D || |
| 394 | !fFunctions.fUnmapBufferSubData || |
| 395 | !fFunctions.fUnmapTexSubImage2D) { |
| 396 | RETURN_FALSE_INTERFACE; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 401 | fExtensions.has("GL_EXT_multisampled_render_to_texture") || |
| 402 | fExtensions.has("GL_IMG_multisampled_render_to_texture")))) { |
| 403 | if (!fFunctions.fFramebufferTexture2DMultisample) { |
| 404 | RETURN_FALSE_INTERFACE; |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 409 | fExtensions.has("GL_EXT_multisampled_render_to_texture")))) { |
| 410 | if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) { |
| 411 | RETURN_FALSE_INTERFACE; |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 416 | fExtensions.has("GL_IMG_multisampled_render_to_texture")))) { |
| 417 | if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) { |
| 418 | RETURN_FALSE_INTERFACE; |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 423 | fExtensions.has("GL_APPLE_framebuffer_multisample")))) { |
| 424 | if (!fFunctions.fResolveMultisampleFramebuffer || |
| 425 | !fFunctions.fRenderbufferStorageMultisampleES2APPLE) { |
| 426 | RETURN_FALSE_INTERFACE; |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | if (GR_IS_GR_GL(fStandard) || |
| 431 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 432 | fExtensions.has("GL_OES_mapbuffer")))) { |
| 433 | if (!fFunctions.fMapBuffer) { |
| 434 | RETURN_FALSE_INTERFACE; |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | if (GR_IS_GR_GL(fStandard) || |
| 439 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 440 | (glVer >= GR_GL_VER(3,0)) || |
| 441 | fExtensions.has("GL_OES_mapbuffer")))) { |
| 442 | if (!fFunctions.fUnmapBuffer) { |
| 443 | RETURN_FALSE_INTERFACE; |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | if ((GR_IS_GR_GL(fStandard) && ( |
| 448 | (glVer >= GR_GL_VER(3,0)) || |
| 449 | fExtensions.has("GL_ARB_map_buffer_range"))) || |
| 450 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 451 | (glVer >= GR_GL_VER(3,0)) || |
| 452 | fExtensions.has("GL_EXT_map_buffer_range")))) { |
| 453 | if (!fFunctions.fFlushMappedBufferRange || |
| 454 | !fFunctions.fMapBufferRange) { |
| 455 | RETURN_FALSE_INTERFACE; |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | if ((GR_IS_GR_GL(fStandard) && ( |
| 460 | fExtensions.has("GL_EXT_debug_marker"))) || |
| 461 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 462 | fExtensions.has("GL_EXT_debug_marker")))) { |
| 463 | if (!fFunctions.fInsertEventMarker || |
| 464 | !fFunctions.fPopGroupMarker || |
| 465 | !fFunctions.fPushGroupMarker) { |
| 466 | RETURN_FALSE_INTERFACE; |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | if ((GR_IS_GR_GL(fStandard) && ( |
| 471 | (glVer >= GR_GL_VER(4,3)) || |
| 472 | fExtensions.has("GL_ARB_program_interface_query"))) || |
| 473 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 474 | (glVer >= GR_GL_VER(3,1))))) { |
| 475 | if (!fFunctions.fGetProgramResourceLocation) { |
| 476 | RETURN_FALSE_INTERFACE; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | if ((GR_IS_GR_GL(fStandard) && ( |
| 481 | fExtensions.has("GL_NV_path_rendering"))) || |
| 482 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 483 | fExtensions.has("GL_CHROMIUM_path_rendering") || |
| 484 | fExtensions.has("GL_NV_path_rendering")))) { |
| 485 | if (!fFunctions.fMatrixLoadIdentity || |
| 486 | !fFunctions.fMatrixLoadf) { |
| 487 | RETURN_FALSE_INTERFACE; |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | if ((GR_IS_GR_GL(fStandard) && ( |
| 492 | fExtensions.has("GL_NV_path_rendering"))) || |
| 493 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 494 | fExtensions.has("GL_CHROMIUM_path_rendering") || |
| 495 | fExtensions.has("GL_NV_path_rendering")))) { |
| 496 | if (!fFunctions.fCoverFillPath || |
| 497 | !fFunctions.fCoverFillPathInstanced || |
| 498 | !fFunctions.fCoverStrokePath || |
| 499 | !fFunctions.fCoverStrokePathInstanced || |
| 500 | !fFunctions.fDeletePaths || |
| 501 | !fFunctions.fGenPaths || |
| 502 | !fFunctions.fIsPath || |
| 503 | !fFunctions.fPathCommands || |
| 504 | !fFunctions.fPathParameterf || |
| 505 | !fFunctions.fPathParameteri || |
| 506 | !fFunctions.fPathStencilFunc || |
| 507 | !fFunctions.fStencilFillPath || |
| 508 | !fFunctions.fStencilFillPathInstanced || |
| 509 | !fFunctions.fStencilStrokePath || |
| 510 | !fFunctions.fStencilStrokePathInstanced) { |
| 511 | RETURN_FALSE_INTERFACE; |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 516 | fExtensions.has("GL_CHROMIUM_path_rendering")))) { |
| 517 | if (!fFunctions.fBindFragmentInputLocation) { |
| 518 | RETURN_FALSE_INTERFACE; |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | if ((GR_IS_GR_GL(fStandard) && ( |
| 523 | fExtensions.has("GL_NV_framebuffer_mixed_samples"))) || |
| 524 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 525 | fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples") || |
| 526 | fExtensions.has("GL_NV_framebuffer_mixed_samples")))) { |
| 527 | if (!fFunctions.fCoverageModulation) { |
| 528 | RETURN_FALSE_INTERFACE; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | if ((GR_IS_GR_GL(fStandard) && ( |
| 533 | (glVer >= GR_GL_VER(4,3)) || |
| 534 | fExtensions.has("GL_KHR_debug"))) || |
| 535 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 536 | fExtensions.has("GL_KHR_debug")))) { |
| 537 | if (!fFunctions.fDebugMessageCallback || |
| 538 | !fFunctions.fDebugMessageControl || |
| 539 | !fFunctions.fDebugMessageInsert || |
| 540 | !fFunctions.fGetDebugMessageLog || |
| 541 | !fFunctions.fObjectLabel || |
| 542 | !fFunctions.fPopDebugGroup || |
| 543 | !fFunctions.fPushDebugGroup) { |
| 544 | RETURN_FALSE_INTERFACE; |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 549 | fExtensions.has("GL_CHROMIUM_bind_uniform_location")))) { |
| 550 | if (!fFunctions.fBindUniformLocation) { |
| 551 | RETURN_FALSE_INTERFACE; |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | if ((GR_IS_GR_GL(fStandard) && ( |
| 556 | fExtensions.has("GL_EXT_window_rectangles"))) || |
| 557 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 558 | fExtensions.has("GL_EXT_window_rectangles")))) { |
| 559 | if (!fFunctions.fWindowRectangles) { |
| 560 | RETURN_FALSE_INTERFACE; |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | if ((GR_IS_GR_GL(fStandard) && ( |
| 565 | fExtensions.has("EGL_KHR_image") || |
| 566 | fExtensions.has("EGL_KHR_image_base"))) || |
| 567 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 568 | fExtensions.has("EGL_KHR_image") || |
| 569 | fExtensions.has("EGL_KHR_image_base")))) { |
| 570 | if (!fFunctions.fEGLCreateImage || |
| 571 | !fFunctions.fEGLDestroyImage) { |
| 572 | RETURN_FALSE_INTERFACE; |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | if ((GR_IS_GR_GL(fStandard) && ( |
| 577 | (glVer >= GR_GL_VER(3,2)) || |
| 578 | fExtensions.has("GL_ARB_sync"))) || |
| 579 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 580 | (glVer >= GR_GL_VER(3,0)) || |
| 581 | fExtensions.has("GL_APPLE_sync")))) { |
| 582 | if (!fFunctions.fClientWaitSync || |
| 583 | !fFunctions.fDeleteSync || |
| 584 | !fFunctions.fFenceSync || |
| 585 | !fFunctions.fIsSync || |
| 586 | !fFunctions.fWaitSync) { |
| 587 | RETURN_FALSE_INTERFACE; |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | if ((GR_IS_GR_GL(fStandard) && ( |
| 592 | (glVer >= GR_GL_VER(4,2)) || |
| 593 | fExtensions.has("GL_ARB_internalformat_query"))) || |
| 594 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 595 | (glVer >= GR_GL_VER(3,0))))) { |
| 596 | if (!fFunctions.fGetInternalformativ) { |
| 597 | RETURN_FALSE_INTERFACE; |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | if ((GR_IS_GR_GL(fStandard) && ( |
| 602 | (glVer >= GR_GL_VER(4,1)))) || |
| 603 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 604 | (glVer >= GR_GL_VER(3,0))))) { |
| 605 | if (!fFunctions.fGetProgramBinary || |
| 606 | !fFunctions.fProgramBinary || |
| 607 | !fFunctions.fProgramParameteri) { |
| 608 | RETURN_FALSE_INTERFACE; |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | if ((GR_IS_GR_GL(fStandard) && ( |
| 613 | (glVer >= GR_GL_VER(3,2)) || |
| 614 | fExtensions.has("GL_ARB_sampler_objects"))) || |
| 615 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 616 | (glVer >= GR_GL_VER(3,0))))) { |
| 617 | if (!fFunctions.fBindSampler || |
| 618 | !fFunctions.fDeleteSamplers || |
| 619 | !fFunctions.fGenSamplers || |
| 620 | !fFunctions.fSamplerParameteri || |
| 621 | !fFunctions.fSamplerParameteriv) { |
| 622 | RETURN_FALSE_INTERFACE; |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | if (GR_IS_GR_GL(fStandard)) { |
| 627 | if (!fFunctions.fGetQueryObjectiv) { |
| 628 | RETURN_FALSE_INTERFACE; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | if (GR_IS_GR_GL(fStandard) || |
| 633 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 634 | (glVer >= GR_GL_VER(3,0)) || |
| 635 | fExtensions.has("GL_EXT_occlusion_query_boolean")))) { |
| 636 | // all functions were marked optional |
| 637 | } |
| 638 | |
| 639 | if ((GR_IS_GR_GL(fStandard) && ( |
| 640 | (glVer >= GR_GL_VER(3,3)) || |
| 641 | fExtensions.has("GL_ARB_timer_query") || |
| 642 | fExtensions.has("GL_EXT_timer_query")))) { |
| 643 | if (!fFunctions.fGetQueryObjecti64v || |
| 644 | !fFunctions.fGetQueryObjectui64v) { |
| 645 | RETURN_FALSE_INTERFACE; |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | if ((GR_IS_GR_GL(fStandard) && ( |
| 650 | (glVer >= GR_GL_VER(3,3)) || |
| 651 | fExtensions.has("GL_ARB_timer_query")))) { |
| 652 | if (!fFunctions.fQueryCounter) { |
| 653 | RETURN_FALSE_INTERFACE; |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | if ((GR_IS_GR_GL(fStandard) && ( |
| 658 | (glVer >= GR_GL_VER(4,3)) || |
| 659 | fExtensions.has("GL_ARB_invalidate_subdata")))) { |
| 660 | if (!fFunctions.fInvalidateBufferData || |
| 661 | !fFunctions.fInvalidateBufferSubData || |
| 662 | !fFunctions.fInvalidateTexImage || |
| 663 | !fFunctions.fInvalidateTexSubImage) { |
| 664 | RETURN_FALSE_INTERFACE; |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | if ((GR_IS_GR_GL(fStandard) && ( |
| 669 | (glVer >= GR_GL_VER(4,3)) || |
| 670 | fExtensions.has("GL_ARB_invalidate_subdata"))) || |
| 671 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 672 | (glVer >= GR_GL_VER(3,0))))) { |
| 673 | if (!fFunctions.fInvalidateFramebuffer || |
| 674 | !fFunctions.fInvalidateSubFramebuffer) { |
| 675 | RETURN_FALSE_INTERFACE; |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | if ((GR_IS_GR_GL(fStandard) && ( |
| 680 | (glVer >= GR_GL_VER(4,3)) || |
| 681 | fExtensions.has("GL_ARB_ES2_compatibility"))) || |
| 682 | GR_IS_GR_GL_ES(fStandard)) { |
| 683 | if (!fFunctions.fGetShaderPrecisionFormat) { |
| 684 | RETURN_FALSE_INTERFACE; |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | |
| 689 | // End autogenerated content |
| 690 | return true; |
| 691 | } |
| 692 | |
| 693 | #if GR_TEST_UTILS |
| 694 | |
| 695 | void GrGLInterface::abandon() const { |
| 696 | const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions(); |
| 697 | } |
| 698 | |
| 699 | #endif // GR_TEST_UTILS |