• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2014-2018 Khronos Group. This work is licensed under a
2// Creative Commons Attribution 4.0 International License; see
3// http://creativecommons.org/licenses/by/4.0/
4
5[[wsi]]
6= Window System Integration (WSI)
7
8This chapter discusses the window system integration (WSI) between the
9Vulkan API and the various forms of displaying the results of rendering to a
10user.
11Since the Vulkan API can: be used without displaying results, WSI is
12provided through the use of optional Vulkan extensions.
13This chapter provides an overview of WSI.
14See the appendix for additional details of each WSI extension, including
15which extensions must: be enabled in order to use each of the functions
16described in this chapter.
17
18
19== WSI Platform
20
21A platform is an abstraction for a window system, OS, etc.
22Some examples include MS Windows, Android, and Wayland.
23The Vulkan API may: be integrated in a unique manner for each platform.
24
25The Vulkan API does not define any type of platform object.
26Platform-specific WSI extensions are defined, which contain
27platform-specific functions for using WSI.
28Use of these extensions is guarded by preprocessor symbols as defined in the
29<<boilerplate-wsi-header,Window System-Specific Header Control>> appendix.
30
31In order for an application to be compiled to use WSI with a given platform,
32it must either:
33
34  * #define the appropriate preprocessor symbol prior to including the
35    `vulkan.h` header file, or
36  * include `vulkan_core.h` and any native platform headers, followed by the
37    appropriate platform-specific header.
38
39The preprocessor symbols and platform-specific headers are defined in the
40<<boilerplate-wsi-header-table, Window System Extensions and Headers>>
41table.
42
43Each platform-specific extension is an instance extension.
44The application must: enable instance extensions with fname:vkCreateInstance
45before using them.
46
47
48== WSI Surface
49
50[open,refpage='VkSurfaceKHR',desc='Opaque handle to a surface object',type='handles']
51--
52
53Native platform surface or window objects are abstracted by surface objects,
54which are represented by sname:VkSurfaceKHR handles:
55
56include::../../api/handles/VkSurfaceKHR.txt[]
57
58The `VK_KHR_surface` extension declares the sname:VkSurfaceKHR object, and
59provides a function for destroying sname:VkSurfaceKHR objects.
60Separate platform-specific extensions each provide a function for creating a
61sname:VkSurfaceKHR object for the respective platform.
62From the application's perspective this is an opaque handle, just like the
63handles of other Vulkan objects.
64
65ifdef::implementation-guide[]
66[NOTE]
67.Note
68====
69On certain platforms, the Vulkan loader and ICDs may: have conventions that
70treat the handle as a pointer to a struct that contains the
71platform-specific information about the surface.
72This will be described in the documentation for the loader-ICD interface,
73and in the `vk_icd.h` header file of the LoaderAndTools source-code
74repository.
75This does not affect the loader-layer interface; layers may: wrap
76sname:VkSurfaceKHR objects.
77====
78endif::implementation-guide[]
79
80--
81
82ifdef::editing-notes[]
83[NOTE]
84.editing-note
85====
86TODO: Consider replacing the above note editing note with a pointer to the
87loader spec when it exists.
88However, the information is not relevant to users of the API nor does it
89affect conformance of a Vulkan implementation to this spec.
90====
91endif::editing-notes[]
92
93ifdef::VK_KHR_android_surface[]
94include::../VK_KHR_android_surface/platformCreateSurface_android.txt[]
95endif::VK_KHR_android_surface[]
96
97ifdef::VK_KHR_mir_surface[]
98include::../VK_KHR_mir_surface/platformCreateSurface_mir.txt[]
99endif::VK_KHR_mir_surface[]
100
101ifdef::VK_KHR_wayland_surface[]
102include::../VK_KHR_wayland_surface/platformCreateSurface_wayland.txt[]
103endif::VK_KHR_wayland_surface[]
104
105ifdef::VK_KHR_win32_surface[]
106include::../VK_KHR_win32_surface/platformCreateSurface_win32.txt[]
107endif::VK_KHR_win32_surface[]
108
109ifdef::VK_KHR_xcb_surface[]
110include::../VK_KHR_xcb_surface/platformCreateSurface_xcb.txt[]
111endif::VK_KHR_xcb_surface[]
112
113ifdef::VK_KHR_xlib_surface[]
114include::../VK_KHR_xlib_surface/platformCreateSurface_xlib.txt[]
115endif::VK_KHR_xlib_surface[]
116
117ifdef::VK_MVK_ios_surface[]
118include::../VK_MVK_ios_surface/platformCreateSurface_ios.txt[]
119endif::VK_MVK_ios_surface[]
120
121ifdef::VK_MVK_macos_surface[]
122include::../VK_MVK_macos_surface/platformCreateSurface_macos.txt[]
123endif::VK_MVK_macos_surface[]
124
125ifdef::VK_NN_vi_surface[]
126include::../VK_NN_vi_surface/platformCreateSurface_vi.txt[]
127endif::VK_NN_vi_surface[]
128
129
130=== Platform-Independent Information
131
132Once created, sname:VkSurfaceKHR objects can: be used in this and other
133extensions, in particular the `<<VK_KHR_swapchain>>` extension.
134
135Several WSI functions return ename:VK_ERROR_SURFACE_LOST_KHR if the surface
136becomes no longer available.
137After such an error, the surface (and any child swapchain, if one exists)
138should: be destroyed, as there is no way to restore them to a not-lost
139state.
140Applications may: attempt to create a new sname:VkSurfaceKHR using the same
141native platform window object, but whether such re-creation will succeed is
142platform-dependent and may: depend on the reason the surface became
143unavailable.
144A lost surface does not otherwise cause devices to be
145<<devsandqueues-lost-device,lost>>.
146
147[open,refpage='vkDestroySurfaceKHR',desc='Destroy a VkSurfaceKHR object',type='protos']
148--
149
150To destroy a sname:VkSurfaceKHR object, call:
151
152include::../../api/protos/vkDestroySurfaceKHR.txt[]
153
154  * pname:instance is the instance used to create the surface.
155  * pname:surface is the surface to destroy.
156  * pname:pAllocator is the allocator used for host memory allocated for the
157    surface object when there is no more specific allocator available (see
158    <<memory-allocation,Memory Allocation>>).
159
160Destroying a sname:VkSurfaceKHR merely severs the connection between Vulkan
161and the native surface, and does not imply destroying the native surface,
162closing a window, or similar behavior.
163
164.Valid Usage
165****
166  * [[VUID-vkDestroySurfaceKHR-surface-01266]]
167    All sname:VkSwapchainKHR objects created for pname:surface must: have
168    been destroyed prior to destroying pname:surface
169  * [[VUID-vkDestroySurfaceKHR-surface-01267]]
170    If sname:VkAllocationCallbacks were provided when pname:surface was
171    created, a compatible set of callbacks must: be provided here
172  * [[VUID-vkDestroySurfaceKHR-surface-01268]]
173    If no sname:VkAllocationCallbacks were provided when pname:surface was
174    created, pname:pAllocator must: be `NULL`
175****
176
177include::../../validity/protos/vkDestroySurfaceKHR.txt[]
178--
179
180ifdef::VK_KHR_display[]
181include::../VK_KHR_display/display.txt[]
182endif::VK_KHR_display[]
183
184
185== Querying for WSI Support
186
187Not all physical devices will include WSI support.
188Within a physical device, not all queue families will support presentation.
189WSI support and compatibility can: be determined in a platform-neutral
190manner (which determines support for presentation to a particular surface
191object) and additionally may: be determined in platform-specific manners
192(which determine support for presentation on the specified physical device
193but do not guarantee support for presentation to a particular surface
194object).
195
196[open,refpage='vkGetPhysicalDeviceSurfaceSupportKHR',desc='Query if presentation is supported',type='protos']
197--
198
199To determine whether a queue family of a physical device supports
200presentation to a given surface, call:
201
202include::../../api/protos/vkGetPhysicalDeviceSurfaceSupportKHR.txt[]
203
204  * pname:physicalDevice is the physical device.
205  * pname:queueFamilyIndex is the queue family.
206  * pname:surface is the surface.
207  * pname:pSupported is a pointer to a basetype:VkBool32, which is set to
208    ename:VK_TRUE to indicate support, and ename:VK_FALSE otherwise.
209
210.Valid Usage
211****
212  * [[VUID-vkGetPhysicalDeviceSurfaceSupportKHR-queueFamilyIndex-01269]]
213    pname:queueFamilyIndex must: be less than
214    pname:pQueueFamilyPropertyCount returned by
215    fname:vkGetPhysicalDeviceQueueFamilyProperties for the given
216    pname:physicalDevice
217****
218
219include::../../validity/protos/vkGetPhysicalDeviceSurfaceSupportKHR.txt[]
220--
221
222ifdef::VK_KHR_android_surface[]
223include::../VK_KHR_android_surface/platformQuerySupport_android.txt[]
224endif::VK_KHR_android_surface[]
225
226ifdef::VK_KHR_mir_surface[]
227include::../VK_KHR_mir_surface/platformQuerySupport_mir.txt[]
228endif::VK_KHR_mir_surface[]
229
230ifdef::VK_KHR_wayland_surface[]
231include::../VK_KHR_wayland_surface/platformQuerySupport_wayland.txt[]
232endif::VK_KHR_wayland_surface[]
233
234ifdef::VK_KHR_win32_surface[]
235include::../VK_KHR_win32_surface/platformQuerySupport_win32.txt[]
236endif::VK_KHR_win32_surface[]
237
238ifdef::VK_KHR_xcb_surface[]
239include::../VK_KHR_xcb_surface/platformQuerySupport_xcb.txt[]
240endif::VK_KHR_xcb_surface[]
241
242ifdef::VK_KHR_xlib_surface[]
243include::../VK_KHR_xlib_surface/platformQuerySupport_xlib.txt[]
244endif::VK_KHR_xlib_surface[]
245
246ifdef::VK_MVK_ios_surface[]
247include::../VK_MVK_ios_surface/platformQuerySupport_ios.txt[]
248endif::VK_MVK_ios_surface[]
249
250ifdef::VK_MVK_macos_surface[]
251include::../VK_MVK_macos_surface/platformQuerySupport_macos.txt[]
252endif::VK_MVK_macos_surface[]
253
254ifdef::VK_NN_vi_surface[]
255include::../VK_NN_vi_surface/platformQuerySupport_vi.txt[]
256endif::VK_NN_vi_surface[]
257
258
259== Surface Queries
260
261The capabilities of a swapchain targetting a surface are the intersection of
262the capabilities of the WSI platform, the native window or display, and the
263physical device.
264The resulting capabilities can be obtained with the queries listed below in
265this section.
266Capabilities that correspond to image creation parameters are not
267independent of each other: combinations of parameters that are not supported
268as reported by flink:vkGetPhysicalDeviceImageFormatProperties are not
269supported by the surface on that physical device, even if the capabilities
270taken individually are supported as part of some other parameter
271combinations.
272
273[open,refpage='vkGetPhysicalDeviceSurfaceCapabilitiesKHR',desc='Query surface capabilities',type='protos']
274--
275
276To query the basic capabilities of a surface, needed in order to create a
277swapchain, call:
278
279include::../../api/protos/vkGetPhysicalDeviceSurfaceCapabilitiesKHR.txt[]
280
281  * pname:physicalDevice is the physical device that will be associated with
282    the swapchain to be created, as described for
283    flink:vkCreateSwapchainKHR.
284  * pname:surface is the surface that will be associated with the swapchain.
285  * pname:pSurfaceCapabilities is a pointer to an instance of the
286    slink:VkSurfaceCapabilitiesKHR structure in which the capabilities are
287    returned.
288
289include::../../validity/protos/vkGetPhysicalDeviceSurfaceCapabilitiesKHR.txt[]
290--
291
292[open,refpage='VkSurfaceCapabilitiesKHR',desc='Structure describing capabilities of a surface',type='structs']
293--
294
295The sname:VkSurfaceCapabilitiesKHR structure is defined as:
296
297include::../../api/structs/VkSurfaceCapabilitiesKHR.txt[]
298
299  * pname:minImageCount is the minimum number of images the specified device
300    supports for a swapchain created for the surface, and will be at least
301    one.
302  * pname:maxImageCount is the maximum number of images the specified device
303    supports for a swapchain created for the surface, and will be either 0,
304    or greater than or equal to pname:minImageCount.
305    A value of 0 means that there is no limit on the number of images,
306    though there may: be limits related to the total amount of memory used
307    by presentable images.
308  * pname:currentExtent is the current width and height of the surface, or
309    the special value [eq]#(0xFFFFFFFF, 0xFFFFFFFF)# indicating that the
310    surface size will be determined by the extent of a swapchain targeting
311    the surface.
312  * pname:minImageExtent contains the smallest valid swapchain extent for
313    the surface on the specified device.
314    The pname:width and pname:height of the extent will each be less than or
315    equal to the corresponding pname:width and pname:height of
316    pname:currentExtent, unless pname:currentExtent has the special value
317    described above.
318  * pname:maxImageExtent contains the largest valid swapchain extent for the
319    surface on the specified device.
320    The pname:width and pname:height of the extent will each be greater than
321    or equal to the corresponding pname:width and pname:height of
322    pname:minImageExtent.
323    The pname:width and pname:height of the extent will each be greater than
324    or equal to the corresponding pname:width and pname:height of
325    pname:currentExtent, unless pname:currentExtent has the special value
326    described above.
327  * pname:maxImageArrayLayers is the maximum number of layers presentable
328    images can: have for a swapchain created for this device and surface,
329    and will be at least one.
330  * pname:supportedTransforms is a bitmask of
331    elink:VkSurfaceTransformFlagBitsKHR indicating the presentation
332    transforms supported for the surface on the specified device.
333    At least one bit will be set.
334  * pname:currentTransform is elink:VkSurfaceTransformFlagBitsKHR value
335    indicating the surface's current transform relative to the presentation
336    engine's natural orientation.
337  * pname:supportedCompositeAlpha is a bitmask of
338    elink:VkCompositeAlphaFlagBitsKHR, representing the alpha compositing
339    modes supported by the presentation engine for the surface on the
340    specified device, and at least one bit will be set.
341    Opaque composition can: be achieved in any alpha compositing mode by
342    either using an image format that has no alpha component, or by ensuring
343    that all pixels in the presentable images have an alpha value of 1.0.
344  * pname:supportedUsageFlags is a bitmask of elink:VkImageUsageFlagBits
345    representing the ways the application can: use the presentable images of
346    a swapchain created
347ifdef::VK_KHR_shared_presentable_image[]
348    with elink:VkPresentModeKHR set to ename:VK_PRESENT_MODE_IMMEDIATE_KHR,
349    ename:VK_PRESENT_MODE_MAILBOX_KHR, ename:VK_PRESENT_MODE_FIFO_KHR or
350    ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR
351endif::VK_KHR_shared_presentable_image[]
352    for the surface on the specified device.
353    ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT must: be included in the set
354    but implementations may: support additional usages.
355
356ifdef::VK_KHR_shared_presentable_image[]
357[NOTE]
358.Note
359====
360Supported usage flags of a presentable image when using
361ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR or
362ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR presentation mode are
363provided by
364slink:VkSharedPresentSurfaceCapabilitiesKHR::pname:sharedPresentSupportedUsageFlags.
365====
366endif::VK_KHR_shared_presentable_image[]
367
368[NOTE]
369.Note
370====
371Formulas such as [eq]#min(N, pname:maxImageCount)# are not correct, since
372pname:maxImageCount may: be zero.
373====
374
375include::../../validity/structs/VkSurfaceCapabilitiesKHR.txt[]
376--
377
378ifdef::VK_KHR_get_surface_capabilities2[]
379
380[open,refpage='vkGetPhysicalDeviceSurfaceCapabilities2KHR',desc='Reports capabilities of a surface on a physical device',type='protos']
381--
382
383To query the basic capabilities of a surface defined by the core or
384extensions, call:
385
386include::../../api/protos/vkGetPhysicalDeviceSurfaceCapabilities2KHR.txt[]
387
388  * pname:physicalDevice is the physical device that will be associated with
389    the swapchain to be created, as described for
390    flink:vkCreateSwapchainKHR.
391  * pname:pSurfaceInfo points to an instance of the
392    slink:VkPhysicalDeviceSurfaceInfo2KHR structure, describing the surface
393    and other fixed parameters that would be consumed by
394    flink:vkCreateSwapchainKHR.
395  * pname:pSurfaceCapabilities points to an instance of the
396    slink:VkSurfaceCapabilities2KHR structure in which the capabilities are
397    returned.
398
399fname:vkGetPhysicalDeviceSurfaceCapabilities2KHR behaves similarly to
400flink:vkGetPhysicalDeviceSurfaceCapabilitiesKHR, with the ability to specify
401extended inputs via chained input structures, and to return extended
402information via chained output structures.
403
404include::../../validity/protos/vkGetPhysicalDeviceSurfaceCapabilities2KHR.txt[]
405--
406
407[open,refpage='VkPhysicalDeviceSurfaceInfo2KHR',desc='Structure specifying a surface and related swapchain creation parameters',type='structs']
408--
409
410The sname:VkPhysicalDeviceSurfaceInfo2KHR structure is defined as:
411
412include::../../api/structs/VkPhysicalDeviceSurfaceInfo2KHR.txt[]
413
414  * pname:sType is the type of this structure.
415  * pname:pNext is `NULL` or a pointer to an extension-specific structure.
416  * pname:surface is the surface that will be associated with the swapchain.
417
418The members of sname:VkPhysicalDeviceSurfaceInfo2KHR correspond to the
419arguments to flink:vkGetPhysicalDeviceSurfaceCapabilitiesKHR, with
420pname:sType and pname:pNext added for extensibility.
421
422include::../../validity/structs/VkPhysicalDeviceSurfaceInfo2KHR.txt[]
423--
424
425[open,refpage='VkSurfaceCapabilities2KHR',desc='Structure describing capabilities of a surface',type='structs']
426--
427
428The sname:VkSurfaceCapabilities2KHR structure is defined as:
429
430include::../../api/structs/VkSurfaceCapabilities2KHR.txt[]
431
432  * pname:sType is the type of this structure.
433  * pname:pNext is `NULL` or a pointer to an extension-specific structure.
434  * pname:surfaceCapabilities is a structure of type
435    slink:VkSurfaceCapabilitiesKHR describing the capabilities of the
436    specified surface.
437
438include::../../validity/structs/VkSurfaceCapabilities2KHR.txt[]
439--
440
441ifdef::VK_KHR_shared_presentable_image[]
442[open,refpage='VkSharedPresentSurfaceCapabilitiesKHR',desc='structure describing capabilities of a surface for shared presentation',type='structs']
443--
444
445The sname:VkSharedPresentSurfaceCapabilitiesKHR structure is defined as:
446
447include::../../api/structs/VkSharedPresentSurfaceCapabilitiesKHR.txt[]
448
449  * pname:sType is the type of this structure.
450  * pname:pNext is `NULL` or a pointer to an extension-specific structure.
451  * pname:sharedPresentSupportedUsageFlags is a bitmask of
452    elink:VkImageUsageFlagBits representing the ways the application can:
453    use the shared presentable image from a swapchain created with
454    elink:VkPresentModeKHR set to
455    ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR or
456    ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR for the surface on
457    the specified device.
458    ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT must: be included in the set
459    but implementations may: support additional usages.
460
461include::../../validity/structs/VkSharedPresentSurfaceCapabilitiesKHR.txt[]
462
463--
464endif::VK_KHR_shared_presentable_image[]
465endif::VK_KHR_get_surface_capabilities2[]
466
467ifdef::VK_EXT_display_surface_counter[]
468include::../VK_EXT_display_surface_counter/surface_capabilities.txt[]
469endif::VK_EXT_display_surface_counter[]
470
471[open,refpage='VkSurfaceTransformFlagBitsKHR',desc='presentation transforms supported on a device',type='enums']
472--
473
474Bits which may: be set in
475slink:VkSurfaceCapabilitiesKHR::pname:supportedTransforms indicating the
476presentation transforms supported for the surface on the specified device,
477and possible values of
478slink:VkSurfaceCapabilitiesKHR::pname:currentTransform is indicating the
479surface's current transform relative to the presentation engine's natural
480orientation, are:
481
482include::../../api/enums/VkSurfaceTransformFlagBitsKHR.txt[]
483
484  * ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR specifies that image content
485    is presented without being transformed.
486  * ename:VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR specifies that image
487    content is rotated 90 degrees clockwise.
488  * ename:VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR specifies that image
489    content is rotated 180 degrees clockwise.
490  * ename:VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR specifies that image
491    content is rotated 270 degrees clockwise.
492  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR specifies that
493    image content is mirrored horizontally.
494  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR specifies
495    that image content is mirrored horizontally, then rotated 90 degrees
496    clockwise.
497  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR
498    specifies that image content is mirrored horizontally, then rotated 180
499    degrees clockwise.
500  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR
501    specifies that image content is mirrored horizontally, then rotated 270
502    degrees clockwise.
503  * ename:VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR specifies that the
504    presentation transform is not specified, and is instead determined by
505    platform-specific considerations and mechanisms outside Vulkan.
506
507--
508
509[open,refpage='VkSurfaceTransformFlagsKHR',desc='Bitmask of VkSurfaceTransformFlagBitsKHR',type='enums']
510--
511include::../../api/flags/VkSurfaceTransformFlagsKHR.txt[]
512
513sname:VkSurfaceTransformFlagsKHR is a bitmask type for setting a mask of
514zero or more slink:VkSurfaceTransformFlagBitsKHR.
515--
516
517
518[open,refpage='VkCompositeAlphaFlagBitsKHR',desc='alpha compositing modes supported on a device',type='enums']
519--
520
521The pname:supportedCompositeAlpha member is of type
522elink:VkCompositeAlphaFlagBitsKHR, which contains the following values:
523
524include::../../api/enums/VkCompositeAlphaFlagBitsKHR.txt[]
525
526These values are described as follows:
527
528  * ename:VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR: The alpha channel, if it
529    exists, of the images is ignored in the compositing process.
530    Instead, the image is treated as if it has a constant alpha of 1.0.
531  * ename:VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR: The alpha channel, if
532    it exists, of the images is respected in the compositing process.
533    The non-alpha channels of the image are expected to already be
534    multiplied by the alpha channel by the application.
535  * ename:VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR: The alpha channel, if
536    it exists, of the images is respected in the compositing process.
537    The non-alpha channels of the image are not expected to already be
538    multiplied by the alpha channel by the application; instead, the
539    compositor will multiply the non-alpha channels of the image by the
540    alpha channel during compositing.
541  * ename:VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR: The way in which the
542    presentation engine treats the alpha channel in the images is unknown to
543    the Vulkan API.
544    Instead, the application is responsible for setting the composite alpha
545    blending mode using native window system commands.
546    If the application does not set the blending mode using native window
547    system commands, then a platform-specific default will be used.
548
549--
550
551[open,refpage='VkCompositeAlphaFlagsKHR',desc='Bitmask of VkCompositeAlphaFlagBitsKHR',type='enums']
552--
553include::../../api/flags/VkCompositeAlphaFlagsKHR.txt[]
554
555sname:VkCompositeAlphaFlagsKHR is a bitmask type for setting a mask of zero
556or more slink:VkCompositeAlphaFlagBitsKHR.
557--
558
559[open,refpage='vkGetPhysicalDeviceSurfaceFormatsKHR',desc='Query color formats supported by surface',type='protos']
560--
561
562To query the supported swapchain format-color space pairs for a surface,
563call:
564
565include::../../api/protos/vkGetPhysicalDeviceSurfaceFormatsKHR.txt[]
566
567  * pname:physicalDevice is the physical device that will be associated with
568    the swapchain to be created, as described for
569    flink:vkCreateSwapchainKHR.
570  * pname:surface is the surface that will be associated with the swapchain.
571  * pname:pSurfaceFormatCount is a pointer to an integer related to the
572    number of format pairs available or queried, as described below.
573  * pname:pSurfaceFormats is either `NULL` or a pointer to an array of
574    sname:VkSurfaceFormatKHR structures.
575
576If pname:pSurfaceFormats is `NULL`, then the number of format pairs
577supported for the given pname:surface is returned in
578pname:pSurfaceFormatCount.
579The number of format pairs supported will be greater than or equal to 1.
580Otherwise, pname:pSurfaceFormatCount must: point to a variable set by the
581user to the number of elements in the pname:pSurfaceFormats array, and on
582return the variable is overwritten with the number of structures actually
583written to pname:pSurfaceFormats.
584If the value of pname:pSurfaceFormatCount is less than the number of format
585pairs supported, at most pname:pSurfaceFormatCount structures will be
586written.
587If pname:pSurfaceFormatCount is smaller than the number of format pairs
588supported for the given pname:surface, ename:VK_INCOMPLETE will be returned
589instead of ename:VK_SUCCESS to indicate that not all the available values
590were returned.
591
592include::../../validity/protos/vkGetPhysicalDeviceSurfaceFormatsKHR.txt[]
593--
594
595[open,refpage='VkSurfaceFormatKHR',desc='Structure describing a supported swapchain format-color space pair',type='structs']
596--
597
598The sname:VkSurfaceFormatKHR structure is defined as:
599
600include::../../api/structs/VkSurfaceFormatKHR.txt[]
601
602  * pname:format is a elink:VkFormat that is compatible with the specified
603    surface.
604  * pname:colorSpace is a presentation elink:VkColorSpaceKHR that is
605    compatible with the surface.
606
607include::../../validity/structs/VkSurfaceFormatKHR.txt[]
608--
609
610ifdef::VK_KHR_get_surface_capabilities2[]
611
612[open,refpage='vkGetPhysicalDeviceSurfaceFormats2KHR',desc='Query color formats supported by surface',type='protos']
613--
614
615To query the supported swapchain format tuples for a surface, call:
616
617include::../../api/protos/vkGetPhysicalDeviceSurfaceFormats2KHR.txt[]
618
619  * pname:physicalDevice is the physical device that will be associated with
620    the swapchain to be created, as described for
621    flink:vkCreateSwapchainKHR.
622  * pname:pSurfaceInfo points to an instance of the
623    slink:VkPhysicalDeviceSurfaceInfo2KHR structure, describing the surface
624    and other fixed parameters that would be consumed by
625    flink:vkCreateSwapchainKHR.
626  * pname:pSurfaceFormatCount is a pointer to an integer related to the
627    number of format tuples available or queried, as described below.
628  * pname:pSurfaceFormats is either `NULL` or a pointer to an array of
629    slink:VkSurfaceFormat2KHR structures.
630
631If pname:pSurfaceFormats is `NULL`, then the number of format tuples
632supported for the given pname:surface is returned in
633pname:pSurfaceFormatCount.
634The number of format tuples supported will be greater than or equal to 1.
635Otherwise, pname:pSurfaceFormatCount must: point to a variable set by the
636user to the number of elements in the pname:pSurfaceFormats array, and on
637return the variable is overwritten with the number of structures actually
638written to pname:pSurfaceFormats.
639If the value of pname:pSurfaceFormatCount is less than the number of format
640tuples supported, at most pname:pSurfaceFormatCount structures will be
641written.
642If pname:pSurfaceFormatCount is smaller than the number of format tuples
643supported for the surface parameters described in pname:pSurfaceInfo,
644ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS to indicate
645that not all the available values were returned.
646
647include::../../validity/protos/vkGetPhysicalDeviceSurfaceFormats2KHR.txt[]
648--
649
650[open,refpage='VkSurfaceFormat2KHR',desc='Structure describing a supported swapchain format tuple',type='structs']
651--
652
653The sname:VkSurfaceFormat2KHR structure is defined as:
654
655include::../../api/structs/VkSurfaceFormat2KHR.txt[]
656
657  * pname:sType is the type of this structure.
658  * pname:pNext is `NULL` or a pointer to an extension-specific structure.
659  * pname:surfaceFormat is an instance of slink:VkSurfaceFormatKHR
660    describing a format-color space pair that is compatible with the
661    specified surface.
662
663include::../../validity/structs/VkSurfaceFormat2KHR.txt[]
664--
665
666endif::VK_KHR_get_surface_capabilities2[]
667
668While the pname:format of a presentable image refers to the encoding of each
669pixel, the pname:colorSpace determines how the presentation engine
670interprets the pixel values.
671A color space in this document refers to a specific color space (defined by
672the chromaticities of its primaries and a white point in CIE Lab), and a
673transfer function that is applied before storing or transmitting color data
674in the given color space.
675
676[open,refpage='VkColorSpaceKHR',desc='supported color space of the presentation engine',type='enums']
677--
678
679Possible values of slink:VkSurfaceFormatKHR::pname:colorSpace, specifying
680supported color spaces of a presentation engine, are:
681
682include::../../api/enums/VkColorSpaceKHR.txt[]
683
684  * ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR specifies support for the sRGB
685    color space.
686ifdef::VK_EXT_swapchain_colorspace[]
687  * ename:VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT specifies support for the
688    Display-P3 color space and applies an sRGB-like transfer function
689    (defined below).
690  * ename:VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT specifies support for the
691    extended sRGB color space and applies a linear transfer function.
692  * ename:VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT specifies support for
693    the extended sRGB color space and applies an sRGB transfer function.
694  * ename:VK_COLOR_SPACE_DCI_P3_LINEAR_EXT specifies support for the DCI-P3
695    color space and applies a linear OETF.
696  * ename:VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT specifies support for the
697    DCI-P3 color space and applies the Gamma 2.6 OETF.
698  * ename:VK_COLOR_SPACE_BT709_LINEAR_EXT specifies support for the BT709
699    color space and applies a linear OETF.
700  * ename:VK_COLOR_SPACE_BT709_NONLINEAR_EXT specifies support for the BT709
701    color space and applies the SMPTE 170M OETF.
702  * ename:VK_COLOR_SPACE_BT2020_LINEAR_EXT specifies support for the BT2020
703    color space and applies a linear OETF.
704  * ename:VK_COLOR_SPACE_HDR10_ST2084_EXT specifies support for the HDR10
705    (BT2020 color) space and applies the SMPTE ST2084 Perceptual Quantizer
706    (PQ) OETF.
707  * ename:VK_COLOR_SPACE_DOLBYVISION_EXT specifies support for the Dolby
708    Vision (BT2020 color space), proprietary encoding, and applies the SMPTE
709    ST2084 OETF.
710  * ename:VK_COLOR_SPACE_HDR10_HLG_EXT specifies support for the HDR10
711    (BT2020 color space) and applies the Hybrid Log Gamma (HLG) OETF.
712  * ename:VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT specifies support for the
713    AdobeRGB color space and applies a linear OETF.
714  * ename:VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT specifies support for the
715    AdobeRGB color space and applies the Gamma 2.2 OETF.
716  * ename:VK_COLOR_SPACE_PASS_THROUGH_EXT specifies that color components
717    are used "`as is`".
718    This is intended to allow applications to supply data for color spaces
719    not described here.
720
721The color components of Non-linear color space swap chain images have had
722the appropriate transfer function applied.
723Vulkan requires that all implementations support the sRGB transfer function
724when using an SRGB pixel format.
725Other transfer functions, such as SMPTE 170M or SMPTE2084, must: not be
726performed by the implementation, but can: be performed by the application
727shader.
728This extension defines enums for elink:VkColorSpaceKHR that correspond to
729the following color spaces:
730
731[[VK_EXT_swapchain_colorspace-table]]
732.Color Spaces and Attributes
733[options="header"]
734|====
735| Name           | Red Primary  | Green Primary | Blue Primary | White-point | Transfer function
736| DCI-P3         | 0.680, 0.320 | 0.265, 0.690  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | Gamma 2.6
737| Display-P3     | 0.680, 0.320 | 0.265, 0.690  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | Display-P3
738| BT709          | 0.640, 0.330 | 0.300, 0.600  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | SMPTE 170M
739| sRGB           | 0.640, 0.330 | 0.300, 0.600  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | sRGB
740| extended sRGB  | 0.640, 0.330 | 0.300, 0.600  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | extended sRGB
741| HDR10_ST2084   | 0.708, 0.292 | 0.170, 0.797  | 0.131, 0.046 | 0.3127, 0.3290 (D65) | ST2084
742| DOLBYVISION    | 0.708, 0.292 | 0.170, 0.797  | 0.131, 0.046 | 0.3127, 0.3290 (D65) | ST2084
743| HDR10_HLG      | 0.708, 0.292 | 0.170, 0.797  | 0.131, 0.046 | 0.3127, 0.3290 (D65) | HLG
744| AdobeRGB       | 0.640, 0.330 | 0.210, 0.710  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | AdobeRGB
745|====
746
747For Opto-Electrical Transfer Function (OETF), unless otherwise specified,
748the values of [eq]#L# and [eq]#E# are defined as:
749
750[eq]#L# - linear luminance of image latexmath:[0 \leq L \leq 1] for
751conventional colorimetry
752
753[eq]#E# - corresponding electrical signal (value stored in memory)
754
755// @@@ The ref page is ended earlier than in the original markup due to
756// asciidoctor issues described in internal MR 2201.
757endif::VK_EXT_swapchain_colorspace[]
758
759--
760
761ifdef::VK_EXT_swapchain_colorspace[]
762
763=== sRGB transfer function
764
765[latexmath]
766+++++++++++++++++++
767\begin{aligned}
768E & =
769  \begin{cases}
770    1.055 \times L^{1 \over 2.4} - 0.055 & \text{for}\  0.0031308 \leq L \leq 1 \\
771    12.92 \times L                       & \text{for}\  0 \leq L < 0.0031308
772  \end{cases}
773\end{aligned}
774+++++++++++++++++++
775
776
777=== Display-P3 EOTF
778
779[latexmath]
780+++++++++++++++++++
781\begin{aligned}
782E & =
783  \begin{cases}
784    (a \times L + b)^{2.4} & \text{for}\  0.039 \leq L \leq 1 \\
785    b \times L                    & \text{for}\  0 \leq L < 0.039
786  \end{cases}
787\end{aligned}
788+++++++++++++++++++
789
790latexmath:[a = 0.948] +
791latexmath:[b = 0.052] +
792latexmath:[c = 0.077] +
793
794
795=== Display-P3 OETF
796
797[latexmath]
798+++++++++++++++++++
799\begin{aligned}
800E & =
801  \begin{cases}
802    1.055 \times L^{1 \over 2.4} - 0.055 & \text{for}\  0.0030186 \leq L \leq 1 \\
803    12.92 \times L                       & \text{for}\  0 \leq L < 0.0030186
804  \end{cases}
805\end{aligned}
806+++++++++++++++++++
807
808[NOTE]
809.Note
810====
811For most uses, the sRGB OETF is equivalent.
812====
813
814
815=== Extended sRGB OETF
816
817[latexmath]
818+++++++++++++++++++
819\begin{aligned}
820E & =
821  \begin{cases}
822    1.055 \times L^{1 \over 2.4} - 0.055 & \text{for}\  0.0031308 \leq L \leq 7.5913 \\
823    12.92 \times L                       & \text{for}\  0 \leq L < 0.0031308 \\
824    -f(-L)                               & \text{for}\  L < 0
825  \end{cases}
826\end{aligned}
827+++++++++++++++++++
828
829[eq]#L# - luminance of image is within [eq]#[-0.6038, 7.5913]#.
830
831[eq]#E# can be negative and/or > 1.
832That is how extended sRGB specifies colors outside the standard sRGB gamut.
833This means extended sRGB needs a floating point pixel format to cover the
834intended color range.
835
836
837=== SMPTE 170M OETF
838
839[latexmath]
840+++++++++++++++++++
841\begin{aligned}
842E & =
843  \begin{cases}
844    \alpha \times L^{0.45} - (1 - \alpha) & \text{for}\  \beta \leq L \leq 1 \\
845    4.5 \times L                            & \text{for}\  0 \leq L < \beta
846  \end{cases}
847\end{aligned}
848+++++++++++++++++++
849
850latexmath:[\alpha = 1.099 \text{ and } \beta = 0.018 \text{ for 10-bits and
851less per sample system (the values given in Rec.
852709)}] +
853latexmath:[\alpha = 1.0993 \text{ and } \beta = 0.0181 \text{ for 12-bits
854per sample system}]
855
856
857=== SMPTE ST2084 OETF (Inverse-EOTF)
858
859[latexmath]
860+++++++++++++++++++
861\[
862E = (\frac{c_1 + c_2 \times L^{m_1}}{1 + c_3 \times L^{m_1}})^{m_2}
863\]
864+++++++++++++++++++
865
866where:
867
868latexmath:[m_1 = 2610 / 4096 \times \frac{1}{4} = 0.1593017578125] +
869latexmath:[m_2 = 2523 / 4096 \times 128 = 78.84375] +
870latexmath:[c_1 = 3424 / 4096 = 0.8359375 = c3 - c2 + 1] +
871latexmath:[c_2 = 2413 / 4096 \times 32 = 18.8515625] +
872latexmath:[c_3 = 2392 / 4096 \times 32 = 18.6875] +
873
874
875=== Hybrid Log Gamma (HLG)
876
877[latexmath]
878+++++++++++++++++++
879\begin{aligned}
880E & =
881  \begin{cases}
882    r \sqrt{L}                & \text{for}\  0 \leq L \leq 1 \\
883    a \times \ln(L - b) + c    & \text{for}\  1 < L
884  \end{cases}
885\end{aligned}
886+++++++++++++++++++
887
888[eq]#_L_# -- is the signal normalized by the reference white level +
889[eq]#_r_# -- is the reference white level and has a signal value of 0.5 +
890[eq]#_a_ = 0.17883277# and [eq]#_b_ = 0.28466892# and [eq]#_c_ = 0.55991073#
891
892
893=== Adobe RGB (1998) OETF
894
895latexmath:[E = L^\frac{1}{2.19921875}]
896
897
898=== Gamma 2.6 OETF
899
900latexmath:[E = L^\frac{1}{2.6}]
901
902An implementation supporting this extension indicates support for these
903color spaces via slink:VkSurfaceFormatKHR structures returned from
904flink:vkGetPhysicalDeviceSurfaceFormatsKHR.
905
906Specifying the supported surface color space when calling
907flink:vkCreateSwapchainKHR will create a swapchain using that color space.
908
909Vulkan requires that all implementations support the sRGB Opto-Electrical
910Transfer Function (OETF) and Electro-optical transfer function (EOTF) when
911using an SRGB pixel format.
912Other transfer functions, such as SMPTE 170M, must: not be performed by the
913implementation, but can: be performed by the application shader.
914
915endif::VK_EXT_swapchain_colorspace[]
916
917If pname:pSurfaceFormats includes an entry whose value for pname:colorSpace
918is ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR and whose value for pname:format
919is a UNORM (or SRGB) format and the corresponding SRGB (or UNORM) format is
920a color renderable format for ename:VK_IMAGE_TILING_OPTIMAL, then
921pname:pSurfaceFormats must: also contain an entry with the same value for
922pname:colorSpace and pname:format equal to the corresponding SRGB (or UNORM)
923format.
924
925[NOTE]
926.Note
927====
928If pname:pSurfaceFormats includes just one entry, whose value for
929pname:format is ename:VK_FORMAT_UNDEFINED, pname:surface has no preferred
930format.
931In this case, the application can: use any valid elink:VkFormat value.
932====
933
934[NOTE]
935.Note
936====
937In the initial release of the `VK_KHR_surface` and `<<VK_KHR_swapchain>>`
938extensions, the token ename:VK_COLORSPACE_SRGB_NONLINEAR_KHR was used.
939Starting in the 2016-05-13 updates to the extension branches, matching
940release 1.0.13 of the core API specification,
941ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR is used instead for consistency with
942Vulkan naming rules.
943The older enum is still available for backwards compatibility.
944====
945
946// @@@ originally, the VkColorSpaceKHR ref page ended here
947// --
948
949[open,refpage='vkGetPhysicalDeviceSurfacePresentModesKHR',desc='Query supported presentation modes',type='protos']
950--
951
952To query the supported presentation modes for a surface, call:
953
954include::../../api/protos/vkGetPhysicalDeviceSurfacePresentModesKHR.txt[]
955
956  * pname:physicalDevice is the physical device that will be associated with
957    the swapchain to be created, as described for
958    flink:vkCreateSwapchainKHR.
959  * pname:surface is the surface that will be associated with the swapchain.
960  * pname:pPresentModeCount is a pointer to an integer related to the number
961    of presentation modes available or queried, as described below.
962  * pname:pPresentModes is either `NULL` or a pointer to an array of
963    elink:VkPresentModeKHR values, indicating the supported presentation
964    modes.
965
966If pname:pPresentModes is `NULL`, then the number of presentation modes
967supported for the given pname:surface is returned in
968pname:pPresentModeCount.
969Otherwise, pname:pPresentModeCount must: point to a variable set by the user
970to the number of elements in the pname:pPresentModes array, and on return
971the variable is overwritten with the number of values actually written to
972pname:pPresentModes.
973If the value of pname:pPresentModeCount is less than the number of
974presentation modes supported, at most pname:pPresentModeCount values will be
975written.
976If pname:pPresentModeCount is smaller than the number of presentation modes
977supported for the given pname:surface, ename:VK_INCOMPLETE will be returned
978instead of ename:VK_SUCCESS to indicate that not all the available values
979were returned.
980
981include::../../validity/protos/vkGetPhysicalDeviceSurfacePresentModesKHR.txt[]
982--
983
984[open,refpage='VkPresentModeKHR',desc='presentation mode supported for a surface',type='enums']
985--
986
987Possible values of elements of the
988flink:vkGetPhysicalDeviceSurfacePresentModesKHR::pname:pPresentModes array,
989indicating the supported presentation modes for a surface, are:
990
991include::../../api/enums/VkPresentModeKHR.txt[]
992
993  * ename:VK_PRESENT_MODE_IMMEDIATE_KHR specifies that the presentation
994    engine does not wait for a vertical blanking period to update the
995    current image, meaning this mode may: result in visible tearing.
996    No internal queuing of presentation requests is needed, as the requests
997    are applied immediately.
998  * ename:VK_PRESENT_MODE_MAILBOX_KHR specifies that the presentation engine
999    waits for the next vertical blanking period to update the current image.
1000    Tearing cannot: be observed.
1001    An internal single-entry queue is used to hold pending presentation
1002    requests.
1003    If the queue is full when a new presentation request is received, the
1004    new request replaces the existing entry, and any images associated with
1005    the prior entry become available for re-use by the application.
1006    One request is removed from the queue and processed during each vertical
1007    blanking period in which the queue is non-empty.
1008  * ename:VK_PRESENT_MODE_FIFO_KHR specifies that the presentation engine
1009    waits for the next vertical blanking period to update the current image.
1010    Tearing cannot: be observed.
1011    An internal queue is used to hold pending presentation requests.
1012    New requests are appended to the end of the queue, and one request is
1013    removed from the beginning of the queue and processed during each
1014    vertical blanking period in which the queue is non-empty.
1015    This is the only value of pname:presentMode that is required: to be
1016    supported.
1017  * ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR specifies that the presentation
1018    engine generally waits for the next vertical blanking period to update
1019    the current image.
1020    If a vertical blanking period has already passed since the last update
1021    of the current image then the presentation engine does not wait for
1022    another vertical blanking period for the update, meaning this mode may:
1023    result in visible tearing in this case.
1024    This mode is useful for reducing visual stutter with an application that
1025    will mostly present a new image before the next vertical blanking
1026    period, but may occasionally be late, and present a new image just after
1027    the next vertical blanking period.
1028    An internal queue is used to hold pending presentation requests.
1029    New requests are appended to the end of the queue, and one request is
1030    removed from the beginning of the queue and processed during or after
1031    each vertical blanking period in which the queue is non-empty.
1032ifdef::VK_KHR_shared_presentable_image[]
1033  * ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR specifies that the
1034    presentation engine and application have concurrent access to a single
1035    image, which is referred to as a _shared presentable image_.
1036    The presentation engine is only required to update the current image
1037    after a new presentation request is received.
1038    Therefore the application must: make a presentation request whenever an
1039    update is required.
1040    However, the presentation engine may: update the current image at any
1041    point, meaning this mode may: result in visible tearing.
1042  * ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR specifies that the
1043    presentation engine and application have concurrent access to a single
1044    image, which is referred to as a _shared presentable image_.
1045    The presentation engine periodically updates the current image on its
1046    regular refresh cycle.
1047    The application is only required to make one initial presentation
1048    request, after which the presentation engine must: update the current
1049    image without any need for further presentation requests.
1050    The application can: indicate the image contents have been updated by
1051    making a presentation request, but this does not guarantee the timing of
1052    when it will be updated.
1053    This mode may: result in visible tearing if rendering to the image is
1054    not timed correctly.
1055
1056The supported elink:VkImageUsageFlagBits of the presentable images of a
1057swapchain created for a surface may: differ depending on the presentation
1058mode, and can be determined as per the table below:
1059
1060.Presentable image usage queries
1061[width="100%",cols="<50%,<50%",options="header"]
1062|====
1063| Presentation mode                                   | Image usage flags
1064| ename:VK_PRESENT_MODE_IMMEDIATE_KHR                 | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
1065| ename:VK_PRESENT_MODE_MAILBOX_KHR                   | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
1066| ename:VK_PRESENT_MODE_FIFO_KHR                      | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
1067| ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR              | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
1068| ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR     | slink:VkSharedPresentSurfaceCapabilitiesKHR::pname:sharedPresentSupportedUsageFlags
1069| ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR | slink:VkSharedPresentSurfaceCapabilitiesKHR::pname:sharedPresentSupportedUsageFlags
1070|====
1071endif::VK_KHR_shared_presentable_image[]
1072
1073[NOTE]
1074.Note
1075====
1076For reference, the mode indicated by ename:VK_PRESENT_MODE_FIFO_KHR is
1077equivalent to the behavior of {wgl|glX|egl}SwapBuffers with a swap interval
1078of 1, while the mode indicated by ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR is
1079equivalent to the behavior of {wgl|glX}SwapBuffers with a swap interval of
1080-1 (from the {WGL|GLX}_EXT_swap_control_tear extensions).
1081====
1082
1083--
1084
1085ifdef::VK_KHR_swapchain[]
1086ifdef::VK_VERSION_1_1,VK_KHR_device_group[]
1087
1088
1089== Device Group Queries
1090
1091[open,refpage='vkGetDeviceGroupPresentCapabilitiesKHR',desc='Query present capabilities from other physical devices',type='protos']
1092--
1093
1094A logical device that represents multiple physical devices may: support
1095presenting from images on more than one physical device, or combining images
1096from multiple physical devices.
1097
1098To query these capabilities, call:
1099
1100include::../../api/protos/vkGetDeviceGroupPresentCapabilitiesKHR.txt[]
1101
1102  * pname:device is the logical device.
1103  * pname:pDeviceGroupPresentCapabilities is a pointer to a structure of
1104    type slink:VkDeviceGroupPresentCapabilitiesKHR that is filled with the
1105    logical device's capabilities.
1106
1107include::../../validity/protos/vkGetDeviceGroupPresentCapabilitiesKHR.txt[]
1108--
1109
1110[open,refpage='VkDeviceGroupPresentCapabilitiesKHR',desc='Present capabilities from other physical devices',type='structs']
1111--
1112
1113The sname:VkDeviceGroupPresentCapabilitiesKHR structure is defined as:
1114
1115include::../../api/structs/VkDeviceGroupPresentCapabilitiesKHR.txt[]
1116
1117  * pname:sType is the type of this structure.
1118  * pname:pNext is `NULL` or a pointer to an extension-specific structure.
1119  * pname:presentMask is an array of masks, where the mask at element
1120    [eq]#i# is non-zero if physical device [eq]#i# has a presentation
1121    engine, and where bit [eq]#j# is set in element [eq]#i# if physical
1122    device [eq]#i# can: present swapchain images from physical device
1123    [eq]#j#.
1124    If element [eq]#i# is non-zero, then bit [eq]#i# must: be set.
1125  * pname:modes is a bitmask of elink:VkDeviceGroupPresentModeFlagBitsKHR
1126    indicating which device group presentation modes are supported.
1127
1128pname:modes always has ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR set.
1129
1130The present mode flags are also used when presenting an image, in
1131slink:VkDeviceGroupPresentInfoKHR::pname:mode.
1132
1133If a device group only includes a single physical device, then pname:modes
1134must: equal ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR.
1135
1136include::../../validity/structs/VkDeviceGroupPresentCapabilitiesKHR.txt[]
1137--
1138
1139
1140[open,refpage='VkDeviceGroupPresentModeFlagBitsKHR',desc='Bitmask specifying supported device group present modes',type='enums']
1141--
1142
1143Bits which may: be set in
1144slink:VkDeviceGroupPresentCapabilitiesKHR::pname:modes to indicate which
1145device group presentation modes are supported are:
1146
1147include::../../api/enums/VkDeviceGroupPresentModeFlagBitsKHR.txt[]
1148
1149  * ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR specifies that any
1150    physical device with a presentation engine can: present its own
1151    swapchain images.
1152  * ename:VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR specifies that any
1153    physical device with a presentation engine can: present swapchain images
1154    from any physical device in its pname:presentMask.
1155  * ename:VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR specifies that any
1156    physical device with a presentation engine can: present the sum of
1157    swapchain images from any physical devices in its pname:presentMask.
1158  * ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR specifies
1159    that multiple physical devices with a presentation engine can: each
1160    present their own swapchain images.
1161
1162--
1163
1164[open,refpage='VkDeviceGroupPresentModeFlagsKHR',desc='Bitmask of VkDeviceGroupPresentModeFlagBitsKHR',type='enums']
1165--
1166include::../../api/flags/VkDeviceGroupPresentModeFlagsKHR.txt[]
1167
1168sname:VkDeviceGroupPresentModeFlagsKHR is a bitmask type for setting a mask
1169of zero or more slink:VkDeviceGroupPresentModeFlagBitsKHR.
1170--
1171
1172[open,refpage='vkGetDeviceGroupSurfacePresentModesKHR',desc='Query present capabilities for a surface',type='protos']
1173--
1174
1175Some surfaces may: not be capable of using all the device group present
1176modes.
1177
1178To query the supported device group present modes for a particular surface,
1179call:
1180
1181include::../../api/protos/vkGetDeviceGroupSurfacePresentModesKHR.txt[]
1182
1183  * pname:device is the logical device.
1184  * pname:surface is the surface.
1185  * pname:pModes is a pointer to a value of type
1186    sname:VkDeviceGroupPresentModeFlagsKHR that is filled with the supported
1187    device group present modes for the surface.
1188
1189The modes returned by this command are not invariant, and may: change in
1190response to the surface being moved, resized, or occluded.
1191These modes must: be a subset of the modes returned by
1192flink:vkGetDeviceGroupPresentCapabilitiesKHR.
1193
1194include::../../validity/protos/vkGetDeviceGroupSurfacePresentModesKHR.txt[]
1195
1196--
1197
1198[open,refpage='vkGetPhysicalDevicePresentRectanglesKHR',desc='Query present rectangles for a surface on a physical device',type='protos']
1199--
1200
1201When using ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR,
1202the application may: need to know which regions of the surface are used when
1203presenting locally on each physical device.
1204Presentation of swapchain images to this surface need only have valid
1205contents in the regions returned by this command.
1206
1207To query a set of rectangles used in presentation on the physical device,
1208call:
1209
1210include::../../api/protos/vkGetPhysicalDevicePresentRectanglesKHR.txt[]
1211
1212  * pname:physicalDevice is the physical device.
1213  * pname:surface is the surface.
1214  * pname:pRectCount is a pointer to an integer related to the number of
1215    rectangles available or queried, as described below.
1216  * pname:pRects is either `NULL` or a pointer to an array of slink:VkRect2D
1217    structures.
1218
1219If pname:pRects is `NULL`, then the number of rectangles used when
1220presenting the given pname:surface is returned in pname:pRectCount.
1221Otherwise, pname:pRectCount must: point to a variable set by the user to the
1222number of elements in the pname:pRects array, and on return the variable is
1223overwritten with the number of structures actually written to pname:pRects.
1224If the value of pname:pRectCount is less than the number of rectangles, at
1225most pname:pRectCount structures will be written.
1226If pname:pRectCount is smaller than the number of rectangles used for the
1227given pname:surface, ename:VK_INCOMPLETE will be returned instead of
1228ename:VK_SUCCESS to indicate that not all the available values were
1229returned.
1230
1231The values returned by this command are not invariant, and may: change in
1232response to the surface being moved, resized, or occluded.
1233
1234The rectangles returned by this command must: not overlap.
1235
1236include::../../validity/protos/vkGetPhysicalDevicePresentRectanglesKHR.txt[]
1237
1238--
1239
1240endif::VK_VERSION_1_1,VK_KHR_device_group[]
1241
1242ifdef::VK_GOOGLE_display_timing[]
1243include::../VK_GOOGLE_display_timing/queries.txt[]
1244endif::VK_GOOGLE_display_timing[]
1245
1246include::../VK_KHR_swapchain/wsi.txt[]
1247endif::VK_KHR_swapchain[]
1248