vk: Add the WSI header files
[mesa.git] / include / vulkan / vk_wsi_swapchain.h
1 //
2 // File: vk_wsi_swapchain.h
3 //
4 /*
5 ** Copyright (c) 2014 The Khronos Group Inc.
6 **
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:
14 **
15 ** The above copyright notice and this permission notice shall be included
16 ** in all copies or substantial portions of the Materials.
17 **
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.
25 */
26
27 #ifndef __VK_WSI_SWAPCHAIN_H__
28 #define __VK_WSI_SWAPCHAIN_H__
29
30 #include "vulkan.h"
31
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"
35
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif // __cplusplus
40
41 // ------------------------------------------------------------------------------------------------
42 // Objects
43
44 // ------------------------------------------------------------------------------------------------
45 // Enumeration constants
46
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)))
49
50 // Extend VkStructureType enum with extension specific constants
51 #define VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI VK_WSI_SWAPCHAIN_ENUM(VkStructureType, 0)
52
53 // ------------------------------------------------------------------------------------------------
54 // Enumerations
55
56 typedef enum VkPlatformWSI_
57 {
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
68 } VkPlatformWSI;
69
70 // ------------------------------------------------------------------------------------------------
71 // Flags
72
73 // ------------------------------------------------------------------------------------------------
74 // Structures
75
76 // pPlatformHandle points to this struct when platform is VK_PLATFORM_X11_WSI
77 #ifdef _X11_XLIB_H_
78 typedef struct VkPlatformHandleX11WSI_
79 {
80 Display* dpy; // Display connection to an X server
81 Window root; // To identify the X screen
82 } VkPlatformHandleX11WSI;
83 #endif /* _X11_XLIB_H_ */
84
85 // pPlatformHandle points to this struct when platform is VK_PLATFORM_XCB_WSI
86 #ifdef __XCB_H__
87 typedef struct VkPlatformHandleXcbWSI_
88 {
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__ */
93
94 // Placeholder structure header for the different types of surface description structures
95 typedef struct VkSurfaceDescriptionWSI_
96 {
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;
100
101 // Surface description structure for a native platform window surface
102 typedef struct VkSurfaceDescriptionWindowWSI_
103 {
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;
110
111 // ------------------------------------------------------------------------------------------------
112 // Function types
113
114 typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceSurfaceSupportWSI)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, const VkSurfaceDescriptionWSI* pSurfaceDescription, VkBool32* pSupported);
115
116 // ------------------------------------------------------------------------------------------------
117 // Function prototypes
118
119 #ifdef VK_PROTOTYPES
120
121 VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportWSI(
122 VkPhysicalDevice physicalDevice,
123 uint32_t queueFamilyIndex,
124 const VkSurfaceDescriptionWSI* pSurfaceDescription,
125 VkBool32* pSupported);
126
127 #endif // VK_PROTOTYPES
128
129 #ifdef __cplusplus
130 } // extern "C"
131 #endif // __cplusplus
132
133 #endif // __VK_WSI_SWAPCHAIN_H__