Manual

WSIheaders

Control inclusion of window system interface extensions

To use a Vulkan extension supporting a platform-specific window system, header files for that window system must be included at compile time, or platform-specific types must be forward-declared. The Vulkan header files are unable to determine whether or not an external header is available at compile time, so platform-specific extensions are provided in separate headers from the core API and platform-independent extensions, allowing applications to decide which ones they need to be defined and how the external headers are included.

Extensions dependent on particular sets of platform headers, or that forward-declare platform-specific types, are declared in a header named for that platform. Before including these platform-specific Vulkan headers, applications must include both vulkan_core.h and any external native headers the platform extensions depend on.

As a convenience for applications that do not need the flexibility of separate platform-specific Vulkan headers, vulkan.h includes vulkan_core.h, and then conditionally includes platform-specific Vulkan headers and the external headers they depend on. Applications control which platform-specific headers are included by #defining macros before including vulkan.h.

The correspondence between platform-specific extensions, external headers they require, the platform-specific header which declares them, and the preprocessor macros which enable inclusion by vulkan.h are shown in the following table.

Extension NameWindow System NamePlatform-specific HeaderRequired External HeadersControllingvulkan.hMacro
VK_KHR_android_surfaceAndroidvulkan_android.hNoneVK_USE_PLATFORM_ANDROID_KHR
VK_KHR_wayland_surfaceWaylandvulkan_wayland.h<wayland-client.h>VK_USE_PLATFORM_WAYLAND_KHR
VK_KHR_win32_surface,VK_KHR_external_memory_win32,VK_KHR_win32_keyed_mutex,VK_KHR_external_semaphore_win32,VK_KHR_external_fence_win32,VK_NV_external_memory_win32,VK_NV_win32_keyed_mutexMicrosoft Windowsvulkan_win32.h<windows.h>VK_USE_PLATFORM_WIN32_KHR
VK_KHR_xcb_surfaceX11 Xcbvulkan_xcb.h<xcb/xcb.h>VK_USE_PLATFORM_XCB_KHR
VK_KHR_xlib_surfaceX11 Xlibvulkan_xlib.h<X11/Xlib.h>VK_USE_PLATFORM_XLIB_KHR
VK_EXT_directfb_surfaceDirectFBvulkan_directfb.h<directfb/directfb.h>VK_USE_PLATFORM_DIRECTFB_EXT
VK_EXT_acquire_xlib_displayX11 XRAndRvulkan_xlib_xrandr.h<X11/Xlib.h>,<X11/extensions/Xrandr.h>VK_USE_PLATFORM_XLIB_XRANDR_EXT
VK_GGP_stream_descriptor_surface,VK_GGP_frame_tokenGoogle Games Platformvulkan_ggp.h<ggp_c/vulkan_types.h>VK_USE_PLATFORM_GGP
VK_MVK_ios_surfaceiOSvulkan_ios.hNoneVK_USE_PLATFORM_IOS_MVK
VK_MVK_macos_surfacemacOSvulkan_macos.hNoneVK_USE_PLATFORM_MACOS_MVK
VK_OHOS_surfaceOHOSvulkan_ohos.hNoneVK_USE_PLATFORM_OHOS
VK_NN_vi_surfaceVIvulkan_vi.hNoneVK_USE_PLATFORM_VI_NN
VK_FUCHSIA_imagepipe_surfaceFuchsiavulkan_fuchsia.h<zircon/types.h>VK_USE_PLATFORM_FUCHSIA
VK_EXT_metal_surfaceMetal on CoreAnimationvulkan_metal.hNoneVK_USE_PLATFORM_METAL_EXT
VK_QNX_screen_surfaceQNX Screenvulkan_screen.h<screen/screen.h>VK_USE_PLATFORM_SCREEN_QNX
This section describes the purpose of the headers independently of the specific underlying functionality of the window system extensions themselves. Each extension name will only link to a description of that extension when viewing a specification built with that extension included.