vk/vulkan.h: One more quick enum refactor clean-up
[mesa.git] / include / vulkan / vk_wsi_lunarg.h
1 //
2 // File: vk_wsi_display.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_LUNARG_H__
28 #define __VK_WSI_LUNARG_H__
29
30 #include "vulkan.h"
31
32 #define VK_WSI_LUNARG_REVISION 3
33 #define VK_WSI_LUNARG_EXTENSION_NUMBER 1
34
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif // __cplusplus
39
40 // ------------------------------------------------------------------------------------------------
41 // Objects
42
43 VK_DEFINE_DISP_SUBCLASS_HANDLE(VkDisplayWSI, VkObject)
44 VK_DEFINE_DISP_SUBCLASS_HANDLE(VkSwapChainWSI, VkObject)
45
46 // ------------------------------------------------------------------------------------------------
47 // Enumeration constants
48
49 #define VK_WSI_LUNARG_ENUM(type,id) ((type)(VK_WSI_LUNARG_EXTENSION_NUMBER * -1000 + (id)))
50
51 // Extend VkPhysicalDeviceInfoType enum with extension specific constants
52 #define VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI VK_WSI_LUNARG_ENUM(VkPhysicalDeviceInfoType, 0)
53 #define VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PRESENT_PROPERTIES_WSI VK_WSI_LUNARG_ENUM(VkPhysicalDeviceInfoType, 1)
54
55 // Extend VkStructureType enum with extension specific constants
56 #define VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI VK_WSI_LUNARG_ENUM(VkStructureType, 0)
57 #define VK_STRUCTURE_TYPE_PRESENT_INFO_WSI VK_WSI_LUNARG_ENUM(VkStructureType, 1)
58
59 // Extend VkImageLayout enum with extension specific constants
60 #define VK_IMAGE_LAYOUT_PRESENT_SOURCE_WSI VK_WSI_LUNARG_ENUM(VkImageLayout, 0)
61
62 // Extend VkObjectType enum for new objects
63 #define VK_OBJECT_TYPE_DISPLAY_WSI VK_WSI_LUNARG_ENUM(VkObjectType, 0)
64 #define VK_OBJECT_TYPE_SWAP_CHAIN_WSI VK_WSI_LUNARG_ENUM(VkObjectType, 1)
65
66 // ------------------------------------------------------------------------------------------------
67 // Enumerations
68
69 typedef enum VkDisplayInfoTypeWSI_
70 {
71 // Info type for vkGetDisplayInfo()
72 VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI = 0x00000003, // Return the VkFormat(s) supported for swap chains with the display
73
74 VK_ENUM_RANGE(DISPLAY_INFO_TYPE, FORMAT_PROPERTIES_WSI, FORMAT_PROPERTIES_WSI)
75 } VkDisplayInfoTypeWSI;
76
77 typedef enum VkSwapChainInfoTypeWSI_
78 {
79 // Info type for vkGetSwapChainInfo()
80 VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI = 0x00000000, // Return information about the persistent images of the swapchain
81
82 VK_ENUM_RANGE(SWAP_CHAIN_INFO_TYPE, PERSISTENT_IMAGES_WSI, PERSISTENT_IMAGES_WSI)
83 } VkSwapChainInfoTypeWSI;
84
85 // ------------------------------------------------------------------------------------------------
86 // Flags
87
88 typedef VkFlags VkSwapModeFlagsWSI;
89 typedef enum VkSwapModeFlagBitsWSI_
90 {
91 VK_SWAP_MODE_FLIP_BIT_WSI = VK_BIT(0),
92 VK_SWAP_MODE_BLIT_BIT_WSI = VK_BIT(1),
93 } VkSwapModeFlagBitsWSI;
94
95 // ------------------------------------------------------------------------------------------------
96 // Structures
97
98 typedef struct VkDisplayPropertiesWSI_
99 {
100 VkDisplayWSI display; // Handle of the display object
101 VkExtent2D physicalResolution; // Max resolution for CRT?
102 } VkDisplayPropertiesWSI;
103
104 typedef struct VkDisplayFormatPropertiesWSI_
105 {
106 VkFormat swapChainFormat; // Format of the images of the swap chain
107 } VkDisplayFormatPropertiesWSI;
108
109 typedef struct VkSwapChainCreateInfoWSI_
110 {
111 VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI
112 const void* pNext; // Pointer to next structure
113
114 // TBD: It is not yet clear what the use will be for the following two
115 // values. It seems to be needed for more-global window-system handles
116 // (e.g. X11 display). If not needed for the SDK, we will drop it from
117 // this extension, and from a future version of this header.
118 const void* pNativeWindowSystemHandle; // Pointer to native window system handle
119 const void* pNativeWindowHandle; // Pointer to native window handle
120
121 uint32_t displayCount; // Number of displays the swap chain is created for
122 const VkDisplayWSI* pDisplays; // displayCount number of display objects the swap chain is created for
123
124 uint32_t imageCount; // Number of images in the swap chain
125
126 VkFormat imageFormat; // Format of the images of the swap chain
127 VkExtent2D imageExtent; // Width and height of the images of the swap chain
128 uint32_t imageArraySize; // Number of layers of the images of the swap chain (needed for multi-view rendering)
129 VkFlags imageUsageFlags; // Usage flags for the images of the swap chain (see VkImageUsageFlags)
130
131 VkFlags swapModeFlags; // Allowed swap modes (see VkSwapModeFlagsWSI)
132 } VkSwapChainCreateInfoWSI;
133
134 typedef struct VkSwapChainImageInfoWSI_
135 {
136 VkImage image; // Persistent swap chain image handle
137 VkDeviceMemory memory; // Persistent swap chain image's memory handle
138 } VkSwapChainImageInfoWSI;
139
140 typedef struct VkPhysicalDeviceQueuePresentPropertiesWSI_
141 {
142 bool32_t supportsPresent; // Tells whether the queue supports presenting
143 } VkPhysicalDeviceQueuePresentPropertiesWSI;
144
145 typedef struct VkPresentInfoWSI_
146 {
147 VkStructureType sType; // Must be VK_STRUCTURE_TYPE_PRESENT_INFO_WSI
148 const void* pNext; // Pointer to next structure
149 VkImage image; // Image to present
150 uint32_t flipInterval; // Flip interval
151 } VkPresentInfoWSI;
152
153 // ------------------------------------------------------------------------------------------------
154 // Function types
155
156 typedef VkResult (VKAPI *PFN_vkGetDisplayInfoWSI)(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData);
157 typedef VkResult (VKAPI *PFN_vkCreateSwapChainWSI)(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain);
158 typedef VkResult (VKAPI *PFN_vkDestroySwapChainWSI)(VkSwapChainWSI swapChain);
159 typedef VkResult (VKAPI *PFN_vkGetSwapChainInfoWSI)(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData);
160 typedef VkResult (VKAPI *PFN_vkQueuePresentWSI)(VkQueue queue, const VkPresentInfoWSI* pPresentInfo);
161
162 // ------------------------------------------------------------------------------------------------
163 // Function prototypes
164
165 #ifdef VK_PROTOTYPES
166
167 VkResult VKAPI vkGetDisplayInfoWSI(
168 VkDisplayWSI display,
169 VkDisplayInfoTypeWSI infoType,
170 size_t* pDataSize,
171 void* pData);
172
173 VkResult VKAPI vkCreateSwapChainWSI(
174 VkDevice device,
175 const VkSwapChainCreateInfoWSI* pCreateInfo,
176 VkSwapChainWSI* pSwapChain);
177
178 VkResult VKAPI vkDestroySwapChainWSI(
179 VkSwapChainWSI swapChain);
180
181 VkResult VKAPI vkGetSwapChainInfoWSI(
182 VkSwapChainWSI swapChain,
183 VkSwapChainInfoTypeWSI infoType,
184 size_t* pDataSize,
185 void* pData);
186
187 VkResult VKAPI vkQueuePresentWSI(
188 VkQueue queue,
189 const VkPresentInfoWSI* pPresentInfo);
190
191 #endif // VK_PROTOTYPES
192
193 #ifdef __cplusplus
194 } // extern "C"
195 #endif // __cplusplus
196
197 #endif // __VK_WSI_LUNARG_H__