Chromium Code Reviews| Index: tools/gpu/gl/GLContext.h |
| diff --git a/include/gpu/gl/SkGLContext.h b/tools/gpu/gl/GLContext.h |
| similarity index 59% |
| rename from include/gpu/gl/SkGLContext.h |
| rename to tools/gpu/gl/GLContext.h |
| index fe41a606ef19923d246f31eab3269f63b0973c27..70cecc867ebde7957156c90e71a5cbfa853d3ea4 100644 |
| --- a/include/gpu/gl/SkGLContext.h |
| +++ b/tools/gpu/gl/GLContext.h |
| @@ -5,29 +5,29 @@ |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| */ |
| -#ifndef SkGLContext_DEFINED |
| -#define SkGLContext_DEFINED |
| +#ifndef GLContext_DEFINED |
| +#define GLContext_DEFINED |
| -#include "GrGLInterface.h" |
| +#include "gl/GrGLInterface.h" |
| #include "../private/SkGpuFenceSync.h" |
| + |
| +namespace sk_gpu_test { |
| /** |
| - * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO. |
| - * Provides a GrGLInterface struct of function pointers for the context. |
| - * This class is intended for Skia's testing needs and not for general |
| - * use. |
| + * Create an offscreen Oppengl context. Provides a GrGLInterface struct of function pointers for |
|
jvanverth1
2016/03/29 14:45:09
OpenGL
bsalomon
2016/03/29 17:07:59
Done.
|
| + * the context. This class is intended for Skia's internal testing needs and not for general use. |
| */ |
| -class SK_API SkGLContext : public SkNoncopyable { |
| +class GLContext : public SkNoncopyable { |
| public: |
| - virtual ~SkGLContext(); |
| + virtual ~GLContext(); |
| bool isValid() const { return NULL != gl(); } |
| - const GrGLInterface* gl() const { return fGL.get(); } |
| + const GrGLInterface *gl() const { return fGL.get(); } |
|
jvanverth1
2016/03/29 14:45:09
Not a big deal, but why did you change this to a C
bsalomon
2016/03/29 17:07:59
Stupid IDE not remembering my code style prefs.
|
| bool fenceSyncSupport() const { return fFenceSync != nullptr; } |
| - bool getMaxGpuFrameLag(int* maxFrameLag) const { |
| + bool getMaxGpuFrameLag(int *maxFrameLag) const { |
| if (!fFenceSync) { |
| return false; |
| } |
| @@ -39,7 +39,8 @@ public: |
| /** Used for testing EGLImage integration. Take a GL_TEXTURE_2D and wraps it in an EGL Image */ |
| virtual GrEGLImage texture2DToEGLImage(GrGLuint /*texID*/) const { return 0; } |
| - virtual void destroyEGLImage(GrEGLImage) const {} |
| + |
| + virtual void destroyEGLImage(GrEGLImage) const { } |
| /** Used for testing GL_TEXTURE_RECTANGLE integration. */ |
| GrGLint createTextureRectangle(int width, int height, GrGLenum internalFormat, |
| @@ -81,37 +82,40 @@ public: |
| * Creates a new GL context of the same type and makes the returned context current |
| * (if not null). |
| */ |
| - virtual SkGLContext* createNew() const { return nullptr; } |
| + virtual GLContext *createNew() const { return nullptr; } |
| class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL functionality. |
| /* |
| - * returns the fencesync object owned by this SkGLContext |
| + * returns the fencesync object owned by this GLContext |
| */ |
| - SkGpuFenceSync* fenceSync() { return fFenceSync.get(); } |
| + SkGpuFenceSync *fenceSync() { return fFenceSync.get(); } |
| protected: |
| - SkGLContext(); |
| + GLContext(); |
| /* |
| * Methods that sublcasses must call from their constructors and destructors. |
| */ |
| - void init(const GrGLInterface*, SkGpuFenceSync* = NULL); |
| + void init(const GrGLInterface *, SkGpuFenceSync * = NULL); |
| + |
| void teardown(); |
| /* |
| * Operations that have a platform-dependent implementation. |
| */ |
| virtual void onPlatformMakeCurrent() const = 0; |
| + |
| virtual void onPlatformSwapBuffers() const = 0; |
| - virtual GrGLFuncPtr onPlatformGetProcAddress(const char*) const = 0; |
| + |
| + virtual GrGLFuncPtr onPlatformGetProcAddress(const char *) const = 0; |
| private: |
| enum { kMaxFrameLag = 3 }; |
| SkAutoTDelete<SkGpuFenceSync> fFenceSync; |
| - SkPlatformGpuFence fFrameFences[kMaxFrameLag - 1]; |
| - int fCurrentFenceIdx; |
| + SkPlatformGpuFence fFrameFences[kMaxFrameLag - 1]; |
| + int fCurrentFenceIdx; |
| /** Subclass provides the gl interface object if construction was |
| * successful. */ |
| @@ -120,26 +124,13 @@ private: |
| friend class GLFenceSync; // For onPlatformGetProcAddress. |
| }; |
| -/** Creates platform-dependent GL context object. The shareContext parameter is in an optional |
| - * context with which to share display lists. This should be a pointer to an SkGLContext created |
| - * with SkCreatePlatformGLContext. NULL indicates that no sharing is to take place. Returns a valid |
| - * gl context object or NULL if such can not be created. |
| - * Note: If Skia embedder needs a custom GL context that sets up the GL interface, this function |
| - * should be implemented by the embedder. Otherwise, the default implementation for the platform |
| - * should be compiled in the library. |
| - */ |
| -SK_API SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, |
| - SkGLContext* shareContext = nullptr); |
| - |
| /** |
| - * Helper macros for using the GL context through the GrGLInterface. Example: |
| - * SK_GL(glCtx, GenTextures(1, &texID)); |
| + * Creates platform-dependent GL context object. The shareContext parameter is in an optional |
| + * context with which to share display lists. This should be a pointer to an GLContext created |
| + * with CreatePlatformGLContext. nullptr indicates that no sharing is to take place. Returns a valid |
| + * gl context object or nullptr if such can not be created. |
| */ |
| -#define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ |
| - SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
| -#define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ |
| - SkASSERT(0 == (ctx).gl()->fFunctions.fGetError()) |
| -#define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X |
| -#define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X |
| +GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext = nullptr); |
| +} // namespace sk_gpu_test |
| #endif |