diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/video/khronos/vulkan/vk_icd.h | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/khronos/vulkan/vk_icd.h')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/khronos/vulkan/vk_icd.h | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/khronos/vulkan/vk_icd.h b/contrib/SDL-3.2.8/src/video/khronos/vulkan/vk_icd.h new file mode 100644 index 0000000..59204a3 --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/khronos/vulkan/vk_icd.h | |||
| @@ -0,0 +1,244 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2015-2023 The Khronos Group Inc. | ||
| 3 | * Copyright 2015-2023 Valve Corporation | ||
| 4 | * Copyright 2015-2023 LunarG, Inc. | ||
| 5 | * | ||
| 6 | * SPDX-License-Identifier: Apache-2.0 | ||
| 7 | */ | ||
| 8 | #pragma once | ||
| 9 | |||
| 10 | #include "vulkan.h" | ||
| 11 | #include <stdbool.h> | ||
| 12 | |||
| 13 | // Loader-ICD version negotiation API. Versions add the following features: | ||
| 14 | // Version 0 - Initial. Doesn't support vk_icdGetInstanceProcAddr | ||
| 15 | // or vk_icdNegotiateLoaderICDInterfaceVersion. | ||
| 16 | // Version 1 - Add support for vk_icdGetInstanceProcAddr. | ||
| 17 | // Version 2 - Add Loader/ICD Interface version negotiation | ||
| 18 | // via vk_icdNegotiateLoaderICDInterfaceVersion. | ||
| 19 | // Version 3 - Add ICD creation/destruction of KHR_surface objects. | ||
| 20 | // Version 4 - Add unknown physical device extension querying via | ||
| 21 | // vk_icdGetPhysicalDeviceProcAddr. | ||
| 22 | // Version 5 - Tells ICDs that the loader is now paying attention to the | ||
| 23 | // application version of Vulkan passed into the ApplicationInfo | ||
| 24 | // structure during vkCreateInstance. This will tell the ICD | ||
| 25 | // that if the loader is older, it should automatically fail a | ||
| 26 | // call for any API version > 1.0. Otherwise, the loader will | ||
| 27 | // manually determine if it can support the expected version. | ||
| 28 | // Version 6 - Add support for vk_icdEnumerateAdapterPhysicalDevices. | ||
| 29 | // Version 7 - If an ICD supports any of the following functions, they must be | ||
| 30 | // queryable with vk_icdGetInstanceProcAddr: | ||
| 31 | // vk_icdNegotiateLoaderICDInterfaceVersion | ||
| 32 | // vk_icdGetPhysicalDeviceProcAddr | ||
| 33 | // vk_icdEnumerateAdapterPhysicalDevices (Windows only) | ||
| 34 | // In addition, these functions no longer need to be exported directly. | ||
| 35 | // This version allows drivers provided through the extension | ||
| 36 | // VK_LUNARG_direct_driver_loading be able to support the entire | ||
| 37 | // Driver-Loader interface. | ||
| 38 | |||
| 39 | #define CURRENT_LOADER_ICD_INTERFACE_VERSION 7 | ||
| 40 | #define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0 | ||
| 41 | #define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4 | ||
| 42 | |||
| 43 | // Old typedefs that don't follow a proper naming convention but are preserved for compatibility | ||
| 44 | typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion); | ||
| 45 | // This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this | ||
| 46 | // file directly, it won't be found. | ||
| 47 | #ifndef PFN_GetPhysicalDeviceProcAddr | ||
| 48 | typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName); | ||
| 49 | #endif | ||
| 50 | |||
| 51 | // Typedefs for loader/ICD interface | ||
| 52 | typedef VkResult (VKAPI_PTR *PFN_vk_icdNegotiateLoaderICDInterfaceVersion)(uint32_t* pVersion); | ||
| 53 | typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetInstanceProcAddr)(VkInstance instance, const char* pName); | ||
| 54 | typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName); | ||
| 55 | #if defined(VK_USE_PLATFORM_WIN32_KHR) | ||
| 56 | typedef VkResult (VKAPI_PTR *PFN_vk_icdEnumerateAdapterPhysicalDevices)(VkInstance instance, LUID adapterLUID, | ||
| 57 | uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); | ||
| 58 | #endif | ||
| 59 | |||
| 60 | // Prototypes for loader/ICD interface | ||
| 61 | #if !defined(VK_NO_PROTOTYPES) | ||
| 62 | #ifdef __cplusplus | ||
| 63 | extern "C" { | ||
| 64 | #endif | ||
| 65 | VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pVersion); | ||
| 66 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName); | ||
| 67 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char* pName); | ||
| 68 | #if defined(VK_USE_PLATFORM_WIN32_KHR) | ||
| 69 | VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID, | ||
| 70 | uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); | ||
| 71 | #endif | ||
| 72 | #ifdef __cplusplus | ||
| 73 | } | ||
| 74 | #endif | ||
| 75 | #endif | ||
| 76 | |||
| 77 | /* | ||
| 78 | * The ICD must reserve space for a pointer for the loader's dispatch | ||
| 79 | * table, at the start of <each object>. | ||
| 80 | * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro. | ||
| 81 | */ | ||
| 82 | |||
| 83 | #define ICD_LOADER_MAGIC 0x01CDC0DE | ||
| 84 | |||
| 85 | typedef union { | ||
| 86 | uintptr_t loaderMagic; | ||
| 87 | void *loaderData; | ||
| 88 | } VK_LOADER_DATA; | ||
| 89 | |||
| 90 | static inline void set_loader_magic_value(void *pNewObject) { | ||
| 91 | VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject; | ||
| 92 | loader_info->loaderMagic = ICD_LOADER_MAGIC; | ||
| 93 | } | ||
| 94 | |||
| 95 | static inline bool valid_loader_magic_value(void *pNewObject) { | ||
| 96 | const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject; | ||
| 97 | return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC; | ||
| 98 | } | ||
| 99 | |||
| 100 | /* | ||
| 101 | * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that | ||
| 102 | * contains the platform-specific connection and surface information. | ||
| 103 | */ | ||
| 104 | typedef enum { | ||
| 105 | VK_ICD_WSI_PLATFORM_MIR, | ||
| 106 | VK_ICD_WSI_PLATFORM_WAYLAND, | ||
| 107 | VK_ICD_WSI_PLATFORM_WIN32, | ||
| 108 | VK_ICD_WSI_PLATFORM_XCB, | ||
| 109 | VK_ICD_WSI_PLATFORM_XLIB, | ||
| 110 | VK_ICD_WSI_PLATFORM_ANDROID, | ||
| 111 | VK_ICD_WSI_PLATFORM_MACOS, | ||
| 112 | VK_ICD_WSI_PLATFORM_IOS, | ||
| 113 | VK_ICD_WSI_PLATFORM_DISPLAY, | ||
| 114 | VK_ICD_WSI_PLATFORM_HEADLESS, | ||
| 115 | VK_ICD_WSI_PLATFORM_METAL, | ||
| 116 | VK_ICD_WSI_PLATFORM_DIRECTFB, | ||
| 117 | VK_ICD_WSI_PLATFORM_VI, | ||
| 118 | VK_ICD_WSI_PLATFORM_GGP, | ||
| 119 | VK_ICD_WSI_PLATFORM_SCREEN, | ||
| 120 | VK_ICD_WSI_PLATFORM_FUCHSIA, | ||
| 121 | } VkIcdWsiPlatform; | ||
| 122 | |||
| 123 | typedef struct { | ||
| 124 | VkIcdWsiPlatform platform; | ||
| 125 | } VkIcdSurfaceBase; | ||
| 126 | |||
| 127 | #ifdef VK_USE_PLATFORM_MIR_KHR | ||
| 128 | typedef struct { | ||
| 129 | VkIcdSurfaceBase base; | ||
| 130 | MirConnection *connection; | ||
| 131 | MirSurface *mirSurface; | ||
| 132 | } VkIcdSurfaceMir; | ||
| 133 | #endif // VK_USE_PLATFORM_MIR_KHR | ||
| 134 | |||
| 135 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR | ||
| 136 | typedef struct { | ||
| 137 | VkIcdSurfaceBase base; | ||
| 138 | struct wl_display *display; | ||
| 139 | struct wl_surface *surface; | ||
| 140 | } VkIcdSurfaceWayland; | ||
| 141 | #endif // VK_USE_PLATFORM_WAYLAND_KHR | ||
| 142 | |||
| 143 | #ifdef VK_USE_PLATFORM_WIN32_KHR | ||
| 144 | typedef struct { | ||
| 145 | VkIcdSurfaceBase base; | ||
| 146 | HINSTANCE hinstance; | ||
| 147 | HWND hwnd; | ||
| 148 | } VkIcdSurfaceWin32; | ||
| 149 | #endif // VK_USE_PLATFORM_WIN32_KHR | ||
| 150 | |||
| 151 | #ifdef VK_USE_PLATFORM_XCB_KHR | ||
| 152 | typedef struct { | ||
| 153 | VkIcdSurfaceBase base; | ||
| 154 | xcb_connection_t *connection; | ||
| 155 | xcb_window_t window; | ||
| 156 | } VkIcdSurfaceXcb; | ||
| 157 | #endif // VK_USE_PLATFORM_XCB_KHR | ||
| 158 | |||
| 159 | #ifdef VK_USE_PLATFORM_XLIB_KHR | ||
| 160 | typedef struct { | ||
| 161 | VkIcdSurfaceBase base; | ||
| 162 | Display *dpy; | ||
| 163 | Window window; | ||
| 164 | } VkIcdSurfaceXlib; | ||
| 165 | #endif // VK_USE_PLATFORM_XLIB_KHR | ||
| 166 | |||
| 167 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT | ||
| 168 | typedef struct { | ||
| 169 | VkIcdSurfaceBase base; | ||
| 170 | IDirectFB *dfb; | ||
| 171 | IDirectFBSurface *surface; | ||
| 172 | } VkIcdSurfaceDirectFB; | ||
| 173 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT | ||
| 174 | |||
| 175 | #ifdef VK_USE_PLATFORM_ANDROID_KHR | ||
| 176 | typedef struct { | ||
| 177 | VkIcdSurfaceBase base; | ||
| 178 | struct ANativeWindow *window; | ||
| 179 | } VkIcdSurfaceAndroid; | ||
| 180 | #endif // VK_USE_PLATFORM_ANDROID_KHR | ||
| 181 | |||
| 182 | #ifdef VK_USE_PLATFORM_MACOS_MVK | ||
| 183 | typedef struct { | ||
| 184 | VkIcdSurfaceBase base; | ||
| 185 | const void *pView; | ||
| 186 | } VkIcdSurfaceMacOS; | ||
| 187 | #endif // VK_USE_PLATFORM_MACOS_MVK | ||
| 188 | |||
| 189 | #ifdef VK_USE_PLATFORM_IOS_MVK | ||
| 190 | typedef struct { | ||
| 191 | VkIcdSurfaceBase base; | ||
| 192 | const void *pView; | ||
| 193 | } VkIcdSurfaceIOS; | ||
| 194 | #endif // VK_USE_PLATFORM_IOS_MVK | ||
| 195 | |||
| 196 | #ifdef VK_USE_PLATFORM_GGP | ||
| 197 | typedef struct { | ||
| 198 | VkIcdSurfaceBase base; | ||
| 199 | GgpStreamDescriptor streamDescriptor; | ||
| 200 | } VkIcdSurfaceGgp; | ||
| 201 | #endif // VK_USE_PLATFORM_GGP | ||
| 202 | |||
| 203 | typedef struct { | ||
| 204 | VkIcdSurfaceBase base; | ||
| 205 | VkDisplayModeKHR displayMode; | ||
| 206 | uint32_t planeIndex; | ||
| 207 | uint32_t planeStackIndex; | ||
| 208 | VkSurfaceTransformFlagBitsKHR transform; | ||
| 209 | float globalAlpha; | ||
| 210 | VkDisplayPlaneAlphaFlagBitsKHR alphaMode; | ||
| 211 | VkExtent2D imageExtent; | ||
| 212 | } VkIcdSurfaceDisplay; | ||
| 213 | |||
| 214 | typedef struct { | ||
| 215 | VkIcdSurfaceBase base; | ||
| 216 | } VkIcdSurfaceHeadless; | ||
| 217 | |||
| 218 | #ifdef VK_USE_PLATFORM_METAL_EXT | ||
| 219 | typedef struct { | ||
| 220 | VkIcdSurfaceBase base; | ||
| 221 | const CAMetalLayer *pLayer; | ||
| 222 | } VkIcdSurfaceMetal; | ||
| 223 | #endif // VK_USE_PLATFORM_METAL_EXT | ||
| 224 | |||
| 225 | #ifdef VK_USE_PLATFORM_VI_NN | ||
| 226 | typedef struct { | ||
| 227 | VkIcdSurfaceBase base; | ||
| 228 | void *window; | ||
| 229 | } VkIcdSurfaceVi; | ||
| 230 | #endif // VK_USE_PLATFORM_VI_NN | ||
| 231 | |||
| 232 | #ifdef VK_USE_PLATFORM_SCREEN_QNX | ||
| 233 | typedef struct { | ||
| 234 | VkIcdSurfaceBase base; | ||
| 235 | struct _screen_context *context; | ||
| 236 | struct _screen_window *window; | ||
| 237 | } VkIcdSurfaceScreen; | ||
| 238 | #endif // VK_USE_PLATFORM_SCREEN_QNX | ||
| 239 | |||
| 240 | #ifdef VK_USE_PLATFORM_FUCHSIA | ||
| 241 | typedef struct { | ||
| 242 | VkIcdSurfaceBase base; | ||
| 243 | } VkIcdSurfaceImagePipe; | ||
| 244 | #endif // VK_USE_PLATFORM_FUCHSIA | ||
