| 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" |
| 11 #include "gl/GrGLUtil.h" | 11 #include "gl/GrGLUtil.h" |
| 12 | 12 |
| 13 #include <stdio.h> | 13 #include <stdio.h> |
| 14 | 14 |
| 15 #if GR_GL_PER_GL_FUNC_CALLBACK | 15 #if GR_GL_PER_GL_FUNC_CALLBACK |
| 16 namespace { | 16 namespace { |
| 17 void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} | 17 void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} |
| 18 } | 18 } |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { | |
| 22 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); | |
| 23 | |
| 24 newInterface->fExtensions.remove("GL_NV_path_rendering"); | |
| 25 | |
| 26 newInterface->fPathCommands = NULL; | |
| 27 newInterface->fPathCoords = NULL; | |
| 28 newInterface->fPathSubCommands = NULL; | |
| 29 newInterface->fPathSubCoords = NULL; | |
| 30 newInterface->fPathString = NULL; | |
| 31 newInterface->fPathGlyphs = NULL; | |
| 32 newInterface->fPathGlyphRange = NULL; | |
| 33 newInterface->fWeightPaths = NULL; | |
| 34 newInterface->fCopyPath = NULL; | |
| 35 newInterface->fInterpolatePaths = NULL; | |
| 36 newInterface->fTransformPath = NULL; | |
| 37 newInterface->fPathParameteriv = NULL; | |
| 38 newInterface->fPathParameteri = NULL; | |
| 39 newInterface->fPathParameterfv = NULL; | |
| 40 newInterface->fPathParameterf = NULL; | |
| 41 newInterface->fPathDashArray = NULL; | |
| 42 newInterface->fGenPaths = NULL; | |
| 43 newInterface->fDeletePaths = NULL; | |
| 44 newInterface->fIsPath = NULL; | |
| 45 newInterface->fPathStencilFunc = NULL; | |
| 46 newInterface->fPathStencilDepthOffset = NULL; | |
| 47 newInterface->fStencilFillPath = NULL; | |
| 48 newInterface->fStencilStrokePath = NULL; | |
| 49 newInterface->fStencilFillPathInstanced = NULL; | |
| 50 newInterface->fStencilStrokePathInstanced = NULL; | |
| 51 newInterface->fPathCoverDepthFunc = NULL; | |
| 52 newInterface->fPathColorGen = NULL; | |
| 53 newInterface->fPathTexGen = NULL; | |
| 54 newInterface->fPathFogGen = NULL; | |
| 55 newInterface->fCoverFillPath = NULL; | |
| 56 newInterface->fCoverStrokePath = NULL; | |
| 57 newInterface->fCoverFillPathInstanced = NULL; | |
| 58 newInterface->fCoverStrokePathInstanced = NULL; | |
| 59 newInterface->fGetPathParameteriv = NULL; | |
| 60 newInterface->fGetPathParameterfv = NULL; | |
| 61 newInterface->fGetPathCommands = NULL; | |
| 62 newInterface->fGetPathCoords = NULL; | |
| 63 newInterface->fGetPathDashArray = NULL; | |
| 64 newInterface->fGetPathMetrics = NULL; | |
| 65 newInterface->fGetPathMetricRange = NULL; | |
| 66 newInterface->fGetPathSpacing = NULL; | |
| 67 newInterface->fGetPathColorGeniv = NULL; | |
| 68 newInterface->fGetPathColorGenfv = NULL; | |
| 69 newInterface->fGetPathTexGeniv = NULL; | |
| 70 newInterface->fGetPathTexGenfv = NULL; | |
| 71 newInterface->fIsPointInFillPath = NULL; | |
| 72 newInterface->fIsPointInStrokePath = NULL; | |
| 73 newInterface->fGetPathLength = NULL; | |
| 74 newInterface->fPointAlongPath = NULL; | |
| 75 | |
| 76 return newInterface; | |
| 77 } | |
| 78 | |
| 79 GrGLInterface::GrGLInterface() | 21 GrGLInterface::GrGLInterface() |
| 80 // TODO: Remove this madness ASAP. | 22 // TODO: Remove this madness ASAP. |
| 81 : fActiveTexture(&fFunctions.fActiveTexture) | 23 : fActiveTexture(&fFunctions.fActiveTexture) |
| 82 , fAttachShader(&fFunctions.fAttachShader) | 24 , fAttachShader(&fFunctions.fAttachShader) |
| 83 , fBeginQuery(&fFunctions.fBeginQuery) | 25 , fBeginQuery(&fFunctions.fBeginQuery) |
| 84 , fBindAttribLocation(&fFunctions.fBindAttribLocation) | 26 , fBindAttribLocation(&fFunctions.fBindAttribLocation) |
| 85 , fBindBuffer(&fFunctions.fBindBuffer) | 27 , fBindBuffer(&fFunctions.fBindBuffer) |
| 86 , fBindFragDataLocation(&fFunctions.fBindFragDataLocation) | 28 , fBindFragDataLocation(&fFunctions.fBindFragDataLocation) |
| 87 , fBindFragDataLocationIndexed(&fFunctions.fBindFragDataLocationIndexed) | 29 , fBindFragDataLocationIndexed(&fFunctions.fBindFragDataLocationIndexed) |
| 88 , fBindFramebuffer(&fFunctions.fBindFramebuffer) | 30 , fBindFramebuffer(&fFunctions.fBindFramebuffer) |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 , fGetPathMetrics(&fFunctions.fGetPathMetrics) | 198 , fGetPathMetrics(&fFunctions.fGetPathMetrics) |
| 257 , fGetPathMetricRange(&fFunctions.fGetPathMetricRange) | 199 , fGetPathMetricRange(&fFunctions.fGetPathMetricRange) |
| 258 , fGetPathSpacing(&fFunctions.fGetPathSpacing) | 200 , fGetPathSpacing(&fFunctions.fGetPathSpacing) |
| 259 , fGetPathColorGeniv(&fFunctions.fGetPathColorGeniv) | 201 , fGetPathColorGeniv(&fFunctions.fGetPathColorGeniv) |
| 260 , fGetPathColorGenfv(&fFunctions.fGetPathColorGenfv) | 202 , fGetPathColorGenfv(&fFunctions.fGetPathColorGenfv) |
| 261 , fGetPathTexGeniv(&fFunctions.fGetPathTexGeniv) | 203 , fGetPathTexGeniv(&fFunctions.fGetPathTexGeniv) |
| 262 , fGetPathTexGenfv(&fFunctions.fGetPathTexGenfv) | 204 , fGetPathTexGenfv(&fFunctions.fGetPathTexGenfv) |
| 263 , fIsPointInFillPath(&fFunctions.fIsPointInFillPath) | 205 , fIsPointInFillPath(&fFunctions.fIsPointInFillPath) |
| 264 , fIsPointInStrokePath(&fFunctions.fIsPointInStrokePath) | 206 , fIsPointInStrokePath(&fFunctions.fIsPointInStrokePath) |
| 265 , fGetPathLength(&fFunctions.fGetPathLength) | 207 , fGetPathLength(&fFunctions.fGetPathLength) |
| 266 , fPointAlongPath(&fFunctions.fPointAlongPath) { | 208 , fPointAlongPath(&fFunctions.fPointAlongPath) |
| 209 { |
| 267 fStandard = kNone_GrGLStandard; | 210 fStandard = kNone_GrGLStandard; |
| 268 | 211 |
| 269 #if GR_GL_PER_GL_FUNC_CALLBACK | 212 #if GR_GL_PER_GL_FUNC_CALLBACK |
| 270 fCallback = GrGLDefaultInterfaceCallback; | 213 fCallback = GrGLDefaultInterfaceCallback; |
| 271 fCallbackData = 0; | 214 fCallbackData = 0; |
| 272 #endif | 215 #endif |
| 273 } | 216 } |
| 274 | 217 |
| 275 GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { | |
| 276 SkASSERT(NULL != interface); | |
| 277 | |
| 278 GrGLInterface* clone = SkNEW(GrGLInterface); | |
| 279 clone->fStandard = interface->fStandard; | |
| 280 clone->fExtensions = interface->fExtensions; | |
| 281 clone->fFunctions = interface->fFunctions; | |
| 282 #if GR_GL_PER_GL_FUNC_CALLBACK | |
| 283 clone->fCallback = interface->fCallback; | |
| 284 clone->fCallbackData = interface->fCallbackData; | |
| 285 #endif | |
| 286 return clone; | |
| 287 } | |
| 288 | |
| 289 bool GrGLInterface::validate() const { | 218 bool GrGLInterface::validate() const { |
| 290 | 219 |
| 291 if (kNone_GrGLStandard == fStandard) { | 220 if (kNone_GrGLStandard == fStandard) { |
| 292 return false; | 221 return false; |
| 293 } | 222 } |
| 294 | 223 |
| 295 // This const hackery is necessary because the factories in Chromium do not
yet initialize | 224 // This const hackery is necessary because the factories in Chromium do not
yet initialize |
| 296 // fExtensions. | 225 // fExtensions. |
| 297 if (!fExtensions.isInitialized()) { | 226 if (!fExtensions.isInitialized()) { |
| 298 GrGLExtensions* extensions = const_cast<GrGLExtensions*>(&fExtensions); | 227 GrGLExtensions* extensions = const_cast<GrGLExtensions*>(&fExtensions); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 NULL == fFunctions.fLoadIdentity || | 398 NULL == fFunctions.fLoadIdentity || |
| 470 NULL == fFunctions.fLoadMatrixf || | 399 NULL == fFunctions.fLoadMatrixf || |
| 471 NULL == fFunctions.fMatrixMode || | 400 NULL == fFunctions.fMatrixMode || |
| 472 NULL == fFunctions.fTexGenf || | 401 NULL == fFunctions.fTexGenf || |
| 473 NULL == fFunctions.fTexGenfv || | 402 NULL == fFunctions.fTexGenfv || |
| 474 NULL == fFunctions.fTexGeni || | 403 NULL == fFunctions.fTexGeni || |
| 475 NULL == fFunctions.fVertexPointer) { | 404 NULL == fFunctions.fVertexPointer) { |
| 476 return false; | 405 return false; |
| 477 } | 406 } |
| 478 } | 407 } |
| 479 if (fExtensions.has("GL_NV_path_rendering")) { | 408 if (false && fExtensions.has("GL_NV_path_rendering")) { |
| 480 if (NULL == fFunctions.fPathCommands || | 409 if (NULL == fFunctions.fPathCommands || |
| 481 NULL == fFunctions.fPathCoords || | 410 NULL == fFunctions.fPathCoords || |
| 482 NULL == fFunctions.fPathSubCommands || | 411 NULL == fFunctions.fPathSubCommands || |
| 483 NULL == fFunctions.fPathSubCoords || | 412 NULL == fFunctions.fPathSubCoords || |
| 484 NULL == fFunctions.fPathString || | 413 NULL == fFunctions.fPathString || |
| 485 NULL == fFunctions.fPathGlyphs || | 414 NULL == fFunctions.fPathGlyphs || |
| 486 NULL == fFunctions.fPathGlyphRange || | 415 NULL == fFunctions.fPathGlyphRange || |
| 487 NULL == fFunctions.fWeightPaths || | 416 NULL == fFunctions.fWeightPaths || |
| 488 NULL == fFunctions.fCopyPath || | 417 NULL == fFunctions.fCopyPath || |
| 489 NULL == fFunctions.fInterpolatePaths || | 418 NULL == fFunctions.fInterpolatePaths || |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_obje
ct")) { | 579 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_obje
ct")) { |
| 651 if (NULL == fFunctions.fBindVertexArray || | 580 if (NULL == fFunctions.fBindVertexArray || |
| 652 NULL == fFunctions.fDeleteVertexArrays || | 581 NULL == fFunctions.fDeleteVertexArrays || |
| 653 NULL == fFunctions.fGenVertexArrays) { | 582 NULL == fFunctions.fGenVertexArrays) { |
| 654 return false; | 583 return false; |
| 655 } | 584 } |
| 656 } | 585 } |
| 657 } | 586 } |
| 658 return true; | 587 return true; |
| 659 } | 588 } |
| OLD | NEW |