diff options
-rw-r--r-- | bench/nanobench.cpp | 4 | ||||
-rw-r--r-- | dm/DM.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleApp.cpp | 2 | ||||
-rw-r--r-- | tests/EGLImageTest.cpp | 8 | ||||
-rw-r--r-- | tests/RectangleTextureTest.cpp | 2 | ||||
-rw-r--r-- | tests/Test.h | 4 | ||||
-rw-r--r-- | tests/TestTest.cpp | 4 | ||||
-rw-r--r-- | tests/TextureStorageAllocator.cpp | 2 | ||||
-rw-r--r-- | tools/VisualBench/VisualBench.cpp | 2 | ||||
-rw-r--r-- | tools/VisualBench/VisualBench.h | 2 | ||||
-rw-r--r-- | tools/VisualBench/VisualStreamTimingModule.cpp | 2 | ||||
-rwxr-xr-x | tools/gpu/GrContextFactory.cpp | 32 | ||||
-rw-r--r-- | tools/gpu/GrContextFactory.h | 8 | ||||
-rw-r--r-- | tools/gpu/gl/GLTestContext.cpp (renamed from tools/gpu/gl/GLContext.cpp) | 32 | ||||
-rw-r--r-- | tools/gpu/gl/GLTestContext.h (renamed from tools/gpu/gl/GLContext.h) | 20 | ||||
-rw-r--r-- | tools/gpu/gl/angle/GLTestContext_angle.cpp (renamed from tools/gpu/gl/angle/GLContext_angle.cpp) | 19 | ||||
-rw-r--r-- | tools/gpu/gl/angle/GLTestContext_angle.h (renamed from tools/gpu/gl/angle/GLContext_angle.h) | 14 | ||||
-rw-r--r-- | tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp (renamed from tools/gpu/gl/command_buffer/GLContext_command_buffer.cpp) | 26 | ||||
-rw-r--r-- | tools/gpu/gl/command_buffer/GLTestContext_command_buffer.h (renamed from tools/gpu/gl/command_buffer/GLContext_command_buffer.h) | 22 | ||||
-rw-r--r-- | tools/gpu/gl/debug/DebugGLTestContext.cpp (renamed from tools/gpu/gl/debug/DebugGLContext.cpp) | 8 | ||||
-rw-r--r-- | tools/gpu/gl/debug/DebugGLTestContext.h (renamed from tools/gpu/gl/debug/DebugGLContext.h) | 4 | ||||
-rw-r--r-- | tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp (renamed from tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp) | 56 | ||||
-rw-r--r-- | tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp (renamed from tools/gpu/gl/glx/CreatePlatformGLContext_glx.cpp) | 27 | ||||
-rw-r--r-- | tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm (renamed from tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm) | 25 | ||||
-rw-r--r-- | tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp (renamed from tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp) | 25 | ||||
-rw-r--r-- | tools/gpu/gl/mesa/GLTestContext_mesa.cpp (renamed from tools/gpu/gl/mesa/GLContext_mesa.cpp) | 6 | ||||
-rw-r--r-- | tools/gpu/gl/mesa/GLTestContext_mesa.h (renamed from tools/gpu/gl/mesa/GLContext_mesa.h) | 8 | ||||
-rw-r--r-- | tools/gpu/gl/null/NullGLTestContext.cpp (renamed from tools/gpu/gl/null/NullGLContext.cpp) | 8 | ||||
-rw-r--r-- | tools/gpu/gl/null/NullGLTestContext.h (renamed from tools/gpu/gl/null/NullGLContext.h) | 4 | ||||
-rw-r--r-- | tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp (renamed from tools/gpu/gl/win/CreatePlatformGLContext_win.cpp) | 27 | ||||
-rw-r--r-- | tools/kilobench/kilobench.cpp | 12 | ||||
-rw-r--r-- | tools/skiaserve/Request.cpp | 2 |
32 files changed, 214 insertions, 207 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 235de02f57..521824e97b 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -58,7 +58,7 @@ #include "GrContextFactory.h" #include "gl/GrGLUtil.h" using sk_gpu_test::GrContextFactory; - using sk_gpu_test::GLContext; + using sk_gpu_test::GLTestContext; SkAutoTDelete<GrContextFactory> gGrFactory; #endif @@ -158,7 +158,7 @@ bool Target::capturePixels(SkBitmap* bmp) { #if SK_SUPPORT_GPU struct GPUTarget : public Target { explicit GPUTarget(const Config& c) : Target(c), gl(nullptr) { } - GLContext* gl; + GLTestContext* gl; void setup() override { this->gl->makeCurrent(); @@ -71,7 +71,7 @@ DEFINE_bool(simpleCodec, false, "Only decode images to native scale"); using namespace DM; using sk_gpu_test::GrContextFactory; -using sk_gpu_test::GLContext; +using sk_gpu_test::GLTestContext; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ @@ -1418,7 +1418,7 @@ int dm_main() { namespace skiatest { namespace { typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*); -typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, GLContext*); +typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, GLTestContext*); #if SK_SUPPORT_GPU template<typename T> void call_test(T test, skiatest::Reporter* reporter, const GrContextFactory::ContextInfo& context); diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 5bf28aa38e..d4cf1cccb9 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -39,7 +39,7 @@ # include "GrContext.h" # include "SkGpuDevice.h" # if SK_ANGLE -# include "gl/angle/GLContext_angle.h" +# include "gl/angle/GLTestContext_angle.h" # endif #else class GrContext; diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 7f0d7ea376..47dad8164e 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -11,11 +11,11 @@ #include "GrContextFactory.h" #include "gl/GrGLGpu.h" #include "gl/GrGLUtil.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" -using sk_gpu_test::GLContext; +using sk_gpu_test::GLTestContext; -static void cleanup(GLContext* glctx0, GrGLuint texID0, GLContext* glctx1, GrContext* grctx1, +static void cleanup(GLTestContext* glctx0, GrGLuint texID0, GLTestContext* glctx1, GrContext* grctx1, const GrGLTextureInfo* grbackendtex1, GrEGLImage image1) { if (glctx1) { glctx1->makeCurrent(); @@ -93,7 +93,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EGLImageTest, reporter, context0, glCtx0) { return; } - SkAutoTDelete<GLContext> glCtx1 = glCtx0->createNew(); + SkAutoTDelete<GLTestContext> glCtx1 = glCtx0->createNew(); if (!glCtx1) { return; } diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index fc9e65e12d..782a3b57b3 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -11,7 +11,7 @@ #include "GrDrawContext.h" #include "gl/GrGLGpu.h" #include "gl/GrGLUtil.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context, GrTexture* rectangleTexture, uint32_t expectedPixelValues[]) { diff --git a/tests/Test.h b/tests/Test.h index 119976f3ee..7660c44d0d 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -13,7 +13,7 @@ namespace sk_gpu_test { class GrContextFactory; -class GLContext; +class GLTestContext; } // namespace sk_gpu_test class GrContext; @@ -146,7 +146,7 @@ private: #define GPUTEST_SELECT(a1, a2, N, ...) N #define GPUTEST_CONTEXT_ARGS1(a1) GrContext* a1 -#define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, sk_gpu_test::GLContext* a2 +#define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, sk_gpu_test::GLTestContext* a2 #define GPUTEST_CONTEXT_ARGS(...) \ GPUTEST_APPLY(GPUTEST_SELECT(__VA_ARGS__, GPUTEST_CONTEXT_ARGS2, GPUTEST_CONTEXT_ARGS1), \ __VA_ARGS__) diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 05ab9ff697..d72e02d5c1 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -9,7 +9,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" #endif @@ -64,7 +64,7 @@ DEF_GPUTEST_FOR_NULL_CONTEXT(TestGpuNullContext, reporter, context) { #endif // This is an example of a GPU test that tests a property that should work for all GPU contexts. -// It uses the additional GLContext* glContext to implement the test. +// It uses the additional GLTestContext* glContext to implement the test. #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuGrContextAndGLContext, reporter, context, glContext) { REPORTER_ASSERT(reporter, reporter); diff --git a/tests/TextureStorageAllocator.cpp b/tests/TextureStorageAllocator.cpp index dd08354136..fbd00d32f6 100644 --- a/tests/TextureStorageAllocator.cpp +++ b/tests/TextureStorageAllocator.cpp @@ -8,7 +8,7 @@ #include "Test.h" #if SK_SUPPORT_GPU #include "gl/GrGLGpu.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" #include "GrContext.h" #include "SkSurface_Gpu.h" #include "../include/gpu/GrTypes.h" diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp index 578ff92e3d..154c84b6f2 100644 --- a/tools/VisualBench/VisualBench.cpp +++ b/tools/VisualBench/VisualBench.cpp @@ -118,7 +118,7 @@ void VisualBench::setupContext() { fInterface.reset(GrGLCreateNativeInterface()); - // TODO use the GLContext creation factories and also set this all up in configs + // TODO use the GLTestContext creation factories and also set this all up in configs if (!FLAGS_nvpr) { fInterface.reset(GrGLInterfaceRemoveNVPR(fInterface)); } diff --git a/tools/VisualBench/VisualBench.h b/tools/VisualBench/VisualBench.h index e9fbdfb8ae..e965b094d9 100644 --- a/tools/VisualBench/VisualBench.h +++ b/tools/VisualBench/VisualBench.h @@ -16,7 +16,7 @@ #include "SkSurface.h" #include "VisualFlags.h" #include "VisualModule.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" class GrContext; struct GrGLInterface; diff --git a/tools/VisualBench/VisualStreamTimingModule.cpp b/tools/VisualBench/VisualStreamTimingModule.cpp index 0ac698eff2..b5726219dd 100644 --- a/tools/VisualBench/VisualStreamTimingModule.cpp +++ b/tools/VisualBench/VisualStreamTimingModule.cpp @@ -23,7 +23,7 @@ inline void VisualStreamTimingModule::handleInitState(SkCanvas* canvas) { fBenchmarkStream->current()->delayedSetup(); // fallthrough case kReset_InitState: - // This will flicker unfortunately, but as we are reseting the GLContext each bench, + // This will flicker unfortunately, but as we are reseting the GLTestContext each bench, // we unfortunately don't have a choice fOwner->clear(canvas, SK_ColorWHITE, 3); fBenchmarkStream->current()->preTimingHooks(canvas); diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp index cb23014ad0..e5fa2c799e 100755 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -7,19 +7,19 @@ */ #include "GrContextFactory.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" #if SK_ANGLE - #include "gl/angle/GLContext_angle.h" + #include "gl/angle/GLTestContext_angle.h" #endif #if SK_COMMAND_BUFFER - #include "gl/command_buffer/GLContext_command_buffer.h" + #include "gl/command_buffer/GLTestContext_command_buffer.h" #endif -#include "gl/debug/DebugGLContext.h" +#include "gl/debug/DebugGLTestContext.h" #if SK_MESA - #include "gl/mesa/GLContext_mesa.h" + #include "gl/mesa/GLTestContext_mesa.h" #endif -#include "gl/null/NullGLContext.h" +#include "gl/null/NullGLTestContext.h" #include "gl/GrGLGpu.h" #include "GrCaps.h" @@ -73,43 +73,43 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ return ContextInfo(context.fGrContext, context.fGLContext); } } - SkAutoTDelete<GLContext> glCtx; + SkAutoTDelete<GLTestContext> glCtx; SkAutoTUnref<GrContext> grCtx; switch (type) { case kNative_GLContextType: - glCtx.reset(CreatePlatformGLContext(kNone_GrGLStandard)); + glCtx.reset(CreatePlatformGLTestContext(kNone_GrGLStandard)); break; case kGL_GLContextType: - glCtx.reset(CreatePlatformGLContext(kGL_GrGLStandard)); + glCtx.reset(CreatePlatformGLTestContext(kGL_GrGLStandard)); break; case kGLES_GLContextType: - glCtx.reset(CreatePlatformGLContext(kGLES_GrGLStandard)); + glCtx.reset(CreatePlatformGLTestContext(kGLES_GrGLStandard)); break; #if SK_ANGLE #ifdef SK_BUILD_FOR_WIN case kANGLE_GLContextType: - glCtx.reset(CreateANGLEDirect3DGLContext()); + glCtx.reset(CreateANGLEDirect3DGLTestContext()); break; #endif case kANGLE_GL_GLContextType: - glCtx.reset(CreateANGLEOpenGLGLContext()); + glCtx.reset(CreateANGLEOpenGLGLTestContext()); break; #endif #if SK_COMMAND_BUFFER case kCommandBuffer_GLContextType: - glCtx.reset(CommandBufferGLContext::Create()); + glCtx.reset(CommandBufferGLTestContext::Create()); break; #endif #if SK_MESA case kMESA_GLContextType: - glCtx.reset(CreateMesaGLContext()); + glCtx.reset(CreateMesaGLTestContext()); break; #endif case kNull_GLContextType: - glCtx.reset(CreateNullGLContext()); + glCtx.reset(CreateNullGLTestContext()); break; case kDebug_GLContextType: - glCtx.reset(CreateDebugGLContext()); + glCtx.reset(CreateDebugGLTestContext()); break; } if (nullptr == glCtx.get()) { diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h index b17460819d..14a2739815 100644 --- a/tools/gpu/GrContextFactory.h +++ b/tools/gpu/GrContextFactory.h @@ -11,7 +11,7 @@ #include "GrContext.h" #include "GrContextOptions.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" #include "SkTArray.h" namespace sk_gpu_test { @@ -111,10 +111,10 @@ public: struct ContextInfo { ContextInfo() : fGrContext(nullptr), fGLContext(nullptr) { } - ContextInfo(GrContext* grContext, GLContext* glContext) + ContextInfo(GrContext* grContext, GLTestContext* glContext) : fGrContext(grContext), fGLContext(glContext) { } GrContext* fGrContext; - GLContext* fGLContext; //! Valid until the factory destroys it via abandonContexts() or + GLTestContext* fGLContext; //! Valid until the factory destroys it via abandonContexts() or //! destroyContexts(). }; @@ -136,7 +136,7 @@ private: struct Context { GLContextType fType; GLContextOptions fOptions; - GLContext* fGLContext; + GLTestContext* fGLContext; GrContext* fGrContext; }; SkTArray<Context, true> fContexts; diff --git a/tools/gpu/gl/GLContext.cpp b/tools/gpu/gl/GLTestContext.cpp index ac0e310014..1069929bf2 100644 --- a/tools/gpu/gl/GLContext.cpp +++ b/tools/gpu/gl/GLTestContext.cpp @@ -5,14 +5,14 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "GLContext.h" +#include "GLTestContext.h" #include "gl/GrGLUtil.h" #include "SkGpuFenceSync.h" namespace sk_gpu_test { -class GLContext::GLFenceSync : public SkGpuFenceSync { +class GLTestContext::GLFenceSync : public SkGpuFenceSync { public: - static GLFenceSync* CreateIfSupported(const GLContext*); + static GLFenceSync* CreateIfSupported(const GLTestContext*); SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override; bool waitFence(SkPlatformGpuFence fence, bool flush) const override; @@ -38,12 +38,12 @@ private: typedef SkGpuFenceSync INHERITED; }; -GLContext::GLContext() +GLTestContext::GLTestContext() : fCurrentFenceIdx(0) { memset(fFrameFences, 0, sizeof(fFrameFences)); } -GLContext::~GLContext() { +GLTestContext::~GLTestContext() { // Subclass should call teardown. #ifdef SK_DEBUG for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) { @@ -54,13 +54,13 @@ GLContext::~GLContext() { SkASSERT(nullptr == fFenceSync.get()); } -void GLContext::init(const GrGLInterface* gl, SkGpuFenceSync* fenceSync) { +void GLTestContext::init(const GrGLInterface* gl, SkGpuFenceSync* fenceSync) { SkASSERT(!fGL.get()); fGL.reset(gl); fFenceSync.reset(fenceSync ? fenceSync : GLFenceSync::CreateIfSupported(this)); } -void GLContext::teardown() { +void GLTestContext::teardown() { if (fFenceSync) { for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) { if (fFrameFences[i]) { @@ -74,15 +74,15 @@ void GLContext::teardown() { fGL.reset(nullptr); } -void GLContext::makeCurrent() const { +void GLTestContext::makeCurrent() const { this->onPlatformMakeCurrent(); } -void GLContext::swapBuffers() { +void GLTestContext::swapBuffers() { this->onPlatformSwapBuffers(); } -void GLContext::waitOnSyncOrSwap() { +void GLTestContext::waitOnSyncOrSwap() { if (!fFenceSync) { // Fallback on the platform SwapBuffers method for synchronization. This may have no effect. this->swapBuffers(); @@ -100,7 +100,7 @@ void GLContext::waitOnSyncOrSwap() { fCurrentFenceIdx = (fCurrentFenceIdx + 1) % SK_ARRAY_COUNT(fFrameFences); } -void GLContext::testAbandon() { +void GLTestContext::testAbandon() { if (fGL) { fGL->abandon(); } @@ -109,7 +109,7 @@ void GLContext::testAbandon() { } } -GLContext::GLFenceSync* GLContext::GLFenceSync::CreateIfSupported(const GLContext* ctx) { +GLTestContext::GLFenceSync* GLTestContext::GLFenceSync::CreateIfSupported(const GLTestContext* ctx) { SkAutoTDelete<GLFenceSync> ret(new GLFenceSync); if (kGL_GrGLStandard == ctx->gl()->fStandard) { @@ -144,21 +144,21 @@ GLContext::GLFenceSync* GLContext::GLFenceSync::CreateIfSupported(const GLContex return ret.release(); } -SkPlatformGpuFence GLContext::GLFenceSync::insertFence() const { +SkPlatformGpuFence GLTestContext::GLFenceSync::insertFence() const { return fGLFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } -bool GLContext::GLFenceSync::waitFence(SkPlatformGpuFence fence, bool flush) const { +bool GLTestContext::GLFenceSync::waitFence(SkPlatformGpuFence fence, bool flush) const { GLsync glsync = static_cast<GLsync>(fence); return GL_WAIT_FAILED != fGLClientWaitSync(glsync, flush ? GL_SYNC_FLUSH_COMMANDS_BIT : 0, -1); } -void GLContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const { +void GLTestContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const { GLsync glsync = static_cast<GLsync>(fence); fGLDeleteSync(glsync); } -GrGLint GLContext::createTextureRectangle(int width, int height, GrGLenum internalFormat, +GrGLint GLTestContext::createTextureRectangle(int width, int height, GrGLenum internalFormat, GrGLenum externalFormat, GrGLenum externalType, GrGLvoid* data) { if (!(kGL_GrGLStandard == fGL->fStandard && GrGLGetVersion(fGL) >= GR_GL_VER(3, 1)) && diff --git a/tools/gpu/gl/GLContext.h b/tools/gpu/gl/GLTestContext.h index 3f47613722..d6054a8ba6 100644 --- a/tools/gpu/gl/GLContext.h +++ b/tools/gpu/gl/GLTestContext.h @@ -5,8 +5,8 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#ifndef GLContext_DEFINED -#define GLContext_DEFINED +#ifndef GLTestContext_DEFINED +#define GLTestContext_DEFINED #include "gl/GrGLInterface.h" #include "../private/SkGpuFenceSync.h" @@ -17,9 +17,9 @@ namespace sk_gpu_test { * Create an offscreen Oppengl context. Provides a GrGLInterface struct of function pointers for * the context. This class is intended for Skia's internal testing needs and not for general use. */ -class GLContext : public SkNoncopyable { +class GLTestContext : public SkNoncopyable { public: - virtual ~GLContext(); + virtual ~GLTestContext(); bool isValid() const { return NULL != gl(); } @@ -82,17 +82,17 @@ public: * Creates a new GL context of the same type and makes the returned context current * (if not null). */ - virtual GLContext *createNew() const { return nullptr; } + virtual GLTestContext *createNew() const { return nullptr; } class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL functionality. /* - * returns the fencesync object owned by this GLContext + * returns the fencesync object owned by this GLTestContext */ SkGpuFenceSync *fenceSync() { return fFenceSync.get(); } protected: - GLContext(); + GLTestContext(); /* * Methods that sublcasses must call from their constructors and destructors. @@ -128,14 +128,14 @@ private: /** 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 SkCreatePlatformGLContext. NULL indicates that no sharing is to take place. Returns a valid + * context with which to share display lists. This should be a pointer to an GLTestContext created + * with SkCreatePlatformGLTestContext. 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. */ -GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext = nullptr); +GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, GLTestContext *shareContext = nullptr); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/angle/GLContext_angle.cpp b/tools/gpu/gl/angle/GLTestContext_angle.cpp index f1e8aad509..0b4aae9f34 100644 --- a/tools/gpu/gl/angle/GLContext_angle.cpp +++ b/tools/gpu/gl/angle/GLTestContext_angle.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "GLContext_angle.h" +#include "GLTestContext_angle.h" #include <EGL/egl.h> #include <EGL/eglext.h> @@ -84,7 +84,7 @@ void* get_angle_egl_display(void* nativeDisplay, bool useGLBackend) { return display; } -class ANGLEGLContext : public sk_gpu_test::GLContext { +class ANGLEGLContext : public sk_gpu_test::GLTestContext { public: ANGLEGLContext(bool preferGLBackend); ~ANGLEGLContext() override; @@ -92,7 +92,7 @@ public: GrEGLImage texture2DToEGLImage(GrGLuint texID) const override; void destroyEGLImage(GrEGLImage) const override; GrGLuint eglImageToExternalTexture(GrEGLImage) const override; - sk_gpu_test::GLContext* createNew() const override; + sk_gpu_test::GLTestContext* createNew() const override; private: void destroyGLContext(); @@ -223,12 +223,13 @@ GrGLuint ANGLEGLContext::eglImageToExternalTexture(GrEGLImage image) const { return texID; } -sk_gpu_test::GLContext* ANGLEGLContext::createNew() const { +sk_gpu_test::GLTestContext* ANGLEGLContext::createNew() const { #ifdef SK_BUILD_FOR_WIN - sk_gpu_test::GLContext* ctx = fIsGLBackend ? sk_gpu_test::CreateANGLEOpenGLGLContext() - : sk_gpu_test::CreateANGLEDirect3DGLContext(); + sk_gpu_test::GLTestContext* ctx = fIsGLBackend? + ? sk_gpu_test::CreateANGLEOpenGLGLTestContext() + : sk_gpu_test::CreateANGLEDirect3DGLTestContext(); #else - sk_gpu_test::GLContext* ctx = sk_gpu_test::CreateANGLEOpenGLGLContext(); + sk_gpu_test::GLTestContext* ctx = sk_gpu_test::CreateANGLEOpenGLGLTestContext(); #endif if (ctx) { ctx->makeCurrent(); @@ -299,7 +300,7 @@ const GrGLInterface* CreateANGLEGLInterface() { } #ifdef SK_BUILD_FOR_WIN -GLContext* CreateANGLEDirect3DGLContext() { +GLTestContext* CreateANGLEDirect3DGLTestContext() { ANGLEGLContext* ctx = new ANGLEGLContext(false); if (!ctx->isValid()) { delete ctx; @@ -309,7 +310,7 @@ GLContext* CreateANGLEDirect3DGLContext() { } #endif -GLContext* CreateANGLEOpenGLGLContext() { +GLTestContext* CreateANGLEOpenGLGLTestContext() { ANGLEGLContext* ctx = new ANGLEGLContext(true); if (!ctx->isValid()) { delete ctx; diff --git a/tools/gpu/gl/angle/GLContext_angle.h b/tools/gpu/gl/angle/GLTestContext_angle.h index 519ea6b5a3..0140477a54 100644 --- a/tools/gpu/gl/angle/GLContext_angle.h +++ b/tools/gpu/gl/angle/GLTestContext_angle.h @@ -5,10 +5,10 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#ifndef GLContext_angle_DEFINED -#define GLContext_angle_DEFINED +#ifndef GLTestContext_angle_DEFINED +#define GLTestContext_angle_DEFINED -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" namespace sk_gpu_test { @@ -19,12 +19,12 @@ namespace sk_gpu_test { const GrGLInterface* CreateANGLEGLInterface(); #ifdef SK_BUILD_FOR_WIN -/** Creates a GLContext backed by ANGLE's Direct3D backend. */ -GLContext* CreateANGLEDirect3DGLContext(); +/** Creates a GLTestContext backed by ANGLE's Direct3D backend. */ +GLTestContext* CreateANGLEDirect3DGLTestContext(); #endif -/** Creates a GLContext backed by ANGLE's OpenGL backend. */ -GLContext* CreateANGLEOpenGLGLContext(); +/** Creates a GLTestContext backed by ANGLE's OpenGL backend. */ +GLTestContext* CreateANGLEOpenGLGLTestContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/command_buffer/GLContext_command_buffer.cpp b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp index b878cb4aa9..5985a2e31f 100644 --- a/tools/gpu/gl/command_buffer/GLContext_command_buffer.cpp +++ b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp @@ -9,7 +9,7 @@ #include "SkOnce.h" #include "gl/GrGLInterface.h" #include "gl/GrGLAssembleInterface.h" -#include "gl/command_buffer/GLContext_command_buffer.h" +#include "gl/command_buffer/GLTestContext_command_buffer.h" #include "../ports/SkOSEnvironment.h" #include "../ports/SkOSLibrary.h" @@ -143,7 +143,7 @@ static const GrGLInterface* create_command_buffer_interface() { namespace sk_gpu_test { -CommandBufferGLContext::CommandBufferGLContext() +CommandBufferGLTestContext::CommandBufferGLTestContext() : fContext(EGL_NO_CONTEXT), fDisplay(EGL_NO_DISPLAY), fSurface(EGL_NO_SURFACE) { static const EGLint configAttribs[] = { @@ -165,7 +165,7 @@ CommandBufferGLContext::CommandBufferGLContext() initializeGLContext(nullptr, configAttribs, surfaceAttribs); } -CommandBufferGLContext::CommandBufferGLContext(void *nativeWindow, int msaaSampleCount) { +CommandBufferGLTestContext::CommandBufferGLTestContext(void *nativeWindow, int msaaSampleCount) { static const EGLint surfaceAttribs[] = {EGL_NONE}; EGLint configAttribs[] = { @@ -186,7 +186,7 @@ CommandBufferGLContext::CommandBufferGLContext(void *nativeWindow, int msaaSampl initializeGLContext(nativeWindow, configAttribs, surfaceAttribs); } -void CommandBufferGLContext::initializeGLContext(void *nativeWindow, const int *configAttribs, +void CommandBufferGLTestContext::initializeGLContext(void *nativeWindow, const int *configAttribs, const int *surfaceAttribs) { load_command_buffer_once(); if (!gfFunctionsLoadedSuccessfully) { @@ -266,12 +266,12 @@ void CommandBufferGLContext::initializeGLContext(void *nativeWindow, const int * this->init(gl.release()); } -CommandBufferGLContext::~CommandBufferGLContext() { +CommandBufferGLTestContext::~CommandBufferGLTestContext() { this->teardown(); this->destroyGLContext(); } -void CommandBufferGLContext::destroyGLContext() { +void CommandBufferGLTestContext::destroyGLContext() { if (!gfFunctionsLoadedSuccessfully) { return; } @@ -293,7 +293,7 @@ void CommandBufferGLContext::destroyGLContext() { } } -void CommandBufferGLContext::onPlatformMakeCurrent() const { +void CommandBufferGLTestContext::onPlatformMakeCurrent() const { if (!gfFunctionsLoadedSuccessfully) { return; } @@ -302,7 +302,7 @@ void CommandBufferGLContext::onPlatformMakeCurrent() const { } } -void CommandBufferGLContext::onPlatformSwapBuffers() const { +void CommandBufferGLTestContext::onPlatformSwapBuffers() const { if (!gfFunctionsLoadedSuccessfully) { return; } @@ -311,14 +311,14 @@ void CommandBufferGLContext::onPlatformSwapBuffers() const { } } -GrGLFuncPtr CommandBufferGLContext::onPlatformGetProcAddress(const char *name) const { +GrGLFuncPtr CommandBufferGLTestContext::onPlatformGetProcAddress(const char *name) const { if (!gfFunctionsLoadedSuccessfully) { return nullptr; } return gfGetProcAddress(name); } -void CommandBufferGLContext::presentCommandBuffer() { +void CommandBufferGLTestContext::presentCommandBuffer() { if (this->gl()) { this->gl()->fFunctions.fFlush(); } @@ -326,17 +326,17 @@ void CommandBufferGLContext::presentCommandBuffer() { this->onPlatformSwapBuffers(); } -bool CommandBufferGLContext::makeCurrent() { +bool CommandBufferGLTestContext::makeCurrent() { return gfMakeCurrent(fDisplay, fSurface, fSurface, fContext) != EGL_FALSE; } -int CommandBufferGLContext::getStencilBits() { +int CommandBufferGLTestContext::getStencilBits() { EGLint result = 0; gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_STENCIL_SIZE, &result); return result; } -int CommandBufferGLContext::getSampleCount() { +int CommandBufferGLTestContext::getSampleCount() { EGLint result = 0; gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_SAMPLES, &result); return result; diff --git a/tools/gpu/gl/command_buffer/GLContext_command_buffer.h b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.h index 73f02e2c78..0994c98c8b 100644 --- a/tools/gpu/gl/command_buffer/GLContext_command_buffer.h +++ b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.h @@ -6,18 +6,18 @@ * found in the LICENSE file. */ -#ifndef GLContext_command_buffer_DEFINED -#define GLContext_command_buffer_DEFINED +#ifndef GLTestContext_command_buffer_DEFINED +#define GLTestContext_command_buffer_DEFINED -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" namespace sk_gpu_test { -class CommandBufferGLContext : public GLContext { +class CommandBufferGLTestContext : public GLTestContext { public: - ~CommandBufferGLContext() override; + ~CommandBufferGLTestContext() override; - static CommandBufferGLContext *Create() { - CommandBufferGLContext *ctx = new CommandBufferGLContext; + static CommandBufferGLTestContext *Create() { + CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext; if (!ctx->isValid()) { delete ctx; return nullptr; @@ -25,8 +25,8 @@ public: return ctx; } - static CommandBufferGLContext *Create(void *nativeWindow, int msaaSampleCount) { - CommandBufferGLContext *ctx = new CommandBufferGLContext(nativeWindow, msaaSampleCount); + static CommandBufferGLTestContext *Create(void *nativeWindow, int msaaSampleCount) { + CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext(nativeWindow, msaaSampleCount); if (!ctx->isValid()) { delete ctx; return nullptr; @@ -43,9 +43,9 @@ public: int getSampleCount(); private: - CommandBufferGLContext(); + CommandBufferGLTestContext(); - CommandBufferGLContext(void *nativeWindow, int msaaSampleCount); + CommandBufferGLTestContext(void *nativeWindow, int msaaSampleCount); void initializeGLContext(void *nativeWindow, const int *configAttribs, const int *surfaceAttribs); diff --git a/tools/gpu/gl/debug/DebugGLContext.cpp b/tools/gpu/gl/debug/DebugGLTestContext.cpp index f4cbbea680..96640c5908 100644 --- a/tools/gpu/gl/debug/DebugGLContext.cpp +++ b/tools/gpu/gl/debug/DebugGLTestContext.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "DebugGLContext.h" +#include "DebugGLTestContext.h" #include "GrBufferObj.h" #include "GrFrameBufferObj.h" @@ -1229,7 +1229,7 @@ const char* DebugInterface::kExtensions[] = { nullptr, // signifies the end of the array. }; -class DebugGLContext : public sk_gpu_test::GLContext { +class DebugGLContext : public sk_gpu_test::GLTestContext { public: DebugGLContext() { this->init(new DebugInterface()); @@ -1245,8 +1245,8 @@ private: } // anonymous namespace namespace sk_gpu_test { -GLContext* CreateDebugGLContext() { - GLContext* ctx = new DebugGLContext(); +GLTestContext* CreateDebugGLTestContext() { + GLTestContext* ctx = new DebugGLContext(); if (ctx->isValid()) { return ctx; } diff --git a/tools/gpu/gl/debug/DebugGLContext.h b/tools/gpu/gl/debug/DebugGLTestContext.h index 0ac505b632..3f2646bb8c 100644 --- a/tools/gpu/gl/debug/DebugGLContext.h +++ b/tools/gpu/gl/debug/DebugGLTestContext.h @@ -8,10 +8,10 @@ #ifndef DebugGLContext_DEFINED #define DebugGLContext_DEFINED -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" namespace sk_gpu_test { -GLContext* CreateDebugGLContext(); +GLTestContext* CreateDebugGLTestContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp index ac2e7ca7cf..ae61b337d9 100644 --- a/tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp +++ b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp @@ -5,8 +5,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" +#define GL_GLEXT_PROTOTYPES #include <GLES2/gl2.h> #define EGL_EGLEXT_PROTOTYPES @@ -19,31 +20,31 @@ namespace { // TODO: Share this class with ANGLE if/when it gets support for EGL_KHR_fence_sync. -class SkEGLFenceSync : public SkGpuFenceSync { +class EGLFenceSync : public SkGpuFenceSync { public: - static SkEGLFenceSync* CreateIfSupported(EGLDisplay); + static EGLFenceSync* CreateIfSupported(EGLDisplay); SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override; bool waitFence(SkPlatformGpuFence fence, bool flush) const override; void deleteFence(SkPlatformGpuFence fence) const override; private: - SkEGLFenceSync(EGLDisplay display) : fDisplay(display) {} + EGLFenceSync(EGLDisplay display) : fDisplay(display) {} EGLDisplay fDisplay; typedef SkGpuFenceSync INHERITED; }; -class EGLGLContext : public sk_gpu_test::GLContext { +class EGLGLTestContext : public sk_gpu_test::GLTestContext { public: - EGLGLContext(GrGLStandard forcedGpuAPI); - ~EGLGLContext() override; + EGLGLTestContext(GrGLStandard forcedGpuAPI); + ~EGLGLTestContext() override; GrEGLImage texture2DToEGLImage(GrGLuint texID) const override; void destroyEGLImage(GrEGLImage) const override; GrGLuint eglImageToExternalTexture(GrEGLImage) const override; - sk_gpu_test::GLContext* createNew() const override; + sk_gpu_test::GLTestContext* createNew() const override; private: void destroyGLContext(); @@ -57,7 +58,7 @@ private: EGLSurface fSurface; }; -EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI) +EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI) : fContext(EGL_NO_CONTEXT) , fDisplay(EGL_NO_DISPLAY) , fSurface(EGL_NO_SURFACE) { @@ -179,17 +180,17 @@ EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI) continue; } - this->init(gl.release(), SkEGLFenceSync::CreateIfSupported(fDisplay)); + this->init(gl.release(), EGLFenceSync::CreateIfSupported(fDisplay)); break; } } -EGLGLContext::~EGLGLContext() { +EGLGLTestContext::~EGLGLTestContext() { this->teardown(); this->destroyGLContext(); } -void EGLGLContext::destroyGLContext() { +void EGLGLTestContext::destroyGLContext() { if (fDisplay) { eglMakeCurrent(fDisplay, 0, 0, 0); @@ -208,7 +209,7 @@ void EGLGLContext::destroyGLContext() { } } -GrEGLImage EGLGLContext::texture2DToEGLImage(GrGLuint texID) const { +GrEGLImage EGLGLTestContext::texture2DToEGLImage(GrGLuint texID) const { if (!this->gl()->hasExtension("EGL_KHR_gl_texture_2D_image")) { return GR_EGL_NO_IMAGE; } @@ -220,11 +221,11 @@ GrEGLImage EGLGLContext::texture2DToEGLImage(GrGLuint texID) const { return img; } -void EGLGLContext::destroyEGLImage(GrEGLImage image) const { +void EGLGLTestContext::destroyEGLImage(GrEGLImage image) const { GR_GL_CALL(this->gl(), EGLDestroyImage(fDisplay, image)); } -GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const { +GrGLuint EGLGLTestContext::eglImageToExternalTexture(GrEGLImage image) const { GrGLClearErr(this->gl()); if (!this->gl()->hasExtension("GL_OES_EGL_image_external")) { return 0; @@ -254,27 +255,27 @@ GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const { return texID; } -sk_gpu_test::GLContext* EGLGLContext::createNew() const { - sk_gpu_test::GLContext* ctx = new EGLGLContext(this->gl()->fStandard); +sk_gpu_test::GLTestContext* EGLGLTestContext::createNew() const { + sk_gpu_test::GLTestContext* ctx = new EGLGLTestContext(this->gl()->fStandard); if (ctx) { ctx->makeCurrent(); } return ctx; } -void EGLGLContext::onPlatformMakeCurrent() const { +void EGLGLTestContext::onPlatformMakeCurrent() const { if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { SkDebugf("Could not set the context.\n"); } } -void EGLGLContext::onPlatformSwapBuffers() const { +void EGLGLTestContext::onPlatformSwapBuffers() const { if (!eglSwapBuffers(fDisplay, fSurface)) { SkDebugf("Could not complete eglSwapBuffers.\n"); } } -GrGLFuncPtr EGLGLContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr EGLGLTestContext::onPlatformGetProcAddress(const char* procName) const { return eglGetProcAddress(procName); } @@ -293,18 +294,18 @@ static bool supports_egl_extension(EGLDisplay display, const char* extension) { return false; } -SkEGLFenceSync* SkEGLFenceSync::CreateIfSupported(EGLDisplay display) { +EGLFenceSync* EGLFenceSync::CreateIfSupported(EGLDisplay display) { if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) { return nullptr; } - return new SkEGLFenceSync(display); + return new EGLFenceSync(display); } -SkPlatformGpuFence SkEGLFenceSync::insertFence() const { +SkPlatformGpuFence EGLFenceSync::insertFence() const { return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr); } -bool SkEGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const { +bool EGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const { EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); return EGL_CONDITION_SATISFIED_KHR == eglClientWaitSyncKHR(fDisplay, @@ -313,7 +314,7 @@ bool SkEGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) con EGL_FOREVER_KHR); } -void SkEGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { +void EGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); eglDestroySyncKHR(fDisplay, eglsync); } @@ -321,12 +322,13 @@ void SkEGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { } // anonymous namespace namespace sk_gpu_test { -GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { +GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, + GLTestContext *shareContext) { SkASSERT(!shareContext); if (shareContext) { return nullptr; } - EGLGLContext *ctx = new EGLGLContext(forcedGpuAPI); + EGLGLTestContext *ctx = new EGLGLTestContext(forcedGpuAPI); if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/gpu/gl/glx/CreatePlatformGLContext_glx.cpp b/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp index b2168e3c5a..7429bed630 100644 --- a/tools/gpu/gl/glx/CreatePlatformGLContext_glx.cpp +++ b/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" #include <X11/Xlib.h> #include <GL/glx.h> @@ -44,10 +44,10 @@ static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) { return 0; } -class GLXGLContext : public sk_gpu_test::GLContext { +class GLXGLTestContext : public sk_gpu_test::GLTestContext { public: - GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareList); - ~GLXGLContext() override; + GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext* shareList); + ~GLXGLTestContext() override; private: void destroyGLContext(); @@ -62,7 +62,7 @@ private: GLXPixmap fGlxPixmap; }; -GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareContext) +GLXGLTestContext::GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext* shareContext) : fContext(nullptr) , fDisplay(nullptr) , fPixmap(0) @@ -288,12 +288,12 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareContext } -GLXGLContext::~GLXGLContext() { +GLXGLTestContext::~GLXGLTestContext() { this->teardown(); this->destroyGLContext(); } -void GLXGLContext::destroyGLContext() { +void GLXGLTestContext::destroyGLContext() { if (fDisplay) { glXMakeCurrent(fDisplay, 0, 0); @@ -317,26 +317,27 @@ void GLXGLContext::destroyGLContext() { } } -void GLXGLContext::onPlatformMakeCurrent() const { +void GLXGLTestContext::onPlatformMakeCurrent() const { if (!glXMakeCurrent(fDisplay, fGlxPixmap, fContext)) { SkDebugf("Could not set the context.\n"); } } -void GLXGLContext::onPlatformSwapBuffers() const { +void GLXGLTestContext::onPlatformSwapBuffers() const { glXSwapBuffers(fDisplay, fGlxPixmap); } -GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr GLXGLTestContext::onPlatformGetProcAddress(const char* procName) const { return glXGetProcAddress(reinterpret_cast<const GLubyte*>(procName)); } } // anonymous namespace namespace sk_gpu_test { -GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { - GLXGLContext *glxShareContext = reinterpret_cast<GLXGLContext *>(shareContext); - GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext); +GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, + GLTestContext *shareContext) { + GLXGLTestContext *glxShareContext = reinterpret_cast<GLXGLTestContext *>(shareContext); + GLXGLTestContext *ctx = new GLXGLTestContext(forcedGpuAPI, glxShareContext); if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm b/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm index d6507f280f..d31cb86958 100644 --- a/tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm +++ b/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "GLContext.h" +#include "GLTestContext.h" #import <OpenGLES/EAGL.h> #include <dlfcn.h> @@ -14,10 +14,10 @@ namespace { -class IOSGLContext : public sk_gpu_test::GLContext { +class IOSGLTestContext : public sk_gpu_test::GLTestContext { public: - IOSGLContext(); - ~IOSGLContext() override; + IOSGLTestContext(); + ~IOSGLTestContext() override; private: void destroyGLContext(); @@ -30,7 +30,7 @@ private: void* fGLLibrary; }; -IOSGLContext::IOSGLContext() +IOSGLTestContext::IOSGLTestContext() : fEAGLContext(NULL) , fGLLibrary(RTLD_DEFAULT) { @@ -56,12 +56,12 @@ IOSGLContext::IOSGLContext() this->init(gl.release()); } -IOSGLContext::~IOSGLContext() { +IOSGLTestContext::~IOSGLTestContext() { this->teardown(); this->destroyGLContext(); } -void IOSGLContext::destroyGLContext() { +void IOSGLTestContext::destroyGLContext() { if (fEAGLContext) { if ([EAGLContext currentContext] == EAGLCTX) { [EAGLContext setCurrentContext:nil]; @@ -75,22 +75,23 @@ void IOSGLContext::destroyGLContext() { } -void IOSGLContext::onPlatformMakeCurrent() const { +void IOSGLTestContext::onPlatformMakeCurrent() const { if (![EAGLContext setCurrentContext:EAGLCTX]) { SkDebugf("Could not set the context.\n"); } } -void IOSGLContext::onPlatformSwapBuffers() const { } +void IOSGLTestContext::onPlatformSwapBuffers() const { } -GrGLFuncPtr IOSGLContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr IOSGLTestContext::onPlatformGetProcAddress(const char* procName) const { return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName)); } } // anonymous namespace namespace sk_gpu_test { -GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { +GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, + GLTestContext *shareContext) { SkASSERT(!shareContext); if (shareContext) { return NULL; @@ -98,7 +99,7 @@ GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareCo if (kGL_GrGLStandard == forcedGpuAPI) { return NULL; } - IOSGLContext *ctx = new IOSGLContext; + IOSGLTestContext *ctx = new IOSGLTestContext; if (!ctx->isValid()) { delete ctx; return NULL; diff --git a/tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp b/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp index 7da99d7eb5..b2cdaacd8a 100644 --- a/tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp +++ b/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp @@ -7,17 +7,17 @@ */ #include "SkTypes.h" -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" #include "AvailabilityMacros.h" #include <OpenGL/OpenGL.h> #include <dlfcn.h> namespace { -class MacGLContext : public sk_gpu_test::GLContext { +class MacGLTestContext : public sk_gpu_test::GLTestContext { public: - MacGLContext(); - ~MacGLContext() override; + MacGLTestContext(); + ~MacGLTestContext() override; private: void destroyGLContext(); @@ -30,7 +30,7 @@ private: void* fGLLibrary; }; -MacGLContext::MacGLContext() +MacGLTestContext::MacGLTestContext() : fContext(nullptr) , fGLLibrary(RTLD_DEFAULT) { CGLPixelFormatAttribute attributes[] = { @@ -79,12 +79,12 @@ MacGLContext::MacGLContext() this->init(gl.release()); } -MacGLContext::~MacGLContext() { +MacGLTestContext::~MacGLTestContext() { this->teardown(); this->destroyGLContext(); } -void MacGLContext::destroyGLContext() { +void MacGLTestContext::destroyGLContext() { if (fContext) { CGLReleaseContext(fContext); fContext = nullptr; @@ -94,22 +94,23 @@ void MacGLContext::destroyGLContext() { } } -void MacGLContext::onPlatformMakeCurrent() const { +void MacGLTestContext::onPlatformMakeCurrent() const { CGLSetCurrentContext(fContext); } -void MacGLContext::onPlatformSwapBuffers() const { +void MacGLTestContext::onPlatformSwapBuffers() const { CGLFlushDrawable(fContext); } -GrGLFuncPtr MacGLContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr MacGLTestContext::onPlatformGetProcAddress(const char* procName) const { return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName)); } } // anonymous namespace namespace sk_gpu_test { -GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext* shareContext) { +GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, + GLTestContext* shareContext) { SkASSERT(!shareContext); if (shareContext) { return nullptr; @@ -118,7 +119,7 @@ GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext* shareCo if (kGLES_GrGLStandard == forcedGpuAPI) { return nullptr; } - MacGLContext* ctx = new MacGLContext; + MacGLTestContext* ctx = new MacGLTestContext; if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/gpu/gl/mesa/GLContext_mesa.cpp b/tools/gpu/gl/mesa/GLTestContext_mesa.cpp index e6cc7c7f4b..e0cf9c198a 100644 --- a/tools/gpu/gl/mesa/GLContext_mesa.cpp +++ b/tools/gpu/gl/mesa/GLTestContext_mesa.cpp @@ -8,7 +8,7 @@ #include <GL/osmesa.h> -#include "gl/mesa/GLContext_mesa.h" +#include "gl/mesa/GLTestContext_mesa.h" #include "gl/GrGLDefines.h" #include "gl/GrGLAssembleInterface.h" @@ -32,7 +32,7 @@ static const GrGLInterface* create_mesa_interface() { static const GrGLint gBOGUS_SIZE = 16; -class MesaGLContext : public sk_gpu_test::GLContext { +class MesaGLContext : public sk_gpu_test::GLTestContext { private: typedef intptr_t Context; @@ -140,7 +140,7 @@ GrGLFuncPtr MesaGLContext::onPlatformGetProcAddress(const char *procName) const namespace sk_gpu_test { -GLContext *CreateMesaGLContext() { +GLTestContext *CreateMesaGLTestContext() { MesaGLContext *ctx = new MesaGLContext; if (!ctx->isValid()) { delete ctx; diff --git a/tools/gpu/gl/mesa/GLContext_mesa.h b/tools/gpu/gl/mesa/GLTestContext_mesa.h index 0d6ee4dc10..17c072e679 100644 --- a/tools/gpu/gl/mesa/GLContext_mesa.h +++ b/tools/gpu/gl/mesa/GLTestContext_mesa.h @@ -5,13 +5,13 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#ifndef GLContext_mesa_DEFINED -#define GLContext_mesa_DEFINED +#ifndef GLTestContext_mesa_DEFINED +#define GLTestContext_mesa_DEFINED -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" namespace sk_gpu_test { -GLContext* CreateMesaGLContext(); +GLTestContext* CreateMesaGLTestContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/null/NullGLContext.cpp b/tools/gpu/gl/null/NullGLTestContext.cpp index 4781c90e4f..44abf59370 100644 --- a/tools/gpu/gl/null/NullGLContext.cpp +++ b/tools/gpu/gl/null/NullGLTestContext.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "NullGLContext.h" +#include "NullGLTestContext.h" #include "gl/GrGLTestInterface.h" #include "gl/GrGLDefines.h" #include "gl/GrGLInterface.h" @@ -605,7 +605,7 @@ const char* NullInterface::kExtensions[] = { nullptr, // signifies the end of the array. }; -class NullGLContext : public sk_gpu_test::GLContext { +class NullGLContext : public sk_gpu_test::GLTestContext { public: NullGLContext() { this->init(new NullInterface); } ~NullGLContext() override { this->teardown(); } @@ -618,8 +618,8 @@ private: } // anonymous namespace namespace sk_gpu_test { -GLContext* CreateNullGLContext() { - GLContext* ctx = new NullGLContext(); +GLTestContext* CreateNullGLTestContext() { + GLTestContext* ctx = new NullGLContext(); if (ctx->isValid()) { return ctx; } diff --git a/tools/gpu/gl/null/NullGLContext.h b/tools/gpu/gl/null/NullGLTestContext.h index 16fb9fd1df..ebde61a4c2 100644 --- a/tools/gpu/gl/null/NullGLContext.h +++ b/tools/gpu/gl/null/NullGLTestContext.h @@ -8,10 +8,10 @@ #ifndef NullGLContext_DEFINED #define NullGLContext_DEFINED -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" namespace sk_gpu_test { -GLContext* CreateNullGLContext(); +GLTestContext* CreateNullGLTestContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/win/CreatePlatformGLContext_win.cpp b/tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp index efee28b74b..3d70be82cd 100644 --- a/tools/gpu/gl/win/CreatePlatformGLContext_win.cpp +++ b/tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "gl/GLContext.h" +#include "gl/GLTestContext.h" #include <windows.h> #include <GL/GL.h> @@ -17,10 +17,10 @@ namespace { -class WinGLContext : public sk_gpu_test::GLContext { +class WinGLTestContext : public sk_gpu_test::GLTestContext { public: - WinGLContext(GrGLStandard forcedGpuAPI); - ~WinGLContext() override; + WinGLTestContext(GrGLStandard forcedGpuAPI); + ~WinGLTestContext() override; private: void destroyGLContext(); @@ -36,9 +36,9 @@ private: SkWGLPbufferContext* fPbufferContext; }; -ATOM WinGLContext::gWC = 0; +ATOM WinGLTestContext::gWC = 0; -WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI) +WinGLTestContext::WinGLTestContext(GrGLStandard forcedGpuAPI) : fWindow(nullptr) , fDeviceContext(nullptr) , fGlRenderContext(0) @@ -130,12 +130,12 @@ WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI) this->init(gl.release()); } -WinGLContext::~WinGLContext() { +WinGLTestContext::~WinGLTestContext() { this->teardown(); this->destroyGLContext(); } -void WinGLContext::destroyGLContext() { +void WinGLTestContext::destroyGLContext() { SkSafeSetNull(fPbufferContext); if (fGlRenderContext) { wglDeleteContext(fGlRenderContext); @@ -151,7 +151,7 @@ void WinGLContext::destroyGLContext() { } } -void WinGLContext::onPlatformMakeCurrent() const { +void WinGLTestContext::onPlatformMakeCurrent() const { HDC dc; HGLRC glrc; @@ -168,7 +168,7 @@ void WinGLContext::onPlatformMakeCurrent() const { } } -void WinGLContext::onPlatformSwapBuffers() const { +void WinGLTestContext::onPlatformSwapBuffers() const { HDC dc; if (nullptr == fPbufferContext) { @@ -181,19 +181,20 @@ void WinGLContext::onPlatformSwapBuffers() const { } } -GrGLFuncPtr WinGLContext::onPlatformGetProcAddress(const char* name) const { +GrGLFuncPtr WinGLTestContext::onPlatformGetProcAddress(const char* name) const { return reinterpret_cast<GrGLFuncPtr>(wglGetProcAddress(name)); } } // anonymous namespace namespace sk_gpu_test { -GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { +GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, + GLTestContext *shareContext) { SkASSERT(!shareContext); if (shareContext) { return nullptr; } - WinGLContext *ctx = new WinGLContext(forcedGpuAPI); + WinGLTestContext *ctx = new WinGLTestContext(forcedGpuAPI); if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/kilobench/kilobench.cpp b/tools/kilobench/kilobench.cpp index 81238353e2..f4c2999b91 100644 --- a/tools/kilobench/kilobench.cpp +++ b/tools/kilobench/kilobench.cpp @@ -218,10 +218,10 @@ struct GPUTarget { return true; } - GLContext* gl() { return fGL; } + GLTestContext* gl() { return fGL; } private: - GLContext* fGL; + GLTestContext* fGL; SkAutoTDelete<SkSurface> fSurface; }; @@ -282,7 +282,7 @@ static int clamp_loops(int loops) { static double now_ms() { return SkTime::GetNSecs() * 1e-6; } struct TimingThread { - TimingThread(GLContext* mainContext) + TimingThread(GLTestContext* mainContext) : fFenceSync(mainContext->fenceSync()) , fMainContext(mainContext) , fDone(false) {} @@ -308,8 +308,8 @@ struct TimingThread { void timingLoop() { // Create a context which shares display lists with the main thread - SkAutoTDelete<GLContext> glContext(CreatePlatformGLContext(kNone_GrGLStandard, - fMainContext)); + SkAutoTDelete<GLTestContext> glContext(CreatePlatformGLTestContext(kNone_GrGLStandard, + fMainContext)); glContext->makeCurrent(); // Basic timing methodology is: @@ -405,7 +405,7 @@ private: SyncQueue fFrameEndSyncs; SkTArray<double> fTimings; SkMutex fDoneMutex; - GLContext* fMainContext; + GLTestContext* fMainContext; bool fDone; }; diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp index d9e1bdaa33..225ca398df 100644 --- a/tools/skiaserve/Request.cpp +++ b/tools/skiaserve/Request.cpp @@ -65,7 +65,7 @@ SkData* Request::writeCanvasToPng(SkCanvas* canvas) { SkCanvas* Request::getCanvas() { #if SK_SUPPORT_GPU GrContextFactory* factory = fContextFactory; - GLContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextType, + GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextType, GrContextFactory::kNone_GLContextOptions).fGLContext; gl->makeCurrent(); #endif |