API Boilerplate

This appendix defines Vulkan API features that are infrastructure required for a complete functional description of Vulkan, but do not logically belong elsewhere in the Specification.

Vulkan Header Files

Vulkan is defined as an API in the C99 language. Khronos provides a corresponding set of header files for applications using the API, which may be used in either C or C++ code. The interface descriptions in the specification are the same as the interfaces defined in these header files, and both are derived from the vk.xml XML API Registry, which is the canonical machine-readable description of the Vulkan API. The Registry, scripts used for processing it into various forms, and documentation of the registry schema are available as described at https://registry.khronos.org/vulkan/#apiregistry .

Language bindings for other languages can be defined using the information in the Specification and the Registry. Khronos does not provide any such bindings, but third-party developers have created some additional bindings.

Vulkan Combined API Header vulkan.h (Informative)

Applications normally will include the header vulkan.h. In turn, vulkan.h always includes the following headers:

In addition, specific preprocessor macros defined at the time vulkan.h is included cause header files for the corresponding window system-specific and provisional interfaces to be included, as described below.

Vulkan Platform-Specific Header vk_platform.h (Informative)

Platform-specific macros and interfaces are defined in vk_platform.h. These macros are used to control platform-dependent behavior, and their exact definitions are under the control of specific platforms and Vulkan implementations.

Platform-Specific Calling Conventions

On many platforms the following macros are empty strings, causing platform- and compiler-specific default calling conventions to be used.

VKAPI_ATTRVulkan function attribute macro
VKAPI_CALLVulkan function calling conventions macro
VKAPI_PTRVulkan function pointer calling conventions macro

With these macros, a Vulkan function declaration takes the form of:

VKAPI_ATTR <return_type> VKAPI_CALL <command_name>(<command_parameters>);

Additionally, a Vulkan function pointer type declaration takes the form of:

typedef <return_type> (VKAPI_PTR *PFN_<command_name>)(<command_parameters>);

Platform-Specific Header Control

VK_NO_STDINT_HControl definition of <stdint.h> types
VK_NO_STDDEF_HControl definition of <stddef.h> types

Vulkan Core API Header vulkan_core.h

Applications that do not make use of window system-specific extensions may simply include vulkan_core.h instead of vulkan.h, although there is usually no reason to do so. In addition to the Vulkan API, vulkan_core.h also defines and / or uses a small number of C preprocessor macros that are described below.

Vulkan Header File Compile Time Controls

VK_NO_PROTOTYPESVulkan header file prototype inclusion control
VK_ONLY_EXPORTED_PROTOTYPESVulkan header file exported prototype inclusion control

Vulkan Header File Version Number

VK_HEADER_VERSIONVulkan header file version number
VK_HEADER_VERSION_COMPLETEVulkan header file complete version number
VK_API_VERSIONDeprecated version number macro

Vulkan Handle Macros

VK_DEFINE_HANDLEDeclare a dispatchable object handle
VK_DEFINE_NON_DISPATCHABLE_HANDLEDeclare a non-dispatchable object handle
VK_NULL_HANDLEReserved non-valid object handle
VK_USE_64_BIT_PTR_DEFINESDefines whether non-dispatchable handles are a 64-bit pointer type or a 64-bit unsigned integer type

Window System-Specific Header Control (Informative)

WSIheadersControl inclusion of window system interface extensions

Provisional Extension Header Control (Informative)

provisional-headersControl inclusion of provisional extensions

Video Std Headers

Performing video coding operations usually involves the application having to provide various parameters, data structures, or other syntax elements specific to the particular video compression standard used, and the associated semantics are covered by the specification of those.

The interface descriptions of these are available in the header files derived from the video.xml XML file, which is the canonical machine-readable description of data structures and enumerations that are associated with the externally-provided video compression standards.

Video Std Header NameDescriptionHeader FileRelated Extensions
vulkan_video_codecs_commonCodec-independent common definitions<vk_video/vulkan_video_codecs_common.h>-
vulkan_video_codec_h264stdITU-T H.264 common definitions<vk_video/vulkan_video_codec_h264std.h>VK_KHR_video_decode_h264,VK_KHR_video_encode_h264
vulkan_video_codec_h264std_decodeITU-T H.264 decode-specific definitions<vk_video/vulkan_video_codec_h264std_decode.h>VK_KHR_video_decode_h264
vulkan_video_codec_h264std_encodeITU-T H.264 encode-specific definitions<vk_video/vulkan_video_codec_h264std_encode.h>VK_KHR_video_encode_h264
vulkan_video_codec_h265stdITU-T H.265 common definitions<vk_video/vulkan_video_codec_h265std.h>VK_KHR_video_decode_h265,VK_KHR_video_encode_h265
vulkan_video_codec_h265std_decodeITU-T H.265 decode-specific definitions<vk_video/vulkan_video_codec_h265std_decode.h>VK_KHR_video_decode_h265
vulkan_video_codec_h265std_encodeITU-T H.265 encode-specific definitions<vk_video/vulkan_video_codec_h265std_encode.h>VK_KHR_video_encode_h265
vulkan_video_codec_vp9stdVP9 common definitions<vk_video/vulkan_video_codec_vp9std.h>VK_KHR_video_decode_vp9
vulkan_video_codec_vp9std_decodeVP9 decode-specific definitions<vk_video/vulkan_video_codec_vp9std_decode.h>VK_KHR_video_decode_vp9
vulkan_video_codec_av1stdAV1 common definitions<vk_video/vulkan_video_codec_av1std.h>VK_KHR_video_decode_av1
vulkan_video_codec_av1std_decodeAV1 decode-specific definitions<vk_video/vulkan_video_codec_av1std_decode.h>VK_KHR_video_decode_av1
vulkan_video_codec_av1std_encodeAV1 encode-specific definitions<vk_video/vulkan_video_codec_av1std_encode.h>VK_KHR_video_encode_av1