2 // File: vk_wsi_swapchain.h
5 ** Copyright (c) 2014 The Khronos Group Inc.
7 ** Permission is hereby granted, free of charge, to any person obtaining a
8 ** copy of this software and/or associated documentation files (the
9 ** "Materials"), to deal in the Materials without restriction, including
10 ** without limitation the rights to use, copy, modify, merge, publish,
11 ** distribute, sublicense, and/or sell copies of the Materials, and to
12 ** permit persons to whom the Materials are furnished to do so, subject to
13 ** the following conditions:
15 ** The above copyright notice and this permission notice shall be included
16 ** in all copies or substantial portions of the Materials.
18 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 #ifndef __VK_WSI_SWAPCHAIN_H__
28 #define __VK_WSI_SWAPCHAIN_H__
32 #define VK_WSI_SWAPCHAIN_REVISION 12
33 #define VK_WSI_SWAPCHAIN_EXTENSION_NUMBER 1
34 #define VK_WSI_SWAPCHAIN_EXTENSION_NAME "VK_WSI_swapchain"
41 // ------------------------------------------------------------------------------------------------
44 // ------------------------------------------------------------------------------------------------
45 // Enumeration constants
47 #define VK_WSI_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_WSI_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id)))
48 #define VK_WSI_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_WSI_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id)))
50 // Extend VkStructureType enum with extension specific constants
51 #define VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI VK_WSI_SWAPCHAIN_ENUM(VkStructureType, 0)
53 // ------------------------------------------------------------------------------------------------
56 typedef enum VkPlatformWSI_
58 VK_PLATFORM_WIN32_WSI
= 0,
59 VK_PLATFORM_X11_WSI
= 1,
60 VK_PLATFORM_XCB_WSI
= 2,
61 VK_PLATFORM_ANDROID_WSI
= 3,
62 VK_PLATFORM_WAYLAND_WSI
= 4,
63 VK_PLATFORM_MIR_WSI
= 5,
64 VK_PLATFORM_BEGIN_RANGE_WSI
= VK_PLATFORM_WIN32_WSI
,
65 VK_PLATFORM_END_RANGE_WSI
= VK_PLATFORM_MIR_WSI
,
66 VK_PLATFORM_NUM_WSI
= (VK_PLATFORM_MIR_WSI
- VK_PLATFORM_WIN32_WSI
+ 1),
67 VK_PLATFORM_MAX_ENUM_WSI
= 0x7FFFFFFF
70 // ------------------------------------------------------------------------------------------------
73 // ------------------------------------------------------------------------------------------------
76 // pPlatformHandle points to this struct when platform is VK_PLATFORM_X11_WSI
78 typedef struct VkPlatformHandleX11WSI_
80 Display
* dpy
; // Display connection to an X server
81 Window root
; // To identify the X screen
82 } VkPlatformHandleX11WSI
;
83 #endif /* _X11_XLIB_H_ */
85 // pPlatformHandle points to this struct when platform is VK_PLATFORM_XCB_WSI
87 typedef struct VkPlatformHandleXcbWSI_
89 xcb_connection_t
* connection
; // XCB connection to an X server
90 xcb_window_t root
; // To identify the X screen
91 } VkPlatformHandleXcbWSI
;
92 #endif /* __XCB_H__ */
94 // Placeholder structure header for the different types of surface description structures
95 typedef struct VkSurfaceDescriptionWSI_
97 VkStructureType sType
; // Can be any of the VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_XXX_WSI constants
98 const void* pNext
; // Pointer to next structure
99 } VkSurfaceDescriptionWSI
;
101 // Surface description structure for a native platform window surface
102 typedef struct VkSurfaceDescriptionWindowWSI_
104 VkStructureType sType
; // Must be VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI
105 const void* pNext
; // Pointer to next structure
106 VkPlatformWSI platform
; // e.g. VK_PLATFORM_*_WSI
107 void* pPlatformHandle
;
108 void* pPlatformWindow
;
109 } VkSurfaceDescriptionWindowWSI
;
111 // ------------------------------------------------------------------------------------------------
114 typedef VkResult (VKAPI
*PFN_vkGetPhysicalDeviceSurfaceSupportWSI
)(VkPhysicalDevice physicalDevice
, uint32_t queueFamilyIndex
, const VkSurfaceDescriptionWSI
* pSurfaceDescription
, VkBool32
* pSupported
);
116 // ------------------------------------------------------------------------------------------------
117 // Function prototypes
121 VkResult VKAPI
vkGetPhysicalDeviceSurfaceSupportWSI(
122 VkPhysicalDevice physicalDevice
,
123 uint32_t queueFamilyIndex
,
124 const VkSurfaceDescriptionWSI
* pSurfaceDescription
,
125 VkBool32
* pSupported
);
127 #endif // VK_PROTOTYPES
131 #endif // __cplusplus
133 #endif // __VK_WSI_SWAPCHAIN_H__