5 * Copyright (c) 2015-2016 The Khronos Group Inc.
6 * Copyright (c) 2015-2016 Valve Corporation
7 * Copyright (c) 2015-2016 LunarG, Inc.
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
29 * Loader-ICD version negotiation API
31 #define CURRENT_LOADER_ICD_INTERFACE_VERSION 3
32 #define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
33 typedef VkResult (VKAPI_PTR
*PFN_vkNegotiateLoaderICDInterfaceVersion
)(uint32_t *pVersion
);
35 * The ICD must reserve space for a pointer for the loader's dispatch
36 * table, at the start of <each object>.
37 * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
40 #define ICD_LOADER_MAGIC 0x01CDC0DE
43 uintptr_t loaderMagic
;
47 static inline void set_loader_magic_value(void *pNewObject
) {
48 VK_LOADER_DATA
*loader_info
= (VK_LOADER_DATA
*)pNewObject
;
49 loader_info
->loaderMagic
= ICD_LOADER_MAGIC
;
52 static inline bool valid_loader_magic_value(void *pNewObject
) {
53 const VK_LOADER_DATA
*loader_info
= (VK_LOADER_DATA
*)pNewObject
;
54 return (loader_info
->loaderMagic
& 0xffffffff) == ICD_LOADER_MAGIC
;
58 * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
59 * contains the platform-specific connection and surface information.
62 VK_ICD_WSI_PLATFORM_MIR
,
63 VK_ICD_WSI_PLATFORM_WAYLAND
,
64 VK_ICD_WSI_PLATFORM_WIN32
,
65 VK_ICD_WSI_PLATFORM_XCB
,
66 VK_ICD_WSI_PLATFORM_XLIB
,
67 VK_ICD_WSI_PLATFORM_DISPLAY
71 VkIcdWsiPlatform platform
;
74 #ifdef VK_USE_PLATFORM_MIR_KHR
76 VkIcdSurfaceBase base
;
77 MirConnection
*connection
;
78 MirSurface
*mirSurface
;
80 #endif // VK_USE_PLATFORM_MIR_KHR
82 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
84 VkIcdSurfaceBase base
;
85 struct wl_display
*display
;
86 struct wl_surface
*surface
;
87 } VkIcdSurfaceWayland
;
88 #endif // VK_USE_PLATFORM_WAYLAND_KHR
90 #ifdef VK_USE_PLATFORM_WIN32_KHR
92 VkIcdSurfaceBase base
;
96 #endif // VK_USE_PLATFORM_WIN32_KHR
98 #ifdef VK_USE_PLATFORM_XCB_KHR
100 VkIcdSurfaceBase base
;
101 xcb_connection_t
*connection
;
104 #endif // VK_USE_PLATFORM_XCB_KHR
106 #ifdef VK_USE_PLATFORM_XLIB_KHR
108 VkIcdSurfaceBase base
;
112 #endif // VK_USE_PLATFORM_XLIB_KHR
114 #ifdef VK_USE_PLATFORM_ANDROID_KHR
116 ANativeWindow
* window
;
117 } VkIcdSurfaceAndroid
;
118 #endif //VK_USE_PLATFORM_ANDROID_KHR
121 VkIcdSurfaceBase base
;
122 VkDisplayModeKHR displayMode
;
124 uint32_t planeStackIndex
;
125 VkSurfaceTransformFlagBitsKHR transform
;
127 VkDisplayPlaneAlphaFlagBitsKHR alphaMode
;
128 VkExtent2D imageExtent
;
129 } VkIcdSurfaceDisplay
;