diff options
author | csmartdalton <csmartdalton@google.com> | 2017-02-21 12:36:05 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-21 21:45:45 +0000 |
commit | e812d496aaa5e5e9f2117de8f442c297c9cb1367 (patch) | |
tree | 7342c7c6e048e3a226e162d7d1bcbf6ffbcddc55 /tools/flags | |
parent | e026511f4c4b90bfe842f89966d088b663fc8c13 (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/flags')
-rw-r--r-- | tools/flags/SkCommonFlagsConfig.cpp | 21 | ||||
-rw-r--r-- | tools/flags/SkCommonFlagsConfig.h | 14 |
2 files changed, 20 insertions, 15 deletions
diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp index 65ba372d7c..3e5e9b9fff 100644 --- a/tools/flags/SkCommonFlagsConfig.cpp +++ b/tools/flags/SkCommonFlagsConfig.cpp @@ -169,30 +169,31 @@ SkCommandLineConfigGpu::SkCommandLineConfigGpu( sk_sp<SkColorSpace> colorSpace) : SkCommandLineConfig(tag, SkString("gpu"), viaParts) , fContextType(contextType) - , fContextOptions(ContextOptions::kNone) + , fContextOverrides(ContextOverrides::kNone) , fUseDIText(useDIText) , fSamples(samples) , fColorType(colorType) , fColorSpace(std::move(colorSpace)) { if (useNVPR) { - fContextOptions |= ContextOptions::kEnableNVPR; + fContextOverrides |= ContextOverrides::kRequireNVPRSupport; + } else if (!useInstanced) { + // We don't disable NVPR for instanced configs. Otherwise the caps wouldn't use mixed + // samples and we couldn't test the mixed samples backend for simple shapes. + fContextOverrides |= ContextOverrides::kDisableNVPR; } if (useInstanced) { - fContextOptions |= ContextOptions::kUseInstanced; + fContextOverrides |= ContextOverrides::kUseInstanced; } // Subtle logic: If the config has a color space attached, we're going to be rendering to sRGB, // so we need that capability. In addition, to get the widest test coverage, we DO NOT require // that we can disable sRGB decode. (That's for rendering sRGB sources to legacy surfaces). // // If the config doesn't have a color space attached, we're going to be rendering in legacy - // mode. In that case, we can't allow a context to be created that has sRGB support without - // the ability to disable sRGB decode. Otherwise, all of our sRGB source resources will be - // treated as sRGB textures, but we will be unable to prevent the decode, causing them to be - // too dark. + // mode. In that case, we don't require sRGB capability and we defer to the client to decide on + // sRGB decode control. if (fColorSpace) { - fContextOptions |= ContextOptions::kRequireSRGBSupport; - } else { - fContextOptions |= ContextOptions::kRequireSRGBDecodeDisableSupport; + fContextOverrides |= ContextOverrides::kRequireSRGBSupport; + fContextOverrides |= ContextOverrides::kAllowSRGBWithoutDecodeControl; } } static bool parse_option_int(const SkString& value, int* outInt) { diff --git a/tools/flags/SkCommonFlagsConfig.h b/tools/flags/SkCommonFlagsConfig.h index 2b80397a2a..7336fa7971 100644 --- a/tools/flags/SkCommonFlagsConfig.h +++ b/tools/flags/SkCommonFlagsConfig.h @@ -51,15 +51,19 @@ class SkCommandLineConfig { class SkCommandLineConfigGpu : public SkCommandLineConfig { public: typedef sk_gpu_test::GrContextFactory::ContextType ContextType; - typedef sk_gpu_test::GrContextFactory::ContextOptions ContextOptions; + typedef sk_gpu_test::GrContextFactory::ContextOverrides ContextOverrides; SkCommandLineConfigGpu(const SkString& tag, const SkTArray<SkString>& viaParts, ContextType contextType, bool useNVPR, bool useInstanced, bool useDIText, int samples, SkColorType colorType, sk_sp<SkColorSpace> colorSpace); const SkCommandLineConfigGpu* asConfigGpu() const override { return this; } ContextType getContextType() const { return fContextType; } - ContextOptions getContextOptions() const { return fContextOptions; } - bool getUseNVPR() const { return fContextOptions & ContextOptions::kEnableNVPR; } - bool getUseInstanced() const { return fContextOptions & ContextOptions::kUseInstanced; } + ContextOverrides getContextOverrides() const { return fContextOverrides; } + bool getUseNVPR() const { + SkASSERT(!(fContextOverrides & ContextOverrides::kRequireNVPRSupport) || + !(fContextOverrides & ContextOverrides::kDisableNVPR)); + return fContextOverrides & ContextOverrides::kRequireNVPRSupport; + } + bool getUseInstanced() const { return fContextOverrides & ContextOverrides::kUseInstanced; } bool getUseDIText() const { return fUseDIText; } int getSamples() const { return fSamples; } SkColorType getColorType() const { return fColorType; } @@ -67,7 +71,7 @@ class SkCommandLineConfigGpu : public SkCommandLineConfig { private: ContextType fContextType; - ContextOptions fContextOptions; + ContextOverrides fContextOverrides; bool fUseDIText; int fSamples; SkColorType fColorType; |