diff options
author | bsalomon <bsalomon@google.com> | 2015-12-01 07:58:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 07:58:44 -0800 |
commit | a0a024e323ebf73ea4559d4b29f937902703828b (patch) | |
tree | 1750701851ece8ade9a23444a41e23a5e3b4e097 /src | |
parent | cb6cb21cd9d27054810d2c80ef534dcddd615d4b (diff) |
Revert of Make NVPR a GL context option instead of a GL context (patchset #2 id:20001 of https://codereview.chromium.org/1448883002/ )
Reason for revert:
BUG=skia:4609
skbug.com/4609
Seems like GrContextFactory needs to fail when the NVPR option is requested but the driver version isn't sufficiently high.
Original issue's description:
> Make NVPR a GL context option instead of a GL context
>
> Make NVPR a GL context option instead of a GL context.
> This may enable NVPR to be run with command buffer
> interface.
>
> No functionality change in DM or nanobench. NVPR can
> only be run with normal GL APIs.
>
> BUG=skia:2992
>
> Committed: https://skia.googlesource.com/skia/+/eeebdb538d476c1bfc8b63a946094ca1b505ecd1
TBR=mtklein@google.com,jvanverth@google.com,kkinnunen@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:2992
Review URL: https://codereview.chromium.org/1486153002
Diffstat (limited to 'src')
-rwxr-xr-x | src/gpu/GrContextFactory.cpp | 19 | ||||
-rw-r--r-- | src/gpu/GrContextFactory.h | 45 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp index 19382ee112..424b3fda3a 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, - GLContextOptions options) { + GrGLStandard forcedGpuAPI) { for (int i = 0; i < fContexts.count(); ++i) { - if (fContexts[i]->fType == type && - fContexts[i]->fOptions == options && - (forcedGpuAPI == kNone_GrGLStandard || - forcedGpuAPI == fContexts[i]->fGLContext->gl()->fStandard)) { + if (forcedGpuAPI != kNone_GrGLStandard && + forcedGpuAPI != fContexts[i]->fGLContext->gl()->fStandard) + continue; + + if (fContexts[i]->fType == type) { 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,7 +75,7 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty // Block NVPR from non-NVPR types. SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl())); - if (!(kEnableNVPR_GLContextOptions & options)) { + if (kNVPR_GLContextType != type) { glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); if (!glInterface) { return nullptr; @@ -97,7 +97,7 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty return nullptr; } // Warn if path rendering support is not available for the NVPR type. - if (kEnableNVPR_GLContextOptions & options) { + if (kNVPR_GLContextType == type) { if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { GrGpu* gpu = grCtx->getGpu(); const GrGLContext* ctx = gpu->glContextForTesting(); @@ -119,6 +119,5 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty ctx->fGLContext = SkRef(glCtx.get()); ctx->fGrContext = SkRef(grCtx.get()); ctx->fType = type; - ctx->fOptions = options; return ctx; } diff --git a/src/gpu/GrContextFactory.h b/src/gpu/GrContextFactory.h index 3a71d80a0a..c837e74a25 100644 --- a/src/gpu/GrContextFactory.h +++ b/src/gpu/GrContextFactory.h @@ -23,34 +23,35 @@ */ class GrContextFactory : SkNoncopyable { public: + /** + * Types of GL contexts supported. For historical and testing reasons the native GrContext will + * not use "GL_NV_path_rendering" even when the driver supports it. There is a separate context + * type that does not remove NVPR support and which will fail when the driver does not support + * the extension. + */ enum GLContextType { - kNative_GLContextType, + kNative_GLContextType, #if SK_ANGLE - kANGLE_GLContextType, - kANGLE_GL_GLContextType, + kANGLE_GLContextType, + kANGLE_GL_GLContextType, #endif #if SK_COMMAND_BUFFER - kCommandBuffer_GLContextType, + kCommandBuffer_GLContextType, #endif #if SK_MESA - kMESA_GLContextType, + kMESA_GLContextType, #endif - kNull_GLContextType, - kDebug_GLContextType, - kLastGLContextType = kDebug_GLContextType + /** Similar to kNative but does not filter NVPR. It will fail if the GL driver does not + support NVPR */ + kNVPR_GLContextType, + kNull_GLContextType, + kDebug_GLContextType, + + kLastGLContextType = kDebug_GLContextType }; static const int kGLContextTypeCnt = kLastGLContextType + 1; - /** - * Options for GL context creation. For historical and testing reasons the options will default - * to not using GL_NV_path_rendering extension even when the driver supports it. - */ - enum GLContextOptions { - kNone_GLContextOptions = 0, - kEnableNVPR_GLContextOptions = 0x1, - }; - static bool IsRenderingGLContext(GLContextType type) { switch (type) { case kNull_GLContextType: @@ -81,6 +82,8 @@ public: case kMESA_GLContextType: return "mesa"; #endif + case kNVPR_GLContextType: + return "nvpr"; case kDebug_GLContextType: return "debug"; default: @@ -116,7 +119,6 @@ public: struct ContextInfo { GLContextType fType; - GLContextOptions fOptions; SkGLContext* fGLContext; GrContext* fGrContext; }; @@ -124,14 +126,13 @@ public: * Get a context initialized with a type of GL context. It also makes the GL context current. * Pointer is valid until destroyContexts() is called. */ - ContextInfo* getContextInfo(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLStandard, GLContextOptions options = kNone_GLContextOptions); + ContextInfo* getContextInfo(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLStandard); /** * Get a GrContext initialized with a type of GL context. It also makes the GL context current. */ - GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLStandard, - GLContextOptions options = kNone_GLContextOptions) { - if (ContextInfo* info = this->getContextInfo(type, forcedGpuAPI, options)) { + GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLStandard) { + if (ContextInfo* info = this->getContextInfo(type, forcedGpuAPI)) { return info->fGrContext; } return nullptr; |