Migrate several GLSL workaround unit tests to golden files.

We now support building an SkSL golden output twice, once honoring the
custom #pragma settings, and once more ignoring the settings. This
allows us to see the output of the workaround technique, alongside the
"default-settings" output which should not contain a workaround.

To implement this, skslc now supports a flag: --[no]settings.
When it's set, /*#pragma settings*/ comments are honored. When it's not
set, skslc ignores the comments. compile_sksl_tests.py passes this flag
along to skslc.

This approach is not strictly limited to workarounds; the
"TypePrecision" GLSL test was also updated to use this technique.

Change-Id: I79204df047b024533ed6bc1f4c088e0e878d5bb1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317246
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index b3ed087..cfbcb7c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -689,22 +689,60 @@
           rebase_path("$dir/golden/$name.glsl", target_out_dir) ]
   }
 
+  sksl_glsl_settings_tests_outputs = []
+  foreach(src, sksl_glsl_settings_tests_sources) {
+    dir = get_path_info(src, "dir")
+    name = get_path_info(src, "name")
+    sksl_glsl_tests_outputs +=
+        [ "$target_out_dir/" +
+          rebase_path("$dir/golden/$name.glsl", target_out_dir) ]
+    sksl_glsl_settings_tests_outputs += [
+      "$target_out_dir/" +
+          rebase_path("$dir/golden/${name}DefaultSettings.glsl",
+                      target_out_dir),
+    ]
+  }
+
   action("compile_sksl_tests") {
+    # This action compiles SkSL tests with their settings enabled, i.e. in --settings mode.
     script = "gn/compile_sksl_tests.py"
     deps = [
       ":create_sksl_fp",
       ":sksl_pre_includes",
       ":skslc(//gn/toolchain:$host_toolchain)",
     ]
-    sources = sksl_fp_tests_sources + sksl_glsl_tests_sources
+    sources = sksl_fp_tests_sources + sksl_glsl_tests_sources +
+              sksl_glsl_settings_tests_sources
     outputs = sksl_fp_tests_outputs + sksl_glsl_tests_outputs
-    args = [ rebase_path(skslc_path) ]
+    args = [
+      rebase_path(skslc_path),
+      "--settings",
+    ]
     args += rebase_path(sksl_fp_tests_sources)
     args += rebase_path(sksl_glsl_tests_sources)
+    args += rebase_path(sksl_glsl_settings_tests_sources)
+  }
+  action("compile_sksl_tests_nosettings") {
+    # This action compiles SkSL tests with their settings disabled, i.e. in --nosettings mode.
+    script = "gn/compile_sksl_tests.py"
+    deps = [
+      ":create_sksl_fp",
+      ":sksl_pre_includes",
+      ":skslc(//gn/toolchain:$host_toolchain)",
+    ]
+    sources = sksl_glsl_settings_tests_sources
+    outputs = sksl_glsl_settings_tests_outputs
+    args = [
+      rebase_path(skslc_path),
+      "--nosettings",
+    ]
+    args += rebase_path(sksl_glsl_settings_tests_sources)
   }
 } else {
   group("compile_sksl_tests") {
   }
+  group("compile_sksl_tests_nosettings") {
+  }
 }
 
 optional("gpu") {
@@ -712,6 +750,7 @@
   deps = [
     ":compile_processors",
     ":compile_sksl_tests",
+    ":compile_sksl_tests_nosettings",
     ":dehydrate_sksl",
     ":run_sksllex",
   ]