Test sRGB with non-linear blending using new "srgbnl" sink
authorMatt Sarett <msarett@google.com>
Thu, 2 Mar 2017 13:53:46 +0000 (08:53 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 2 Mar 2017 14:28:29 +0000 (14:28 +0000)
BUG=skia:

Change-Id: Ief7516c1505f8e447f83121ed4ba75b9fa9ba75b
Reviewed-on: https://skia-review.googlesource.com/8976
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
13 files changed:
dm/DM.cpp
infra/bots/recipe_modules/sktest/api.py
infra/bots/recipe_modules/sktest/example.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug.json
infra/bots/recipe_modules/sktest/example.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN.json
infra/bots/recipe_modules/sktest/example.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN.json
infra/bots/recipe_modules/sktest/example.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug.json
infra/bots/recipe_modules/sktest/example.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared.json
infra/bots/recipe_modules/sktest/example.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN.json
infra/bots/recipe_modules/sktest/example.expected/failed_dm.json
infra/bots/recipe_modules/sktest/example.expected/nobuildbot.json
infra/bots/recipe_modules/sktest/example.expected/recipe_with_gerrit_patch.json
infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug.json
tools/flags/SkCommonFlagsConfig.cpp

index 5e3185b..bec5dd3 100644 (file)
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -866,19 +866,24 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi
 
     if (FLAGS_cpu) {
         auto srgbColorSpace = SkColorSpace::MakeSRGB();
+        auto srgbColorSpaceNonLinearBlending = SkColorSpace::MakeRGB(
+                SkColorSpace::kSRGB_RenderTargetGamma,
+                SkColorSpace::kSRGB_Gamut,
+                SkColorSpace::kNonLinearBlending_ColorSpaceFlag);
         auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear();
 
-        SINK("565",  RasterSink, kRGB_565_SkColorType);
-        SINK("8888", RasterSink, kN32_SkColorType);
-        SINK("srgb", RasterSink, kN32_SkColorType, srgbColorSpace);
-        SINK("f16",  RasterSink, kRGBA_F16_SkColorType, srgbLinearColorSpace);
-        SINK("pdf",  PDFSink);
-        SINK("skp",  SKPSink);
-        SINK("pipe", PipeSink);
-        SINK("svg",  SVGSink);
-        SINK("null", NullSink);
-        SINK("xps",  XPSSink);
-        SINK("pdfa", PDFSink, true);
+        SINK("565",     RasterSink, kRGB_565_SkColorType);
+        SINK("8888",    RasterSink, kN32_SkColorType);
+        SINK("srgb",    RasterSink, kN32_SkColorType, srgbColorSpace);
+        SINK("srgbnl",  RasterSink, kN32_SkColorType, srgbColorSpaceNonLinearBlending);
+        SINK("f16",     RasterSink, kRGBA_F16_SkColorType, srgbLinearColorSpace);
+        SINK("pdf",     PDFSink);
+        SINK("skp",     SKPSink);
+        SINK("pipe",    PipeSink);
+        SINK("svg",     SVGSink);
+        SINK("null",    NullSink);
+        SINK("xps",     XPSSink);
+        SINK("pdfa",    PDFSink, true);
         SINK("jsdebug", DebugSink);
     }
 #undef SINK
index a9af719..e5fc92d 100644 (file)
@@ -50,6 +50,7 @@ def dm_flags(bot):
     configs.extend(['f16'])
     configs.extend(['sp-8888', '2ndpic-8888'])   # Test niche uses of SkPicture.
     configs.extend(['lite-8888'])                # Experimental display list.
+    configs.extend(['srgbnl'])
 
   if '-TSAN' not in bot:
     if ('TegraK1'  in bot or
index 42d9c0f..3f82f04 100644 (file)
       "sp-8888",
       "2ndpic-8888",
       "lite-8888",
+      "srgbnl",
       "serialize-8888",
       "tiles_rt-8888",
       "pic-8888",
index 064a0e7..e172521 100644 (file)
       "sp-8888",
       "2ndpic-8888",
       "lite-8888",
+      "srgbnl",
       "serialize-8888",
       "tiles_rt-8888",
       "pic-8888",
index 9abab39..5fb195c 100644 (file)
       "sp-8888",
       "2ndpic-8888",
       "lite-8888",
+      "srgbnl",
       "serialize-8888",
       "tiles_rt-8888",
       "pic-8888",
index 7281519..622155b 100644 (file)
       "sp-8888",
       "2ndpic-8888",
       "lite-8888",
+      "srgbnl",
       "serialize-8888",
       "tiles_rt-8888",
       "pic-8888",
index 3e5e9b9..c9ac767 100644 (file)
@@ -49,6 +49,7 @@ static const struct {
     { "esinstdit4",            "gpu", "api=gles,inst=true,samples=4,dit=true" },
     { "gpuf16",                "gpu", "color=f16" },
     { "gpusrgb",               "gpu", "color=srgb" },
+    { "gpusrgbnl",             "gpu", "color=srgbnl" },
     { "glsrgb",                "gpu", "api=gl,color=srgb" },
     { "glwide",                "gpu", "api=gl,color=f16_wide" },
     { "glnarrow",              "gpu", "api=gl,color=f16_narrow" },
@@ -290,10 +291,16 @@ static bool parse_option_gpu_color(const SkString& value,
         return false;
     }
 
-    // First, figure out color gamut that we'll work in (default to sRGB)
     const bool linearGamma = commands[0].equals("f16");
-    *outColorSpace = linearGamma ? SkColorSpace::MakeSRGBLinear()
-                                 : SkColorSpace::MakeSRGB();
+    const bool nonLinearBlending = commands[0].equals("srgbnl");
+    SkColorSpace::Gamut gamut = SkColorSpace::kSRGB_Gamut;
+    SkColorSpace::RenderTargetGamma gamma = linearGamma ? SkColorSpace::kLinear_RenderTargetGamma
+                                                        : SkColorSpace::kSRGB_RenderTargetGamma;
+    SkColorSpace::ColorSpaceFlags flags =
+            nonLinearBlending ? SkColorSpace::kNonLinearBlending_ColorSpaceFlag
+                              : (SkColorSpace::ColorSpaceFlags) 0;
+    *outColorSpace = SkColorSpace::MakeRGB(gamma, gamut, flags);
+
     if (commands.count() == 2) {
         if (commands[1].equals("srgb")) {
             // sRGB gamut (which is our default)
@@ -306,10 +313,7 @@ static bool parse_option_gpu_color(const SkString& value,
             };
             SkMatrix44 wideGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor);
             wideGamutRGBMatrix.set3x3RowMajorf(gWideGamutRGB_toXYZD50);
-            *outColorSpace = SkColorSpace::MakeRGB(linearGamma
-                                                          ? SkColorSpace::kLinear_RenderTargetGamma
-                                                          : SkColorSpace::kSRGB_RenderTargetGamma,
-                                                   wideGamutRGBMatrix);
+            *outColorSpace = SkColorSpace::MakeRGB(gamma, wideGamutRGBMatrix, flags);
         } else if (commands[1].equals("narrow")) {
             // NarrowGamut RGB (an artifically smaller than sRGB gamut)
             SkColorSpacePrimaries primaries ={
@@ -320,10 +324,7 @@ static bool parse_option_gpu_color(const SkString& value,
             };
             SkMatrix44 narrowGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor);
             primaries.toXYZD50(&narrowGamutRGBMatrix);
-            *outColorSpace = SkColorSpace::MakeRGB(linearGamma
-                                                          ? SkColorSpace::kLinear_RenderTargetGamma
-                                                          : SkColorSpace::kSRGB_RenderTargetGamma,
-                                                   narrowGamutRGBMatrix);
+            *outColorSpace = SkColorSpace::MakeRGB(gamma, narrowGamutRGBMatrix, flags);
         } else {
             // Unknown color gamut
             return false;
@@ -335,7 +336,7 @@ static bool parse_option_gpu_color(const SkString& value,
         *outColorType = kRGBA_F16_SkColorType;
         return true;
     }
-    if (commands[0].equals("srgb")) {
+    if (commands[0].equals("srgb") || commands[0].equals("srgbnl")) {
         *outColorType = kRGBA_8888_SkColorType;
         return true;
     }