OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
10 #include "gl/GrGLExtensions.h" | 10 #include "gl/GrGLExtensions.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn; | 32 newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn; |
33 newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn; | 33 newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn; |
34 | 34 |
35 return newInterface; | 35 return newInterface; |
36 } | 36 } |
37 | 37 |
38 const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { | 38 const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { |
39 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); | 39 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
40 | 40 |
41 newInterface->fExtensions.remove("GL_NV_path_rendering"); | 41 newInterface->fExtensions.remove("GL_NV_path_rendering"); |
| 42 |
42 newInterface->fFunctions.fPathCommands = NULL; | 43 newInterface->fFunctions.fPathCommands = NULL; |
43 newInterface->fFunctions.fPathCoords = NULL; | 44 newInterface->fFunctions.fPathCoords = NULL; |
| 45 newInterface->fFunctions.fPathSubCommands = NULL; |
| 46 newInterface->fFunctions.fPathSubCoords = NULL; |
| 47 newInterface->fFunctions.fPathString = NULL; |
| 48 newInterface->fFunctions.fPathGlyphs = NULL; |
| 49 newInterface->fFunctions.fPathGlyphRange = NULL; |
| 50 newInterface->fFunctions.fWeightPaths = NULL; |
| 51 newInterface->fFunctions.fCopyPath = NULL; |
| 52 newInterface->fFunctions.fInterpolatePaths = NULL; |
| 53 newInterface->fFunctions.fTransformPath = NULL; |
| 54 newInterface->fFunctions.fPathParameteriv = NULL; |
44 newInterface->fFunctions.fPathParameteri = NULL; | 55 newInterface->fFunctions.fPathParameteri = NULL; |
| 56 newInterface->fFunctions.fPathParameterfv = NULL; |
45 newInterface->fFunctions.fPathParameterf = NULL; | 57 newInterface->fFunctions.fPathParameterf = NULL; |
| 58 newInterface->fFunctions.fPathDashArray = NULL; |
46 newInterface->fFunctions.fGenPaths = NULL; | 59 newInterface->fFunctions.fGenPaths = NULL; |
47 newInterface->fFunctions.fDeletePaths = NULL; | 60 newInterface->fFunctions.fDeletePaths = NULL; |
| 61 newInterface->fFunctions.fIsPath = NULL; |
48 newInterface->fFunctions.fPathStencilFunc = NULL; | 62 newInterface->fFunctions.fPathStencilFunc = NULL; |
| 63 newInterface->fFunctions.fPathStencilDepthOffset = NULL; |
49 newInterface->fFunctions.fStencilFillPath = NULL; | 64 newInterface->fFunctions.fStencilFillPath = NULL; |
50 newInterface->fFunctions.fStencilStrokePath = NULL; | 65 newInterface->fFunctions.fStencilStrokePath = NULL; |
51 newInterface->fFunctions.fStencilFillPathInstanced = NULL; | 66 newInterface->fFunctions.fStencilFillPathInstanced = NULL; |
52 newInterface->fFunctions.fStencilStrokePathInstanced = NULL; | 67 newInterface->fFunctions.fStencilStrokePathInstanced = NULL; |
| 68 newInterface->fFunctions.fPathCoverDepthFunc = NULL; |
| 69 newInterface->fFunctions.fPathColorGen = NULL; |
53 newInterface->fFunctions.fPathTexGen = NULL; | 70 newInterface->fFunctions.fPathTexGen = NULL; |
| 71 newInterface->fFunctions.fPathFogGen = NULL; |
54 newInterface->fFunctions.fCoverFillPath = NULL; | 72 newInterface->fFunctions.fCoverFillPath = NULL; |
55 newInterface->fFunctions.fCoverStrokePath = NULL; | 73 newInterface->fFunctions.fCoverStrokePath = NULL; |
56 newInterface->fFunctions.fCoverFillPathInstanced = NULL; | 74 newInterface->fFunctions.fCoverFillPathInstanced = NULL; |
57 newInterface->fFunctions.fCoverStrokePathInstanced = NULL; | 75 newInterface->fFunctions.fCoverStrokePathInstanced = NULL; |
58 newInterface->fFunctions.fProgramPathFragmentInputGen = NULL; | 76 newInterface->fFunctions.fGetPathParameteriv = NULL; |
| 77 newInterface->fFunctions.fGetPathParameterfv = NULL; |
| 78 newInterface->fFunctions.fGetPathCommands = NULL; |
| 79 newInterface->fFunctions.fGetPathCoords = NULL; |
| 80 newInterface->fFunctions.fGetPathDashArray = NULL; |
| 81 newInterface->fFunctions.fGetPathMetrics = NULL; |
| 82 newInterface->fFunctions.fGetPathMetricRange = NULL; |
| 83 newInterface->fFunctions.fGetPathSpacing = NULL; |
| 84 newInterface->fFunctions.fGetPathColorGeniv = NULL; |
| 85 newInterface->fFunctions.fGetPathColorGenfv = NULL; |
| 86 newInterface->fFunctions.fGetPathTexGeniv = NULL; |
| 87 newInterface->fFunctions.fGetPathTexGenfv = NULL; |
| 88 newInterface->fFunctions.fIsPointInFillPath = NULL; |
| 89 newInterface->fFunctions.fIsPointInStrokePath = NULL; |
| 90 newInterface->fFunctions.fGetPathLength = NULL; |
| 91 newInterface->fFunctions.fPointAlongPath = NULL; |
| 92 |
59 return newInterface; | 93 return newInterface; |
60 } | 94 } |
61 | 95 |
62 GrGLInterface::GrGLInterface() { | 96 GrGLInterface::GrGLInterface() { |
63 fStandard = kNone_GrGLStandard; | 97 fStandard = kNone_GrGLStandard; |
64 | 98 |
65 #if GR_GL_PER_GL_FUNC_CALLBACK | 99 #if GR_GL_PER_GL_FUNC_CALLBACK |
66 fCallback = GrGLDefaultInterfaceCallback; | 100 fCallback = GrGLDefaultInterfaceCallback; |
67 fCallbackData = 0; | 101 fCallbackData = 0; |
68 #endif | 102 #endif |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if (NULL == fFunctions.fGetQueryObjecti64v || | 285 if (NULL == fFunctions.fGetQueryObjecti64v || |
252 NULL == fFunctions.fGetQueryObjectui64v) { | 286 NULL == fFunctions.fGetQueryObjectui64v) { |
253 RETURN_FALSE_INTERFACE | 287 RETURN_FALSE_INTERFACE |
254 } | 288 } |
255 } | 289 } |
256 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { | 290 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { |
257 if (NULL == fFunctions.fQueryCounter) { | 291 if (NULL == fFunctions.fQueryCounter) { |
258 RETURN_FALSE_INTERFACE | 292 RETURN_FALSE_INTERFACE |
259 } | 293 } |
260 } | 294 } |
| 295 if (fExtensions.has("GL_EXT_direct_state_access")) { |
| 296 if (NULL == fFunctions.fMatrixLoadf || |
| 297 NULL == fFunctions.fMatrixLoadIdentity) { |
| 298 RETURN_FALSE_INTERFACE |
| 299 } |
| 300 } |
| 301 if (fExtensions.has("GL_NV_path_rendering")) { |
| 302 if (NULL == fFunctions.fPathCommands || |
| 303 NULL == fFunctions.fPathCoords || |
| 304 NULL == fFunctions.fPathSubCommands || |
| 305 NULL == fFunctions.fPathSubCoords || |
| 306 NULL == fFunctions.fPathString || |
| 307 NULL == fFunctions.fPathGlyphs || |
| 308 NULL == fFunctions.fPathGlyphRange || |
| 309 NULL == fFunctions.fWeightPaths || |
| 310 NULL == fFunctions.fCopyPath || |
| 311 NULL == fFunctions.fInterpolatePaths || |
| 312 NULL == fFunctions.fTransformPath || |
| 313 NULL == fFunctions.fPathParameteriv || |
| 314 NULL == fFunctions.fPathParameteri || |
| 315 NULL == fFunctions.fPathParameterfv || |
| 316 NULL == fFunctions.fPathParameterf || |
| 317 NULL == fFunctions.fPathDashArray || |
| 318 NULL == fFunctions.fGenPaths || |
| 319 NULL == fFunctions.fDeletePaths || |
| 320 NULL == fFunctions.fIsPath || |
| 321 NULL == fFunctions.fPathStencilFunc || |
| 322 NULL == fFunctions.fPathStencilDepthOffset || |
| 323 NULL == fFunctions.fStencilFillPath || |
| 324 NULL == fFunctions.fStencilStrokePath || |
| 325 NULL == fFunctions.fStencilFillPathInstanced || |
| 326 NULL == fFunctions.fStencilStrokePathInstanced || |
| 327 NULL == fFunctions.fPathCoverDepthFunc || |
| 328 NULL == fFunctions.fPathColorGen || |
| 329 NULL == fFunctions.fPathTexGen || |
| 330 NULL == fFunctions.fPathFogGen || |
| 331 NULL == fFunctions.fCoverFillPath || |
| 332 NULL == fFunctions.fCoverStrokePath || |
| 333 NULL == fFunctions.fCoverFillPathInstanced || |
| 334 NULL == fFunctions.fCoverStrokePathInstanced || |
| 335 NULL == fFunctions.fGetPathParameteriv || |
| 336 NULL == fFunctions.fGetPathParameterfv || |
| 337 NULL == fFunctions.fGetPathCommands || |
| 338 NULL == fFunctions.fGetPathCoords || |
| 339 NULL == fFunctions.fGetPathDashArray || |
| 340 NULL == fFunctions.fGetPathMetrics || |
| 341 NULL == fFunctions.fGetPathMetricRange || |
| 342 NULL == fFunctions.fGetPathSpacing || |
| 343 NULL == fFunctions.fGetPathColorGeniv || |
| 344 NULL == fFunctions.fGetPathColorGenfv || |
| 345 NULL == fFunctions.fGetPathTexGeniv || |
| 346 NULL == fFunctions.fGetPathTexGenfv || |
| 347 NULL == fFunctions.fIsPointInFillPath || |
| 348 NULL == fFunctions.fIsPointInStrokePath || |
| 349 NULL == fFunctions.fGetPathLength || |
| 350 NULL == fFunctions.fPointAlongPath) { |
| 351 RETURN_FALSE_INTERFACE |
| 352 } |
| 353 } |
261 } | 354 } |
262 | 355 |
263 // optional function on desktop before 1.3 | 356 // optional function on desktop before 1.3 |
264 if (kGL_GrGLStandard != fStandard || | 357 if (kGL_GrGLStandard != fStandard || |
265 (glVer >= GR_GL_VER(1,3)) || | 358 (glVer >= GR_GL_VER(1,3)) || |
266 fExtensions.has("GL_ARB_texture_compression")) { | 359 fExtensions.has("GL_ARB_texture_compression")) { |
267 if (NULL == fFunctions.fCompressedTexImage2D | 360 if (NULL == fFunctions.fCompressedTexImage2D |
268 #if 0 | 361 #if 0 |
269 || NULL == fFunctions.fCompressedTexSubImage2D | 362 || NULL == fFunctions.fCompressedTexSubImage2D |
270 #endif | 363 #endif |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 519 |
427 // These functions are added to the 3.0 version of both GLES and GL. | 520 // These functions are added to the 3.0 version of both GLES and GL. |
428 if (glVer >= GR_GL_VER(3,0) || | 521 if (glVer >= GR_GL_VER(3,0) || |
429 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || | 522 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || |
430 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { | 523 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { |
431 if (NULL == fFunctions.fMapBufferRange || | 524 if (NULL == fFunctions.fMapBufferRange || |
432 NULL == fFunctions.fFlushMappedBufferRange) { | 525 NULL == fFunctions.fFlushMappedBufferRange) { |
433 RETURN_FALSE_INTERFACE; | 526 RETURN_FALSE_INTERFACE; |
434 } | 527 } |
435 } | 528 } |
436 if (fExtensions.has("GL_EXT_direct_state_access")) { | |
437 if (NULL == fFunctions.fMatrixLoadf || | |
438 NULL == fFunctions.fMatrixLoadIdentity) { | |
439 RETURN_FALSE_INTERFACE | |
440 } | |
441 } | |
442 if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) || | |
443 fExtensions.has("GL_ARB_program_interface_query")) { | |
444 if (NULL == fFunctions.fGetProgramResourceLocation) { | |
445 RETURN_FALSE_INTERFACE | |
446 } | |
447 } | |
448 if (fExtensions.has("GL_NV_path_rendering")) { | |
449 if (NULL == fFunctions.fPathCommands || | |
450 NULL == fFunctions.fPathCoords || | |
451 NULL == fFunctions.fPathParameteri || | |
452 NULL == fFunctions.fPathParameterf || | |
453 NULL == fFunctions.fGenPaths || | |
454 NULL == fFunctions.fDeletePaths || | |
455 NULL == fFunctions.fPathStencilFunc || | |
456 NULL == fFunctions.fStencilFillPath || | |
457 NULL == fFunctions.fStencilStrokePath || | |
458 NULL == fFunctions.fStencilFillPathInstanced || | |
459 NULL == fFunctions.fStencilStrokePathInstanced || | |
460 NULL == fFunctions.fCoverFillPath || | |
461 NULL == fFunctions.fCoverStrokePath || | |
462 NULL == fFunctions.fCoverFillPathInstanced || | |
463 NULL == fFunctions.fCoverStrokePathInstanced) { | |
464 RETURN_FALSE_INTERFACE | |
465 } | |
466 // Currently ProgramPathFragmentInputGen is not used on | |
467 // OpenGL, rather PathTexGen is. | |
468 if ((kGL_GrGLStandard == fStandard && NULL == fFunctions.fPathTexGen) || | |
469 (kGLES_GrGLStandard == fStandard && NULL == fFunctions.fProgramPathF
ragmentInputGen)) { | |
470 RETURN_FALSE_INTERFACE | |
471 } | |
472 } | |
473 | |
474 return true; | 529 return true; |
475 } | 530 } |
OLD | NEW |