From 3e4616ff10fad7ee7dae48f465223b4591ec8ffd Mon Sep 17 00:00:00 2001 From: bsalomon Date: Thu, 31 Mar 2016 10:22:40 -0700 Subject: [PATCH] Revert of rename sk_gpu_test::GLContext to sk_gpu_test::GLTestContext (patchset #5 id:80001 of https://codereview.chromium.org/1849463002/ ) Reason for revert: breaking bots Original issue's description: > rename sk_gpu_test::GLContext to sk_gpu_test::GLTestContext > > rename subclasses > > Fix up the EGL native GLTestContext > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1849463002 > > TBR=jvanverth@google.com > > Committed: https://skia.googlesource.com/skia/+/4c7f0a16312c374eba4e8d5d46435ce9eb0b9971 TBR=jvanverth@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1850543003 --- bench/nanobench.cpp | 4 +- dm/DM.cpp | 4 +- samplecode/SampleApp.cpp | 2 +- tests/EGLImageTest.cpp | 8 +-- tests/RectangleTextureTest.cpp | 2 +- tests/Test.h | 4 +- tests/TestTest.cpp | 4 +- tests/TextureStorageAllocator.cpp | 2 +- tools/VisualBench/VisualBench.cpp | 2 +- tools/VisualBench/VisualBench.h | 2 +- .../VisualBench/VisualStreamTimingModule.cpp | 2 +- tools/gpu/GrContextFactory.cpp | 32 +++++------ tools/gpu/GrContextFactory.h | 8 +-- .../gl/{GLTestContext.cpp => GLContext.cpp} | 32 +++++------ tools/gpu/gl/{GLTestContext.h => GLContext.h} | 20 +++---- ...tContext_angle.cpp => GLContext_angle.cpp} | 16 +++--- ...LTestContext_angle.h => GLContext_angle.h} | 14 ++--- ...uffer.cpp => GLContext_command_buffer.cpp} | 26 ++++----- ...nd_buffer.h => GLContext_command_buffer.h} | 22 ++++---- ...ugGLTestContext.cpp => DebugGLContext.cpp} | 8 +-- ...{DebugGLTestContext.h => DebugGLContext.h} | 4 +- ...gl.cpp => CreatePlatformGLContext_egl.cpp} | 56 +++++++++---------- ...lx.cpp => CreatePlatformGLContext_glx.cpp} | 27 +++++---- ..._iOS.mm => CreatePlatformGLContext_iOS.mm} | 25 ++++----- ...ac.cpp => CreatePlatformGLContext_mac.cpp} | 25 ++++----- ...estContext_mesa.cpp => GLContext_mesa.cpp} | 6 +- ...{GLTestContext_mesa.h => GLContext_mesa.h} | 8 +-- ...ullGLTestContext.cpp => NullGLContext.cpp} | 8 +-- .../{NullGLTestContext.h => NullGLContext.h} | 4 +- ...in.cpp => CreatePlatformGLContext_win.cpp} | 27 +++++---- tools/kilobench/kilobench.cpp | 12 ++-- tools/skiaserve/Request.cpp | 2 +- 32 files changed, 206 insertions(+), 212 deletions(-) rename tools/gpu/gl/{GLTestContext.cpp => GLContext.cpp} (86%) rename tools/gpu/gl/{GLTestContext.h => GLContext.h} (88%) rename tools/gpu/gl/angle/{GLTestContext_angle.cpp => GLContext_angle.cpp} (94%) rename tools/gpu/gl/angle/{GLTestContext_angle.h => GLContext_angle.h} (54%) rename tools/gpu/gl/command_buffer/{GLTestContext_command_buffer.cpp => GLContext_command_buffer.cpp} (93%) rename tools/gpu/gl/command_buffer/{GLTestContext_command_buffer.h => GLContext_command_buffer.h} (60%) rename tools/gpu/gl/debug/{DebugGLTestContext.cpp => DebugGLContext.cpp} (99%) rename tools/gpu/gl/debug/{DebugGLTestContext.h => DebugGLContext.h} (78%) rename tools/gpu/gl/egl/{CreatePlatformGLTestContext_egl.cpp => CreatePlatformGLContext_egl.cpp} (83%) rename tools/gpu/gl/glx/{CreatePlatformGLTestContext_glx.cpp => CreatePlatformGLContext_glx.cpp} (92%) rename tools/gpu/gl/iOS/{CreatePlatformGLTestContext_iOS.mm => CreatePlatformGLContext_iOS.mm} (75%) rename tools/gpu/gl/mac/{CreatePlatformGLTestContext_mac.cpp => CreatePlatformGLContext_mac.cpp} (79%) rename tools/gpu/gl/mesa/{GLTestContext_mesa.cpp => GLContext_mesa.cpp} (96%) rename tools/gpu/gl/mesa/{GLTestContext_mesa.h => GLContext_mesa.h} (59%) rename tools/gpu/gl/null/{NullGLTestContext.cpp => NullGLContext.cpp} (99%) rename tools/gpu/gl/null/{NullGLTestContext.h => NullGLContext.h} (78%) rename tools/gpu/gl/win/{CreatePlatformGLTestContext_win.cpp => CreatePlatformGLContext_win.cpp} (86%) diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 521824e97b..235de02f57 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::GLTestContext; + using sk_gpu_test::GLContext; SkAutoTDelete 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) { } - GLTestContext* gl; + GLContext* gl; void setup() override { this->gl->makeCurrent(); diff --git a/dm/DM.cpp b/dm/DM.cpp index 07e594b25d..79b9e8d62b 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -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::GLTestContext; +using sk_gpu_test::GLContext; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ @@ -1418,7 +1418,7 @@ int dm_main() { namespace skiatest { namespace { typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*); -typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, GLTestContext*); +typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, GLContext*); #if SK_SUPPORT_GPU template void call_test(T test, skiatest::Reporter* reporter, const GrContextFactory::ContextInfo& context); diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index d4cf1cccb9..5bf28aa38e 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/GLTestContext_angle.h" +# include "gl/angle/GLContext_angle.h" # endif #else class GrContext; diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 47dad8164e..7f0d7ea376 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/GLTestContext.h" +#include "gl/GLContext.h" -using sk_gpu_test::GLTestContext; +using sk_gpu_test::GLContext; -static void cleanup(GLTestContext* glctx0, GrGLuint texID0, GLTestContext* glctx1, GrContext* grctx1, +static void cleanup(GLContext* glctx0, GrGLuint texID0, GLContext* 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 glCtx1 = glCtx0->createNew(); + SkAutoTDelete glCtx1 = glCtx0->createNew(); if (!glCtx1) { return; } diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index 782a3b57b3..fc9e65e12d 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/GLTestContext.h" +#include "gl/GLContext.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 7660c44d0d..119976f3ee 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -13,7 +13,7 @@ namespace sk_gpu_test { class GrContextFactory; -class GLTestContext; +class GLContext; } // 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::GLTestContext* a2 +#define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, sk_gpu_test::GLContext* 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 d72e02d5c1..05ab9ff697 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -9,7 +9,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" -#include "gl/GLTestContext.h" +#include "gl/GLContext.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 GLTestContext* glContext to implement the test. +// It uses the additional GLContext* 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 fbd00d32f6..dd08354136 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/GLTestContext.h" +#include "gl/GLContext.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 154c84b6f2..578ff92e3d 100644 --- a/tools/VisualBench/VisualBench.cpp +++ b/tools/VisualBench/VisualBench.cpp @@ -118,7 +118,7 @@ void VisualBench::setupContext() { fInterface.reset(GrGLCreateNativeInterface()); - // TODO use the GLTestContext creation factories and also set this all up in configs + // TODO use the GLContext 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 e965b094d9..e9fbdfb8ae 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/GLTestContext.h" +#include "gl/GLContext.h" class GrContext; struct GrGLInterface; diff --git a/tools/VisualBench/VisualStreamTimingModule.cpp b/tools/VisualBench/VisualStreamTimingModule.cpp index b5726219dd..0ac698eff2 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 GLTestContext each bench, + // This will flicker unfortunately, but as we are reseting the GLContext 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 e5fa2c799e..cb23014ad0 100755 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -7,19 +7,19 @@ */ #include "GrContextFactory.h" -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" #if SK_ANGLE - #include "gl/angle/GLTestContext_angle.h" + #include "gl/angle/GLContext_angle.h" #endif #if SK_COMMAND_BUFFER - #include "gl/command_buffer/GLTestContext_command_buffer.h" + #include "gl/command_buffer/GLContext_command_buffer.h" #endif -#include "gl/debug/DebugGLTestContext.h" +#include "gl/debug/DebugGLContext.h" #if SK_MESA - #include "gl/mesa/GLTestContext_mesa.h" + #include "gl/mesa/GLContext_mesa.h" #endif -#include "gl/null/NullGLTestContext.h" +#include "gl/null/NullGLContext.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 glCtx; + SkAutoTDelete glCtx; SkAutoTUnref grCtx; switch (type) { case kNative_GLContextType: - glCtx.reset(CreatePlatformGLTestContext(kNone_GrGLStandard)); + glCtx.reset(CreatePlatformGLContext(kNone_GrGLStandard)); break; case kGL_GLContextType: - glCtx.reset(CreatePlatformGLTestContext(kGL_GrGLStandard)); + glCtx.reset(CreatePlatformGLContext(kGL_GrGLStandard)); break; case kGLES_GLContextType: - glCtx.reset(CreatePlatformGLTestContext(kGLES_GrGLStandard)); + glCtx.reset(CreatePlatformGLContext(kGLES_GrGLStandard)); break; #if SK_ANGLE #ifdef SK_BUILD_FOR_WIN case kANGLE_GLContextType: - glCtx.reset(CreateANGLEDirect3DGLTestContext()); + glCtx.reset(CreateANGLEDirect3DGLContext()); break; #endif case kANGLE_GL_GLContextType: - glCtx.reset(CreateANGLEOpenGLGLTestContext()); + glCtx.reset(CreateANGLEOpenGLGLContext()); break; #endif #if SK_COMMAND_BUFFER case kCommandBuffer_GLContextType: - glCtx.reset(CommandBufferGLTestContext::Create()); + glCtx.reset(CommandBufferGLContext::Create()); break; #endif #if SK_MESA case kMESA_GLContextType: - glCtx.reset(CreateMesaGLTestContext()); + glCtx.reset(CreateMesaGLContext()); break; #endif case kNull_GLContextType: - glCtx.reset(CreateNullGLTestContext()); + glCtx.reset(CreateNullGLContext()); break; case kDebug_GLContextType: - glCtx.reset(CreateDebugGLTestContext()); + glCtx.reset(CreateDebugGLContext()); break; } if (nullptr == glCtx.get()) { diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h index 14a2739815..b17460819d 100644 --- a/tools/gpu/GrContextFactory.h +++ b/tools/gpu/GrContextFactory.h @@ -11,7 +11,7 @@ #include "GrContext.h" #include "GrContextOptions.h" -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" #include "SkTArray.h" namespace sk_gpu_test { @@ -111,10 +111,10 @@ public: struct ContextInfo { ContextInfo() : fGrContext(nullptr), fGLContext(nullptr) { } - ContextInfo(GrContext* grContext, GLTestContext* glContext) + ContextInfo(GrContext* grContext, GLContext* glContext) : fGrContext(grContext), fGLContext(glContext) { } GrContext* fGrContext; - GLTestContext* fGLContext; //! Valid until the factory destroys it via abandonContexts() or + GLContext* fGLContext; //! Valid until the factory destroys it via abandonContexts() or //! destroyContexts(). }; @@ -136,7 +136,7 @@ private: struct Context { GLContextType fType; GLContextOptions fOptions; - GLTestContext* fGLContext; + GLContext* fGLContext; GrContext* fGrContext; }; SkTArray fContexts; diff --git a/tools/gpu/gl/GLTestContext.cpp b/tools/gpu/gl/GLContext.cpp similarity index 86% rename from tools/gpu/gl/GLTestContext.cpp rename to tools/gpu/gl/GLContext.cpp index 1069929bf2..ac0e310014 100644 --- a/tools/gpu/gl/GLTestContext.cpp +++ b/tools/gpu/gl/GLContext.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 "GLTestContext.h" +#include "GLContext.h" #include "gl/GrGLUtil.h" #include "SkGpuFenceSync.h" namespace sk_gpu_test { -class GLTestContext::GLFenceSync : public SkGpuFenceSync { +class GLContext::GLFenceSync : public SkGpuFenceSync { public: - static GLFenceSync* CreateIfSupported(const GLTestContext*); + static GLFenceSync* CreateIfSupported(const GLContext*); SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override; bool waitFence(SkPlatformGpuFence fence, bool flush) const override; @@ -38,12 +38,12 @@ private: typedef SkGpuFenceSync INHERITED; }; -GLTestContext::GLTestContext() +GLContext::GLContext() : fCurrentFenceIdx(0) { memset(fFrameFences, 0, sizeof(fFrameFences)); } -GLTestContext::~GLTestContext() { +GLContext::~GLContext() { // Subclass should call teardown. #ifdef SK_DEBUG for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) { @@ -54,13 +54,13 @@ GLTestContext::~GLTestContext() { SkASSERT(nullptr == fFenceSync.get()); } -void GLTestContext::init(const GrGLInterface* gl, SkGpuFenceSync* fenceSync) { +void GLContext::init(const GrGLInterface* gl, SkGpuFenceSync* fenceSync) { SkASSERT(!fGL.get()); fGL.reset(gl); fFenceSync.reset(fenceSync ? fenceSync : GLFenceSync::CreateIfSupported(this)); } -void GLTestContext::teardown() { +void GLContext::teardown() { if (fFenceSync) { for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) { if (fFrameFences[i]) { @@ -74,15 +74,15 @@ void GLTestContext::teardown() { fGL.reset(nullptr); } -void GLTestContext::makeCurrent() const { +void GLContext::makeCurrent() const { this->onPlatformMakeCurrent(); } -void GLTestContext::swapBuffers() { +void GLContext::swapBuffers() { this->onPlatformSwapBuffers(); } -void GLTestContext::waitOnSyncOrSwap() { +void GLContext::waitOnSyncOrSwap() { if (!fFenceSync) { // Fallback on the platform SwapBuffers method for synchronization. This may have no effect. this->swapBuffers(); @@ -100,7 +100,7 @@ void GLTestContext::waitOnSyncOrSwap() { fCurrentFenceIdx = (fCurrentFenceIdx + 1) % SK_ARRAY_COUNT(fFrameFences); } -void GLTestContext::testAbandon() { +void GLContext::testAbandon() { if (fGL) { fGL->abandon(); } @@ -109,7 +109,7 @@ void GLTestContext::testAbandon() { } } -GLTestContext::GLFenceSync* GLTestContext::GLFenceSync::CreateIfSupported(const GLTestContext* ctx) { +GLContext::GLFenceSync* GLContext::GLFenceSync::CreateIfSupported(const GLContext* ctx) { SkAutoTDelete ret(new GLFenceSync); if (kGL_GrGLStandard == ctx->gl()->fStandard) { @@ -144,21 +144,21 @@ GLTestContext::GLFenceSync* GLTestContext::GLFenceSync::CreateIfSupported(const return ret.release(); } -SkPlatformGpuFence GLTestContext::GLFenceSync::insertFence() const { +SkPlatformGpuFence GLContext::GLFenceSync::insertFence() const { return fGLFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } -bool GLTestContext::GLFenceSync::waitFence(SkPlatformGpuFence fence, bool flush) const { +bool GLContext::GLFenceSync::waitFence(SkPlatformGpuFence fence, bool flush) const { GLsync glsync = static_cast(fence); return GL_WAIT_FAILED != fGLClientWaitSync(glsync, flush ? GL_SYNC_FLUSH_COMMANDS_BIT : 0, -1); } -void GLTestContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const { +void GLContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const { GLsync glsync = static_cast(fence); fGLDeleteSync(glsync); } -GrGLint GLTestContext::createTextureRectangle(int width, int height, GrGLenum internalFormat, +GrGLint GLContext::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/GLTestContext.h b/tools/gpu/gl/GLContext.h similarity index 88% rename from tools/gpu/gl/GLTestContext.h rename to tools/gpu/gl/GLContext.h index d6054a8ba6..3f47613722 100644 --- a/tools/gpu/gl/GLTestContext.h +++ b/tools/gpu/gl/GLContext.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 GLTestContext_DEFINED -#define GLTestContext_DEFINED +#ifndef GLContext_DEFINED +#define GLContext_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 GLTestContext : public SkNoncopyable { +class GLContext : public SkNoncopyable { public: - virtual ~GLTestContext(); + virtual ~GLContext(); 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 GLTestContext *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 GLTestContext + * returns the fencesync object owned by this GLContext */ SkGpuFenceSync *fenceSync() { return fFenceSync.get(); } protected: - GLTestContext(); + GLContext(); /* * 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 GLTestContext created - * with SkCreatePlatformGLTestContext. 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 GLContext 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. */ -GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, GLTestContext *shareContext = nullptr); +GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext = nullptr); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/angle/GLTestContext_angle.cpp b/tools/gpu/gl/angle/GLContext_angle.cpp similarity index 94% rename from tools/gpu/gl/angle/GLTestContext_angle.cpp rename to tools/gpu/gl/angle/GLContext_angle.cpp index d992be375a..f1e8aad509 100644 --- a/tools/gpu/gl/angle/GLTestContext_angle.cpp +++ b/tools/gpu/gl/angle/GLContext_angle.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "GLTestContext_angle.h" +#include "GLContext_angle.h" #include #include @@ -84,7 +84,7 @@ void* get_angle_egl_display(void* nativeDisplay, bool useGLBackend) { return display; } -class ANGLEGLContext : public sk_gpu_test::GLTestContext { +class ANGLEGLContext : public sk_gpu_test::GLContext { 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::GLTestContext* createNew() const override; + sk_gpu_test::GLContext* createNew() const override; private: void destroyGLContext(); @@ -223,12 +223,12 @@ GrGLuint ANGLEGLContext::eglImageToExternalTexture(GrEGLImage image) const { return texID; } -sk_gpu_test::GLTestContext* ANGLEGLContext::createNew() const { +sk_gpu_test::GLContext* ANGLEGLContext::createNew() const { #ifdef SK_BUILD_FOR_WIN - sk_gpu_test::GLTestContext* ctx = fIsGLBackend ? sk_gpu_test::CreateANGLEOpenGLGLContext() + sk_gpu_test::GLContext* ctx = fIsGLBackend ? sk_gpu_test::CreateANGLEOpenGLGLContext() : sk_gpu_test::CreateANGLEDirect3DGLContext(); #else - sk_gpu_test::GLTestContext* ctx = sk_gpu_test::CreateANGLEOpenGLGLTestContext(); + sk_gpu_test::GLContext* ctx = sk_gpu_test::CreateANGLEOpenGLGLContext(); #endif if (ctx) { ctx->makeCurrent(); @@ -299,7 +299,7 @@ const GrGLInterface* CreateANGLEGLInterface() { } #ifdef SK_BUILD_FOR_WIN -GLTestContext* CreateANGLEDirect3DGLTestContext() { +GLContext* CreateANGLEDirect3DGLContext() { ANGLEGLContext* ctx = new ANGLEGLContext(false); if (!ctx->isValid()) { delete ctx; @@ -309,7 +309,7 @@ GLTestContext* CreateANGLEDirect3DGLTestContext() { } #endif -GLTestContext* CreateANGLEOpenGLGLTestContext() { +GLContext* CreateANGLEOpenGLGLContext() { ANGLEGLContext* ctx = new ANGLEGLContext(true); if (!ctx->isValid()) { delete ctx; diff --git a/tools/gpu/gl/angle/GLTestContext_angle.h b/tools/gpu/gl/angle/GLContext_angle.h similarity index 54% rename from tools/gpu/gl/angle/GLTestContext_angle.h rename to tools/gpu/gl/angle/GLContext_angle.h index 0140477a54..519ea6b5a3 100644 --- a/tools/gpu/gl/angle/GLTestContext_angle.h +++ b/tools/gpu/gl/angle/GLContext_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 GLTestContext_angle_DEFINED -#define GLTestContext_angle_DEFINED +#ifndef GLContext_angle_DEFINED +#define GLContext_angle_DEFINED -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" namespace sk_gpu_test { @@ -19,12 +19,12 @@ namespace sk_gpu_test { const GrGLInterface* CreateANGLEGLInterface(); #ifdef SK_BUILD_FOR_WIN -/** Creates a GLTestContext backed by ANGLE's Direct3D backend. */ -GLTestContext* CreateANGLEDirect3DGLTestContext(); +/** Creates a GLContext backed by ANGLE's Direct3D backend. */ +GLContext* CreateANGLEDirect3DGLContext(); #endif -/** Creates a GLTestContext backed by ANGLE's OpenGL backend. */ -GLTestContext* CreateANGLEOpenGLGLTestContext(); +/** Creates a GLContext backed by ANGLE's OpenGL backend. */ +GLContext* CreateANGLEOpenGLGLContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp b/tools/gpu/gl/command_buffer/GLContext_command_buffer.cpp similarity index 93% rename from tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp rename to tools/gpu/gl/command_buffer/GLContext_command_buffer.cpp index 5985a2e31f..b878cb4aa9 100644 --- a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp +++ b/tools/gpu/gl/command_buffer/GLContext_command_buffer.cpp @@ -9,7 +9,7 @@ #include "SkOnce.h" #include "gl/GrGLInterface.h" #include "gl/GrGLAssembleInterface.h" -#include "gl/command_buffer/GLTestContext_command_buffer.h" +#include "gl/command_buffer/GLContext_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 { -CommandBufferGLTestContext::CommandBufferGLTestContext() +CommandBufferGLContext::CommandBufferGLContext() : fContext(EGL_NO_CONTEXT), fDisplay(EGL_NO_DISPLAY), fSurface(EGL_NO_SURFACE) { static const EGLint configAttribs[] = { @@ -165,7 +165,7 @@ CommandBufferGLTestContext::CommandBufferGLTestContext() initializeGLContext(nullptr, configAttribs, surfaceAttribs); } -CommandBufferGLTestContext::CommandBufferGLTestContext(void *nativeWindow, int msaaSampleCount) { +CommandBufferGLContext::CommandBufferGLContext(void *nativeWindow, int msaaSampleCount) { static const EGLint surfaceAttribs[] = {EGL_NONE}; EGLint configAttribs[] = { @@ -186,7 +186,7 @@ CommandBufferGLTestContext::CommandBufferGLTestContext(void *nativeWindow, int m initializeGLContext(nativeWindow, configAttribs, surfaceAttribs); } -void CommandBufferGLTestContext::initializeGLContext(void *nativeWindow, const int *configAttribs, +void CommandBufferGLContext::initializeGLContext(void *nativeWindow, const int *configAttribs, const int *surfaceAttribs) { load_command_buffer_once(); if (!gfFunctionsLoadedSuccessfully) { @@ -266,12 +266,12 @@ void CommandBufferGLTestContext::initializeGLContext(void *nativeWindow, const i this->init(gl.release()); } -CommandBufferGLTestContext::~CommandBufferGLTestContext() { +CommandBufferGLContext::~CommandBufferGLContext() { this->teardown(); this->destroyGLContext(); } -void CommandBufferGLTestContext::destroyGLContext() { +void CommandBufferGLContext::destroyGLContext() { if (!gfFunctionsLoadedSuccessfully) { return; } @@ -293,7 +293,7 @@ void CommandBufferGLTestContext::destroyGLContext() { } } -void CommandBufferGLTestContext::onPlatformMakeCurrent() const { +void CommandBufferGLContext::onPlatformMakeCurrent() const { if (!gfFunctionsLoadedSuccessfully) { return; } @@ -302,7 +302,7 @@ void CommandBufferGLTestContext::onPlatformMakeCurrent() const { } } -void CommandBufferGLTestContext::onPlatformSwapBuffers() const { +void CommandBufferGLContext::onPlatformSwapBuffers() const { if (!gfFunctionsLoadedSuccessfully) { return; } @@ -311,14 +311,14 @@ void CommandBufferGLTestContext::onPlatformSwapBuffers() const { } } -GrGLFuncPtr CommandBufferGLTestContext::onPlatformGetProcAddress(const char *name) const { +GrGLFuncPtr CommandBufferGLContext::onPlatformGetProcAddress(const char *name) const { if (!gfFunctionsLoadedSuccessfully) { return nullptr; } return gfGetProcAddress(name); } -void CommandBufferGLTestContext::presentCommandBuffer() { +void CommandBufferGLContext::presentCommandBuffer() { if (this->gl()) { this->gl()->fFunctions.fFlush(); } @@ -326,17 +326,17 @@ void CommandBufferGLTestContext::presentCommandBuffer() { this->onPlatformSwapBuffers(); } -bool CommandBufferGLTestContext::makeCurrent() { +bool CommandBufferGLContext::makeCurrent() { return gfMakeCurrent(fDisplay, fSurface, fSurface, fContext) != EGL_FALSE; } -int CommandBufferGLTestContext::getStencilBits() { +int CommandBufferGLContext::getStencilBits() { EGLint result = 0; gfGetConfigAttrib(fDisplay, static_cast(fConfig), EGL_STENCIL_SIZE, &result); return result; } -int CommandBufferGLTestContext::getSampleCount() { +int CommandBufferGLContext::getSampleCount() { EGLint result = 0; gfGetConfigAttrib(fDisplay, static_cast(fConfig), EGL_SAMPLES, &result); return result; diff --git a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.h b/tools/gpu/gl/command_buffer/GLContext_command_buffer.h similarity index 60% rename from tools/gpu/gl/command_buffer/GLTestContext_command_buffer.h rename to tools/gpu/gl/command_buffer/GLContext_command_buffer.h index 0994c98c8b..73f02e2c78 100644 --- a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.h +++ b/tools/gpu/gl/command_buffer/GLContext_command_buffer.h @@ -6,18 +6,18 @@ * found in the LICENSE file. */ -#ifndef GLTestContext_command_buffer_DEFINED -#define GLTestContext_command_buffer_DEFINED +#ifndef GLContext_command_buffer_DEFINED +#define GLContext_command_buffer_DEFINED -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" namespace sk_gpu_test { -class CommandBufferGLTestContext : public GLTestContext { +class CommandBufferGLContext : public GLContext { public: - ~CommandBufferGLTestContext() override; + ~CommandBufferGLContext() override; - static CommandBufferGLTestContext *Create() { - CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext; + static CommandBufferGLContext *Create() { + CommandBufferGLContext *ctx = new CommandBufferGLContext; if (!ctx->isValid()) { delete ctx; return nullptr; @@ -25,8 +25,8 @@ public: return ctx; } - static CommandBufferGLTestContext *Create(void *nativeWindow, int msaaSampleCount) { - CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext(nativeWindow, msaaSampleCount); + static CommandBufferGLContext *Create(void *nativeWindow, int msaaSampleCount) { + CommandBufferGLContext *ctx = new CommandBufferGLContext(nativeWindow, msaaSampleCount); if (!ctx->isValid()) { delete ctx; return nullptr; @@ -43,9 +43,9 @@ public: int getSampleCount(); private: - CommandBufferGLTestContext(); + CommandBufferGLContext(); - CommandBufferGLTestContext(void *nativeWindow, int msaaSampleCount); + CommandBufferGLContext(void *nativeWindow, int msaaSampleCount); void initializeGLContext(void *nativeWindow, const int *configAttribs, const int *surfaceAttribs); diff --git a/tools/gpu/gl/debug/DebugGLTestContext.cpp b/tools/gpu/gl/debug/DebugGLContext.cpp similarity index 99% rename from tools/gpu/gl/debug/DebugGLTestContext.cpp rename to tools/gpu/gl/debug/DebugGLContext.cpp index 96640c5908..f4cbbea680 100644 --- a/tools/gpu/gl/debug/DebugGLTestContext.cpp +++ b/tools/gpu/gl/debug/DebugGLContext.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "DebugGLTestContext.h" +#include "DebugGLContext.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::GLTestContext { +class DebugGLContext : public sk_gpu_test::GLContext { public: DebugGLContext() { this->init(new DebugInterface()); @@ -1245,8 +1245,8 @@ private: } // anonymous namespace namespace sk_gpu_test { -GLTestContext* CreateDebugGLTestContext() { - GLTestContext* ctx = new DebugGLContext(); +GLContext* CreateDebugGLContext() { + GLContext* ctx = new DebugGLContext(); if (ctx->isValid()) { return ctx; } diff --git a/tools/gpu/gl/debug/DebugGLTestContext.h b/tools/gpu/gl/debug/DebugGLContext.h similarity index 78% rename from tools/gpu/gl/debug/DebugGLTestContext.h rename to tools/gpu/gl/debug/DebugGLContext.h index 3f2646bb8c..0ac505b632 100644 --- a/tools/gpu/gl/debug/DebugGLTestContext.h +++ b/tools/gpu/gl/debug/DebugGLContext.h @@ -8,10 +8,10 @@ #ifndef DebugGLContext_DEFINED #define DebugGLContext_DEFINED -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" namespace sk_gpu_test { -GLTestContext* CreateDebugGLTestContext(); +GLContext* CreateDebugGLContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp b/tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp similarity index 83% rename from tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp rename to tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp index ae61b337d9..ac2e7ca7cf 100644 --- a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp +++ b/tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp @@ -5,9 +5,8 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" -#define GL_GLEXT_PROTOTYPES #include #define EGL_EGLEXT_PROTOTYPES @@ -20,31 +19,31 @@ namespace { // TODO: Share this class with ANGLE if/when it gets support for EGL_KHR_fence_sync. -class EGLFenceSync : public SkGpuFenceSync { +class SkEGLFenceSync : public SkGpuFenceSync { public: - static EGLFenceSync* CreateIfSupported(EGLDisplay); + static SkEGLFenceSync* 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: - EGLFenceSync(EGLDisplay display) : fDisplay(display) {} + SkEGLFenceSync(EGLDisplay display) : fDisplay(display) {} EGLDisplay fDisplay; typedef SkGpuFenceSync INHERITED; }; -class EGLGLTestContext : public sk_gpu_test::GLTestContext { +class EGLGLContext : public sk_gpu_test::GLContext { public: - EGLGLTestContext(GrGLStandard forcedGpuAPI); - ~EGLGLTestContext() override; + EGLGLContext(GrGLStandard forcedGpuAPI); + ~EGLGLContext() override; GrEGLImage texture2DToEGLImage(GrGLuint texID) const override; void destroyEGLImage(GrEGLImage) const override; GrGLuint eglImageToExternalTexture(GrEGLImage) const override; - sk_gpu_test::GLTestContext* createNew() const override; + sk_gpu_test::GLContext* createNew() const override; private: void destroyGLContext(); @@ -58,7 +57,7 @@ private: EGLSurface fSurface; }; -EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI) +EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI) : fContext(EGL_NO_CONTEXT) , fDisplay(EGL_NO_DISPLAY) , fSurface(EGL_NO_SURFACE) { @@ -180,17 +179,17 @@ EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI) continue; } - this->init(gl.release(), EGLFenceSync::CreateIfSupported(fDisplay)); + this->init(gl.release(), SkEGLFenceSync::CreateIfSupported(fDisplay)); break; } } -EGLGLTestContext::~EGLGLTestContext() { +EGLGLContext::~EGLGLContext() { this->teardown(); this->destroyGLContext(); } -void EGLGLTestContext::destroyGLContext() { +void EGLGLContext::destroyGLContext() { if (fDisplay) { eglMakeCurrent(fDisplay, 0, 0, 0); @@ -209,7 +208,7 @@ void EGLGLTestContext::destroyGLContext() { } } -GrEGLImage EGLGLTestContext::texture2DToEGLImage(GrGLuint texID) const { +GrEGLImage EGLGLContext::texture2DToEGLImage(GrGLuint texID) const { if (!this->gl()->hasExtension("EGL_KHR_gl_texture_2D_image")) { return GR_EGL_NO_IMAGE; } @@ -221,11 +220,11 @@ GrEGLImage EGLGLTestContext::texture2DToEGLImage(GrGLuint texID) const { return img; } -void EGLGLTestContext::destroyEGLImage(GrEGLImage image) const { +void EGLGLContext::destroyEGLImage(GrEGLImage image) const { GR_GL_CALL(this->gl(), EGLDestroyImage(fDisplay, image)); } -GrGLuint EGLGLTestContext::eglImageToExternalTexture(GrEGLImage image) const { +GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const { GrGLClearErr(this->gl()); if (!this->gl()->hasExtension("GL_OES_EGL_image_external")) { return 0; @@ -255,27 +254,27 @@ GrGLuint EGLGLTestContext::eglImageToExternalTexture(GrEGLImage image) const { return texID; } -sk_gpu_test::GLTestContext* EGLGLTestContext::createNew() const { - sk_gpu_test::GLTestContext* ctx = new EGLGLTestContext(this->gl()->fStandard); +sk_gpu_test::GLContext* EGLGLContext::createNew() const { + sk_gpu_test::GLContext* ctx = new EGLGLContext(this->gl()->fStandard); if (ctx) { ctx->makeCurrent(); } return ctx; } -void EGLGLTestContext::onPlatformMakeCurrent() const { +void EGLGLContext::onPlatformMakeCurrent() const { if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { SkDebugf("Could not set the context.\n"); } } -void EGLGLTestContext::onPlatformSwapBuffers() const { +void EGLGLContext::onPlatformSwapBuffers() const { if (!eglSwapBuffers(fDisplay, fSurface)) { SkDebugf("Could not complete eglSwapBuffers.\n"); } } -GrGLFuncPtr EGLGLTestContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr EGLGLContext::onPlatformGetProcAddress(const char* procName) const { return eglGetProcAddress(procName); } @@ -294,18 +293,18 @@ static bool supports_egl_extension(EGLDisplay display, const char* extension) { return false; } -EGLFenceSync* EGLFenceSync::CreateIfSupported(EGLDisplay display) { +SkEGLFenceSync* SkEGLFenceSync::CreateIfSupported(EGLDisplay display) { if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) { return nullptr; } - return new EGLFenceSync(display); + return new SkEGLFenceSync(display); } -SkPlatformGpuFence EGLFenceSync::insertFence() const { +SkPlatformGpuFence SkEGLFenceSync::insertFence() const { return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr); } -bool EGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const { +bool SkEGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const { EGLSyncKHR eglsync = static_cast(platformFence); return EGL_CONDITION_SATISFIED_KHR == eglClientWaitSyncKHR(fDisplay, @@ -314,7 +313,7 @@ bool EGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const EGL_FOREVER_KHR); } -void EGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { +void SkEGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { EGLSyncKHR eglsync = static_cast(platformFence); eglDestroySyncKHR(fDisplay, eglsync); } @@ -322,13 +321,12 @@ void EGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { } // anonymous namespace namespace sk_gpu_test { -GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, - GLTestContext *shareContext) { +GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { SkASSERT(!shareContext); if (shareContext) { return nullptr; } - EGLGLTestContext *ctx = new EGLGLTestContext(forcedGpuAPI); + EGLGLContext *ctx = new EGLGLContext(forcedGpuAPI); if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp b/tools/gpu/gl/glx/CreatePlatformGLContext_glx.cpp similarity index 92% rename from tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp rename to tools/gpu/gl/glx/CreatePlatformGLContext_glx.cpp index 7429bed630..b2168e3c5a 100644 --- a/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp +++ b/tools/gpu/gl/glx/CreatePlatformGLContext_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/GLTestContext.h" +#include "gl/GLContext.h" #include #include @@ -44,10 +44,10 @@ static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) { return 0; } -class GLXGLTestContext : public sk_gpu_test::GLTestContext { +class GLXGLContext : public sk_gpu_test::GLContext { public: - GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext* shareList); - ~GLXGLTestContext() override; + GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareList); + ~GLXGLContext() override; private: void destroyGLContext(); @@ -62,7 +62,7 @@ private: GLXPixmap fGlxPixmap; }; -GLXGLTestContext::GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext* shareContext) +GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareContext) : fContext(nullptr) , fDisplay(nullptr) , fPixmap(0) @@ -288,12 +288,12 @@ GLXGLTestContext::GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext* } -GLXGLTestContext::~GLXGLTestContext() { +GLXGLContext::~GLXGLContext() { this->teardown(); this->destroyGLContext(); } -void GLXGLTestContext::destroyGLContext() { +void GLXGLContext::destroyGLContext() { if (fDisplay) { glXMakeCurrent(fDisplay, 0, 0); @@ -317,27 +317,26 @@ void GLXGLTestContext::destroyGLContext() { } } -void GLXGLTestContext::onPlatformMakeCurrent() const { +void GLXGLContext::onPlatformMakeCurrent() const { if (!glXMakeCurrent(fDisplay, fGlxPixmap, fContext)) { SkDebugf("Could not set the context.\n"); } } -void GLXGLTestContext::onPlatformSwapBuffers() const { +void GLXGLContext::onPlatformSwapBuffers() const { glXSwapBuffers(fDisplay, fGlxPixmap); } -GrGLFuncPtr GLXGLTestContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const { return glXGetProcAddress(reinterpret_cast(procName)); } } // anonymous namespace namespace sk_gpu_test { -GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, - GLTestContext *shareContext) { - GLXGLTestContext *glxShareContext = reinterpret_cast(shareContext); - GLXGLTestContext *ctx = new GLXGLTestContext(forcedGpuAPI, glxShareContext); +GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { + GLXGLContext *glxShareContext = reinterpret_cast(shareContext); + GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext); if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm b/tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm similarity index 75% rename from tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm rename to tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm index d31cb86958..d6507f280f 100644 --- a/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm +++ b/tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "GLTestContext.h" +#include "GLContext.h" #import #include @@ -14,10 +14,10 @@ namespace { -class IOSGLTestContext : public sk_gpu_test::GLTestContext { +class IOSGLContext : public sk_gpu_test::GLContext { public: - IOSGLTestContext(); - ~IOSGLTestContext() override; + IOSGLContext(); + ~IOSGLContext() override; private: void destroyGLContext(); @@ -30,7 +30,7 @@ private: void* fGLLibrary; }; -IOSGLTestContext::IOSGLTestContext() +IOSGLContext::IOSGLContext() : fEAGLContext(NULL) , fGLLibrary(RTLD_DEFAULT) { @@ -56,12 +56,12 @@ IOSGLTestContext::IOSGLTestContext() this->init(gl.release()); } -IOSGLTestContext::~IOSGLTestContext() { +IOSGLContext::~IOSGLContext() { this->teardown(); this->destroyGLContext(); } -void IOSGLTestContext::destroyGLContext() { +void IOSGLContext::destroyGLContext() { if (fEAGLContext) { if ([EAGLContext currentContext] == EAGLCTX) { [EAGLContext setCurrentContext:nil]; @@ -75,23 +75,22 @@ void IOSGLTestContext::destroyGLContext() { } -void IOSGLTestContext::onPlatformMakeCurrent() const { +void IOSGLContext::onPlatformMakeCurrent() const { if (![EAGLContext setCurrentContext:EAGLCTX]) { SkDebugf("Could not set the context.\n"); } } -void IOSGLTestContext::onPlatformSwapBuffers() const { } +void IOSGLContext::onPlatformSwapBuffers() const { } -GrGLFuncPtr IOSGLTestContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr IOSGLContext::onPlatformGetProcAddress(const char* procName) const { return reinterpret_cast(dlsym(fGLLibrary, procName)); } } // anonymous namespace namespace sk_gpu_test { -GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, - GLTestContext *shareContext) { +GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { SkASSERT(!shareContext); if (shareContext) { return NULL; @@ -99,7 +98,7 @@ GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, if (kGL_GrGLStandard == forcedGpuAPI) { return NULL; } - IOSGLTestContext *ctx = new IOSGLTestContext; + IOSGLContext *ctx = new IOSGLContext; if (!ctx->isValid()) { delete ctx; return NULL; diff --git a/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp b/tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp similarity index 79% rename from tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp rename to tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp index b2cdaacd8a..7da99d7eb5 100644 --- a/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp +++ b/tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp @@ -7,17 +7,17 @@ */ #include "SkTypes.h" -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" #include "AvailabilityMacros.h" #include #include namespace { -class MacGLTestContext : public sk_gpu_test::GLTestContext { +class MacGLContext : public sk_gpu_test::GLContext { public: - MacGLTestContext(); - ~MacGLTestContext() override; + MacGLContext(); + ~MacGLContext() override; private: void destroyGLContext(); @@ -30,7 +30,7 @@ private: void* fGLLibrary; }; -MacGLTestContext::MacGLTestContext() +MacGLContext::MacGLContext() : fContext(nullptr) , fGLLibrary(RTLD_DEFAULT) { CGLPixelFormatAttribute attributes[] = { @@ -79,12 +79,12 @@ MacGLTestContext::MacGLTestContext() this->init(gl.release()); } -MacGLTestContext::~MacGLTestContext() { +MacGLContext::~MacGLContext() { this->teardown(); this->destroyGLContext(); } -void MacGLTestContext::destroyGLContext() { +void MacGLContext::destroyGLContext() { if (fContext) { CGLReleaseContext(fContext); fContext = nullptr; @@ -94,23 +94,22 @@ void MacGLTestContext::destroyGLContext() { } } -void MacGLTestContext::onPlatformMakeCurrent() const { +void MacGLContext::onPlatformMakeCurrent() const { CGLSetCurrentContext(fContext); } -void MacGLTestContext::onPlatformSwapBuffers() const { +void MacGLContext::onPlatformSwapBuffers() const { CGLFlushDrawable(fContext); } -GrGLFuncPtr MacGLTestContext::onPlatformGetProcAddress(const char* procName) const { +GrGLFuncPtr MacGLContext::onPlatformGetProcAddress(const char* procName) const { return reinterpret_cast(dlsym(fGLLibrary, procName)); } } // anonymous namespace namespace sk_gpu_test { -GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, - GLTestContext* shareContext) { +GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext* shareContext) { SkASSERT(!shareContext); if (shareContext) { return nullptr; @@ -119,7 +118,7 @@ GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, if (kGLES_GrGLStandard == forcedGpuAPI) { return nullptr; } - MacGLTestContext* ctx = new MacGLTestContext; + MacGLContext* ctx = new MacGLContext; if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/gpu/gl/mesa/GLTestContext_mesa.cpp b/tools/gpu/gl/mesa/GLContext_mesa.cpp similarity index 96% rename from tools/gpu/gl/mesa/GLTestContext_mesa.cpp rename to tools/gpu/gl/mesa/GLContext_mesa.cpp index e0cf9c198a..e6cc7c7f4b 100644 --- a/tools/gpu/gl/mesa/GLTestContext_mesa.cpp +++ b/tools/gpu/gl/mesa/GLContext_mesa.cpp @@ -8,7 +8,7 @@ #include -#include "gl/mesa/GLTestContext_mesa.h" +#include "gl/mesa/GLContext_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::GLTestContext { +class MesaGLContext : public sk_gpu_test::GLContext { private: typedef intptr_t Context; @@ -140,7 +140,7 @@ GrGLFuncPtr MesaGLContext::onPlatformGetProcAddress(const char *procName) const namespace sk_gpu_test { -GLTestContext *CreateMesaGLTestContext() { +GLContext *CreateMesaGLContext() { MesaGLContext *ctx = new MesaGLContext; if (!ctx->isValid()) { delete ctx; diff --git a/tools/gpu/gl/mesa/GLTestContext_mesa.h b/tools/gpu/gl/mesa/GLContext_mesa.h similarity index 59% rename from tools/gpu/gl/mesa/GLTestContext_mesa.h rename to tools/gpu/gl/mesa/GLContext_mesa.h index 17c072e679..0d6ee4dc10 100644 --- a/tools/gpu/gl/mesa/GLTestContext_mesa.h +++ b/tools/gpu/gl/mesa/GLContext_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 GLTestContext_mesa_DEFINED -#define GLTestContext_mesa_DEFINED +#ifndef GLContext_mesa_DEFINED +#define GLContext_mesa_DEFINED -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" namespace sk_gpu_test { -GLTestContext* CreateMesaGLTestContext(); +GLContext* CreateMesaGLContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/null/NullGLTestContext.cpp b/tools/gpu/gl/null/NullGLContext.cpp similarity index 99% rename from tools/gpu/gl/null/NullGLTestContext.cpp rename to tools/gpu/gl/null/NullGLContext.cpp index 44abf59370..4781c90e4f 100644 --- a/tools/gpu/gl/null/NullGLTestContext.cpp +++ b/tools/gpu/gl/null/NullGLContext.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "NullGLTestContext.h" +#include "NullGLContext.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::GLTestContext { +class NullGLContext : public sk_gpu_test::GLContext { public: NullGLContext() { this->init(new NullInterface); } ~NullGLContext() override { this->teardown(); } @@ -618,8 +618,8 @@ private: } // anonymous namespace namespace sk_gpu_test { -GLTestContext* CreateNullGLTestContext() { - GLTestContext* ctx = new NullGLContext(); +GLContext* CreateNullGLContext() { + GLContext* ctx = new NullGLContext(); if (ctx->isValid()) { return ctx; } diff --git a/tools/gpu/gl/null/NullGLTestContext.h b/tools/gpu/gl/null/NullGLContext.h similarity index 78% rename from tools/gpu/gl/null/NullGLTestContext.h rename to tools/gpu/gl/null/NullGLContext.h index ebde61a4c2..16fb9fd1df 100644 --- a/tools/gpu/gl/null/NullGLTestContext.h +++ b/tools/gpu/gl/null/NullGLContext.h @@ -8,10 +8,10 @@ #ifndef NullGLContext_DEFINED #define NullGLContext_DEFINED -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" namespace sk_gpu_test { -GLTestContext* CreateNullGLTestContext(); +GLContext* CreateNullGLContext(); } // namespace sk_gpu_test #endif diff --git a/tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp b/tools/gpu/gl/win/CreatePlatformGLContext_win.cpp similarity index 86% rename from tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp rename to tools/gpu/gl/win/CreatePlatformGLContext_win.cpp index 3d70be82cd..efee28b74b 100644 --- a/tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp +++ b/tools/gpu/gl/win/CreatePlatformGLContext_win.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "gl/GLTestContext.h" +#include "gl/GLContext.h" #include #include @@ -17,10 +17,10 @@ namespace { -class WinGLTestContext : public sk_gpu_test::GLTestContext { +class WinGLContext : public sk_gpu_test::GLContext { public: - WinGLTestContext(GrGLStandard forcedGpuAPI); - ~WinGLTestContext() override; + WinGLContext(GrGLStandard forcedGpuAPI); + ~WinGLContext() override; private: void destroyGLContext(); @@ -36,9 +36,9 @@ private: SkWGLPbufferContext* fPbufferContext; }; -ATOM WinGLTestContext::gWC = 0; +ATOM WinGLContext::gWC = 0; -WinGLTestContext::WinGLTestContext(GrGLStandard forcedGpuAPI) +WinGLContext::WinGLContext(GrGLStandard forcedGpuAPI) : fWindow(nullptr) , fDeviceContext(nullptr) , fGlRenderContext(0) @@ -130,12 +130,12 @@ WinGLTestContext::WinGLTestContext(GrGLStandard forcedGpuAPI) this->init(gl.release()); } -WinGLTestContext::~WinGLTestContext() { +WinGLContext::~WinGLContext() { this->teardown(); this->destroyGLContext(); } -void WinGLTestContext::destroyGLContext() { +void WinGLContext::destroyGLContext() { SkSafeSetNull(fPbufferContext); if (fGlRenderContext) { wglDeleteContext(fGlRenderContext); @@ -151,7 +151,7 @@ void WinGLTestContext::destroyGLContext() { } } -void WinGLTestContext::onPlatformMakeCurrent() const { +void WinGLContext::onPlatformMakeCurrent() const { HDC dc; HGLRC glrc; @@ -168,7 +168,7 @@ void WinGLTestContext::onPlatformMakeCurrent() const { } } -void WinGLTestContext::onPlatformSwapBuffers() const { +void WinGLContext::onPlatformSwapBuffers() const { HDC dc; if (nullptr == fPbufferContext) { @@ -181,20 +181,19 @@ void WinGLTestContext::onPlatformSwapBuffers() const { } } -GrGLFuncPtr WinGLTestContext::onPlatformGetProcAddress(const char* name) const { +GrGLFuncPtr WinGLContext::onPlatformGetProcAddress(const char* name) const { return reinterpret_cast(wglGetProcAddress(name)); } } // anonymous namespace namespace sk_gpu_test { -GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, - GLTestContext *shareContext) { +GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { SkASSERT(!shareContext); if (shareContext) { return nullptr; } - WinGLTestContext *ctx = new WinGLTestContext(forcedGpuAPI); + WinGLContext *ctx = new WinGLContext(forcedGpuAPI); if (!ctx->isValid()) { delete ctx; return nullptr; diff --git a/tools/kilobench/kilobench.cpp b/tools/kilobench/kilobench.cpp index f4c2999b91..81238353e2 100644 --- a/tools/kilobench/kilobench.cpp +++ b/tools/kilobench/kilobench.cpp @@ -218,10 +218,10 @@ struct GPUTarget { return true; } - GLTestContext* gl() { return fGL; } + GLContext* gl() { return fGL; } private: - GLTestContext* fGL; + GLContext* fGL; SkAutoTDelete fSurface; }; @@ -282,7 +282,7 @@ static int clamp_loops(int loops) { static double now_ms() { return SkTime::GetNSecs() * 1e-6; } struct TimingThread { - TimingThread(GLTestContext* mainContext) + TimingThread(GLContext* 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(CreatePlatformGLTestContext(kNone_GrGLStandard, - fMainContext)); + SkAutoTDelete glContext(CreatePlatformGLContext(kNone_GrGLStandard, + fMainContext)); glContext->makeCurrent(); // Basic timing methodology is: @@ -405,7 +405,7 @@ private: SyncQueue fFrameEndSyncs; SkTArray fTimings; SkMutex fDoneMutex; - GLTestContext* fMainContext; + GLContext* fMainContext; bool fDone; }; diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp index 225ca398df..d9e1bdaa33 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; - GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextType, + GLContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextType, GrContextFactory::kNone_GLContextOptions).fGLContext; gl->makeCurrent(); #endif