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