Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: include/gpu/GrContextFactory.h

Issue 144003006: Turn NVPR on by default (but off in tools). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/gpu/GrContextFactory.h
diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h
index 389c398c7c5720166c493503879d9e34ce687b93..d56d74d272539d880b95c8e1717086eec9c9344b 100644
--- a/include/gpu/GrContextFactory.h
+++ b/include/gpu/GrContextFactory.h
@@ -26,14 +26,19 @@
* GrContexts backed by different types of GL contexts. It manages creating the
* GL context and a GrContext that uses it. The GL/Gr contexts persist until the
* factory is destroyed (though the caller can always grab a ref on the returned
- * GrContext to make it outlive the factory).
+ * Gr and GL contexts to make them outlive the factory).
*/
class GrContextFactory : public SkNoncopyable {
public:
/**
- * Types of GL contexts supported.
+ * 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 {
robertphillips 2014/01/22 20:12:06 remove this comment since it appears above?
bsalomon 2014/01/23 16:16:09 oops, done
+ // For historical and testing reasons the native context will not expose GL_NV_path_rendering
+ // even when the driver does. There is a a
kNative_GLContextType,
#if SK_ANGLE
kANGLE_GLContextType,
@@ -41,6 +46,9 @@ public:
#if SK_MESA
kMESA_GLContextType,
#endif
robertphillips 2014/01/22 20:12:06 no,t?
bsalomon 2014/01/23 16:16:09 Done.
+ /** Similar to kNative but does no,t filter NVPR. It will fail if the GL driver does not
+ support NVPR */
+ kNVPR_GLContextType,
kNull_GLContextType,
kDebug_GLContextType,
@@ -73,6 +81,8 @@ public:
case kMESA_GLContextType:
return "mesa";
#endif
+ case kNVPR_GLContextType:
+ return "nvpr";
case kDebug_GLContextType:
return "debug";
default:
@@ -107,6 +117,7 @@ public:
SkAutoTUnref<SkGLContextHelper> glCtx;
SkAutoTUnref<GrContext> grCtx;
switch (type) {
+ case kNVPR_GLContextType: // fallthru
case kNative_GLContextType:
glCtx.reset(SkNEW(SkNativeGLContext));
break;
@@ -134,7 +145,21 @@ public:
if (!glCtx.get()->init(kBogusSize, kBogusSize)) {
return NULL;
}
- GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glCtx.get()->gl());
+
+ // Ensure NVPR is available for the NVPR type and block it from other types.
+ SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx.get()->gl()));
+ if (kNVPR_GLContextType == type) {
+ if (!glInterface->hasExtension("GL_NV_path_rendering")) {
+ return NULL;
+ }
+ } else {
+ glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface));
+ if (!glInterface) {
+ return NULL;
+ }
+ }
+
+ GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get());
grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx));
if (!grCtx.get()) {
return NULL;
« no previous file with comments | « gyp/gpu.gyp ('k') | include/gpu/gl/GrGLConfig.h » ('j') | src/gpu/gl/GrGLExtensions.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698