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 18 matching lines...) Expand all Loading... | |
29 bool getMaxGpuFrameLag(int* maxFrameLag) const { | 29 bool getMaxGpuFrameLag(int* maxFrameLag) const { |
30 if (!fFenceSync) { | 30 if (!fFenceSync) { |
31 return false; | 31 return false; |
32 } | 32 } |
33 *maxFrameLag = kMaxFrameLag; | 33 *maxFrameLag = kMaxFrameLag; |
34 return true; | 34 return true; |
35 } | 35 } |
36 | 36 |
37 void makeCurrent() const; | 37 void makeCurrent() const; |
38 | 38 |
39 /** Used for testing EGLImage integration. Take a GL_TEXTURE_2D and wraps it in an EGL Image */ | |
40 virtual GrEGLImage texture2DToEGLImage(GrGLuint /*texID*/) const { return 0; } | |
41 virtual void destroyEGLImage(GrEGLImage) const {} | |
42 | |
43 /** | |
44 * Used for testing EGLImage integration. Takes a EGLImage and wraps it in a | |
45 * GL_TEXTURE_EXTERNAL_OES. | |
46 */ | |
47 virtual GrGLuint eglImageToExternalTexture(GrEGLImage) const { return 0; } | |
48 | |
39 /** | 49 /** |
40 * The only purpose of this function it to provide a means of scheduling | 50 * The only purpose of this function it to provide a means of scheduling |
41 * work on the GPU (since all of the subclasses create primary buffers for | 51 * work on the GPU (since all of the subclasses create primary buffers for |
42 * testing that are small and not meant to be rendered to the screen). | 52 * testing that are small and not meant to be rendered to the screen). |
43 * | 53 * |
44 * If the platform supports fence sync (OpenGL 3.2+ or EGL_KHR_fence_sync), | 54 * If the platform supports fence sync (OpenGL 3.2+ or EGL_KHR_fence_sync), |
45 * this will not swap any buffers, but rather emulate triple buffer | 55 * this will not swap any buffers, but rather emulate triple buffer |
46 * synchronization using fences. | 56 * synchronization using fences. |
47 * | 57 * |
48 * Otherwise it will call the platform SwapBuffers method. This may or may | 58 * Otherwise it will call the platform SwapBuffers method. This may or may |
49 * not perform some sort of synchronization, depending on whether the | 59 * not perform some sort of synchronization, depending on whether the |
50 * drawing surface provided by the platform is double buffered. | 60 * drawing surface provided by the platform is double buffered. |
51 */ | 61 */ |
52 void swapBuffers(); | 62 void swapBuffers(); |
53 | 63 |
54 /** | 64 /** |
55 * This notifies the context that we are deliberately testing abandoning | 65 * This notifies the context that we are deliberately testing abandoning |
56 * the context. It is useful for debugging contexts that would otherwise | 66 * the context. It is useful for debugging contexts that would otherwise |
57 * test that GPU resources are properly deleted. It also allows a debugging | 67 * test that GPU resources are properly deleted. It also allows a debugging |
58 * context to test that further GL calls are not made by Skia GPU code. | 68 * context to test that further GL calls are not made by Skia GPU code. |
59 */ | 69 */ |
60 void testAbandon(); | 70 void testAbandon(); |
61 | 71 |
72 /** | |
73 * Creates a new GL context of the same type and makes the returned context current | |
74 * (if not null). | |
75 */ | |
76 virtual SkGLContext* createNew() const { return nullptr; } | |
egdaniel
2015/11/20 21:57:42
is this for testing? if some add that to comment
bsalomon
2015/11/20 22:43:55
The whole class is for testing. Amended the commen
| |
77 | |
62 class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL fu nctionality. | 78 class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL fu nctionality. |
63 | 79 |
64 protected: | 80 protected: |
65 SkGLContext(); | 81 SkGLContext(); |
66 | 82 |
67 /* | 83 /* |
68 * Methods that sublcasses must call from their constructors and destructors . | 84 * Methods that sublcasses must call from their constructors and destructors . |
69 */ | 85 */ |
70 void init(const GrGLInterface*, SkGpuFenceSync* = NULL); | 86 void init(const GrGLInterface*, SkGpuFenceSync* = NULL); |
71 void teardown(); | 87 void teardown(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 * SK_GL(glCtx, GenTextures(1, &texID)); | 123 * SK_GL(glCtx, GenTextures(1, &texID)); |
108 */ | 124 */ |
109 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ | 125 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ |
110 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 126 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
111 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ | 127 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ |
112 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 128 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
113 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X | 129 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X |
114 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X | 130 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X |
115 | 131 |
116 #endif | 132 #endif |
OLD | NEW |