Halide
vulkan_interface.h
Go to the documentation of this file.
1 #ifndef HALIDE_RUNTIME_VULKAN_INTERFACE_H
2 #define HALIDE_RUNTIME_VULKAN_INTERFACE_H
3 
4 #include "runtime_internal.h"
5 
6 // --------------------------------------------------------------------------
7 // Vulkan Specific Definitions
8 // --------------------------------------------------------------------------
9 
10 // Vulkan API version identifier macro
11 #define VK_MAKE_API_VERSION(variant, major, minor, patch) \
12  ((((uint32_t)(variant)) << 29) | (((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
13 
14 // Vulkan API version 1.0.0
15 #define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0) // Patch version should always be set to 0
16 
17 // Environment variable string delimiter
18 #ifdef WINDOWS
19 #define HL_VK_ENV_DELIM ";"
20 #else
21 #define HL_VK_ENV_DELIM ":"
22 #endif
23 
24 // Prototypes for the subset of the Vulkan API we need
25 #define VK_NO_PROTOTYPES
26 // NOLINTNEXTLINE
27 #include "mini_vulkan.h"
28 
29 // --------------------------------------------------------------------------
30 // Vulkan API Definition
31 // --------------------------------------------------------------------------
32 
33 namespace Halide {
34 namespace Runtime {
35 namespace Internal {
36 namespace Vulkan {
37 
38 // --------------------------------------------------------------------------
39 
40 // Halide device interface struct for runtime specific funtion table
42 
43 // --------------------------------------------------------------------------
44 
45 // clang-format off
46 #define VULKAN_FN(fn) WEAK PFN_##fn fn;
47 #include "vulkan_functions.h"
48 #undef VULKAN_FN
49 // clang-format on
50 
51 void WEAK vk_load_vulkan_functions(VkInstance instance) {
52 #define VULKAN_FN(fn) fn = (PFN_##fn)vkGetInstanceProcAddr(instance, #fn);
53 #include "vulkan_functions.h"
54 #undef VULKAN_FN
55 }
56 
57 // --
58 
59 // --------------------------------------------------------------------------
60 
61 } // namespace Vulkan
62 } // namespace Internal
63 } // namespace Runtime
64 } // namespace Halide
65 
66 #endif // HALIDE_RUNTIME_VULKAN_INTERFACE_H
Halide::Runtime::Internal::Vulkan::vulkan_device_interface
WEAK halide_device_interface_t vulkan_device_interface
Halide::Runtime::Internal::Vulkan::vk_load_vulkan_functions
void WEAK vk_load_vulkan_functions(VkInstance instance)
Definition: vulkan_interface.h:51
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AbstractGenerator.h:19
halide_device_interface_t
Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device all...
Definition: HalideRuntime.h:770
vulkan_functions.h
WEAK
#define WEAK
Definition: runtime_internal.h:52
runtime_internal.h
mini_vulkan.h