| 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 "include/gpu/gl/GrGLExtensions.h" |
| 13 | #include "include/gpu/gl/GrGLInterface.h" |
| 14 | #include "src/gpu/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 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 147 | (glVer >= GR_GL_VER(2,0))))) { |
| 148 | if (!fFunctions.fGetStringi) { |
| 149 | RETURN_FALSE_INTERFACE; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | if ((GR_IS_GR_GL(fStandard) && ( |
| 154 | (glVer >= GR_GL_VER(4,2)))) || |
| 155 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 156 | (glVer >= GR_GL_VER(3,1))))) { |
| 157 | // all functions were marked optional or test_only |
| 158 | } |
| 159 | |
| 160 | if (GR_IS_GR_GL(fStandard) || |
| 161 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 162 | (glVer >= GR_GL_VER(3,0)) || |
| 163 | fExtensions.has("GL_OES_vertex_array_object" ))) || |
| 164 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 165 | (glVer >= GR_GL_VER(2,0)) || |
| 166 | fExtensions.has("GL_OES_vertex_array_object" ) || |
| 167 | fExtensions.has("OES_vertex_array_object" )))) { |
| 168 | if (!fFunctions.fBindVertexArray || |
| 169 | !fFunctions.fDeleteVertexArrays || |
| 170 | !fFunctions.fGenVertexArrays) { |
| 171 | RETURN_FALSE_INTERFACE; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | if ((GR_IS_GR_GL(fStandard) && ( |
| 176 | (glVer >= GR_GL_VER(4,0)) || |
| 177 | fExtensions.has("GL_ARB_tessellation_shader" ))) || |
| 178 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 179 | (glVer >= GR_GL_VER(3,2)) || |
| 180 | fExtensions.has("GL_OES_tessellation_shader" )))) { |
| 181 | // all functions were marked optional or test_only |
| 182 | } |
| 183 | |
| 184 | if ((GR_IS_GR_GL(fStandard) && ( |
| 185 | (glVer >= GR_GL_VER(3,0)))) || |
| 186 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 187 | (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended" ))))) { |
| 188 | if (!fFunctions.fBindFragDataLocation) { |
| 189 | RETURN_FALSE_INTERFACE; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | if ((GR_IS_GR_GL(fStandard) && ( |
| 194 | (glVer >= GR_GL_VER(3,3)) || |
| 195 | fExtensions.has("GL_ARB_blend_func_extended" ))) || |
| 196 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 197 | (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended" ))))) { |
| 198 | if (!fFunctions.fBindFragDataLocationIndexed) { |
| 199 | RETURN_FALSE_INTERFACE; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | if ((GR_IS_GR_GL(fStandard) && ( |
| 204 | fExtensions.has("GL_KHR_blend_equation_advanced" ) || |
| 205 | fExtensions.has("GL_NV_blend_equation_advanced" ))) || |
| 206 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 207 | fExtensions.has("GL_KHR_blend_equation_advanced" ) || |
| 208 | fExtensions.has("GL_NV_blend_equation_advanced" )))) { |
| 209 | if (!fFunctions.fBlendBarrier) { |
| 210 | RETURN_FALSE_INTERFACE; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | if ((GR_IS_GR_GL(fStandard) && ( |
| 215 | (glVer >= GR_GL_VER(4,4)) || |
| 216 | fExtensions.has("GL_ARB_clear_texture" ))) || |
| 217 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 218 | fExtensions.has("GL_EXT_clear_texture" )))) { |
| 219 | // all functions were marked optional or test_only |
| 220 | } |
| 221 | |
| 222 | if ((GR_IS_GR_GL(fStandard) && ( |
| 223 | (glVer >= GR_GL_VER(3,1)) || |
| 224 | fExtensions.has("GL_ARB_draw_instanced" ) || |
| 225 | fExtensions.has("GL_EXT_draw_instanced" ))) || |
| 226 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 227 | (glVer >= GR_GL_VER(3,0)) || |
| 228 | fExtensions.has("GL_EXT_draw_instanced" ))) || |
| 229 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 230 | (glVer >= GR_GL_VER(2,0))))) { |
| 231 | if (!fFunctions.fDrawArraysInstanced || |
| 232 | !fFunctions.fDrawElementsInstanced) { |
| 233 | RETURN_FALSE_INTERFACE; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | if ((GR_IS_GR_GL(fStandard) && ( |
| 238 | (glVer >= GR_GL_VER(4,2)) || |
| 239 | fExtensions.has("GL_ARB_base_instance" ))) || |
| 240 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 241 | fExtensions.has("GL_EXT_base_instance" ) || |
| 242 | fExtensions.has("GL_ANGLE_base_vertex_base_instance" )))) { |
| 243 | if (!fFunctions.fDrawArraysInstancedBaseInstance || |
| 244 | !fFunctions.fDrawElementsInstancedBaseVertexBaseInstance) { |
| 245 | RETURN_FALSE_INTERFACE; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | if (GR_IS_GR_GL(fStandard) || |
| 250 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 251 | (glVer >= GR_GL_VER(3,0)))) || |
| 252 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 253 | (glVer >= GR_GL_VER(2,0))))) { |
| 254 | if (!fFunctions.fDrawBuffers || |
| 255 | !fFunctions.fReadBuffer) { |
| 256 | RETURN_FALSE_INTERFACE; |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | if ((GR_IS_GR_GL(fStandard) && ( |
| 261 | (glVer >= GR_GL_VER(4,0)) || |
| 262 | fExtensions.has("GL_ARB_draw_indirect" ))) || |
| 263 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 264 | (glVer >= GR_GL_VER(3,1))))) { |
| 265 | if (!fFunctions.fDrawArraysIndirect || |
| 266 | !fFunctions.fDrawElementsIndirect) { |
| 267 | RETURN_FALSE_INTERFACE; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | if (GR_IS_GR_GL(fStandard) || |
| 272 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 273 | (glVer >= GR_GL_VER(3,0)))) || |
| 274 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 275 | (glVer >= GR_GL_VER(2,0))))) { |
| 276 | if (!fFunctions.fDrawRangeElements) { |
| 277 | RETURN_FALSE_INTERFACE; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | if ((GR_IS_GR_GL(fStandard) && ( |
| 282 | (glVer >= GR_GL_VER(3,2)) || |
| 283 | fExtensions.has("GL_ARB_texture_multisample" ))) || |
| 284 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 285 | (glVer >= GR_GL_VER(3,1))))) { |
| 286 | if (!fFunctions.fGetMultisamplefv) { |
| 287 | RETURN_FALSE_INTERFACE; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | if (GR_IS_GR_GL(fStandard) || |
| 292 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 293 | (glVer >= GR_GL_VER(3,1))))) { |
| 294 | if (!fFunctions.fGetTexLevelParameteriv) { |
| 295 | RETURN_FALSE_INTERFACE; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | if ((GR_IS_GR_GL(fStandard) && ( |
| 300 | (glVer >= GR_GL_VER(4,3)) || |
| 301 | fExtensions.has("GL_ARB_multi_draw_indirect" ))) || |
| 302 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 303 | fExtensions.has("GL_EXT_multi_draw_indirect" )))) { |
| 304 | if (!fFunctions.fMultiDrawArraysIndirect || |
| 305 | !fFunctions.fMultiDrawElementsIndirect) { |
| 306 | RETURN_FALSE_INTERFACE; |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | if ((GR_IS_GR_GL(fStandard) && ( |
| 311 | (glVer >= GR_GL_VER(3,1)))) || |
| 312 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 313 | (glVer >= GR_GL_VER(3,2)) || |
| 314 | fExtensions.has("GL_OES_texture_buffer" ) || |
| 315 | fExtensions.has("GL_EXT_texture_buffer" )))) { |
| 316 | if (!fFunctions.fTexBuffer) { |
| 317 | RETURN_FALSE_INTERFACE; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | if ((GR_IS_GR_GL(fStandard) && ( |
| 322 | (glVer >= GR_GL_VER(4,3)))) || |
| 323 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 324 | (glVer >= GR_GL_VER(3,2)) || |
| 325 | fExtensions.has("GL_OES_texture_buffer" ) || |
| 326 | fExtensions.has("GL_EXT_texture_buffer" )))) { |
| 327 | if (!fFunctions.fTexBufferRange) { |
| 328 | RETURN_FALSE_INTERFACE; |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | if ((GR_IS_GR_GL(fStandard) && ( |
| 333 | (glVer >= GR_GL_VER(4,2)) || |
| 334 | fExtensions.has("GL_ARB_texture_storage" ) || |
| 335 | fExtensions.has("GL_EXT_texture_storage" ))) || |
| 336 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 337 | (glVer >= GR_GL_VER(3,0)) || |
| 338 | fExtensions.has("GL_EXT_texture_storage" ))) || |
| 339 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 340 | (glVer >= GR_GL_VER(2,0))))) { |
| 341 | if (!fFunctions.fTexStorage2D) { |
| 342 | RETURN_FALSE_INTERFACE; |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | if ((GR_IS_GR_GL(fStandard) && ( |
| 347 | (glVer >= GR_GL_VER(4,5)) || |
| 348 | fExtensions.has("GL_ARB_texture_barrier" ) || |
| 349 | fExtensions.has("GL_NV_texture_barrier" ))) || |
| 350 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 351 | fExtensions.has("GL_NV_texture_barrier" )))) { |
| 352 | if (!fFunctions.fTextureBarrier) { |
| 353 | RETURN_FALSE_INTERFACE; |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 358 | fExtensions.has("GL_EXT_discard_framebuffer" )))) { |
| 359 | if (!fFunctions.fDiscardFramebuffer) { |
| 360 | RETURN_FALSE_INTERFACE; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 365 | fExtensions.has("GL_QCOM_tiled_rendering" )))) { |
| 366 | // all functions were marked optional or test_only |
| 367 | } |
| 368 | |
| 369 | if ((GR_IS_GR_GL(fStandard) && ( |
| 370 | (glVer >= GR_GL_VER(3,2)) || |
| 371 | fExtensions.has("GL_ARB_instanced_arrays" ))) || |
| 372 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 373 | (glVer >= GR_GL_VER(3,0)) || |
| 374 | fExtensions.has("GL_EXT_instanced_arrays" ))) || |
| 375 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 376 | (glVer >= GR_GL_VER(2,0))))) { |
| 377 | if (!fFunctions.fVertexAttribDivisor) { |
| 378 | RETURN_FALSE_INTERFACE; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | if ((GR_IS_GR_GL(fStandard) && ( |
| 383 | (glVer >= GR_GL_VER(3,0)))) || |
| 384 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 385 | (glVer >= GR_GL_VER(3,0)))) || |
| 386 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 387 | (glVer >= GR_GL_VER(2,0))))) { |
| 388 | if (!fFunctions.fVertexAttribIPointer) { |
| 389 | RETURN_FALSE_INTERFACE; |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | if ((GR_IS_GR_GL(fStandard) && ( |
| 394 | (glVer >= GR_GL_VER(3,0)) || |
| 395 | fExtensions.has("GL_ARB_framebuffer_object" ) || |
| 396 | fExtensions.has("GL_EXT_framebuffer_object" ))) || |
| 397 | GR_IS_GR_GL_ES(fStandard) || |
| 398 | GR_IS_GR_WEBGL(fStandard)) { |
| 399 | if (!fFunctions.fBindFramebuffer || |
| 400 | !fFunctions.fBindRenderbuffer || |
| 401 | !fFunctions.fCheckFramebufferStatus || |
| 402 | !fFunctions.fDeleteFramebuffers || |
| 403 | !fFunctions.fDeleteRenderbuffers || |
| 404 | !fFunctions.fFramebufferRenderbuffer || |
| 405 | !fFunctions.fFramebufferTexture2D || |
| 406 | !fFunctions.fGenFramebuffers || |
| 407 | !fFunctions.fGenRenderbuffers || |
| 408 | !fFunctions.fGenerateMipmap || |
| 409 | !fFunctions.fGetFramebufferAttachmentParameteriv || |
| 410 | !fFunctions.fGetRenderbufferParameteriv || |
| 411 | !fFunctions.fRenderbufferStorage) { |
| 412 | RETURN_FALSE_INTERFACE; |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | if ((GR_IS_GR_GL(fStandard) && ( |
| 417 | (glVer >= GR_GL_VER(3,0)) || |
| 418 | fExtensions.has("GL_ARB_framebuffer_object" ) || |
| 419 | fExtensions.has("GL_EXT_framebuffer_blit" ))) || |
| 420 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 421 | (glVer >= GR_GL_VER(3,0)) || |
| 422 | fExtensions.has("GL_CHROMIUM_framebuffer_multisample" ) || |
| 423 | fExtensions.has("GL_ANGLE_framebuffer_blit" ))) || |
| 424 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 425 | (glVer >= GR_GL_VER(2,0))))) { |
| 426 | if (!fFunctions.fBlitFramebuffer) { |
| 427 | RETURN_FALSE_INTERFACE; |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | if ((GR_IS_GR_GL(fStandard) && ( |
| 432 | (glVer >= GR_GL_VER(3,0)) || |
| 433 | fExtensions.has("GL_ARB_framebuffer_object" ) || |
| 434 | fExtensions.has("GL_EXT_framebuffer_multisample" ))) || |
| 435 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 436 | (glVer >= GR_GL_VER(3,0)) || |
| 437 | fExtensions.has("GL_CHROMIUM_framebuffer_multisample" ) || |
| 438 | fExtensions.has("GL_ANGLE_framebuffer_multisample" ))) || |
| 439 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 440 | (glVer >= GR_GL_VER(2,0))))) { |
| 441 | if (!fFunctions.fRenderbufferStorageMultisample) { |
| 442 | RETURN_FALSE_INTERFACE; |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 447 | fExtensions.has("GL_CHROMIUM_map_sub" )))) { |
| 448 | if (!fFunctions.fMapBufferSubData || |
| 449 | !fFunctions.fMapTexSubImage2D || |
| 450 | !fFunctions.fUnmapBufferSubData || |
| 451 | !fFunctions.fUnmapTexSubImage2D) { |
| 452 | RETURN_FALSE_INTERFACE; |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 457 | fExtensions.has("GL_EXT_multisampled_render_to_texture" ) || |
| 458 | fExtensions.has("GL_IMG_multisampled_render_to_texture" )))) { |
| 459 | if (!fFunctions.fFramebufferTexture2DMultisample) { |
| 460 | RETURN_FALSE_INTERFACE; |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 465 | fExtensions.has("GL_EXT_multisampled_render_to_texture" )))) { |
| 466 | if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) { |
| 467 | RETURN_FALSE_INTERFACE; |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 472 | fExtensions.has("GL_IMG_multisampled_render_to_texture" )))) { |
| 473 | if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) { |
| 474 | RETURN_FALSE_INTERFACE; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 479 | fExtensions.has("GL_APPLE_framebuffer_multisample" )))) { |
| 480 | if (!fFunctions.fResolveMultisampleFramebuffer || |
| 481 | !fFunctions.fRenderbufferStorageMultisampleES2APPLE) { |
| 482 | RETURN_FALSE_INTERFACE; |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | if (GR_IS_GR_GL(fStandard) || |
| 487 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 488 | fExtensions.has("GL_OES_mapbuffer" )))) { |
| 489 | if (!fFunctions.fMapBuffer) { |
| 490 | RETURN_FALSE_INTERFACE; |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | if (GR_IS_GR_GL(fStandard) || |
| 495 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 496 | (glVer >= GR_GL_VER(3,0)) || |
| 497 | fExtensions.has("GL_OES_mapbuffer" )))) { |
| 498 | if (!fFunctions.fUnmapBuffer) { |
| 499 | RETURN_FALSE_INTERFACE; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | if ((GR_IS_GR_GL(fStandard) && ( |
| 504 | (glVer >= GR_GL_VER(3,0)) || |
| 505 | fExtensions.has("GL_ARB_map_buffer_range" ))) || |
| 506 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 507 | (glVer >= GR_GL_VER(3,0)) || |
| 508 | fExtensions.has("GL_EXT_map_buffer_range" )))) { |
| 509 | if (!fFunctions.fFlushMappedBufferRange || |
| 510 | !fFunctions.fMapBufferRange) { |
| 511 | RETURN_FALSE_INTERFACE; |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | if ((GR_IS_GR_GL(fStandard) && ( |
| 516 | fExtensions.has("GL_EXT_debug_marker" ))) || |
| 517 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 518 | fExtensions.has("GL_EXT_debug_marker" )))) { |
| 519 | if (!fFunctions.fInsertEventMarker || |
| 520 | !fFunctions.fPopGroupMarker || |
| 521 | !fFunctions.fPushGroupMarker) { |
| 522 | RETURN_FALSE_INTERFACE; |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | if ((GR_IS_GR_GL(fStandard) && ( |
| 527 | (glVer >= GR_GL_VER(4,3)) || |
| 528 | fExtensions.has("GL_ARB_program_interface_query" ))) || |
| 529 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 530 | (glVer >= GR_GL_VER(3,1))))) { |
| 531 | if (!fFunctions.fGetProgramResourceLocation) { |
| 532 | RETURN_FALSE_INTERFACE; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | if ((GR_IS_GR_GL(fStandard) && ( |
| 537 | fExtensions.has("GL_NV_path_rendering" ))) || |
| 538 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 539 | fExtensions.has("GL_CHROMIUM_path_rendering" ) || |
| 540 | fExtensions.has("GL_NV_path_rendering" )))) { |
| 541 | if (!fFunctions.fMatrixLoadIdentity || |
| 542 | !fFunctions.fMatrixLoadf) { |
| 543 | RETURN_FALSE_INTERFACE; |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | if ((GR_IS_GR_GL(fStandard) && ( |
| 548 | fExtensions.has("GL_NV_path_rendering" ))) || |
| 549 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 550 | fExtensions.has("GL_CHROMIUM_path_rendering" ) || |
| 551 | fExtensions.has("GL_NV_path_rendering" )))) { |
| 552 | if (!fFunctions.fCoverFillPath || |
| 553 | !fFunctions.fCoverFillPathInstanced || |
| 554 | !fFunctions.fCoverStrokePath || |
| 555 | !fFunctions.fCoverStrokePathInstanced || |
| 556 | !fFunctions.fDeletePaths || |
| 557 | !fFunctions.fGenPaths || |
| 558 | !fFunctions.fIsPath || |
| 559 | !fFunctions.fPathCommands || |
| 560 | !fFunctions.fPathParameterf || |
| 561 | !fFunctions.fPathParameteri || |
| 562 | !fFunctions.fPathStencilFunc || |
| 563 | !fFunctions.fStencilFillPath || |
| 564 | !fFunctions.fStencilFillPathInstanced || |
| 565 | !fFunctions.fStencilStrokePath || |
| 566 | !fFunctions.fStencilStrokePathInstanced) { |
| 567 | RETURN_FALSE_INTERFACE; |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 572 | fExtensions.has("GL_CHROMIUM_path_rendering" )))) { |
| 573 | if (!fFunctions.fBindFragmentInputLocation) { |
| 574 | RETURN_FALSE_INTERFACE; |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | if ((GR_IS_GR_GL(fStandard) && ( |
| 579 | fExtensions.has("GL_NV_framebuffer_mixed_samples" ))) || |
| 580 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 581 | fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples" ) || |
| 582 | fExtensions.has("GL_NV_framebuffer_mixed_samples" )))) { |
| 583 | if (!fFunctions.fCoverageModulation) { |
| 584 | RETURN_FALSE_INTERFACE; |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | if ((GR_IS_GR_GL(fStandard) && ( |
| 589 | (glVer >= GR_GL_VER(4,3)) || |
| 590 | fExtensions.has("GL_KHR_debug" ))) || |
| 591 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 592 | fExtensions.has("GL_KHR_debug" )))) { |
| 593 | if (!fFunctions.fDebugMessageCallback || |
| 594 | !fFunctions.fDebugMessageControl || |
| 595 | !fFunctions.fDebugMessageInsert || |
| 596 | !fFunctions.fGetDebugMessageLog || |
| 597 | !fFunctions.fObjectLabel || |
| 598 | !fFunctions.fPopDebugGroup || |
| 599 | !fFunctions.fPushDebugGroup) { |
| 600 | RETURN_FALSE_INTERFACE; |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | if ((GR_IS_GR_GL_ES(fStandard) && ( |
| 605 | fExtensions.has("GL_CHROMIUM_bind_uniform_location" )))) { |
| 606 | if (!fFunctions.fBindUniformLocation) { |
| 607 | RETURN_FALSE_INTERFACE; |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | if ((GR_IS_GR_GL(fStandard) && ( |
| 612 | fExtensions.has("GL_EXT_window_rectangles" ))) || |
| 613 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 614 | fExtensions.has("GL_EXT_window_rectangles" )))) { |
| 615 | if (!fFunctions.fWindowRectangles) { |
| 616 | RETURN_FALSE_INTERFACE; |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | if ((GR_IS_GR_GL(fStandard) && ( |
| 621 | (glVer >= GR_GL_VER(3,2)) || |
| 622 | fExtensions.has("GL_ARB_sync" ))) || |
| 623 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 624 | (glVer >= GR_GL_VER(3,0)) || |
| 625 | fExtensions.has("GL_APPLE_sync" ))) || |
| 626 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 627 | (glVer >= GR_GL_VER(2,0))))) { |
| 628 | if (!fFunctions.fClientWaitSync || |
| 629 | !fFunctions.fDeleteSync || |
| 630 | !fFunctions.fFenceSync || |
| 631 | !fFunctions.fIsSync || |
| 632 | !fFunctions.fWaitSync) { |
| 633 | RETURN_FALSE_INTERFACE; |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | if ((GR_IS_GR_GL(fStandard) && ( |
| 638 | (glVer >= GR_GL_VER(4,2)) || |
| 639 | fExtensions.has("GL_ARB_internalformat_query" ))) || |
| 640 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 641 | (glVer >= GR_GL_VER(3,0))))) { |
| 642 | if (!fFunctions.fGetInternalformativ) { |
| 643 | RETURN_FALSE_INTERFACE; |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | if ((GR_IS_GR_GL(fStandard) && ( |
| 648 | (glVer >= GR_GL_VER(4,1)))) || |
| 649 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 650 | (glVer >= GR_GL_VER(3,0)) || |
| 651 | fExtensions.has("GL_OES_get_program_binary" )))) { |
| 652 | if (!fFunctions.fGetProgramBinary || |
| 653 | !fFunctions.fProgramBinary) { |
| 654 | RETURN_FALSE_INTERFACE; |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | if ((GR_IS_GR_GL(fStandard) && ( |
| 659 | (glVer >= GR_GL_VER(4,1)))) || |
| 660 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 661 | (glVer >= GR_GL_VER(3,0))))) { |
| 662 | if (!fFunctions.fProgramParameteri) { |
| 663 | RETURN_FALSE_INTERFACE; |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | if ((GR_IS_GR_GL(fStandard) && ( |
| 668 | (glVer >= GR_GL_VER(3,2)) || |
| 669 | fExtensions.has("GL_ARB_sampler_objects" ))) || |
| 670 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 671 | (glVer >= GR_GL_VER(3,0)))) || |
| 672 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 673 | (glVer >= GR_GL_VER(2,0))))) { |
| 674 | if (!fFunctions.fBindSampler || |
| 675 | !fFunctions.fDeleteSamplers || |
| 676 | !fFunctions.fGenSamplers || |
| 677 | !fFunctions.fSamplerParameteri || |
| 678 | !fFunctions.fSamplerParameteriv) { |
| 679 | RETURN_FALSE_INTERFACE; |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | if (GR_IS_GR_GL(fStandard)) { |
| 684 | if (!fFunctions.fGetQueryObjectiv) { |
| 685 | RETURN_FALSE_INTERFACE; |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | if (GR_IS_GR_GL(fStandard) || |
| 690 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 691 | (glVer >= GR_GL_VER(3,0)) || |
| 692 | fExtensions.has("GL_EXT_occlusion_query_boolean" )))) { |
| 693 | #if GR_TEST_UTILS |
| 694 | if (!fFunctions.fBeginQuery || |
| 695 | !fFunctions.fDeleteQueries || |
| 696 | !fFunctions.fEndQuery || |
| 697 | !fFunctions.fGenQueries || |
| 698 | !fFunctions.fGetQueryObjectuiv || |
| 699 | !fFunctions.fGetQueryiv) { |
| 700 | RETURN_FALSE_INTERFACE; |
| 701 | } |
| 702 | #endif |
| 703 | // all functions were marked optional or test_only |
| 704 | } |
| 705 | |
| 706 | if ((GR_IS_GR_GL(fStandard) && ( |
| 707 | (glVer >= GR_GL_VER(3,3)) || |
| 708 | fExtensions.has("GL_ARB_timer_query" ) || |
| 709 | fExtensions.has("GL_EXT_timer_query" )))) { |
| 710 | if (!fFunctions.fGetQueryObjecti64v || |
| 711 | !fFunctions.fGetQueryObjectui64v) { |
| 712 | RETURN_FALSE_INTERFACE; |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | if ((GR_IS_GR_GL(fStandard) && ( |
| 717 | (glVer >= GR_GL_VER(3,3)) || |
| 718 | fExtensions.has("GL_ARB_timer_query" )))) { |
| 719 | if (!fFunctions.fQueryCounter) { |
| 720 | RETURN_FALSE_INTERFACE; |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | if ((GR_IS_GR_GL(fStandard) && ( |
| 725 | (glVer >= GR_GL_VER(4,3)) || |
| 726 | fExtensions.has("GL_ARB_invalidate_subdata" )))) { |
| 727 | if (!fFunctions.fInvalidateBufferData || |
| 728 | !fFunctions.fInvalidateBufferSubData || |
| 729 | !fFunctions.fInvalidateTexImage || |
| 730 | !fFunctions.fInvalidateTexSubImage) { |
| 731 | RETURN_FALSE_INTERFACE; |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | if ((GR_IS_GR_GL(fStandard) && ( |
| 736 | (glVer >= GR_GL_VER(4,3)) || |
| 737 | fExtensions.has("GL_ARB_invalidate_subdata" ))) || |
| 738 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 739 | (glVer >= GR_GL_VER(3,0)))) || |
| 740 | (GR_IS_GR_WEBGL(fStandard) && ( |
| 741 | (glVer >= GR_GL_VER(2,0))))) { |
| 742 | if (!fFunctions.fInvalidateFramebuffer || |
| 743 | !fFunctions.fInvalidateSubFramebuffer) { |
| 744 | RETURN_FALSE_INTERFACE; |
| 745 | } |
| 746 | } |
| 747 | |
| 748 | if ((GR_IS_GR_GL(fStandard) && ( |
| 749 | (glVer >= GR_GL_VER(4,3)) || |
| 750 | fExtensions.has("GL_ARB_ES2_compatibility" ))) || |
| 751 | GR_IS_GR_GL_ES(fStandard) || |
| 752 | GR_IS_GR_WEBGL(fStandard)) { |
| 753 | if (!fFunctions.fGetShaderPrecisionFormat) { |
| 754 | RETURN_FALSE_INTERFACE; |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | if ((GR_IS_GR_GL(fStandard) && ( |
| 759 | fExtensions.has("GL_NV_fence" ))) || |
| 760 | (GR_IS_GR_GL_ES(fStandard) && ( |
| 761 | fExtensions.has("GL_NV_fence" )))) { |
| 762 | if (!fFunctions.fDeleteFences || |
| 763 | !fFunctions.fFinishFence || |
| 764 | !fFunctions.fGenFences || |
| 765 | !fFunctions.fSetFence || |
| 766 | !fFunctions.fTestFence) { |
| 767 | RETURN_FALSE_INTERFACE; |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | |
| 772 | // End autogenerated content |
| 773 | return true; |
| 774 | } |
| 775 | |
| 776 | #if GR_TEST_UTILS |
| 777 | |
| 778 | void GrGLInterface::abandon() const { |
| 779 | const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions(); |
| 780 | } |
| 781 | |
| 782 | #endif // GR_TEST_UTILS |
| 783 | |