Chromium Code Reviews| Index: src/gpu/GrContextFactory.cpp |
| diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp |
| index 424b3fda3a86b6047ee45d4fbe94ca056b86a3ff..75b15a716019f31677917fa97229b314007ab86e 100755 |
| --- a/src/gpu/GrContextFactory.cpp |
| +++ b/src/gpu/GrContextFactory.cpp |
| @@ -24,21 +24,21 @@ |
| #include "GrCaps.h" |
| GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType type, |
| - GrGLStandard forcedGpuAPI) { |
| + GrGLStandard forcedGpuAPI, |
| + GLContextOptions options) { |
| for (int i = 0; i < fContexts.count(); ++i) { |
| - if (forcedGpuAPI != kNone_GrGLStandard && |
| - forcedGpuAPI != fContexts[i]->fGLContext->gl()->fStandard) |
| - continue; |
| - |
| - if (fContexts[i]->fType == type) { |
| + if (fContexts[i]->fType == type && |
| + fContexts[i]->fOptions == options && |
| + (forcedGpuAPI == kNone_GrGLStandard || |
| + forcedGpuAPI == fContexts[i]->fGLContext->gl()->fStandard)) { |
| fContexts[i]->fGLContext->makeCurrent(); |
| return fContexts[i]; |
| } |
| } |
| + |
| SkAutoTUnref<SkGLContext> glCtx; |
| SkAutoTUnref<GrContext> grCtx; |
| switch (type) { |
| - case kNVPR_GLContextType: // fallthru |
| case kNative_GLContextType: |
| glCtx.reset(SkCreatePlatformGLContext(forcedGpuAPI)); |
| break; |
| @@ -75,15 +75,11 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty |
| // Block NVPR from non-NVPR types. |
| SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl())); |
| - if (kNVPR_GLContextType != type) { |
| + if (!(kEnableNVPR_GLContextOptions & options)) { |
| glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); |
| if (!glInterface) { |
| return nullptr; |
| } |
| - } else { |
| - if (!glInterface->hasExtension("GL_NV_path_rendering")) { |
| - return nullptr; |
| - } |
| } |
| glCtx->makeCurrent(); |
| @@ -96,22 +92,10 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty |
| if (!grCtx.get()) { |
| return nullptr; |
| } |
| - // Warn if path rendering support is not available for the NVPR type. |
| - if (kNVPR_GLContextType == type) { |
| + |
| + if (kEnableNVPR_GLContextOptions & options) { |
| if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { |
| - GrGpu* gpu = grCtx->getGpu(); |
|
Kimmo Kinnunen
2015/12/02 14:03:57
IIRC this hunk was interesting when NVPR was run b
bsalomon
2015/12/02 14:30:28
Does DM really fail or does it just print that it
|
| - const GrGLContext* ctx = gpu->glContextForTesting(); |
| - if (ctx) { |
| - const GrGLubyte* verUByte; |
| - GR_GL_CALL_RET(ctx->interface(), verUByte, GetString(GR_GL_VERSION)); |
| - const char* ver = reinterpret_cast<const char*>(verUByte); |
| - SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering " |
| - "support not available. Maybe update the driver? Your driver version " |
| - "string: \"%s\"\n", ver); |
| - } else { |
| - SkDebugf("\nWARNING: nvprmsaa config requested, but driver path rendering " |
| - "support not available.\n"); |
| - } |
| + return nullptr; |
| } |
| } |
| @@ -119,5 +103,6 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty |
| ctx->fGLContext = SkRef(glCtx.get()); |
| ctx->fGrContext = SkRef(grCtx.get()); |
| ctx->fType = type; |
| + ctx->fOptions = options; |
| return ctx; |
| } |