| 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 |
| 11 #include "GrGLInterface.h" | 11 #include "GrGLInterface.h" |
| 12 #include "../private/SkGpuFenceSync.h" | 12 #include "../private/SkGpuFenceSync.h" |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO. | 15 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO. |
| 16 * Provides a GrGLInterface struct of function pointers for the context. | 16 * Provides a GrGLInterface struct of function pointers for the context. |
| 17 * This class is intended for Skia's testing needs and not for general | 17 * This class is intended for Skia's testing needs and not for general |
| 18 * use. | 18 * use. |
| 19 */ | 19 */ |
| 20 class SK_API SkGLContext : public SkNoncopyable { | 20 class SK_API SkGLContext : public SkNoncopyable { |
| 21 public: | 21 public: |
| 22 virtual ~SkGLContext(); | 22 virtual ~SkGLContext(); |
| 23 | 23 |
| 24 bool isValid() const { return NULL != gl(); } | 24 bool isValid() const { return NULL != gl(); } |
| 25 | 25 |
| 26 const GrGLInterface* gl() const { return fGL.get(); } | 26 const GrGLInterface* gl() const { return fGL.get(); } |
| 27 | 27 |
| 28 bool fenceSyncSupport() const { return SkToBool(fFenceSync); } | 28 bool fenceSyncSupport() const { return fFenceSync != nullptr; } |
| 29 | 29 |
| 30 bool getMaxGpuFrameLag(int* maxFrameLag) const { | 30 bool getMaxGpuFrameLag(int* maxFrameLag) const { |
| 31 if (!fFenceSync) { | 31 if (!fFenceSync) { |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 *maxFrameLag = kMaxFrameLag; | 34 *maxFrameLag = kMaxFrameLag; |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void makeCurrent() const; | 38 void makeCurrent() const; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 * SK_GL(glCtx, GenTextures(1, &texID)); | 136 * SK_GL(glCtx, GenTextures(1, &texID)); |
| 137 */ | 137 */ |
| 138 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ | 138 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ |
| 139 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 139 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
| 140 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ | 140 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ |
| 141 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) | 141 SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
| 142 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X | 142 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X |
| 143 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X | 143 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X |
| 144 | 144 |
| 145 #endif | 145 #endif |
| OLD | NEW |