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 | |
43 newInterface->fFunctions.fPathCommands = NULL; | 42 newInterface->fFunctions.fPathCommands = NULL; |
44 newInterface->fFunctions.fPathCoords = NULL; | 43 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; | |
55 newInterface->fFunctions.fPathParameteri = NULL; | 44 newInterface->fFunctions.fPathParameteri = NULL; |
56 newInterface->fFunctions.fPathParameterfv = NULL; | |
57 newInterface->fFunctions.fPathParameterf = NULL; | 45 newInterface->fFunctions.fPathParameterf = NULL; |
58 newInterface->fFunctions.fPathDashArray = NULL; | |
59 newInterface->fFunctions.fGenPaths = NULL; | 46 newInterface->fFunctions.fGenPaths = NULL; |
60 newInterface->fFunctions.fDeletePaths = NULL; | 47 newInterface->fFunctions.fDeletePaths = NULL; |
61 newInterface->fFunctions.fIsPath = NULL; | |
62 newInterface->fFunctions.fPathStencilFunc = NULL; | 48 newInterface->fFunctions.fPathStencilFunc = NULL; |
63 newInterface->fFunctions.fPathStencilDepthOffset = NULL; | |
64 newInterface->fFunctions.fStencilFillPath = NULL; | 49 newInterface->fFunctions.fStencilFillPath = NULL; |
65 newInterface->fFunctions.fStencilStrokePath = NULL; | 50 newInterface->fFunctions.fStencilStrokePath = NULL; |
66 newInterface->fFunctions.fStencilFillPathInstanced = NULL; | 51 newInterface->fFunctions.fStencilFillPathInstanced = NULL; |
67 newInterface->fFunctions.fStencilStrokePathInstanced = NULL; | 52 newInterface->fFunctions.fStencilStrokePathInstanced = NULL; |
68 newInterface->fFunctions.fPathCoverDepthFunc = NULL; | |
69 newInterface->fFunctions.fPathColorGen = NULL; | |
70 newInterface->fFunctions.fPathTexGen = NULL; | 53 newInterface->fFunctions.fPathTexGen = NULL; |
71 newInterface->fFunctions.fPathFogGen = NULL; | |
72 newInterface->fFunctions.fCoverFillPath = NULL; | 54 newInterface->fFunctions.fCoverFillPath = NULL; |
73 newInterface->fFunctions.fCoverStrokePath = NULL; | 55 newInterface->fFunctions.fCoverStrokePath = NULL; |
74 newInterface->fFunctions.fCoverFillPathInstanced = NULL; | 56 newInterface->fFunctions.fCoverFillPathInstanced = NULL; |
75 newInterface->fFunctions.fCoverStrokePathInstanced = NULL; | 57 newInterface->fFunctions.fCoverStrokePathInstanced = NULL; |
76 newInterface->fFunctions.fGetPathParameteriv = NULL; | 58 newInterface->fFunctions.fProgramPathFragmentInputGen = 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 | |
93 return newInterface; | 59 return newInterface; |
94 } | 60 } |
95 | 61 |
96 GrGLInterface::GrGLInterface() { | 62 GrGLInterface::GrGLInterface() { |
97 fStandard = kNone_GrGLStandard; | 63 fStandard = kNone_GrGLStandard; |
98 | 64 |
99 #if GR_GL_PER_GL_FUNC_CALLBACK | 65 #if GR_GL_PER_GL_FUNC_CALLBACK |
100 fCallback = GrGLDefaultInterfaceCallback; | 66 fCallback = GrGLDefaultInterfaceCallback; |
101 fCallbackData = 0; | 67 fCallbackData = 0; |
102 #endif | 68 #endif |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (NULL == fFunctions.fGetQueryObjecti64v || | 251 if (NULL == fFunctions.fGetQueryObjecti64v || |
286 NULL == fFunctions.fGetQueryObjectui64v) { | 252 NULL == fFunctions.fGetQueryObjectui64v) { |
287 RETURN_FALSE_INTERFACE | 253 RETURN_FALSE_INTERFACE |
288 } | 254 } |
289 } | 255 } |
290 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { | 256 if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { |
291 if (NULL == fFunctions.fQueryCounter) { | 257 if (NULL == fFunctions.fQueryCounter) { |
292 RETURN_FALSE_INTERFACE | 258 RETURN_FALSE_INTERFACE |
293 } | 259 } |
294 } | 260 } |
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 } | |
354 } | 261 } |
355 | 262 |
356 // optional function on desktop before 1.3 | 263 // optional function on desktop before 1.3 |
357 if (kGL_GrGLStandard != fStandard || | 264 if (kGL_GrGLStandard != fStandard || |
358 (glVer >= GR_GL_VER(1,3)) || | 265 (glVer >= GR_GL_VER(1,3)) || |
359 fExtensions.has("GL_ARB_texture_compression")) { | 266 fExtensions.has("GL_ARB_texture_compression")) { |
360 if (NULL == fFunctions.fCompressedTexImage2D | 267 if (NULL == fFunctions.fCompressedTexImage2D |
361 #if 0 | 268 #if 0 |
362 || NULL == fFunctions.fCompressedTexSubImage2D | 269 || NULL == fFunctions.fCompressedTexSubImage2D |
363 #endif | 270 #endif |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 426 |
520 // These functions are added to the 3.0 version of both GLES and GL. | 427 // These functions are added to the 3.0 version of both GLES and GL. |
521 if (glVer >= GR_GL_VER(3,0) || | 428 if (glVer >= GR_GL_VER(3,0) || |
522 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || | 429 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_r
ange")) || |
523 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { | 430 (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_ran
ge"))) { |
524 if (NULL == fFunctions.fMapBufferRange || | 431 if (NULL == fFunctions.fMapBufferRange || |
525 NULL == fFunctions.fFlushMappedBufferRange) { | 432 NULL == fFunctions.fFlushMappedBufferRange) { |
526 RETURN_FALSE_INTERFACE; | 433 RETURN_FALSE_INTERFACE; |
527 } | 434 } |
528 } | 435 } |
| 436 |
| 437 if ((kGL_GrGLStandard == fStandard && fExtensions.has("GL_EXT_direct_state_a
ccess")) || |
| 438 (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_NV_path_renderin
g"))) { |
| 439 if (NULL == fFunctions.fMatrixLoadf || |
| 440 NULL == fFunctions.fMatrixLoadIdentity) { |
| 441 RETURN_FALSE_INTERFACE |
| 442 } |
| 443 } |
| 444 |
| 445 if ((kGL_GrGLStandard == fStandard && |
| 446 (glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_q
uery"))) || |
| 447 (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1))) { |
| 448 if (NULL == fFunctions.fGetProgramResourceLocation) { |
| 449 RETURN_FALSE_INTERFACE |
| 450 } |
| 451 } |
| 452 |
| 453 if (fExtensions.has("GL_NV_path_rendering")) { |
| 454 if (NULL == fFunctions.fPathCommands || |
| 455 NULL == fFunctions.fPathCoords || |
| 456 NULL == fFunctions.fPathParameteri || |
| 457 NULL == fFunctions.fPathParameterf || |
| 458 NULL == fFunctions.fGenPaths || |
| 459 NULL == fFunctions.fDeletePaths || |
| 460 NULL == fFunctions.fPathStencilFunc || |
| 461 NULL == fFunctions.fStencilFillPath || |
| 462 NULL == fFunctions.fStencilStrokePath || |
| 463 NULL == fFunctions.fStencilFillPathInstanced || |
| 464 NULL == fFunctions.fStencilStrokePathInstanced || |
| 465 NULL == fFunctions.fCoverFillPath || |
| 466 NULL == fFunctions.fCoverStrokePath || |
| 467 NULL == fFunctions.fCoverFillPathInstanced || |
| 468 NULL == fFunctions.fCoverStrokePathInstanced) { |
| 469 RETURN_FALSE_INTERFACE |
| 470 } |
| 471 // Currently ProgramPathFragmentInputGen is not used on |
| 472 // OpenGL, rather PathTexGen is. |
| 473 if ((kGL_GrGLStandard == fStandard && NULL == fFunctions.fPathTexGen) || |
| 474 (kGLES_GrGLStandard == fStandard && NULL == fFunctions.fProgramPathF
ragmentInputGen)) { |
| 475 RETURN_FALSE_INTERFACE |
| 476 } |
| 477 } |
| 478 |
529 return true; | 479 return true; |
530 } | 480 } |
OLD | NEW |