Merge remote-tracking branch 'mesa-public/master' into vulkan
[mesa.git] / include / vulkan / vk_ext_khr_swapchain.h
1 //
2 // File: vk_ext_khr_swapchain.h
3 //
4 /*
5 ** Copyright (c) 2015 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_EXT_KHR_SWAPCHAIN_H__
28 #define __VK_EXT_KHR_SWAPCHAIN_H__
29
30 #include "vulkan.h"
31
32 #define VK_EXT_KHR_SWAPCHAIN_REVISION 17
33 #define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER 1
34 #define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME "VK_EXT_KHR_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_EXT_KHR_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id)))
48 #define VK_EXT_KHR_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id)))
49
50 // Extend VkStructureType enum with extension specific constants
51 #define VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_KHR VK_EXT_KHR_SWAPCHAIN_ENUM(VkStructureType, 0)
52
53 // ------------------------------------------------------------------------------------------------
54 // Enumerations
55
56 typedef enum {
57 VK_SURFACE_TRANSFORM_NONE_KHR = 0,
58 VK_SURFACE_TRANSFORM_ROT90_KHR = 1,
59 VK_SURFACE_TRANSFORM_ROT180_KHR = 2,
60 VK_SURFACE_TRANSFORM_ROT270_KHR = 3,
61 VK_SURFACE_TRANSFORM_HMIRROR_KHR = 4,
62 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_KHR = 5,
63 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_KHR = 6,
64 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_KHR = 7,
65 VK_SURFACE_TRANSFORM_INHERIT_KHR = 8,
66 } VkSurfaceTransformKHR;
67
68 typedef enum {
69 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
70 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
71 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
72 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
73 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
74 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
75 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
76 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
77 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
78 } VkSurfaceTransformFlagBitsKHR;
79 typedef VkFlags VkSurfaceTransformFlagsKHR;
80
81 typedef enum {
82 VK_PLATFORM_WIN32_KHR = 0,
83 VK_PLATFORM_X11_KHR = 1,
84 VK_PLATFORM_XCB_KHR = 2,
85 VK_PLATFORM_ANDROID_KHR = 3,
86 VK_PLATFORM_WAYLAND_KHR = 4,
87 VK_PLATFORM_MIR_KHR = 5,
88 VK_PLATFORM_BEGIN_RANGE_KHR = VK_PLATFORM_WIN32_KHR,
89 VK_PLATFORM_END_RANGE_KHR = VK_PLATFORM_MIR_KHR,
90 VK_PLATFORM_NUM_KHR = (VK_PLATFORM_MIR_KHR - VK_PLATFORM_WIN32_KHR + 1),
91 VK_PLATFORM_MAX_ENUM_KHR = 0x7FFFFFFF
92 } VkPlatformKHR;
93
94 // ------------------------------------------------------------------------------------------------
95 // Flags
96
97 // ------------------------------------------------------------------------------------------------
98 // Structures
99
100 // Placeholder structure header for the different types of surface description structures
101 typedef struct {
102 VkStructureType sType; // Can be any of the VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_XXX_KHR constants
103 const void* pNext; // Pointer to next structure
104 } VkSurfaceDescriptionKHR;
105
106 // Surface description structure for a native platform window surface
107 typedef struct {
108 VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_KHR
109 const void* pNext; // Pointer to next structure
110 VkPlatformKHR platform; // e.g. VK_PLATFORM_*_KHR
111 void* pPlatformHandle;
112 void* pPlatformWindow;
113 } VkSurfaceDescriptionWindowKHR;
114
115 // pPlatformHandle points to this struct when platform is VK_PLATFORM_X11_KHR
116 #ifdef _X11_XLIB_H_
117 typedef struct {
118 Display* dpy; // Display connection to an X server
119 Window root; // To identify the X screen
120 } VkPlatformHandleX11KHR;
121 #endif /* _X11_XLIB_H_ */
122
123 // pPlatformHandle points to this struct when platform is VK_PLATFORM_XCB_KHR
124 #ifdef __XCB_H__
125 typedef struct {
126 xcb_connection_t* connection; // XCB connection to an X server
127 xcb_window_t root; // To identify the X screen
128 } VkPlatformHandleXcbKHR;
129 #endif /* __XCB_H__ */
130
131 // ------------------------------------------------------------------------------------------------
132 // Function types
133
134 typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkBool32* pSupported);
135
136 // ------------------------------------------------------------------------------------------------
137 // Function prototypes
138
139 #ifdef VK_PROTOTYPES
140
141 VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportKHR(
142 VkPhysicalDevice physicalDevice,
143 uint32_t queueFamilyIndex,
144 const VkSurfaceDescriptionKHR* pSurfaceDescription,
145 VkBool32* pSupported);
146
147 #endif // VK_PROTOTYPES
148
149 #ifdef __cplusplus
150 } // extern "C"
151 #endif // __cplusplus
152
153 #endif // __VK_EXT_KHR_SWAPCHAIN_H__