Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 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 | |
Courtney Goeltzenleuchter | 110fdf9 | 2015-06-29 15:39:26 -0600 | [diff] [blame^] | 32 | #define VK_WSI_LUNARG_REVISION VK_MAKE_VERSION(0, 3, 0) |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 33 | #define VK_WSI_LUNARG_EXTENSION_NUMBER 1 |
Jon Ashburn | 07daee7 | 2015-05-21 18:13:33 -0600 | [diff] [blame] | 34 | #define VK_WSI_LUNARG_EXTENSION_NAME "VK_WSI_LunarG" |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 35 | |
| 36 | #ifdef __cplusplus |
| 37 | extern "C" |
| 38 | { |
| 39 | #endif // __cplusplus |
| 40 | |
| 41 | // ------------------------------------------------------------------------------------------------ |
| 42 | // Objects |
| 43 | |
Ian Elliott | 3a93185 | 2015-04-07 13:50:42 -0600 | [diff] [blame] | 44 | VK_DEFINE_DISP_SUBCLASS_HANDLE(VkDisplayWSI, VkObject) |
| 45 | VK_DEFINE_DISP_SUBCLASS_HANDLE(VkSwapChainWSI, VkObject) |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 46 | |
| 47 | // ------------------------------------------------------------------------------------------------ |
| 48 | // Enumeration constants |
| 49 | |
| 50 | #define VK_WSI_LUNARG_ENUM(type,id) ((type)(VK_WSI_LUNARG_EXTENSION_NUMBER * -1000 + (id))) |
| 51 | |
| 52 | // Extend VkPhysicalDeviceInfoType enum with extension specific constants |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 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 | |
Ian Elliott | 3a93185 | 2015-04-07 13:50:42 -0600 | [diff] [blame] | 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 | |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 66 | // ------------------------------------------------------------------------------------------------ |
| 67 | // Enumerations |
| 68 | |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 69 | |
| 70 | typedef enum VkSwapChainInfoTypeWSI_ |
| 71 | { |
| 72 | // Info type for vkGetSwapChainInfo() |
| 73 | VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI = 0x00000000, // Return information about the persistent images of the swapchain |
| 74 | |
| 75 | VK_ENUM_RANGE(SWAP_CHAIN_INFO_TYPE, PERSISTENT_IMAGES_WSI, PERSISTENT_IMAGES_WSI) |
| 76 | } VkSwapChainInfoTypeWSI; |
| 77 | |
| 78 | // ------------------------------------------------------------------------------------------------ |
| 79 | // Flags |
| 80 | |
| 81 | typedef VkFlags VkSwapModeFlagsWSI; |
| 82 | typedef enum VkSwapModeFlagBitsWSI_ |
| 83 | { |
| 84 | VK_SWAP_MODE_FLIP_BIT_WSI = VK_BIT(0), |
| 85 | VK_SWAP_MODE_BLIT_BIT_WSI = VK_BIT(1), |
| 86 | } VkSwapModeFlagBitsWSI; |
| 87 | |
| 88 | // ------------------------------------------------------------------------------------------------ |
| 89 | // Structures |
| 90 | |
| 91 | typedef struct VkDisplayPropertiesWSI_ |
| 92 | { |
| 93 | VkDisplayWSI display; // Handle of the display object |
| 94 | VkExtent2D physicalResolution; // Max resolution for CRT? |
| 95 | } VkDisplayPropertiesWSI; |
| 96 | |
| 97 | typedef struct VkDisplayFormatPropertiesWSI_ |
| 98 | { |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 99 | VkFormat swapChainFormat; // Format of the images of the swap chain |
| 100 | } VkDisplayFormatPropertiesWSI; |
| 101 | |
| 102 | typedef struct VkSwapChainCreateInfoWSI_ |
| 103 | { |
| 104 | VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI |
| 105 | const void* pNext; // Pointer to next structure |
| 106 | |
| 107 | // TBD: It is not yet clear what the use will be for the following two |
| 108 | // values. It seems to be needed for more-global window-system handles |
| 109 | // (e.g. X11 display). If not needed for the SDK, we will drop it from |
| 110 | // this extension, and from a future version of this header. |
| 111 | const void* pNativeWindowSystemHandle; // Pointer to native window system handle |
| 112 | const void* pNativeWindowHandle; // Pointer to native window handle |
| 113 | |
| 114 | uint32_t displayCount; // Number of displays the swap chain is created for |
| 115 | const VkDisplayWSI* pDisplays; // displayCount number of display objects the swap chain is created for |
| 116 | |
| 117 | uint32_t imageCount; // Number of images in the swap chain |
| 118 | |
| 119 | VkFormat imageFormat; // Format of the images of the swap chain |
| 120 | VkExtent2D imageExtent; // Width and height of the images of the swap chain |
| 121 | uint32_t imageArraySize; // Number of layers of the images of the swap chain (needed for multi-view rendering) |
| 122 | VkFlags imageUsageFlags; // Usage flags for the images of the swap chain (see VkImageUsageFlags) |
| 123 | |
| 124 | VkFlags swapModeFlags; // Allowed swap modes (see VkSwapModeFlagsWSI) |
| 125 | } VkSwapChainCreateInfoWSI; |
| 126 | |
Ian Elliott | aa7b95f | 2015-04-17 12:11:54 -0600 | [diff] [blame] | 127 | typedef struct VkSwapChainImageInfoWSI_ |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 128 | { |
| 129 | VkImage image; // Persistent swap chain image handle |
| 130 | VkDeviceMemory memory; // Persistent swap chain image's memory handle |
Ian Elliott | aa7b95f | 2015-04-17 12:11:54 -0600 | [diff] [blame] | 131 | } VkSwapChainImageInfoWSI; |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 132 | |
| 133 | typedef struct VkPhysicalDeviceQueuePresentPropertiesWSI_ |
| 134 | { |
| 135 | bool32_t supportsPresent; // Tells whether the queue supports presenting |
| 136 | } VkPhysicalDeviceQueuePresentPropertiesWSI; |
| 137 | |
| 138 | typedef struct VkPresentInfoWSI_ |
| 139 | { |
| 140 | VkStructureType sType; // Must be VK_STRUCTURE_TYPE_PRESENT_INFO_WSI |
| 141 | const void* pNext; // Pointer to next structure |
| 142 | VkImage image; // Image to present |
| 143 | uint32_t flipInterval; // Flip interval |
| 144 | } VkPresentInfoWSI; |
| 145 | |
| 146 | // ------------------------------------------------------------------------------------------------ |
| 147 | // Function types |
| 148 | |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 149 | typedef VkResult (VKAPI *PFN_vkCreateSwapChainWSI)(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain); |
| 150 | typedef VkResult (VKAPI *PFN_vkDestroySwapChainWSI)(VkSwapChainWSI swapChain); |
| 151 | typedef VkResult (VKAPI *PFN_vkGetSwapChainInfoWSI)(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData); |
Ian Elliott | aa7b95f | 2015-04-17 12:11:54 -0600 | [diff] [blame] | 152 | typedef VkResult (VKAPI *PFN_vkQueuePresentWSI)(VkQueue queue, const VkPresentInfoWSI* pPresentInfo); |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 153 | |
| 154 | // ------------------------------------------------------------------------------------------------ |
| 155 | // Function prototypes |
| 156 | |
| 157 | #ifdef VK_PROTOTYPES |
| 158 | |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 159 | |
| 160 | VkResult VKAPI vkCreateSwapChainWSI( |
| 161 | VkDevice device, |
| 162 | const VkSwapChainCreateInfoWSI* pCreateInfo, |
| 163 | VkSwapChainWSI* pSwapChain); |
| 164 | |
| 165 | VkResult VKAPI vkDestroySwapChainWSI( |
| 166 | VkSwapChainWSI swapChain); |
| 167 | |
| 168 | VkResult VKAPI vkGetSwapChainInfoWSI( |
| 169 | VkSwapChainWSI swapChain, |
| 170 | VkSwapChainInfoTypeWSI infoType, |
| 171 | size_t* pDataSize, |
| 172 | void* pData); |
| 173 | |
| 174 | VkResult VKAPI vkQueuePresentWSI( |
| 175 | VkQueue queue, |
Ian Elliott | aa7b95f | 2015-04-17 12:11:54 -0600 | [diff] [blame] | 176 | const VkPresentInfoWSI* pPresentInfo); |
Ian Elliott | 2350cf8 | 2015-04-03 09:45:49 -0600 | [diff] [blame] | 177 | |
| 178 | #endif // VK_PROTOTYPES |
| 179 | |
| 180 | #ifdef __cplusplus |
| 181 | } // extern "C" |
| 182 | #endif // __cplusplus |
| 183 | |
| 184 | #endif // __VK_WSI_LUNARG_H__ |