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
This commit is contained in:
bsalomon 2016-03-31 10:22:40 -07:00 committed by Commit bot
parent 062bd86033
commit 3e4616ff10
32 changed files with 206 additions and 212 deletions

View File

@ -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<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) { }
GLTestContext* gl;
GLContext* gl;
void setup() override {
this->gl->makeCurrent();

View File

@ -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<typename T>
void call_test(T test, skiatest::Reporter* reporter, const GrContextFactory::ContextInfo& context);

View File

@ -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;

View File

@ -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<GLTestContext> glCtx1 = glCtx0->createNew();
SkAutoTDelete<GLContext> glCtx1 = glCtx0->createNew();
if (!glCtx1) {
return;
}

View File

@ -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[]) {

View File

@ -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__)

View File

@ -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);

View File

@ -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"

View File

@ -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));
}

View File

@ -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;

View File

@ -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);

View File

@ -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<GLTestContext> glCtx;
SkAutoTDelete<GLContext> glCtx;
SkAutoTUnref<GrContext> 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()) {

View File

@ -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<Context, true> fContexts;

View File

@ -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<GLFenceSync> 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<GLsync>(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<GLsync>(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)) &&

View File

@ -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

View File

@ -6,7 +6,7 @@
* found in the LICENSE file.
*/
#include "GLTestContext_angle.h"
#include "GLContext_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::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;

View File

@ -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

View File

@ -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<EGLConfig>(fConfig), EGL_STENCIL_SIZE, &result);
return result;
}
int CommandBufferGLTestContext::getSampleCount() {
int CommandBufferGLContext::getSampleCount() {
EGLint result = 0;
gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_SAMPLES, &result);
return result;

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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 <GLES2/gl2.h>
#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<EGLSyncKHR>(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<EGLSyncKHR>(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;

View File

@ -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 <X11/Xlib.h>
#include <GL/glx.h>
@ -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<const GLubyte*>(procName));
}
} // anonymous namespace
namespace sk_gpu_test {
GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI,
GLTestContext *shareContext) {
GLXGLTestContext *glxShareContext = reinterpret_cast<GLXGLTestContext *>(shareContext);
GLXGLTestContext *ctx = new GLXGLTestContext(forcedGpuAPI, glxShareContext);
GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) {
GLXGLContext *glxShareContext = reinterpret_cast<GLXGLContext *>(shareContext);
GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext);
if (!ctx->isValid()) {
delete ctx;
return nullptr;

View File

@ -6,7 +6,7 @@
* found in the LICENSE file.
*/
#include "GLTestContext.h"
#include "GLContext.h"
#import <OpenGLES/EAGL.h>
#include <dlfcn.h>
@ -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<GrGLFuncPtr>(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;

View File

@ -7,17 +7,17 @@
*/
#include "SkTypes.h"
#include "gl/GLTestContext.h"
#include "gl/GLContext.h"
#include "AvailabilityMacros.h"
#include <OpenGL/OpenGL.h>
#include <dlfcn.h>
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<GrGLFuncPtr>(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;

View File

@ -8,7 +8,7 @@
#include <GL/osmesa.h>
#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;

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -6,7 +6,7 @@
* found in the LICENSE file.
*/
#include "gl/GLTestContext.h"
#include "gl/GLContext.h"
#include <windows.h>
#include <GL/GL.h>
@ -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<GrGLFuncPtr>(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;

View File

@ -218,10 +218,10 @@ struct GPUTarget {
return true;
}
GLTestContext* gl() { return fGL; }
GLContext* gl() { return fGL; }
private:
GLTestContext* fGL;
GLContext* 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(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<GLTestContext> glContext(CreatePlatformGLTestContext(kNone_GrGLStandard,
fMainContext));
SkAutoTDelete<GLContext> glContext(CreatePlatformGLContext(kNone_GrGLStandard,
fMainContext));
glContext->makeCurrent();
// Basic timing methodology is:
@ -405,7 +405,7 @@ private:
SyncQueue fFrameEndSyncs;
SkTArray<double> fTimings;
SkMutex fDoneMutex;
GLTestContext* fMainContext;
GLContext* fMainContext;
bool fDone;
};

View File

@ -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