2 // File: vk_ext_khr_swapchain.h
5 ** Copyright (c) 2015 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_EXT_KHR_SWAPCHAIN_H__
28 #define __VK_EXT_KHR_SWAPCHAIN_H__
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"
41 // ------------------------------------------------------------------------------------------------
44 // ------------------------------------------------------------------------------------------------
45 // Enumeration constants
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)))
50 // Extend VkStructureType enum with extension specific constants
51 #define VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_KHR VK_EXT_KHR_SWAPCHAIN_ENUM(VkStructureType, 0)
53 // ------------------------------------------------------------------------------------------------
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
;
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
;
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
94 // ------------------------------------------------------------------------------------------------
97 // ------------------------------------------------------------------------------------------------
100 // Placeholder structure header for the different types of surface description structures
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
;
106 // Surface description structure for a native platform window surface
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
;
115 // pPlatformHandle points to this struct when platform is VK_PLATFORM_X11_KHR
118 Display
* dpy
; // Display connection to an X server
119 Window root
; // To identify the X screen
120 } VkPlatformHandleX11KHR
;
121 #endif /* _X11_XLIB_H_ */
123 // pPlatformHandle points to this struct when platform is VK_PLATFORM_XCB_KHR
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__ */
131 // ------------------------------------------------------------------------------------------------
134 typedef VkResult (VKAPI_PTR
*PFN_vkGetPhysicalDeviceSurfaceSupportKHR
)(VkPhysicalDevice physicalDevice
, uint32_t queueFamilyIndex
, const VkSurfaceDescriptionKHR
* pSurfaceDescription
, VkBool32
* pSupported
);
136 // ------------------------------------------------------------------------------------------------
137 // Function prototypes
141 VKAPI_ATTR VkResult VKAPI_CALL
vkGetPhysicalDeviceSurfaceSupportKHR(
142 VkPhysicalDevice physicalDevice
,
143 uint32_t queueFamilyIndex
,
144 const VkSurfaceDescriptionKHR
* pSurfaceDescription
,
145 VkBool32
* pSupported
);
147 #endif // VK_PROTOTYPES
151 #endif // __cplusplus
153 #endif // __VK_EXT_KHR_SWAPCHAIN_H__