aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/GrContextFactory.h
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2017-02-21 12:36:05 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-21 21:45:45 +0000
commite812d496aaa5e5e9f2117de8f442c297c9cb1367 (patch)
tree7342c7c6e048e3a226e162d7d1bcbf6ffbcddc55 /tools/gpu/GrContextFactory.h
parente026511f4c4b90bfe842f89966d088b663fc8c13 (diff)
Rename GrContextFactory::ContextOptions to ContextOverrides
Also changes the behavior of these flags to only override their corresponding context options when set, and to leave them unchanged when not set. BUG=skia: Change-Id: I09f6be09997594fa888d9045dd4901354ef3f880 Reviewed-on: https://skia-review.googlesource.com/8780 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'tools/gpu/GrContextFactory.h')
-rw-r--r--tools/gpu/GrContextFactory.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h
index a232112d75..48b250d0ea 100644
--- a/tools/gpu/GrContextFactory.h
+++ b/tools/gpu/GrContextFactory.h
@@ -89,15 +89,17 @@ public:
static const int kContextTypeCnt = kLastContextType + 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.
+ * Overrides for the initial GrContextOptions provided at construction time, and required
+ * features that will cause context creation to fail if not present.
*/
- enum class ContextOptions {
- kNone = 0x0,
- kEnableNVPR = 0x1,
- kUseInstanced = 0x2,
- kRequireSRGBSupport = 0x4,
- kRequireSRGBDecodeDisableSupport = 0x8,
+ enum class ContextOverrides {
+ kNone = 0x0,
+ kDisableNVPR = 0x1,
+ kUseInstanced = 0x2,
+ kAllowSRGBWithoutDecodeControl = 0x4,
+
+ kRequireNVPRSupport = 0x8,
+ kRequireSRGBSupport = 0x10
};
static ContextType NativeContextTypeForBackend(GrBackend backend) {
@@ -144,23 +146,23 @@ public:
* Get a context initialized with a type of GL context. It also makes the GL context current.
*/
ContextInfo getContextInfo(ContextType type,
- ContextOptions options = ContextOptions::kNone);
+ ContextOverrides overrides = ContextOverrides::kNone);
/**
* Get a GrContext initialized with a type of GL context. It also makes the GL context current.
*/
- GrContext* get(ContextType type, ContextOptions options = ContextOptions::kNone) {
- return this->getContextInfo(type, options).grContext();
+ GrContext* get(ContextType type, ContextOverrides overrides = ContextOverrides::kNone) {
+ return this->getContextInfo(type, overrides).grContext();
}
const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; }
private:
struct Context {
- ContextType fType;
- ContextOptions fOptions;
- GrBackend fBackend;
- TestContext* fTestContext;
- GrContext* fGrContext;
- bool fAbandoned;
+ ContextType fType;
+ ContextOverrides fOverrides;
+ GrBackend fBackend;
+ TestContext* fTestContext;
+ GrContext* fGrContext;
+ bool fAbandoned;
};
SkTArray<Context, true> fContexts;
std::unique_ptr<GLTestContext> fSentinelGLContext;
@@ -168,6 +170,6 @@ private:
};
} // namespace sk_gpu_test
-GR_MAKE_BITFIELD_CLASS_OPS(sk_gpu_test::GrContextFactory::ContextOptions);
+GR_MAKE_BITFIELD_CLASS_OPS(sk_gpu_test::GrContextFactory::ContextOverrides);
#endif