Reland "Add stub gpu workaround generators"

This is a reland of 94d25b970b97c68ddd0b4ceb71f2233aac05e6b5

Original change's description:
> Add stub gpu workaround generators
> 
> Like https://chromium-review.googlesource.com/c/chromium/src/+/1005362,
> this patch adds a way for Chrome and Skia to share a set of driver
> workaround names so that they can be turned on by Chrome (or Skia) as
> needed.
> 
> To avoid weird cross-repository dependencies, the generator script is
> duplicated in Skia.
> 
> This patch just adds a few dummy workaround names to make sure the build
> process is working.  The followup to this is to add workaround init
> to GrContext/GrContextOptions and to start implementing individual
> workarounds.
> 
> Implementing these workarounds is to support Chrome's "out of process
> raster" which will use Ganesh without a command buffer, and so will not
> have the workarounds that the command buffer provides.
> 
> Bug: chromium:829614
> Change-Id: I40745a777a95805995991fedb81657ae418b52d9
> Reviewed-on: https://skia-review.googlesource.com/120608
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Adrienne Walker <enne@chromium.org>

Bug: chromium:829614
Change-Id: Idb3309ffa894f7585ee493388b56565e9d4a3101
Reviewed-on: https://skia-review.googlesource.com/122800
Auto-Submit: Adrienne Walker <enne@chromium.org>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index ff6cc1b..3644a8a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -46,6 +46,7 @@
   skia_vulkan_sdk = getenv("VULKAN_SDK")
   skia_qt_path = getenv("QT_PATH")
   skia_compile_processors = false
+  skia_generate_workarounds = false
   skia_lex = false
 
   skia_skqp_enable_driver_correctness_workarounds = false
@@ -584,6 +585,9 @@
     ":compile_processors",
     ":run_sksllex",
   ]
+  if (skia_generate_workarounds) {
+    deps += [ ":workaround_list" ]
+  }
   public_defines = []
 
   sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
@@ -689,7 +693,7 @@
     "//third_party/zlib",
   ]
   if (skia_use_libjpeg_turbo) {
-    deps += [ ":jpeg"]
+    deps += [ ":jpeg" ]
   }
   sources = skia_pdf_sources
   sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
@@ -788,6 +792,32 @@
   ]
 }
 
+if (skia_enable_gpu && skia_generate_workarounds) {
+  action("workaround_list") {
+    script = "tools/build_workaround_header.py"
+
+    inputs = [
+      "src/gpu/gpu_workaround_list.txt",
+    ]
+
+    # see comments in skia_compile_processors about out dir path shenanigans.
+    output_file =
+        rebase_path("src/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
+
+    outputs = [
+      "$root_out_dir/$output_file",
+    ]
+    args = [
+      "--output-file",
+      "$output_file",
+    ]
+
+    foreach(file, inputs) {
+      args += [ rebase_path(file, root_build_dir) ]
+    }
+  }
+}
+
 component("skia") {
   public_configs = [ ":skia_public" ]
   configs += skia_library_configs