Fixing platform-specific Vulkan symbol resolution. (#10904)
diff --git a/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc b/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc
index 63ad55a..025d1d9 100644
--- a/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc
+++ b/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc
@@ -1229,6 +1229,9 @@
static iree_status_t iree_hal_vulkan_device_profiling_begin(
iree_hal_device_t* base_device,
const iree_hal_device_profiling_options_t* options) {
+ iree_hal_vulkan_device_t* device = iree_hal_vulkan_device_cast(base_device);
+ (void)device;
+
// For now we only support RenderDoc. As much as possible we should try to use
// standardized Vulkan layers to do profiling configuration/control like
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_performance_query.html
@@ -1239,7 +1242,6 @@
if (iree_all_bits_set(options->mode,
IREE_HAL_DEVICE_PROFILING_MODE_QUEUE_OPERATIONS)) {
#if defined(IREE_HAL_VULKAN_HAVE_RENDERDOC)
- iree_hal_vulkan_device_t* device = iree_hal_vulkan_device_cast(base_device);
iree_hal_vulkan_begin_renderdoc_capture(device->renderdoc_api,
device->instance, options);
#endif // IREE_HAL_VULKAN_HAVE_RENDERDOC
@@ -1249,8 +1251,10 @@
static iree_status_t iree_hal_vulkan_device_profiling_end(
iree_hal_device_t* base_device) {
-#if defined(IREE_HAL_VULKAN_HAVE_RENDERDOC)
iree_hal_vulkan_device_t* device = iree_hal_vulkan_device_cast(base_device);
+ (void)device;
+
+#if defined(IREE_HAL_VULKAN_HAVE_RENDERDOC)
iree_hal_vulkan_end_renderdoc_capture(device->renderdoc_api,
device->instance);
#endif // IREE_HAL_VULKAN_HAVE_RENDERDOC
diff --git a/runtime/src/iree/hal/drivers/vulkan/vulkan_headers.h b/runtime/src/iree/hal/drivers/vulkan/vulkan_headers.h
index 882e57f..ca5a079 100644
--- a/runtime/src/iree/hal/drivers/vulkan/vulkan_headers.h
+++ b/runtime/src/iree/hal/drivers/vulkan/vulkan_headers.h
@@ -7,6 +7,8 @@
#ifndef IREE_HAL_DRIVERS_VULKAN_VULKAN_HEADERS_H_
#define IREE_HAL_DRIVERS_VULKAN_VULKAN_HEADERS_H_
+#include "iree/base/target_platform.h"
+
// We exclusively use Vulkan via queried function pointers. To ensure that there
// are no accidental calls to the linker-loaded implicit functions we just
// compile them all out.
@@ -33,6 +35,12 @@
// https://djang86.blogspot.com/2019/01/what-is-vknoprototypes.html
#define VK_NO_PROTOTYPES 1
+#if defined(IREE_PLATFORM_ANDROID)
+#define VK_USE_PLATFORM_ANDROID_KHR 1
+#elif defined(IREE_PLATFORM_WINDOWS)
+#define VK_USE_PLATFORM_WIN32_KHR 1
+#endif // IREE_PLATFORM_*
+
#include <vulkan/vulkan.h> // IWYU pragma: export
#ifdef IREE_PLATFORM_APPLE