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.
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.
If the VK_NO_STDINT_H
macro is defined at compile time, it indicates that
the system <stdint.h>
does not define some required integer types, and
vk_platform.h
will declare fallback definitions of those types. This is
included for backwards compatibility with very old compilers, such as
Microsoft Visual Studio version 2008 or before.
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 |
---|---|---|
|
| X11 Xlib library |
|
| X11 Xcb library |
|
| Wayland |
|
| Mir |
|
| Android Native |
|
| Windows Win32 |