From 85b4b53e78dcdeae2a51935ca5e214b0f1a06492 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Tue, 5 Apr 2016 11:06:27 -0700 Subject: Rename enums in GrContextFactory to remove "GL" Also, remove kNative as a separate context type and instead make it an alias for kGL or kGLES based on OS. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1845923004 Committed: https://skia.googlesource.com/skia/+/2d9c6f81353597aebf5934547e5cba7a872196fb Review URL: https://codereview.chromium.org/1845923004 --- tools/gpu/GrContextFactory.cpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'tools/gpu/GrContextFactory.cpp') diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp index c232121332..18fbef8113 100755 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -74,8 +74,16 @@ void GrContextFactory::releaseResourcesAndAbandonContexts() { } } -GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType type, - GLContextOptions options) { +#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC) +const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType = + GrContextFactory::kGL_ContextType; +#else +const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType = + GrContextFactory::kGLES_ContextType; +#endif + +GrContextFactory::ContextInfo GrContextFactory::getContextInfo(ContextType type, + ContextOptions options) { for (int i = 0; i < fContexts.count(); ++i) { Context& context = fContexts[i]; if (!context.fGLContext) { @@ -90,39 +98,36 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ SkAutoTDelete glCtx; SkAutoTUnref grCtx; switch (type) { - case kNative_GLContextType: - glCtx.reset(CreatePlatformGLTestContext(kNone_GrGLStandard)); - break; - case kGL_GLContextType: + case kGL_ContextType: glCtx.reset(CreatePlatformGLTestContext(kGL_GrGLStandard)); break; - case kGLES_GLContextType: + case kGLES_ContextType: glCtx.reset(CreatePlatformGLTestContext(kGLES_GrGLStandard)); break; #if SK_ANGLE #ifdef SK_BUILD_FOR_WIN - case kANGLE_GLContextType: + case kANGLE_ContextType: glCtx.reset(CreateANGLEDirect3DGLTestContext()); break; #endif - case kANGLE_GL_GLContextType: + case kANGLE_GL_ContextType: glCtx.reset(CreateANGLEOpenGLGLTestContext()); break; #endif #if SK_COMMAND_BUFFER - case kCommandBuffer_GLContextType: + case kCommandBuffer_ContextType: glCtx.reset(CommandBufferGLTestContext::Create()); break; #endif #if SK_MESA - case kMESA_GLContextType: + case kMESA_ContextType: glCtx.reset(CreateMesaGLTestContext()); break; #endif - case kNull_GLContextType: + case kNullGL_ContextType: glCtx.reset(CreateNullGLTestContext()); break; - case kDebug_GLContextType: + case kDebugGL_ContextType: glCtx.reset(CreateDebugGLTestContext()); break; } @@ -134,7 +139,7 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ // Block NVPR from non-NVPR types. SkAutoTUnref glInterface(SkRef(glCtx->gl())); - if (!(kEnableNVPR_GLContextOptions & options)) { + if (!(kEnableNVPR_ContextOptions & options)) { glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); if (!glInterface) { return ContextInfo(); @@ -143,7 +148,7 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ glCtx->makeCurrent(); #ifdef SK_VULKAN - if (kEnableNVPR_GLContextOptions & options) { + if (kEnableNVPR_ContextOptions & options) { return ContextInfo(); } else { GrBackendContext p3dctx = reinterpret_cast(GrVkBackendContext::Create()); @@ -156,12 +161,12 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ if (!grCtx.get()) { return ContextInfo(); } - if (kEnableNVPR_GLContextOptions & options) { + if (kEnableNVPR_ContextOptions & options) { if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { return ContextInfo(); } } - if (kRequireSRGBSupport_GLContextOptions & options) { + if (kRequireSRGBSupport_ContextOptions & options) { if (!grCtx->caps()->srgbSupport()) { return ContextInfo(); } -- cgit v1.2.3