aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dm/DM.cpp5
-rwxr-xr-xsrc/gpu/GrContextFactory.cpp5
-rw-r--r--src/gpu/GrContextFactory.h1
-rw-r--r--tests/GrContextFactoryTest.cpp23
-rw-r--r--tools/dm_flags.json74
-rwxr-xr-xtools/dm_flags.py3
6 files changed, 108 insertions, 3 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 34f8a961e3..d93cd2977e 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -819,6 +819,11 @@ static Sink* create_sink(const SkCommandLineConfig* config) {
contextOptions = static_cast<GrContextFactory::GLContextOptions>(
contextOptions | GrContextFactory::kEnableNVPR_GLContextOptions);
}
+ if (kSRGB_SkColorProfileType == gpuConfig->getProfileType() ||
+ kRGBA_F16_SkColorType == gpuConfig->getColorType()) {
+ contextOptions = static_cast<GrContextFactory::GLContextOptions>(
+ contextOptions | GrContextFactory::kRequireSRGBSupport_GLContextOptions);
+ }
GrContextFactory testFactory;
if (!testFactory.get(contextType, contextOptions)) {
info("WARNING: can not create GPU context for config '%s'. "
diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp
index 00ae1226e8..465c910764 100755
--- a/src/gpu/GrContextFactory.cpp
+++ b/src/gpu/GrContextFactory.cpp
@@ -148,6 +148,11 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ
return ContextInfo();
}
}
+ if (kRequireSRGBSupport_GLContextOptions & options) {
+ if (!grCtx->caps()->srgbSupport()) {
+ return ContextInfo();
+ }
+ }
Context& context = fContexts.push_back();
context.fGLContext = glCtx.release();
diff --git a/src/gpu/GrContextFactory.h b/src/gpu/GrContextFactory.h
index 7afa3108c6..1bc1e21fbb 100644
--- a/src/gpu/GrContextFactory.h
+++ b/src/gpu/GrContextFactory.h
@@ -53,6 +53,7 @@ public:
enum GLContextOptions {
kNone_GLContextOptions = 0,
kEnableNVPR_GLContextOptions = 0x1,
+ kRequireSRGBSupport_GLContextOptions = 0x2,
};
static bool IsRenderingGLContext(GLContextType type) {
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp
index 7dc02a56e6..800b18cce0 100644
--- a/tests/GrContextFactoryTest.cpp
+++ b/tests/GrContextFactoryTest.cpp
@@ -46,6 +46,29 @@ DEF_GPUTEST(GrContextFactory_NoPathRenderingUnlessNVPRRequested, reporter, /*fac
}
}
+DEF_GPUTEST(GrContextFactory_RequiredSRGBSupport, reporter, /*factory*/) {
+ // Test that if sRGB support is requested, the context always has that capability
+ // or the context creation fails. Also test that if the creation fails, a context
+ // created without that flag would not have had sRGB support.
+ GrContextFactory testFactory;
+ // Test that if sRGB is requested, caps are in sync.
+ for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
+ GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory::GLContextType>(i);
+ GrContext* context =
+ testFactory.get(glCtxType,
+ GrContextFactory::kRequireSRGBSupport_GLContextOptions);
+
+ if (context) {
+ REPORTER_ASSERT(reporter, context->caps()->srgbSupport());
+ } else {
+ context = testFactory.get(glCtxType);
+ if (context) {
+ REPORTER_ASSERT(reporter, !context->caps()->srgbSupport());
+ }
+ }
+ }
+}
+
DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) {
GrContextFactory testFactory;
for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
diff --git a/tools/dm_flags.json b/tools/dm_flags.json
index df8068831b..1931176198 100644
--- a/tools/dm_flags.json
+++ b/tools/dm_flags.json
@@ -4,6 +4,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"pdf",
"pdf_poppler",
"serialize-8888",
@@ -26,6 +27,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"gpu",
"skp",
"_",
@@ -260,6 +265,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"msaa4",
"serialize-8888",
"tiles_rt-8888",
@@ -281,6 +287,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -565,6 +575,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"msaa4",
"serialize-8888",
"tiles_rt-8888",
@@ -589,6 +600,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -873,6 +888,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",
@@ -895,6 +911,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -1183,6 +1203,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",
@@ -1203,6 +1224,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -1485,7 +1510,8 @@
"565",
"8888",
"gpu",
- "nvprmsaa4",
+ "gpusrgb",
+ "nvprdit4",
"msaa4",
"serialize-8888",
"tiles_rt-8888",
@@ -1507,6 +1533,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -1790,6 +1820,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"--src",
"tests",
"gm",
@@ -1807,6 +1838,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -2000,6 +2035,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"msaa16",
"pdf",
"pdf_poppler",
@@ -2023,6 +2059,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"_",
"image",
"gen_platf",
@@ -2341,6 +2381,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"msaa16",
"pdf",
"pdf_poppler",
@@ -2364,6 +2405,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"_",
"image",
"gen_platf",
@@ -2586,6 +2631,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"f16",
"srgb",
"sp-8888",
@@ -2613,6 +2659,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -2806,6 +2856,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"f16",
"srgb",
"sp-8888",
@@ -2833,6 +2884,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"serialize-8888",
"gm",
"_",
@@ -3023,6 +3078,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"f16",
"srgb",
"sp-8888",
@@ -3050,6 +3106,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"pdf",
"gm",
"_",
@@ -3262,7 +3322,8 @@
"565",
"8888",
"gpu",
- "nvprmsaa16",
+ "gpusrgb",
+ "nvprdit16",
"msaa16",
"pdf",
"pdf_poppler",
@@ -3286,6 +3347,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"pdf",
"gm",
"_",
@@ -3592,6 +3657,7 @@
"565",
"8888",
"gpu",
+ "gpusrgb",
"msaa16",
"pdf",
"pdf_poppler",
@@ -3616,6 +3682,10 @@
"image",
"_",
"_",
+ "gpusrgb",
+ "image",
+ "_",
+ "_",
"msaa16",
"gm",
"_",
diff --git a/tools/dm_flags.py b/tools/dm_flags.py
index ba31ac6772..0296c3a5aa 100755
--- a/tools/dm_flags.py
+++ b/tools/dm_flags.py
@@ -34,7 +34,7 @@ def get_args(bot):
if '-x86-' in bot and not 'NexusPlayer' in bot:
args.extend('--threads 4'.split(' '))
- configs = ['565', '8888', 'gpu']
+ configs = ['565', '8888', 'gpu', 'gpusrgb']
if '-GCE-' in bot:
configs.extend(['f16', 'srgb']) # Gamma-correct formats.
@@ -93,6 +93,7 @@ def get_args(bot):
blacklist.extend('f16 _ _ dstreadshuffle'.split(' '))
blacklist.extend('f16 image _ _'.split(' '))
blacklist.extend('srgb image _ _'.split(' '))
+ blacklist.extend('gpusrgb image _ _'.split(' '))
# Certain gm's on win7 gpu and pdf are never finishing and keeping the test
# running forever