blob: 9f95cc3623040738f6f109560c2ac5b40029b399 [file] [log] [blame]
Ian Elliott2350cf82015-04-03 09:45:49 -06001//
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 Goeltzenleuchter110fdf92015-06-29 15:39:26 -060032#define VK_WSI_LUNARG_REVISION VK_MAKE_VERSION(0, 3, 0)
Ian Elliott2350cf82015-04-03 09:45:49 -060033#define VK_WSI_LUNARG_EXTENSION_NUMBER 1
Jon Ashburn07daee72015-05-21 18:13:33 -060034#define VK_WSI_LUNARG_EXTENSION_NAME "VK_WSI_LunarG"
Ian Elliott2350cf82015-04-03 09:45:49 -060035
36#ifdef __cplusplus
37extern "C"
38{
39#endif // __cplusplus
40
41// ------------------------------------------------------------------------------------------------
42// Objects
43
Ian Elliott3a931852015-04-07 13:50:42 -060044VK_DEFINE_DISP_SUBCLASS_HANDLE(VkDisplayWSI, VkObject)
45VK_DEFINE_DISP_SUBCLASS_HANDLE(VkSwapChainWSI, VkObject)
Ian Elliott2350cf82015-04-03 09:45:49 -060046
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 Elliott2350cf82015-04-03 09:45:49 -060053#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 Elliott3a931852015-04-07 13:50:42 -060062// 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 Elliott2350cf82015-04-03 09:45:49 -060066// ------------------------------------------------------------------------------------------------
67// Enumerations
68
Ian Elliott2350cf82015-04-03 09:45:49 -060069
70typedef 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
81typedef VkFlags VkSwapModeFlagsWSI;
82typedef 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
91typedef struct VkDisplayPropertiesWSI_
92{
93 VkDisplayWSI display; // Handle of the display object
94 VkExtent2D physicalResolution; // Max resolution for CRT?
95} VkDisplayPropertiesWSI;
96
97typedef struct VkDisplayFormatPropertiesWSI_
98{
Ian Elliott2350cf82015-04-03 09:45:49 -060099 VkFormat swapChainFormat; // Format of the images of the swap chain
100} VkDisplayFormatPropertiesWSI;
101
102typedef 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 Elliottaa7b95f2015-04-17 12:11:54 -0600127typedef struct VkSwapChainImageInfoWSI_
Ian Elliott2350cf82015-04-03 09:45:49 -0600128{
129 VkImage image; // Persistent swap chain image handle
130 VkDeviceMemory memory; // Persistent swap chain image's memory handle
Ian Elliottaa7b95f2015-04-17 12:11:54 -0600131} VkSwapChainImageInfoWSI;
Ian Elliott2350cf82015-04-03 09:45:49 -0600132
133typedef struct VkPhysicalDeviceQueuePresentPropertiesWSI_
134{
135 bool32_t supportsPresent; // Tells whether the queue supports presenting
136} VkPhysicalDeviceQueuePresentPropertiesWSI;
137
138typedef 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 Elliott2350cf82015-04-03 09:45:49 -0600149typedef VkResult (VKAPI *PFN_vkCreateSwapChainWSI)(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain);
150typedef VkResult (VKAPI *PFN_vkDestroySwapChainWSI)(VkSwapChainWSI swapChain);
151typedef VkResult (VKAPI *PFN_vkGetSwapChainInfoWSI)(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData);
Ian Elliottaa7b95f2015-04-17 12:11:54 -0600152typedef VkResult (VKAPI *PFN_vkQueuePresentWSI)(VkQueue queue, const VkPresentInfoWSI* pPresentInfo);
Ian Elliott2350cf82015-04-03 09:45:49 -0600153
154// ------------------------------------------------------------------------------------------------
155// Function prototypes
156
157#ifdef VK_PROTOTYPES
158
Ian Elliott2350cf82015-04-03 09:45:49 -0600159
160VkResult VKAPI vkCreateSwapChainWSI(
161 VkDevice device,
162 const VkSwapChainCreateInfoWSI* pCreateInfo,
163 VkSwapChainWSI* pSwapChain);
164
165VkResult VKAPI vkDestroySwapChainWSI(
166 VkSwapChainWSI swapChain);
167
168VkResult VKAPI vkGetSwapChainInfoWSI(
169 VkSwapChainWSI swapChain,
170 VkSwapChainInfoTypeWSI infoType,
171 size_t* pDataSize,
172 void* pData);
173
174VkResult VKAPI vkQueuePresentWSI(
175 VkQueue queue,
Ian Elliottaa7b95f2015-04-17 12:11:54 -0600176 const VkPresentInfoWSI* pPresentInfo);
Ian Elliott2350cf82015-04-03 09:45:49 -0600177
178#endif // VK_PROTOTYPES
179
180#ifdef __cplusplus
181} // extern "C"
182#endif // __cplusplus
183
184#endif // __VK_WSI_LUNARG_H__