diff options
author | 2016-09-13 10:41:49 -0700 | |
---|---|---|
committer | 2016-09-13 10:41:50 -0700 | |
commit | 6270e558c31b75d02db6f598e93f2e3b701ccb7f (patch) | |
tree | 9c330b8761f62ef031f0913aaba00e74b2c91ea3 /tools/gpu/GrContextFactory.cpp | |
parent | 37283c28aa5bea2204c18956e74f83b238d7a891 (diff) |
Add ContextOptions field to SkCommandLineConfigGpu
Reduces duplicate code by computing the ContextOptions in one spot.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2337163002
Review-Url: https://codereview.chromium.org/2337163002
Diffstat (limited to 'tools/gpu/GrContextFactory.cpp')
-rw-r--r-- | tools/gpu/GrContextFactory.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp index 2407da930a..c40764b109 100644 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -31,7 +31,7 @@ GrContextFactory::GrContextFactory() { } GrContextFactory::GrContextFactory(const GrContextOptions& opts) : fGlobalOptions(opts) { - // In this factory, instanced rendering is specified with kUseInstanced_ContextOptions. + // In this factory, instanced rendering is specified with ContextOptions::kUseInstanced. SkASSERT(!fGlobalOptions.fEnableInstancedRendering); } @@ -139,7 +139,7 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op break; #endif case kNullGL_ContextType: - glCtx = CreateNullGLTestContext(kEnableNVPR_ContextOptions & options); + glCtx = CreateNullGLTestContext(ContextOptions::kEnableNVPR & options); break; case kDebugGL_ContextType: glCtx = CreateDebugGLTestContext(); @@ -154,7 +154,7 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op glInterface.reset(SkRef(glCtx->gl())); // Block NVPR from non-NVPR types. We don't block NVPR from contexts that will use // instanced rendering because that would prevent us from testing mixed samples. - if (!((kEnableNVPR_ContextOptions | kUseInstanced_ContextOptions) & options)) { + if (!((ContextOptions::kEnableNVPR | ContextOptions::kUseInstanced) & options)) { glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface.get())); if (!glInterface) { return ContextInfo(); @@ -166,7 +166,7 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op #ifdef SK_VULKAN case kVulkan_GrBackend: SkASSERT(kVulkan_ContextType == type); - if (kEnableNVPR_ContextOptions & options) { + if (ContextOptions::kEnableNVPR & options) { return ContextInfo(); } testCtx.reset(CreatePlatformVkTestContext()); @@ -192,24 +192,24 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op testCtx->makeCurrent(); SkASSERT(testCtx && testCtx->backend() == backend); GrContextOptions grOptions = fGlobalOptions; - if (kUseInstanced_ContextOptions & options) { + if (ContextOptions::kUseInstanced & options) { grOptions.fEnableInstancedRendering = true; } grCtx.reset(GrContext::Create(backend, backendContext, grOptions)); if (!grCtx.get()) { return ContextInfo(); } - if (kEnableNVPR_ContextOptions & options) { + if (ContextOptions::kEnableNVPR & options) { if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { return ContextInfo(); } } - if (kUseInstanced_ContextOptions & options) { + if (ContextOptions::kUseInstanced & options) { if (GrCaps::InstancedSupport::kNone == grCtx->caps()->instancedSupport()) { return ContextInfo(); } } - if (kRequireSRGBSupport_ContextOptions & options) { + if (ContextOptions::kRequireSRGBSupport & options) { if (!grCtx->caps()->srgbSupport()) { return ContextInfo(); } |