1e5c31af7Sopenharmony_ci// Copyright 2014-2021 The Khronos Group, Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ciinclude::{generated}/meta/{refprefix}VK_KHR_surface.txt[]
6e5c31af7Sopenharmony_ci
7e5c31af7Sopenharmony_ci=== Other Extension Metadata
8e5c31af7Sopenharmony_ci
9e5c31af7Sopenharmony_ci*Last Modified Date*::
10e5c31af7Sopenharmony_ci    2016-08-25
11e5c31af7Sopenharmony_ci*IP Status*::
12e5c31af7Sopenharmony_ci    No known IP claims.
13e5c31af7Sopenharmony_ci*Contributors*::
14e5c31af7Sopenharmony_ci  - Patrick Doane, Blizzard
15e5c31af7Sopenharmony_ci  - Ian Elliott, LunarG
16e5c31af7Sopenharmony_ci  - Jesse Hall, Google
17e5c31af7Sopenharmony_ci  - James Jones, NVIDIA
18e5c31af7Sopenharmony_ci  - David Mao, AMD
19e5c31af7Sopenharmony_ci  - Norbert Nopper, Freescale
20e5c31af7Sopenharmony_ci  - Alon Or-bach, Samsung
21e5c31af7Sopenharmony_ci  - Daniel Rakos, AMD
22e5c31af7Sopenharmony_ci  - Graham Sellers, AMD
23e5c31af7Sopenharmony_ci  - Jeff Vigil, Qualcomm
24e5c31af7Sopenharmony_ci  - Chia-I Wu, LunarG
25e5c31af7Sopenharmony_ci  - Jason Ekstrand, Intel
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ci=== Description
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_ciThe `VK_KHR_surface` extension is an instance extension.
30e5c31af7Sopenharmony_ciIt introduces slink:VkSurfaceKHR objects, which abstract native platform
31e5c31af7Sopenharmony_cisurface or window objects for use with Vulkan.
32e5c31af7Sopenharmony_ciIt also provides a way to determine whether a queue family in a physical
33e5c31af7Sopenharmony_cidevice supports presenting to particular surface.
34e5c31af7Sopenharmony_ci
35e5c31af7Sopenharmony_ciSeparate extensions for each platform provide the mechanisms for creating
36e5c31af7Sopenharmony_cislink:VkSurfaceKHR objects, but once created they may be used in this and
37e5c31af7Sopenharmony_ciother platform-independent extensions, in particular the
38e5c31af7Sopenharmony_ci`apiext:VK_KHR_swapchain` extension.
39e5c31af7Sopenharmony_ci
40e5c31af7Sopenharmony_ciinclude::{generated}/interfaces/VK_KHR_surface.txt[]
41e5c31af7Sopenharmony_ci
42e5c31af7Sopenharmony_ci=== Examples
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ci[NOTE]
45e5c31af7Sopenharmony_ci.Note
46e5c31af7Sopenharmony_ci====
47e5c31af7Sopenharmony_ciThe example code for the `VK_KHR_surface` and `apiext:VK_KHR_swapchain`
48e5c31af7Sopenharmony_ciextensions was removed from the appendix after revision 1.0.29.
49e5c31af7Sopenharmony_ciThis WSI example code was ported to the cube demo that is shipped with the
50e5c31af7Sopenharmony_ciofficial Khronos SDK, and is being kept up-to-date in that location (see:
51e5c31af7Sopenharmony_cihttps://github.com/KhronosGroup/Vulkan-Tools/blob/master/cube/cube.c).
52e5c31af7Sopenharmony_ci====
53e5c31af7Sopenharmony_ci
54e5c31af7Sopenharmony_ci=== Issues
55e5c31af7Sopenharmony_ci
56e5c31af7Sopenharmony_ci1) Should this extension include a method to query whether a physical device
57e5c31af7Sopenharmony_cisupports presenting to a specific window or native surface on a given
58e5c31af7Sopenharmony_ciplatform?
59e5c31af7Sopenharmony_ci
60e5c31af7Sopenharmony_ci*RESOLVED*: Yes.
61e5c31af7Sopenharmony_ciWithout this, applications would need to create a device instance to
62e5c31af7Sopenharmony_cidetermine whether a particular window can be presented to.
63e5c31af7Sopenharmony_ciKnowing that a device supports presentation to a platform in general is not
64e5c31af7Sopenharmony_cisufficient, as a single machine might support multiple seats, or instances
65e5c31af7Sopenharmony_ciof the platform that each use different underlying physical devices.
66e5c31af7Sopenharmony_ciAdditionally, on some platforms, such as the X Window System, different
67e5c31af7Sopenharmony_cidrivers and devices might be used for different windows depending on which
68e5c31af7Sopenharmony_cisection of the desktop they exist on.
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ci2) Should the flink:vkGetPhysicalDeviceSurfaceCapabilitiesKHR,
71e5c31af7Sopenharmony_ciflink:vkGetPhysicalDeviceSurfaceFormatsKHR, and
72e5c31af7Sopenharmony_ciflink:vkGetPhysicalDeviceSurfacePresentModesKHR functions be in this
73e5c31af7Sopenharmony_ciextension and operate on physical devices, rather than being in
74e5c31af7Sopenharmony_ci`apiext:VK_KHR_swapchain` (i.e. device extension) and being dependent on
75e5c31af7Sopenharmony_cislink:VkDevice?
76e5c31af7Sopenharmony_ci
77e5c31af7Sopenharmony_ci*RESOLVED*: Yes.
78e5c31af7Sopenharmony_ciWhile it might be useful to depend on sname:VkDevice (and therefore on
79e5c31af7Sopenharmony_cienabled extensions and features) for the queries, Vulkan was released only
80e5c31af7Sopenharmony_ciwith the slink:VkPhysicalDevice versions.
81e5c31af7Sopenharmony_ciMany cases can be resolved by a Valid Usage statement, and/or by a separate
82e5c31af7Sopenharmony_cipname:pNext chain version of the query struct specific to a given extension
83e5c31af7Sopenharmony_cior parameters, via extensible versions of the queries:
84e5c31af7Sopenharmony_ciifdef::VK_EXT_full_screen_exclusive[flink:vkGetPhysicalDeviceSurfacePresentModes2EXT,]
85e5c31af7Sopenharmony_ciflink:vkGetPhysicalDeviceSurfaceCapabilities2KHR, and
86e5c31af7Sopenharmony_ciflink:vkGetPhysicalDeviceSurfaceFormats2KHR.
87e5c31af7Sopenharmony_ci
88e5c31af7Sopenharmony_ci3) Should Vulkan support Xlib or XCB as the API for accessing the X Window
89e5c31af7Sopenharmony_ciSystem platform?
90e5c31af7Sopenharmony_ci
91e5c31af7Sopenharmony_ci*RESOLVED*: Both.
92e5c31af7Sopenharmony_ciXCB is a more modern and efficient API, but Xlib usage is deeply ingrained
93e5c31af7Sopenharmony_ciin many applications and likely will remain in use for the foreseeable
94e5c31af7Sopenharmony_cifuture.
95e5c31af7Sopenharmony_ciNot all drivers necessarily need to support both, but including both as
96e5c31af7Sopenharmony_cioptions in the core specification will probably encourage support, which
97e5c31af7Sopenharmony_cishould in turn ease adoption of the Vulkan API in older codebases.
98e5c31af7Sopenharmony_ciAdditionally, the performance improvements possible with XCB likely will not
99e5c31af7Sopenharmony_cihave a measurable impact on the performance of Vulkan presentation and other
100e5c31af7Sopenharmony_ciminimal window system interactions defined here.
101e5c31af7Sopenharmony_ci
102e5c31af7Sopenharmony_ci4) Should the GBM platform be included in the list of platform enums?
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_ci*RESOLVED*: Deferred, and will be addressed with a platform-specific
105e5c31af7Sopenharmony_ciextension to be written in the future.
106e5c31af7Sopenharmony_ci
107e5c31af7Sopenharmony_ci=== Version History
108e5c31af7Sopenharmony_ci
109e5c31af7Sopenharmony_ci  * Revision 1, 2015-05-20 (James Jones)
110e5c31af7Sopenharmony_ci    - Initial draft, based on LunarG KHR spec, other KHR specs, patches
111e5c31af7Sopenharmony_ci      attached to bugs.
112e5c31af7Sopenharmony_ci
113e5c31af7Sopenharmony_ci  * Revision 2, 2015-05-22 (Ian Elliott)
114e5c31af7Sopenharmony_ci    - Created initial Description section.
115e5c31af7Sopenharmony_ci    - Removed query for whether a platform requires the use of a queue for
116e5c31af7Sopenharmony_ci      presentation, since it was decided that presentation will always be
117e5c31af7Sopenharmony_ci      modeled as being part of the queue.
118e5c31af7Sopenharmony_ci    - Fixed typos and other minor mistakes.
119e5c31af7Sopenharmony_ci
120e5c31af7Sopenharmony_ci  * Revision 3, 2015-05-26 (Ian Elliott)
121e5c31af7Sopenharmony_ci    - Improved the Description section.
122e5c31af7Sopenharmony_ci
123e5c31af7Sopenharmony_ci  * Revision 4, 2015-05-27 (James Jones)
124e5c31af7Sopenharmony_ci    - Fixed compilation errors in example code.
125e5c31af7Sopenharmony_ci
126e5c31af7Sopenharmony_ci  * Revision 5, 2015-06-01 (James Jones)
127e5c31af7Sopenharmony_ci    - Added issues 1 and 2 and made related spec updates.
128e5c31af7Sopenharmony_ci
129e5c31af7Sopenharmony_ci  * Revision 6, 2015-06-01 (James Jones)
130e5c31af7Sopenharmony_ci    - Merged the platform type mappings table previously removed from
131e5c31af7Sopenharmony_ci      VK_KHR_swapchain with the platform description table in this spec.
132e5c31af7Sopenharmony_ci    - Added issues 3 and 4 documenting choices made when building the
133e5c31af7Sopenharmony_ci      initial list of native platforms supported.
134e5c31af7Sopenharmony_ci
135e5c31af7Sopenharmony_ci  * Revision 7, 2015-06-11 (Ian Elliott)
136e5c31af7Sopenharmony_ci    - Updated table 1 per input from the KHR TSG.
137e5c31af7Sopenharmony_ci    - Updated issue 4 (GBM) per discussion with Daniel Stone.
138e5c31af7Sopenharmony_ci      He will create a platform-specific extension sometime in the future.
139e5c31af7Sopenharmony_ci
140e5c31af7Sopenharmony_ci  * Revision 8, 2015-06-17 (James Jones)
141e5c31af7Sopenharmony_ci    - Updated enum-extending values using new convention.
142e5c31af7Sopenharmony_ci    - Fixed the value of VK_SURFACE_PLATFORM_INFO_TYPE_SUPPORTED_KHR.
143e5c31af7Sopenharmony_ci
144e5c31af7Sopenharmony_ci  * Revision 9, 2015-06-17 (James Jones)
145e5c31af7Sopenharmony_ci    - Rebased on Vulkan API version 126.
146e5c31af7Sopenharmony_ci
147e5c31af7Sopenharmony_ci  * Revision 10, 2015-06-18 (James Jones)
148e5c31af7Sopenharmony_ci    - Marked issues 2 and 3 resolved.
149e5c31af7Sopenharmony_ci
150e5c31af7Sopenharmony_ci  * Revision 11, 2015-06-23 (Ian Elliott)
151e5c31af7Sopenharmony_ci    - Examples now show use of function pointers for extension functions.
152e5c31af7Sopenharmony_ci    - Eliminated extraneous whitespace.
153e5c31af7Sopenharmony_ci
154e5c31af7Sopenharmony_ci  * Revision 12, 2015-07-07 (Daniel Rakos)
155e5c31af7Sopenharmony_ci    - Added error section describing when each error is expected to be
156e5c31af7Sopenharmony_ci      reported.
157e5c31af7Sopenharmony_ci    - Replaced the term "`queue node index`" with "`queue family index`" in
158e5c31af7Sopenharmony_ci      the spec as that is the agreed term to be used in the latest version
159e5c31af7Sopenharmony_ci      of the core header and spec.
160e5c31af7Sopenharmony_ci    - Replaced bool32_t with VkBool32.
161e5c31af7Sopenharmony_ci
162e5c31af7Sopenharmony_ci  * Revision 13, 2015-08-06 (Daniel Rakos)
163e5c31af7Sopenharmony_ci    - Updated spec against latest core API header version.
164e5c31af7Sopenharmony_ci
165e5c31af7Sopenharmony_ci  * Revision 14, 2015-08-20 (Ian Elliott)
166e5c31af7Sopenharmony_ci    - Renamed this extension and all of its enumerations, types, functions,
167e5c31af7Sopenharmony_ci      etc.
168e5c31af7Sopenharmony_ci      This makes it compliant with the proposed standard for Vulkan
169e5c31af7Sopenharmony_ci      extensions.
170e5c31af7Sopenharmony_ci    - Switched from "`revision`" to "`version`", including use of the
171e5c31af7Sopenharmony_ci      VK_MAKE_VERSION macro in the header file.
172e5c31af7Sopenharmony_ci    - Did miscellaneous cleanup, etc.
173e5c31af7Sopenharmony_ci
174e5c31af7Sopenharmony_ci  * Revision 15, 2015-08-20 (Ian Elliott--porting a 2015-07-29 change from
175e5c31af7Sopenharmony_ci    James Jones)
176e5c31af7Sopenharmony_ci    - Moved the surface transform enums here from VK_WSI_swapchain so they
177e5c31af7Sopenharmony_ci      could be reused by VK_WSI_display.
178e5c31af7Sopenharmony_ci
179e5c31af7Sopenharmony_ci  * Revision 16, 2015-09-01 (James Jones)
180e5c31af7Sopenharmony_ci    - Restore single-field revision number.
181e5c31af7Sopenharmony_ci
182e5c31af7Sopenharmony_ci  * Revision 17, 2015-09-01 (James Jones)
183e5c31af7Sopenharmony_ci    - Fix example code compilation errors.
184e5c31af7Sopenharmony_ci
185e5c31af7Sopenharmony_ci  * Revision 18, 2015-09-26 (Jesse Hall)
186e5c31af7Sopenharmony_ci    - Replaced VkSurfaceDescriptionKHR with the VkSurfaceKHR object, which
187e5c31af7Sopenharmony_ci      is created via layered extensions.
188e5c31af7Sopenharmony_ci      Added VkDestroySurfaceKHR.
189e5c31af7Sopenharmony_ci
190e5c31af7Sopenharmony_ci  * Revision 19, 2015-09-28 (Jesse Hall)
191e5c31af7Sopenharmony_ci    - Renamed from VK_EXT_KHR_swapchain to VK_EXT_KHR_surface.
192e5c31af7Sopenharmony_ci
193e5c31af7Sopenharmony_ci  * Revision 20, 2015-09-30 (Jeff Vigil)
194e5c31af7Sopenharmony_ci    - Add error result VK_ERROR_SURFACE_LOST_KHR.
195e5c31af7Sopenharmony_ci
196e5c31af7Sopenharmony_ci  * Revision 21, 2015-10-15 (Daniel Rakos)
197e5c31af7Sopenharmony_ci    - Updated the resolution of issue #2 and include the surface capability
198e5c31af7Sopenharmony_ci      queries in this extension.
199e5c31af7Sopenharmony_ci    - Renamed SurfaceProperties to SurfaceCapabilities as it better reflects
200e5c31af7Sopenharmony_ci      that the values returned are the capabilities of the surface on a
201e5c31af7Sopenharmony_ci      particular device.
202e5c31af7Sopenharmony_ci    - Other minor cleanup and consistency changes.
203e5c31af7Sopenharmony_ci
204e5c31af7Sopenharmony_ci  * Revision 22, 2015-10-26 (Ian Elliott)
205e5c31af7Sopenharmony_ci    - Renamed from VK_EXT_KHR_surface to VK_KHR_surface.
206e5c31af7Sopenharmony_ci
207e5c31af7Sopenharmony_ci  * Revision 23, 2015-11-03 (Daniel Rakos)
208e5c31af7Sopenharmony_ci    - Added allocation callbacks to vkDestroySurfaceKHR.
209e5c31af7Sopenharmony_ci
210e5c31af7Sopenharmony_ci  * Revision 24, 2015-11-10 (Jesse Hall)
211e5c31af7Sopenharmony_ci    - Removed VkSurfaceTransformKHR.
212e5c31af7Sopenharmony_ci      Use VkSurfaceTransformFlagBitsKHR instead.
213e5c31af7Sopenharmony_ci    - Rename VkSurfaceCapabilitiesKHR member maxImageArraySize to
214e5c31af7Sopenharmony_ci      maxImageArrayLayers.
215e5c31af7Sopenharmony_ci
216e5c31af7Sopenharmony_ci  * Revision 25, 2016-01-14 (James Jones)
217e5c31af7Sopenharmony_ci    - Moved VK_ERROR_NATIVE_WINDOW_IN_USE_KHR from the
218e5c31af7Sopenharmony_ci      VK_KHR_android_surface to the VK_KHR_surface extension.
219e5c31af7Sopenharmony_ci
220e5c31af7Sopenharmony_ci  * 2016-08-23 (Ian Elliott)
221e5c31af7Sopenharmony_ci    - Update the example code, to not have so many characters per line, and
222e5c31af7Sopenharmony_ci      to split out a new example to show how to obtain function pointers.
223e5c31af7Sopenharmony_ci
224e5c31af7Sopenharmony_ci  * 2016-08-25 (Ian Elliott)
225e5c31af7Sopenharmony_ci    - A note was added at the beginning of the example code, stating that it
226e5c31af7Sopenharmony_ci      will be removed from future versions of the appendix.
227