slightly more complex runtime color filter GM

This adds a runtime color filter with about the same control flow
complexity as Android's tone mapping.  As expected failing on 8888:

    error: 11: return not allowed inside conditional or loop

Incidentally, is there no `const` in sksl?  I made color and luma const
out of habit but got GL/Metal compilation errors (but not sksl ones as
far as I can tell).

Change-Id: Ic4370c068a27349a7f5ab64ecf5ddbb34e91d8f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326909
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/gm/runtimecolorfilter.cpp b/gm/runtimecolorfilter.cpp
index 1fbab76..dfa98b1 100644
--- a/gm/runtimecolorfilter.cpp
+++ b/gm/runtimecolorfilter.cpp
@@ -34,11 +34,36 @@
     }
 )";
 
-DEF_SIMPLE_GM(runtimecolorfilter, canvas, 256 * 3, 256) {
+// A runtime effect with a small amount of control flow (if, else, etc., and
+// early return) that can in principle still be reduced to a single basic block.
+// Distilled from AOSP tone mapping shaders.
+const char* gComplex = R"(
+    in shader input;
+    half4 main() {
+        half4 color = sample(input);
+
+        half luma = dot(color.rgb, half3(0.3, 0.6, 0.1));
+
+        half scale = 0;
+
+        if (luma < 0.33333) {
+            return half4(color.rgb * 0.5, color.a);
+        } else if (luma < 0.66666) {
+            scale = 0.166666 + 2.0 * (luma - 0.33333);
+        } else {
+            scale = 0.833333 + 0.5 * (luma - 0.66666);
+        }
+
+        return half4(color.rgb * (scale/luma), color.a);
+    }
+)";
+
+
+DEF_SIMPLE_GM(runtimecolorfilter, canvas, 256 * 4, 256) {
     auto img = GetResourceAsImage("images/mandrill_256.png");
     canvas->drawImage(img, 0, 0, nullptr);
 
-    for (auto src : { gLumaSrc, gLumaSrcWithCoords }) {
+    for (auto src : { gLumaSrc, gLumaSrcWithCoords, gComplex }) {
         sk_sp<SkRuntimeEffect> effect = std::get<0>(SkRuntimeEffect::Make(SkString(src)));
         SkASSERT(effect);
         SkPaint p;