D.4. Platform-Specific Macro Definitions in vk_platform.h

In addition to the macros described for vulkan.h, platform-specific macros specified and used in the included vk_platform.h file are described in this section. These macros are specifically used to control platform-dependent behavior and their exact definitions are under the control of specific platforms and Vulkan implementations.

D.4.1. Platform-Specific Calling Conventions

VKAPI_ATTR is a macro placed before the return type in Vulkan API function declarations. If not empty, the interpretation of this macro depends on the platform and compiler in use, but normally controls calling conventions for C++11 and GCC/Clang-style compilers.

VKAPI_CALL is a macro placed after the return type in Vulkan API function declarations. If not empty, the interpretation of this macro depends on the platform and compiler in use, but normally controls calling conventions for MSVC-style compilers.

VKAPI_PTR is a macro placed between the ( and * in Vulkan API function pointer declarations. If not empty, the interpretation of this macro depends on the platform and compiler in use, and normally controls calling conventions. VKAPI_PTR typically has the same definition as VKAPI_ATTR or VKAPI_CALL, depending on the compiler.

D.4.2. Platform-Specific Header Control

If the VK_NO_STDINT_H macro is defined by the application at compile time, extended integer types required by vulkan.h, such as uint8_t, must also be defined by the application. Otherwise, vulkan.h will not compile. If VK_NO_STDINT_H is not defined, the system <stdint.h> is used to define these types, or there is a fallback path when Microsoft Visual Studio version 2008 and earlier versions are detected at compile time.

D.4.3. Window System-Specific Header Control

When using different window systems with Khronos extensions, header files for those window systems must be included at compile time in order for the corresponding extension definitions to compile. The Vulkan header files cannot determine whether or not an external header is available at compile time, so applications must include macros enabling those headers. If this is not done, the corresponding extension interfaces will not be defined and they will be unusable.

The extensions, required compile-time symbols to enable them, and window systems they correspond to are defined in the following table.

Table D.1. Window System Extensions and Required Compile-Time Symbol Definitions

Extension Name Required Compile-Time Symbol Window System Name

VK_KHR_android_surface

VK_USE_PLATFORM_ANDROID_KHR

Android Native

VK_KHR_mir_surface

VK_USE_PLATFORM_MIR_KHR

Mir

VK_KHR_wayland_surface

VK_USE_PLATFORM_WAYLAND_KHR

Wayland

VK_KHR_win32_surface

VK_USE_PLATFORM_WIN32_KHR

Microsoft Windows

VK_KHR_xcb_surface

VK_USE_PLATFORM_XCB_KHR

X Window System Xcb library

VK_KHR_xlib_surface

VK_USE_PLATFORM_XLIB_KHR

X Window System Xlib library