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 | |
16 namespace { | |
17 void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} | |
18 } | |
19 #endif | |
20 | |
21 const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interf
ace, | 15 const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interf
ace, |
22 GrGLInsertEventMarkerProc i
nsertEventMarkerFn, | 16 GrGLInsertEventMarkerProc i
nsertEventMarkerFn, |
23 GrGLPushGroupMarkerProc pus
hGroupMarkerFn, | 17 GrGLPushGroupMarkerProc pus
hGroupMarkerFn, |
24 GrGLPopGroupMarkerProc popG
roupMarkerFn) { | 18 GrGLPopGroupMarkerProc popG
roupMarkerFn) { |
25 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); | 19 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
26 | 20 |
27 if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) { | 21 if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) { |
28 newInterface->fExtensions.add("GL_EXT_debug_marker"); | 22 newInterface->fExtensions.add("GL_EXT_debug_marker"); |
29 } | 23 } |
30 | 24 |
(...skipping 30 matching lines...) Expand all Loading... |
61 newInterface->fFunctions.fStencilThenCoverStrokePath = nullptr; | 55 newInterface->fFunctions.fStencilThenCoverStrokePath = nullptr; |
62 newInterface->fFunctions.fStencilThenCoverFillPathInstanced = nullptr; | 56 newInterface->fFunctions.fStencilThenCoverFillPathInstanced = nullptr; |
63 newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = nullptr; | 57 newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = nullptr; |
64 newInterface->fFunctions.fProgramPathFragmentInputGen = nullptr; | 58 newInterface->fFunctions.fProgramPathFragmentInputGen = nullptr; |
65 newInterface->fFunctions.fBindFragmentInputLocation = nullptr; | 59 newInterface->fFunctions.fBindFragmentInputLocation = nullptr; |
66 return newInterface; | 60 return newInterface; |
67 } | 61 } |
68 | 62 |
69 GrGLInterface::GrGLInterface() { | 63 GrGLInterface::GrGLInterface() { |
70 fStandard = kNone_GrGLStandard; | 64 fStandard = kNone_GrGLStandard; |
71 | |
72 #if GR_GL_PER_GL_FUNC_CALLBACK | |
73 fCallback = GrGLDefaultInterfaceCallback; | |
74 fCallbackData = 0; | |
75 #endif | |
76 } | 65 } |
77 | 66 |
78 GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { | 67 GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { |
79 SkASSERT(interface); | 68 SkASSERT(interface); |
80 | 69 |
81 GrGLInterface* clone = new GrGLInterface; | 70 GrGLInterface* clone = new GrGLInterface; |
82 clone->fStandard = interface->fStandard; | 71 clone->fStandard = interface->fStandard; |
83 clone->fExtensions = interface->fExtensions; | 72 clone->fExtensions = interface->fExtensions; |
84 clone->fFunctions = interface->fFunctions; | 73 clone->fFunctions = interface->fFunctions; |
85 #if GR_GL_PER_GL_FUNC_CALLBACK | |
86 clone->fCallback = interface->fCallback; | |
87 clone->fCallbackData = interface->fCallbackData; | |
88 #endif | |
89 return clone; | 74 return clone; |
90 } | 75 } |
91 | 76 |
92 #ifdef SK_DEBUG | 77 #ifdef SK_DEBUG |
93 static int kIsDebug = 1; | 78 static int kIsDebug = 1; |
94 #else | 79 #else |
95 static int kIsDebug = 0; | 80 static int kIsDebug = 0; |
96 #endif | 81 #endif |
97 | 82 |
98 #define RETURN_FALSE_INTERFACE
\ | 83 #define RETURN_FALSE_INTERFACE
\ |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 | 779 |
795 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base"
)) { | 780 if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base"
)) { |
796 if (nullptr == fFunctions.fEGLCreateImage || | 781 if (nullptr == fFunctions.fEGLCreateImage || |
797 nullptr == fFunctions.fEGLDestroyImage) { | 782 nullptr == fFunctions.fEGLDestroyImage) { |
798 RETURN_FALSE_INTERFACE | 783 RETURN_FALSE_INTERFACE |
799 } | 784 } |
800 } | 785 } |
801 | 786 |
802 return true; | 787 return true; |
803 } | 788 } |
OLD | NEW |