Roll all SPIR-V dependencies together.

Function name changed in shaderc.
SPIRV-Cross split up into additional files.

BUG=chromium:951016

Change-Id: I49abb0a163fefdd61b7d6352e57e2a10f519abd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6440
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/DEPS b/DEPS
index 3587202..ebc5bbb 100644
--- a/DEPS
+++ b/DEPS
@@ -50,25 +50,25 @@
 
   # SPIRV-Cross
   'third_party/spirv-cross': {
-    'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Cross@a7697446b12666da353bb2bdafa792d988fb268c',
+    'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Cross@f07a4e16a60e1d0231dda5d3883550761bd70a47',
     'condition': 'dawn_standalone',
   },
 
   # SPIRV compiler dependencies: SPIRV-Tools, SPIRV-headers, glslang and shaderc
   'third_party/SPIRV-Tools': {
-    'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Tools@20b2e2b9f599413e6197a7b84ac71216d2ac4ad0',
+    'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Tools@12e4a7b649e6fe28683de9fc352200c82948a1f0',
     'condition': 'dawn_standalone',
   },
   'third_party/spirv-headers': {
-    'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Headers@79b6681aadcb53c27d1052e5f8a0e82a981dbf2f',
+    'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Headers@111a25e4ae45e2b4d7c18415e1d6884712b958c4',
     'condition': 'dawn_standalone',
   },
   'third_party/glslang': {
-    'url': '{chromium_git}/external/github.com/KhronosGroup/glslang@0ac199df32687fe17b38cd2d0da64c3742e24fef',
+    'url': '{chromium_git}/external/github.com/KhronosGroup/glslang@ef807f4bc543e061f25dbbee6cb64dd5053b2adc',
     'condition': 'dawn_standalone',
   },
   'third_party/shaderc': {
-    'url': '{chromium_git}/external/github.com/google/shaderc@634dd3545cbccb9362f16f41b3b75703f290a9fd',
+    'url': '{chromium_git}/external/github.com/google/shaderc@ff9ae40e3734a264a56bba02191f5ae18c7e5e03',
     'condition': 'dawn_standalone',
   },
 
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index ad91613..ca6548d 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -22,6 +22,8 @@
 #include <spirv-cross/spirv_cross.hpp>
 #include <spirv-tools/libspirv.hpp>
 
+#include <sstream>
+
 namespace dawn_native {
 
     MaybeError ValidateShaderModuleDescriptor(DeviceBase*,
@@ -153,7 +155,8 @@
         }
 
         // Fill in bindingInfo with the SPIRV bindings
-        auto ExtractResourcesBinding = [this](const std::vector<spirv_cross::Resource>& resources,
+        auto ExtractResourcesBinding = [this](const spirv_cross::SmallVector<spirv_cross::Resource>&
+                                                  resources,
                                               const spirv_cross::Compiler& compiler,
                                               dawn::BindingType bindingType) {
             for (const auto& resource : resources) {
diff --git a/src/dawn_native/metal/ShaderModuleMTL.mm b/src/dawn_native/metal/ShaderModuleMTL.mm
index 2d38d18..28cff58 100644
--- a/src/dawn_native/metal/ShaderModuleMTL.mm
+++ b/src/dawn_native/metal/ShaderModuleMTL.mm
@@ -60,8 +60,7 @@
 
         // By default SPIRV-Cross will give MSL resources indices in increasing order.
         // To make the MSL indices match the indices chosen in the PipelineLayout, we build
-        // a table of MSLResourceBinding to give to SPIRV-Cross
-        std::vector<spirv_cross::MSLResourceBinding> mslBindings;
+        // a table of MSLResourceBinding to give to SPIRV-Cross.
 
         // Reserve index 0 for buffers for the push constants buffer.
         for (auto stage : IterateStages(kAllStages)) {
@@ -71,7 +70,7 @@
             binding.binding = spirv_cross::kPushConstBinding;
             binding.msl_buffer = 0;
 
-            mslBindings.push_back(binding);
+            compiler.add_msl_resource_binding(binding);
         }
 
         // Create one resource binding entry per stage per binding.
@@ -87,7 +86,7 @@
                     mslBinding.binding = binding;
                     mslBinding.msl_buffer = mslBinding.msl_texture = mslBinding.msl_sampler = index;
 
-                    mslBindings.push_back(mslBinding);
+                    compiler.add_msl_resource_binding(mslBinding);
                 }
             }
         }
@@ -103,7 +102,7 @@
         {
             // SPIRV-Cross also supports re-ordering attributes but it seems to do the correct thing
             // by default.
-            std::string msl = compiler.compile(nullptr, &mslBindings);
+            std::string msl = compiler.compile();
             NSString* mslSource = [NSString stringWithFormat:@"%s", msl.c_str()];
 
             auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
diff --git a/src/fuzzers/DawnSPIRVCrossGLSLFastFuzzer.cpp b/src/fuzzers/DawnSPIRVCrossGLSLFastFuzzer.cpp
index 414f230..8322598 100644
--- a/src/fuzzers/DawnSPIRVCrossGLSLFastFuzzer.cpp
+++ b/src/fuzzers/DawnSPIRVCrossGLSLFastFuzzer.cpp
@@ -28,7 +28,7 @@
         DawnSPIRVCrossFuzzer::ExecuteWithSignalTrap([&compiler, &input]() {
             // Using the options that are used by Dawn, they appear in ShaderModuleGL.cpp
             shaderc_spvc::CompileOptions options;
-            options.SetOutputLanguageVersion(440);
+            options.SetGLSLLanguageVersion(440);
             options.SetFixupClipspace(true);
             compiler.CompileSpvToGlsl(input.data(), input.size(), options);
         });
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index a745ffb..319a3dc 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -70,6 +70,10 @@
     "${spirv_cross_dir}/spirv_common.hpp",
     "${spirv_cross_dir}/spirv_cross.cpp",
     "${spirv_cross_dir}/spirv_cross.hpp",
+    "${spirv_cross_dir}/spirv_cross_parsed_ir.cpp",
+    "${spirv_cross_dir}/spirv_cross_parsed_ir.hpp",
+    "${spirv_cross_dir}/spirv_parser.cpp",
+    "${spirv_cross_dir}/spirv_parser.hpp",
   ]
 
   need_glsl_cross = dawn_enable_opengl
@@ -110,12 +114,16 @@
     "${spirv_cross_dir}/spirv_common.hpp",
     "${spirv_cross_dir}/spirv_cross.cpp",
     "${spirv_cross_dir}/spirv_cross.hpp",
+    "${spirv_cross_dir}/spirv_cross_parsed_ir.cpp",
+    "${spirv_cross_dir}/spirv_cross_parsed_ir.hpp",
     "${spirv_cross_dir}/spirv_glsl.cpp",
     "${spirv_cross_dir}/spirv_glsl.hpp",
     "${spirv_cross_dir}/spirv_hlsl.cpp",
     "${spirv_cross_dir}/spirv_hlsl.hpp",
     "${spirv_cross_dir}/spirv_msl.cpp",
     "${spirv_cross_dir}/spirv_msl.hpp",
+    "${spirv_cross_dir}/spirv_parser.cpp",
+    "${spirv_cross_dir}/spirv_parser.hpp",
   ]
 }
 
@@ -342,6 +350,7 @@
     configs += [ "//build/config/compiler:no_chromium_code" ]
 
     public_configs = [ ":glm_public_config" ]
+
     # GLM is header only but has too many files to list them.
   }