Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1317)

Side by Side Diff: src/gpu/gl/GrGLInterface.cpp

Issue 144003006: Turn NVPR on by default (but off in tools). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
21 GrGLInterface::GrGLInterface() 79 GrGLInterface::GrGLInterface()
22 // TODO: Remove this madness ASAP. 80 // TODO: Remove this madness ASAP.
23 : fActiveTexture(&fFunctions.fActiveTexture) 81 : fActiveTexture(&fFunctions.fActiveTexture)
24 , fAttachShader(&fFunctions.fAttachShader) 82 , fAttachShader(&fFunctions.fAttachShader)
25 , fBeginQuery(&fFunctions.fBeginQuery) 83 , fBeginQuery(&fFunctions.fBeginQuery)
26 , fBindAttribLocation(&fFunctions.fBindAttribLocation) 84 , fBindAttribLocation(&fFunctions.fBindAttribLocation)
27 , fBindBuffer(&fFunctions.fBindBuffer) 85 , fBindBuffer(&fFunctions.fBindBuffer)
28 , fBindFragDataLocation(&fFunctions.fBindFragDataLocation) 86 , fBindFragDataLocation(&fFunctions.fBindFragDataLocation)
29 , fBindFragDataLocationIndexed(&fFunctions.fBindFragDataLocationIndexed) 87 , fBindFragDataLocationIndexed(&fFunctions.fBindFragDataLocationIndexed)
30 , fBindFramebuffer(&fFunctions.fBindFramebuffer) 88 , fBindFramebuffer(&fFunctions.fBindFramebuffer)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 , fGetPathMetrics(&fFunctions.fGetPathMetrics) 256 , fGetPathMetrics(&fFunctions.fGetPathMetrics)
199 , fGetPathMetricRange(&fFunctions.fGetPathMetricRange) 257 , fGetPathMetricRange(&fFunctions.fGetPathMetricRange)
200 , fGetPathSpacing(&fFunctions.fGetPathSpacing) 258 , fGetPathSpacing(&fFunctions.fGetPathSpacing)
201 , fGetPathColorGeniv(&fFunctions.fGetPathColorGeniv) 259 , fGetPathColorGeniv(&fFunctions.fGetPathColorGeniv)
202 , fGetPathColorGenfv(&fFunctions.fGetPathColorGenfv) 260 , fGetPathColorGenfv(&fFunctions.fGetPathColorGenfv)
203 , fGetPathTexGeniv(&fFunctions.fGetPathTexGeniv) 261 , fGetPathTexGeniv(&fFunctions.fGetPathTexGeniv)
204 , fGetPathTexGenfv(&fFunctions.fGetPathTexGenfv) 262 , fGetPathTexGenfv(&fFunctions.fGetPathTexGenfv)
205 , fIsPointInFillPath(&fFunctions.fIsPointInFillPath) 263 , fIsPointInFillPath(&fFunctions.fIsPointInFillPath)
206 , fIsPointInStrokePath(&fFunctions.fIsPointInStrokePath) 264 , fIsPointInStrokePath(&fFunctions.fIsPointInStrokePath)
207 , fGetPathLength(&fFunctions.fGetPathLength) 265 , fGetPathLength(&fFunctions.fGetPathLength)
208 , fPointAlongPath(&fFunctions.fPointAlongPath) 266 , fPointAlongPath(&fFunctions.fPointAlongPath) {
209 {
210 fStandard = kNone_GrGLStandard; 267 fStandard = kNone_GrGLStandard;
211 268
212 #if GR_GL_PER_GL_FUNC_CALLBACK 269 #if GR_GL_PER_GL_FUNC_CALLBACK
213 fCallback = GrGLDefaultInterfaceCallback; 270 fCallback = GrGLDefaultInterfaceCallback;
214 fCallbackData = 0; 271 fCallbackData = 0;
215 #endif 272 #endif
216 } 273 }
217 274
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
218 bool GrGLInterface::validate() const { 289 bool GrGLInterface::validate() const {
219 290
220 if (kNone_GrGLStandard == fStandard) { 291 if (kNone_GrGLStandard == fStandard) {
221 return false; 292 return false;
222 } 293 }
223 294
224 // This const hackery is necessary because the factories in Chromium do not yet initialize 295 // This const hackery is necessary because the factories in Chromium do not yet initialize
225 // fExtensions. 296 // fExtensions.
226 if (!fExtensions.isInitialized()) { 297 if (!fExtensions.isInitialized()) {
227 GrGLExtensions* extensions = const_cast<GrGLExtensions*>(&fExtensions); 298 GrGLExtensions* extensions = const_cast<GrGLExtensions*>(&fExtensions);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 NULL == fFunctions.fLoadIdentity || 469 NULL == fFunctions.fLoadIdentity ||
399 NULL == fFunctions.fLoadMatrixf || 470 NULL == fFunctions.fLoadMatrixf ||
400 NULL == fFunctions.fMatrixMode || 471 NULL == fFunctions.fMatrixMode ||
401 NULL == fFunctions.fTexGenf || 472 NULL == fFunctions.fTexGenf ||
402 NULL == fFunctions.fTexGenfv || 473 NULL == fFunctions.fTexGenfv ||
403 NULL == fFunctions.fTexGeni || 474 NULL == fFunctions.fTexGeni ||
404 NULL == fFunctions.fVertexPointer) { 475 NULL == fFunctions.fVertexPointer) {
405 return false; 476 return false;
406 } 477 }
407 } 478 }
408 if (false && fExtensions.has("GL_NV_path_rendering")) { 479 if (fExtensions.has("GL_NV_path_rendering")) {
409 if (NULL == fFunctions.fPathCommands || 480 if (NULL == fFunctions.fPathCommands ||
410 NULL == fFunctions.fPathCoords || 481 NULL == fFunctions.fPathCoords ||
411 NULL == fFunctions.fPathSubCommands || 482 NULL == fFunctions.fPathSubCommands ||
412 NULL == fFunctions.fPathSubCoords || 483 NULL == fFunctions.fPathSubCoords ||
413 NULL == fFunctions.fPathString || 484 NULL == fFunctions.fPathString ||
414 NULL == fFunctions.fPathGlyphs || 485 NULL == fFunctions.fPathGlyphs ||
415 NULL == fFunctions.fPathGlyphRange || 486 NULL == fFunctions.fPathGlyphRange ||
416 NULL == fFunctions.fWeightPaths || 487 NULL == fFunctions.fWeightPaths ||
417 NULL == fFunctions.fCopyPath || 488 NULL == fFunctions.fCopyPath ||
418 NULL == fFunctions.fInterpolatePaths || 489 NULL == fFunctions.fInterpolatePaths ||
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_obje ct")) { 650 if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_obje ct")) {
580 if (NULL == fFunctions.fBindVertexArray || 651 if (NULL == fFunctions.fBindVertexArray ||
581 NULL == fFunctions.fDeleteVertexArrays || 652 NULL == fFunctions.fDeleteVertexArrays ||
582 NULL == fFunctions.fGenVertexArrays) { 653 NULL == fFunctions.fGenVertexArrays) {
583 return false; 654 return false;
584 } 655 }
585 } 656 }
586 } 657 }
587 return true; 658 return true;
588 } 659 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698