Add in flag for using spvc instead of direct spriv-cross access

Currently does nothing interesting, future CLs will flesh out the
functionality.

BUG=dawn:281

Change-Id: I89750a45ff5a42a13e1494cafd433bb7ef719b10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13841
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index ca6a8c0..6079642 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -127,6 +127,11 @@
     "${dawn_spirv_tools_dir}:spvtools_val",
     "third_party:spirv_cross",
   ]
+  defines = []
+  if (dawn_use_spvc) {
+    deps += [ "${dawn_shaderc_dir}:libshaderc_spvc" ]
+    defines += [ "DAWN_USE_SPVC" ]
+  }
 
   configs += [ ":libdawn_native_internal" ]
   libs = []
@@ -500,7 +505,7 @@
       ]
     }
     if (dawn_enable_vulkan_validation_layers) {
-      defines = [
+      defines += [
         "DAWN_ENABLE_VULKAN_VALIDATION_LAYERS",
         "DAWN_VK_DATA_DIR=\"$vulkan_data_subdir\"",
       ]
diff --git a/scripts/dawn_features.gni b/scripts/dawn_features.gni
index bed5616..24e6f5a 100644
--- a/scripts/dawn_features.gni
+++ b/scripts/dawn_features.gni
@@ -44,6 +44,10 @@
   # GLSL/HLSL/MSL compiler. This implicitly pulls in the GLSL
   # compiler, since it is a sub-class of if.
   dawn_enable_cross_reflection = false
+
+  # Enables using spvc for accessing SPIR-V toolchain, instead of
+  # directly accessing it in Dawn.
+  dawn_use_spvc = false
 }
 
 # GN does not allow reading a variable defined in the same declare_args().
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 94851ea..d78eacf 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -66,8 +66,9 @@
     "${spirv_cross_dir}/spirv_parser.hpp",
   ]
 
-  need_glsl_cross = dawn_enable_opengl || dawn_enable_cross_reflection
-  need_reflection_cross = dawn_enable_cross_reflection
+  need_glsl_cross =
+      dawn_enable_opengl || dawn_enable_cross_reflection || dawn_use_spvc
+  need_reflection_cross = dawn_enable_cross_reflection || dawn_use_spvc
 
   if (dawn_enable_d3d12) {
     sources += [