OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkGLContext_DEFINED | 8 #ifndef SkGLContext_DEFINED |
9 #define SkGLContext_DEFINED | 9 #define SkGLContext_DEFINED |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 * testing that are small and not meant to be rendered to the screen). | 58 * testing that are small and not meant to be rendered to the screen). |
59 * | 59 * |
60 * If the platform supports fence sync (OpenGL 3.2+ or EGL_KHR_fence_sync), | 60 * If the platform supports fence sync (OpenGL 3.2+ or EGL_KHR_fence_sync), |
61 * this will not swap any buffers, but rather emulate triple buffer | 61 * this will not swap any buffers, but rather emulate triple buffer |
62 * synchronization using fences. | 62 * synchronization using fences. |
63 * | 63 * |
64 * Otherwise it will call the platform SwapBuffers method. This may or may | 64 * Otherwise it will call the platform SwapBuffers method. This may or may |
65 * not perform some sort of synchronization, depending on whether the | 65 * not perform some sort of synchronization, depending on whether the |
66 * drawing surface provided by the platform is double buffered. | 66 * drawing surface provided by the platform is double buffered. |
67 */ | 67 */ |
68 void swapBuffers(); | 68 void swapBuffers(bool usePlatformSwapBuffers = false); |
bsalomon
2016/01/20 18:54:52
Can we just undo the swap-as-fence-sync hack befor
| |
69 | 69 |
70 /** | 70 /** |
71 * This notifies the context that we are deliberately testing abandoning | 71 * This notifies the context that we are deliberately testing abandoning |
72 * the context. It is useful for debugging contexts that would otherwise | 72 * the context. It is useful for debugging contexts that would otherwise |
73 * test that GPU resources are properly deleted. It also allows a debugging | 73 * test that GPU resources are properly deleted. It also allows a debugging |
74 * context to test that further GL calls are not made by Skia GPU code. | 74 * context to test that further GL calls are not made by Skia GPU code. |
75 */ | 75 */ |
76 void testAbandon(); | 76 void testAbandon(); |
77 | 77 |
78 /** | 78 /** |
79 * Creates a new GL context of the same type and makes the returned context current | 79 * Creates a new GL context of the same type and makes the returned context current |
80 * (if not null). | 80 * (if not null). |
81 */ | 81 */ |
82 virtual SkGLContext* createNew() const { return nullptr; } | 82 virtual SkGLContext* createNew() const { return nullptr; } |
83 | 83 |
84 class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL fu nctionality. | 84 class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL fu nctionality. |
85 | 85 |
86 /* | |
87 * returns the fencesync object owned by this SkGLContext | |
88 */ | |
89 SkGpuFenceSync* fenceSync() { return fFenceSync.get(); } | |
90 | |
86 protected: | 91 protected: |
87 SkGLContext(); | 92 SkGLContext(); |
88 | 93 |
89 /* | 94 /* |
90 * Methods that sublcasses must call from their constructors and destructors . | 95 * Methods that sublcasses must call from their constructors and destructors . |
91 */ | 96 */ |
92 void init(const GrGLInterface*, SkGpuFenceSync* = NULL); | 97 void init(const GrGLInterface*, SkGpuFenceSync* = NULL); |
93 void teardown(); | 98 void teardown(); |
94 | 99 |
95 /* | 100 /* |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 * SK_GL(glCtx, GenTextures(1, &texID)); | 134 * SK_GL(glCtx, GenTextures(1, &texID)); |
130 */ | 135 */ |
131 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ | 136 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ |
132 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 137 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
133 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ | 138 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ |
134 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 139 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
135 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X | 140 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X |
136 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X | 141 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X |
137 | 142 |
138 #endif | 143 #endif |
OLD | NEW |