| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 SkPlatformGpuFence fFrameFences[kMaxFrameLag - 1]; | 106 SkPlatformGpuFence fFrameFences[kMaxFrameLag - 1]; |
| 107 int fCurrentFenceIdx; | 107 int fCurrentFenceIdx; |
| 108 | 108 |
| 109 /** Subclass provides the gl interface object if construction was | 109 /** Subclass provides the gl interface object if construction was |
| 110 * successful. */ | 110 * successful. */ |
| 111 SkAutoTUnref<const GrGLInterface> fGL; | 111 SkAutoTUnref<const GrGLInterface> fGL; |
| 112 | 112 |
| 113 friend class GLFenceSync; // For onPlatformGetProcAddress. | 113 friend class GLFenceSync; // For onPlatformGetProcAddress. |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 /** Creates platform-dependent GL context object | 116 /** Creates platform-dependent GL context object. The shareContext parameter is
in an optional |
| 117 * Returns a valid gl context object or NULL if such can not be created. | 117 * context with which to share display lists. This should be a pointer to an SkG
LContext created |
| 118 * Note: If Skia embedder needs a custom GL context that sets up the GL | 118 * with SkCreatePlatformGLContext. NULL indicates that no sharing is to take pl
ace. Returns a valid |
| 119 * interface, this function should be implemented by the embedder. | 119 * gl context object or NULL if such can not be created. |
| 120 * Otherwise, the default implementation for the platform should be compiled in | 120 * Note: If Skia embedder needs a custom GL context that sets up the GL interfac
e, this function |
| 121 * the library. | 121 * should be implemented by the embedder. Otherwise, the default implementation
for the platform |
| 122 * should be compiled in the library. |
| 122 */ | 123 */ |
| 123 SK_API SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI); | 124 SK_API SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, |
| 125 SkGLContext* shareContext = nullpt
r); |
| 124 | 126 |
| 125 /** | 127 /** |
| 126 * Helper macros for using the GL context through the GrGLInterface. Example: | 128 * Helper macros for using the GL context through the GrGLInterface. Example: |
| 127 * SK_GL(glCtx, GenTextures(1, &texID)); | 129 * SK_GL(glCtx, GenTextures(1, &texID)); |
| 128 */ | 130 */ |
| 129 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ | 131 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ |
| 130 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 132 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
| 131 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ | 133 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ |
| 132 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 134 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
| 133 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X | 135 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X |
| 134 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X | 136 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X |
| 135 | 137 |
| 136 #endif | 138 #endif |
| OLD | NEW |