Try to use the vulkan-headers from vulkan-deps instead of third_party/khronos.
Change-Id: Ic4af5ec86e4ea2ec404a6e32e49068fc5993d55a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
diff --git a/scripts/dawn_overrides_with_defaults.gni b/scripts/dawn_overrides_with_defaults.gni
index 35a8baf..c667693 100644
--- a/scripts/dawn_overrides_with_defaults.gni
+++ b/scripts/dawn_overrides_with_defaults.gni
@@ -54,6 +54,14 @@
dawn_swiftshader_dir = ""
}
+if (!defined(dawn_vulkan_headers_dir)) {
+ dawn_vulkan_headers_dir = "//third_party/vulkan-deps/vulkan-headers/src"
+ if (dawn_standalone) {
+ dawn_vulkan_headers_dir =
+ "${dawn_root}/third_party/vulkan-deps/vulkan-headers/src"
+ }
+}
+
if (!defined(dawn_vulkan_loader_dir)) {
# Default to the Vulkan loader not being available except in standalone.
dawn_vulkan_loader_dir = ""
diff --git a/src/dawn/common/vulkan_platform.h b/src/dawn/common/vulkan_platform.h
index 57d2b13..868f13f 100644
--- a/src/dawn/common/vulkan_platform.h
+++ b/src/dawn/common/vulkan_platform.h
@@ -155,26 +155,46 @@
// Import additional parts of Vulkan that are supported on our architecture and preemptively include
// headers that vulkan.h includes that we have "undefs" for.
#if defined(DAWN_PLATFORM_WINDOWS)
-# define VK_USE_PLATFORM_WIN32_KHR
+# ifndef VK_USE_PLATFORM_WIN32_KHR
+# define VK_USE_PLATFORM_WIN32_KHR
+# endif
# include "dawn/common/windows_with_undefs.h"
+#else
+# undef VK_USE_PLATFORM_WIN32_KHR
#endif // DAWN_PLATFORM_WINDOWS
#if defined(DAWN_USE_X11)
# define VK_USE_PLATFORM_XLIB_KHR
-# define VK_USE_PLATFORM_XCB_KHR
+# ifndef VK_USE_PLATFORM_XCB_KHR
+# define VK_USE_PLATFORM_XCB_KHR
+# endif
# include "dawn/common/xlib_with_undefs.h"
+#else
+# undef VK_USE_PLATFORM_XCB_KHR
#endif // defined(DAWN_USE_X11)
#if defined(DAWN_ENABLE_BACKEND_METAL)
-# define VK_USE_PLATFORM_METAL_EXT
+# ifndef VK_USE_PLATFORM_METAL_EXT
+# define VK_USE_PLATFORM_METAL_EXT
+# endif
+#else
+# undef VK_USE_PLATFORM_METAL_EXT
#endif // defined(DAWN_ENABLE_BACKEND_METAL)
#if defined(DAWN_PLATFORM_ANDROID)
-# define VK_USE_PLATFORM_ANDROID_KHR
+# ifndef VK_USE_PLATFORM_ANDROID_KHR
+# define VK_USE_PLATFORM_ANDROID_KHR
+# endif
+#else
+# undef VK_USE_PLATFORM_ANDROID_KHR
#endif // defined(DAWN_PLATFORM_ANDROID)
#if defined(DAWN_PLATFORM_FUCHSIA)
-# define VK_USE_PLATFORM_FUCHSIA
+# ifndef VK_USE_PLATFORM_FUCHSIA
+# define VK_USE_PLATFORM_FUCHSIA
+# endif
+#else
+# undef VK_USE_PLATFORM_FUCHSIA
#endif // defined(DAWN_PLATFORM_FUCHSIA)
// The actual inclusion of vulkan.h!
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index bc90499..ce7d97f 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -571,7 +571,7 @@
}
if (dawn_enable_vulkan) {
- public_deps += [ "${dawn_root}/third_party/khronos:vulkan_headers" ]
+ public_deps += [ "${dawn_vulkan_headers_dir}:vulkan_headers" ]
sources += [
"vulkan/AdapterVk.cpp",
"vulkan/AdapterVk.h",