Index: tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp |
diff --git a/tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp |
similarity index 83% |
rename from tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp |
rename to tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp |
index ac2e7ca7cf63716efcee9fe1a9b090e98c7932bc..ae61b337d9695f57f21022a8262adea5f90a8978 100644 |
--- a/tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp |
+++ b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp |
@@ -5,8 +5,9 @@ |
* Use of this source code is governed by a BSD-style license that can be |
* found in the LICENSE file. |
*/ |
-#include "gl/GLContext.h" |
+#include "gl/GLTestContext.h" |
+#define GL_GLEXT_PROTOTYPES |
#include <GLES2/gl2.h> |
#define EGL_EGLEXT_PROTOTYPES |
@@ -19,31 +20,31 @@ |
namespace { |
// TODO: Share this class with ANGLE if/when it gets support for EGL_KHR_fence_sync. |
-class SkEGLFenceSync : public SkGpuFenceSync { |
+class EGLFenceSync : public SkGpuFenceSync { |
public: |
- static SkEGLFenceSync* CreateIfSupported(EGLDisplay); |
+ static EGLFenceSync* CreateIfSupported(EGLDisplay); |
SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override; |
bool waitFence(SkPlatformGpuFence fence, bool flush) const override; |
void deleteFence(SkPlatformGpuFence fence) const override; |
private: |
- SkEGLFenceSync(EGLDisplay display) : fDisplay(display) {} |
+ EGLFenceSync(EGLDisplay display) : fDisplay(display) {} |
EGLDisplay fDisplay; |
typedef SkGpuFenceSync INHERITED; |
}; |
-class EGLGLContext : public sk_gpu_test::GLContext { |
+class EGLGLTestContext : public sk_gpu_test::GLTestContext { |
public: |
- EGLGLContext(GrGLStandard forcedGpuAPI); |
- ~EGLGLContext() override; |
+ EGLGLTestContext(GrGLStandard forcedGpuAPI); |
+ ~EGLGLTestContext() override; |
GrEGLImage texture2DToEGLImage(GrGLuint texID) const override; |
void destroyEGLImage(GrEGLImage) const override; |
GrGLuint eglImageToExternalTexture(GrEGLImage) const override; |
- sk_gpu_test::GLContext* createNew() const override; |
+ sk_gpu_test::GLTestContext* createNew() const override; |
private: |
void destroyGLContext(); |
@@ -57,7 +58,7 @@ private: |
EGLSurface fSurface; |
}; |
-EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI) |
+EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI) |
: fContext(EGL_NO_CONTEXT) |
, fDisplay(EGL_NO_DISPLAY) |
, fSurface(EGL_NO_SURFACE) { |
@@ -179,17 +180,17 @@ EGLGLContext::EGLGLContext(GrGLStandard forcedGpuAPI) |
continue; |
} |
- this->init(gl.release(), SkEGLFenceSync::CreateIfSupported(fDisplay)); |
+ this->init(gl.release(), EGLFenceSync::CreateIfSupported(fDisplay)); |
break; |
} |
} |
-EGLGLContext::~EGLGLContext() { |
+EGLGLTestContext::~EGLGLTestContext() { |
this->teardown(); |
this->destroyGLContext(); |
} |
-void EGLGLContext::destroyGLContext() { |
+void EGLGLTestContext::destroyGLContext() { |
if (fDisplay) { |
eglMakeCurrent(fDisplay, 0, 0, 0); |
@@ -208,7 +209,7 @@ void EGLGLContext::destroyGLContext() { |
} |
} |
-GrEGLImage EGLGLContext::texture2DToEGLImage(GrGLuint texID) const { |
+GrEGLImage EGLGLTestContext::texture2DToEGLImage(GrGLuint texID) const { |
if (!this->gl()->hasExtension("EGL_KHR_gl_texture_2D_image")) { |
return GR_EGL_NO_IMAGE; |
} |
@@ -220,11 +221,11 @@ GrEGLImage EGLGLContext::texture2DToEGLImage(GrGLuint texID) const { |
return img; |
} |
-void EGLGLContext::destroyEGLImage(GrEGLImage image) const { |
+void EGLGLTestContext::destroyEGLImage(GrEGLImage image) const { |
GR_GL_CALL(this->gl(), EGLDestroyImage(fDisplay, image)); |
} |
-GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const { |
+GrGLuint EGLGLTestContext::eglImageToExternalTexture(GrEGLImage image) const { |
GrGLClearErr(this->gl()); |
if (!this->gl()->hasExtension("GL_OES_EGL_image_external")) { |
return 0; |
@@ -254,27 +255,27 @@ GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const { |
return texID; |
} |
-sk_gpu_test::GLContext* EGLGLContext::createNew() const { |
- sk_gpu_test::GLContext* ctx = new EGLGLContext(this->gl()->fStandard); |
+sk_gpu_test::GLTestContext* EGLGLTestContext::createNew() const { |
+ sk_gpu_test::GLTestContext* ctx = new EGLGLTestContext(this->gl()->fStandard); |
if (ctx) { |
ctx->makeCurrent(); |
} |
return ctx; |
} |
-void EGLGLContext::onPlatformMakeCurrent() const { |
+void EGLGLTestContext::onPlatformMakeCurrent() const { |
if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { |
SkDebugf("Could not set the context.\n"); |
} |
} |
-void EGLGLContext::onPlatformSwapBuffers() const { |
+void EGLGLTestContext::onPlatformSwapBuffers() const { |
if (!eglSwapBuffers(fDisplay, fSurface)) { |
SkDebugf("Could not complete eglSwapBuffers.\n"); |
} |
} |
-GrGLFuncPtr EGLGLContext::onPlatformGetProcAddress(const char* procName) const { |
+GrGLFuncPtr EGLGLTestContext::onPlatformGetProcAddress(const char* procName) const { |
return eglGetProcAddress(procName); |
} |
@@ -293,18 +294,18 @@ static bool supports_egl_extension(EGLDisplay display, const char* extension) { |
return false; |
} |
-SkEGLFenceSync* SkEGLFenceSync::CreateIfSupported(EGLDisplay display) { |
+EGLFenceSync* EGLFenceSync::CreateIfSupported(EGLDisplay display) { |
if (!display || !supports_egl_extension(display, "EGL_KHR_fence_sync")) { |
return nullptr; |
} |
- return new SkEGLFenceSync(display); |
+ return new EGLFenceSync(display); |
} |
-SkPlatformGpuFence SkEGLFenceSync::insertFence() const { |
+SkPlatformGpuFence EGLFenceSync::insertFence() const { |
return eglCreateSyncKHR(fDisplay, EGL_SYNC_FENCE_KHR, nullptr); |
} |
-bool SkEGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const { |
+bool EGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) const { |
EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); |
return EGL_CONDITION_SATISFIED_KHR == |
eglClientWaitSyncKHR(fDisplay, |
@@ -313,7 +314,7 @@ bool SkEGLFenceSync::waitFence(SkPlatformGpuFence platformFence, bool flush) con |
EGL_FOREVER_KHR); |
} |
-void SkEGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { |
+void EGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { |
EGLSyncKHR eglsync = static_cast<EGLSyncKHR>(platformFence); |
eglDestroySyncKHR(fDisplay, eglsync); |
} |
@@ -321,12 +322,13 @@ void SkEGLFenceSync::deleteFence(SkPlatformGpuFence platformFence) const { |
} // anonymous namespace |
namespace sk_gpu_test { |
-GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareContext) { |
+GLTestContext *CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, |
+ GLTestContext *shareContext) { |
SkASSERT(!shareContext); |
if (shareContext) { |
return nullptr; |
} |
- EGLGLContext *ctx = new EGLGLContext(forcedGpuAPI); |
+ EGLGLTestContext *ctx = new EGLGLTestContext(forcedGpuAPI); |
if (!ctx->isValid()) { |
delete ctx; |
return nullptr; |