2 // File: vk_wsi_display.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_LUNARG_H__
28 #define __VK_WSI_LUNARG_H__
32 #define VK_WSI_LUNARG_REVISION 3
33 #define VK_WSI_LUNARG_EXTENSION_NUMBER 1
40 // ------------------------------------------------------------------------------------------------
43 VK_DEFINE_DISP_SUBCLASS_HANDLE(VkDisplayWSI
, VkObject
)
44 VK_DEFINE_DISP_SUBCLASS_HANDLE(VkSwapChainWSI
, VkObject
)
46 // ------------------------------------------------------------------------------------------------
47 // Enumeration constants
49 #define VK_WSI_LUNARG_ENUM(type,id) ((type)(VK_WSI_LUNARG_EXTENSION_NUMBER * -1000 + (id)))
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)
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)
59 // Extend VkImageLayout enum with extension specific constants
60 #define VK_IMAGE_LAYOUT_PRESENT_SOURCE_WSI VK_WSI_LUNARG_ENUM(VkImageLayout, 0)
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)
66 // ------------------------------------------------------------------------------------------------
69 typedef enum VkDisplayInfoTypeWSI_
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
74 VK_ENUM_RANGE(DISPLAY_INFO_TYPE
, FORMAT_PROPERTIES_WSI
, FORMAT_PROPERTIES_WSI
)
75 } VkDisplayInfoTypeWSI
;
77 typedef enum VkSwapChainInfoTypeWSI_
79 // Info type for vkGetSwapChainInfo()
80 VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI
= 0x00000000, // Return information about the persistent images of the swapchain
82 VK_ENUM_RANGE(SWAP_CHAIN_INFO_TYPE
, PERSISTENT_IMAGES_WSI
, PERSISTENT_IMAGES_WSI
)
83 } VkSwapChainInfoTypeWSI
;
85 // ------------------------------------------------------------------------------------------------
88 typedef VkFlags VkSwapModeFlagsWSI
;
89 typedef enum VkSwapModeFlagBitsWSI_
91 VK_SWAP_MODE_FLIP_BIT_WSI
= VK_BIT(0),
92 VK_SWAP_MODE_BLIT_BIT_WSI
= VK_BIT(1),
93 } VkSwapModeFlagBitsWSI
;
95 // ------------------------------------------------------------------------------------------------
98 typedef struct VkDisplayPropertiesWSI_
100 VkDisplayWSI display
; // Handle of the display object
101 VkExtent2D physicalResolution
; // Max resolution for CRT?
102 } VkDisplayPropertiesWSI
;
104 typedef struct VkDisplayFormatPropertiesWSI_
106 VkFormat swapChainFormat
; // Format of the images of the swap chain
107 } VkDisplayFormatPropertiesWSI
;
109 typedef struct VkSwapChainCreateInfoWSI_
111 VkStructureType sType
; // Must be VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI
112 const void* pNext
; // Pointer to next structure
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
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
124 uint32_t imageCount
; // Number of images in the swap chain
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)
131 VkFlags swapModeFlags
; // Allowed swap modes (see VkSwapModeFlagsWSI)
132 } VkSwapChainCreateInfoWSI
;
134 typedef struct VkSwapChainImageInfoWSI_
136 VkImage image
; // Persistent swap chain image handle
137 VkDeviceMemory memory
; // Persistent swap chain image's memory handle
138 } VkSwapChainImageInfoWSI
;
140 typedef struct VkPhysicalDeviceQueuePresentPropertiesWSI_
142 bool32_t supportsPresent
; // Tells whether the queue supports presenting
143 } VkPhysicalDeviceQueuePresentPropertiesWSI
;
145 typedef struct VkPresentInfoWSI_
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
153 // ------------------------------------------------------------------------------------------------
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
);
162 // ------------------------------------------------------------------------------------------------
163 // Function prototypes
167 VkResult VKAPI
vkGetDisplayInfoWSI(
168 VkDisplayWSI display
,
169 VkDisplayInfoTypeWSI infoType
,
173 VkResult VKAPI
vkCreateSwapChainWSI(
175 const VkSwapChainCreateInfoWSI
* pCreateInfo
,
176 VkSwapChainWSI
* pSwapChain
);
178 VkResult VKAPI
vkDestroySwapChainWSI(
179 VkSwapChainWSI swapChain
);
181 VkResult VKAPI
vkGetSwapChainInfoWSI(
182 VkSwapChainWSI swapChain
,
183 VkSwapChainInfoTypeWSI infoType
,
187 VkResult VKAPI
vkQueuePresentWSI(
189 const VkPresentInfoWSI
* pPresentInfo
);
191 #endif // VK_PROTOTYPES
195 #endif // __cplusplus
197 #endif // __VK_WSI_LUNARG_H__