Index: tools/gpu/GrContextFactory.cpp |
diff --git a/src/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp |
similarity index 79% |
rename from src/gpu/GrContextFactory.cpp |
rename to tools/gpu/GrContextFactory.cpp |
index 465c91076448d902128fde8c2f50f727c4c0e3b8..cb23014ad059a9907a292d10432fe524e462236a 100755 |
--- a/src/gpu/GrContextFactory.cpp |
+++ b/tools/gpu/GrContextFactory.cpp |
@@ -1,3 +1,4 @@ |
+ |
/* |
* Copyright 2014 Google Inc. |
* |
@@ -6,25 +7,23 @@ |
*/ |
#include "GrContextFactory.h" |
+#include "gl/GLContext.h" |
#if SK_ANGLE |
- #include "gl/angle/SkANGLEGLContext.h" |
+ #include "gl/angle/GLContext_angle.h" |
#endif |
#if SK_COMMAND_BUFFER |
- #include "gl/command_buffer/SkCommandBufferGLContext.h" |
+ #include "gl/command_buffer/GLContext_command_buffer.h" |
#endif |
-#include "gl/debug/SkDebugGLContext.h" |
+#include "gl/debug/DebugGLContext.h" |
#if SK_MESA |
- #include "gl/mesa/SkMesaGLContext.h" |
-#endif |
-#if SK_VULKAN |
-#include "vk/GrVkBackendContext.h" |
+ #include "gl/mesa/GLContext_mesa.h" |
#endif |
-#include "gl/SkGLContext.h" |
-#include "gl/SkNullGLContext.h" |
+#include "gl/null/NullGLContext.h" |
#include "gl/GrGLGpu.h" |
#include "GrCaps.h" |
+namespace sk_gpu_test { |
GrContextFactory::GrContextFactory() { } |
GrContextFactory::GrContextFactory(const GrContextOptions& opts) |
@@ -74,43 +73,43 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ |
return ContextInfo(context.fGrContext, context.fGLContext); |
} |
} |
- SkAutoTDelete<SkGLContext> glCtx; |
+ SkAutoTDelete<GLContext> glCtx; |
SkAutoTUnref<GrContext> grCtx; |
switch (type) { |
case kNative_GLContextType: |
- glCtx.reset(SkCreatePlatformGLContext(kNone_GrGLStandard)); |
+ glCtx.reset(CreatePlatformGLContext(kNone_GrGLStandard)); |
break; |
case kGL_GLContextType: |
- glCtx.reset(SkCreatePlatformGLContext(kGL_GrGLStandard)); |
+ glCtx.reset(CreatePlatformGLContext(kGL_GrGLStandard)); |
break; |
case kGLES_GLContextType: |
- glCtx.reset(SkCreatePlatformGLContext(kGLES_GrGLStandard)); |
+ glCtx.reset(CreatePlatformGLContext(kGLES_GrGLStandard)); |
break; |
#if SK_ANGLE |
#ifdef SK_BUILD_FOR_WIN |
case kANGLE_GLContextType: |
- glCtx.reset(SkANGLEGLContext::CreateDirectX()); |
+ glCtx.reset(CreateANGLEDirect3DGLContext()); |
break; |
#endif |
case kANGLE_GL_GLContextType: |
- glCtx.reset(SkANGLEGLContext::CreateOpenGL()); |
+ glCtx.reset(CreateANGLEOpenGLGLContext()); |
break; |
#endif |
#if SK_COMMAND_BUFFER |
case kCommandBuffer_GLContextType: |
- glCtx.reset(SkCommandBufferGLContext::Create()); |
+ glCtx.reset(CommandBufferGLContext::Create()); |
break; |
#endif |
#if SK_MESA |
case kMESA_GLContextType: |
- glCtx.reset(SkMesaGLContext::Create()); |
+ glCtx.reset(CreateMesaGLContext()); |
break; |
#endif |
case kNull_GLContextType: |
- glCtx.reset(SkNullGLContext::Create()); |
+ glCtx.reset(CreateNullGLContext()); |
break; |
case kDebug_GLContextType: |
- glCtx.reset(SkDebugGLContext::Create()); |
+ glCtx.reset(CreateDebugGLContext()); |
break; |
} |
if (nullptr == glCtx.get()) { |
@@ -129,15 +128,14 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ |
} |
glCtx->makeCurrent(); |
+ GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get()); |
#ifdef SK_VULKAN |
if (kEnableNVPR_GLContextOptions & options) { |
return ContextInfo(); |
} else { |
- GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(GrVkBackendContext::Create()); |
grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions)); |
} |
#else |
- GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get()); |
grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); |
#endif |
if (!grCtx.get()) { |
@@ -161,3 +159,4 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ |
context.fOptions = options; |
return ContextInfo(context.fGrContext, context.fGLContext); |
} |
+} // namespace sk_gpu_test |