Switch from Vulkan-Tools to Vulkan-Utility-Libraries

Vulkan-Utility-Libraries (VKU) is now the source-of-truth for this
helper, and since VVL requires VKU already this essentially removes
one dependency from Dawn.

This also removes one code transformation requires for the google3
build, where Vulkan-Tools is not available.

Change-Id: Id758c041ab107d9096127a7c42a7accf389b66eb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/153180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c537b05..21b833c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -203,7 +203,7 @@
 set_if_not_defined(DAWN_SPIRV_TOOLS_DIR "${DAWN_VULKAN_DEPS_DIR}/spirv-tools/src" "Directory in which to find SPIRV-Tools")
 set_if_not_defined(DAWN_SPIRV_HEADERS_DIR "${DAWN_VULKAN_DEPS_DIR}/spirv-headers/src" "Directory in which to find SPIRV-Headers")
 set_if_not_defined(DAWN_VULKAN_HEADERS_DIR "${DAWN_VULKAN_DEPS_DIR}/vulkan-headers/src" "Directory in which to find Vulkan-Headers")
-set_if_not_defined(DAWN_VULKAN_TOOLS_DIR "${DAWN_VULKAN_DEPS_DIR}/vulkan-tools/src" "Directory in which to find Vulkan-Tools")
+set_if_not_defined(DAWN_VULKAN_UTILITY_LIBRARIES_DIR "${DAWN_VULKAN_DEPS_DIR}/vulkan-utility-libraries/src" "Directory in which to find Vulkan-Utility-Libraries")
 
 # Dependencies for DAWN_BUILD_NODE_BINDINGS
 set_if_not_defined(NODE_ADDON_API_DIR "${DAWN_THIRD_PARTY_DIR}/node-addon-api" "Directory in which to find node-addon-api")
diff --git a/scripts/dawn_overrides_with_defaults.gni b/scripts/dawn_overrides_with_defaults.gni
index bb6b205..d1f268e 100644
--- a/scripts/dawn_overrides_with_defaults.gni
+++ b/scripts/dawn_overrides_with_defaults.gni
@@ -73,8 +73,9 @@
   }
 }
 
-if (!defined(dawn_vulkan_tools_dir)) {
-  dawn_vulkan_tools_dir = "${dawn_vulkan_deps_dir}/vulkan-tools/src"
+if (!defined(dawn_vulkan_utility_libraries_dir)) {
+  dawn_vulkan_utility_libraries_dir =
+      "${dawn_vulkan_deps_dir}/vulkan-utility-libraries/src"
 }
 
 if (!defined(dawn_vulkan_validation_layers_dir)) {
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index 07da5bd..06591f6 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -76,9 +76,9 @@
   }
 }
 
-# Config that adds include directory for vulkan-tools.
-config("vulkan_tools_include") {
-  include_dirs = [ "${dawn_vulkan_tools_dir}" ]
+# Config that adds include directory for vulkan-utility-libraries.
+config("vulkan_utility_libraries_include") {
+  include_dirs = [ "${dawn_vulkan_utility_libraries_dir}/include" ]
 }
 
 dawn_json_generator("utils_gen") {
@@ -725,8 +725,7 @@
   }
 
   if (dawn_enable_vulkan) {
-    configs += [ ":vulkan_tools_include" ]
-    deps += [ "${dawn_vulkan_tools_dir}:vulkan_tools_headers" ]
+    configs += [ ":vulkan_utility_libraries_include" ]
     public_deps += [ "${dawn_vulkan_headers_dir}:vulkan_headers" ]
     sources += [
       "vulkan/BackendVk.cpp",
diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt
index 69085d6..145e48f 100644
--- a/src/dawn/native/CMakeLists.txt
+++ b/src/dawn/native/CMakeLists.txt
@@ -661,7 +661,7 @@
     )
 
     target_link_libraries(dawn_native PUBLIC Vulkan-Headers)
-    target_include_directories(dawn_native PRIVATE ${DAWN_VULKAN_TOOLS_DIR})
+    target_include_directories(dawn_native PRIVATE ${DAWN_VULKAN_UTILITY_LIBRARIES_DIR}/include)
 
     if (ANDROID)
         target_sources(dawn_native PRIVATE
diff --git a/src/dawn/native/vulkan/StreamImplVk.cpp b/src/dawn/native/vulkan/StreamImplVk.cpp
index 20ee57b..f5b8354 100644
--- a/src/dawn/native/vulkan/StreamImplVk.cpp
+++ b/src/dawn/native/vulkan/StreamImplVk.cpp
@@ -20,7 +20,7 @@
 #include "dawn/native/stream/Stream.h"
 #include "dawn/native/vulkan/RenderPassCache.h"
 
-#include "icd/generated/vk_typemap_helper.h"
+#include <vulkan/utility/vk_struct_helper.hpp>  // NOLINT(build/include_order)
 
 namespace dawn::native {
 
@@ -34,7 +34,7 @@
     while (next != nullptr) {
         // Assert that the type of each pNext struct is exactly one of the specified
         // templates.
-        DAWN_ASSERT(((LvlTypeMap<VK_STRUCT_TYPES>::kSType == next->sType ? 1 : 0) + ... + 0) == 1);
+        DAWN_ASSERT(((vku::GetSType<VK_STRUCT_TYPES>() == next->sType ? 1 : 0) + ... + 0) == 1);
         next = reinterpret_cast<const VkBaseOutStructure*>(next->pNext);
     }
 }
@@ -44,7 +44,7 @@
     const VkBaseOutStructure* next = reinterpret_cast<const VkBaseOutStructure*>(root->pNext);
     const VK_STRUCT_TYPE* found = nullptr;
     while (next != nullptr) {
-        if (LvlTypeMap<VK_STRUCT_TYPE>::kSType == next->sType) {
+        if (vku::GetSType<VK_STRUCT_TYPE>() == next->sType) {
             if (found == nullptr) {
                 found = reinterpret_cast<const VK_STRUCT_TYPE*>(next);
             } else {