summaryrefslogtreecommitdiff
path: root/chapters/VK_KHR_surface/wsi.adoc
blob: fba9dd8e57dc60fd1e84709a6b524368d676c21f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
// Copyright 2014-2024 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

[[wsi]]
= Window System Integration (WSI)

This chapter discusses the window system integration (WSI) between the
Vulkan API and the various forms of displaying the results of rendering to a
user.
Since the Vulkan API can: be used without displaying results, WSI is
provided through the use of optional Vulkan extensions.
This chapter provides an overview of WSI.
See the appendix for additional details of each WSI extension, including
which extensions must: be enabled in order to use each of the functions
described in this chapter.


== WSI Platform

A platform is an abstraction for a window system, OS, etc.
Some examples include MS Windows, Android, and Wayland.
The Vulkan API may: be integrated in a unique manner for each platform.

The Vulkan API does not define any type of platform object.
Platform-specific WSI extensions are defined, each containing
platform-specific functions for using WSI.
Use of these extensions is guarded by preprocessor symbols as defined in the
<<boilerplate-wsi-header,Window System-Specific Header Control>> appendix.

In order for an application to be compiled to use WSI with a given platform,
it must either:

  * `#define` the appropriate preprocessor symbol prior to including the
    `{full_header}` header file, or
  * include `{core_header}` and any native platform headers, followed by the
    appropriate platform-specific header.

The preprocessor symbols and platform-specific headers are defined in the
<<boilerplate-wsi-header-table, Window System Extensions and Headers>>
table.

Each platform-specific extension is an instance extension.
The application must: enable instance extensions with fname:vkCreateInstance
before using them.


== WSI Surface

[open,refpage='VkSurfaceKHR',desc='Opaque handle to a surface object',type='handles']
--
Native platform surface or window objects are abstracted by surface objects,
which are represented by sname:VkSurfaceKHR handles:

include::{generated}/api/handles/VkSurfaceKHR.adoc[]

The `apiext:VK_KHR_surface` extension declares the sname:VkSurfaceKHR
object, and provides a function for destroying sname:VkSurfaceKHR objects.
Separate platform-specific extensions each provide a function for creating a
sname:VkSurfaceKHR object for the respective platform.
From the application's perspective this is an opaque handle, just like the
handles of other Vulkan objects.

ifdef::implementation-guide[]
[NOTE]
.Note
====
On certain platforms, the Vulkan loader and ICDs may: have conventions that
treat the handle as a pointer to a structure containing the
platform-specific information about the surface.
This will be described in the documentation for the loader-ICD interface,
and in the `vk_icd.h` header file of the LoaderAndTools source-code
repository.
This does not affect the loader-layer interface; layers may: wrap
sname:VkSurfaceKHR objects.
====
endif::implementation-guide[]
--

ifdef::editing-notes[]
[NOTE]
.editing-note
====
TODO: Consider replacing the above note editing note with a pointer to the
loader specification, when it exists.
However, the information is not relevant to users of the API nor does it
affect conformance of a Vulkan implementation.
====
endif::editing-notes[]

ifdef::VK_KHR_android_surface[]
include::{chapters}/VK_KHR_android_surface/platformCreateSurface_android.adoc[]
endif::VK_KHR_android_surface[]

ifdef::VK_KHR_wayland_surface[]
include::{chapters}/VK_KHR_wayland_surface/platformCreateSurface_wayland.adoc[]
endif::VK_KHR_wayland_surface[]

ifdef::VK_KHR_win32_surface[]
include::{chapters}/VK_KHR_win32_surface/platformCreateSurface_win32.adoc[]
endif::VK_KHR_win32_surface[]

ifdef::VK_KHR_xcb_surface[]
include::{chapters}/VK_KHR_xcb_surface/platformCreateSurface_xcb.adoc[]
endif::VK_KHR_xcb_surface[]

ifdef::VK_KHR_xlib_surface[]
include::{chapters}/VK_KHR_xlib_surface/platformCreateSurface_xlib.adoc[]
endif::VK_KHR_xlib_surface[]

ifdef::VK_EXT_directfb_surface[]
include::{chapters}/VK_EXT_directfb_surface/platformCreateSurface_directfb.adoc[]
endif::VK_EXT_directfb_surface[]

ifdef::VK_FUCHSIA_imagepipe_surface[]
include::{chapters}/VK_FUCHSIA_imagepipe_surface/platformCreateSurface_imagepipe.adoc[]
endif::VK_FUCHSIA_imagepipe_surface[]

ifdef::VK_GGP_stream_descriptor_surface[]
include::{chapters}/VK_GGP_stream_descriptor_surface/platformCreateSurface_streamdescriptor.adoc[]
endif::VK_GGP_stream_descriptor_surface[]

ifdef::VK_MVK_ios_surface[]
include::{chapters}/VK_MVK_ios_surface/platformCreateSurface_ios.adoc[]
endif::VK_MVK_ios_surface[]

ifdef::VK_MVK_macos_surface[]
include::{chapters}/VK_MVK_macos_surface/platformCreateSurface_macos.adoc[]
endif::VK_MVK_macos_surface[]

ifdef::VK_NN_vi_surface[]
include::{chapters}/VK_NN_vi_surface/platformCreateSurface_vi.adoc[]
endif::VK_NN_vi_surface[]

ifdef::VK_EXT_metal_surface[]
include::{chapters}/VK_EXT_metal_surface/platformCreateSurface_metal.adoc[]
endif::VK_EXT_metal_surface[]

ifdef::VK_QNX_screen_surface[]
include::{chapters}/VK_QNX_screen_surface/platformCreateSurface_screen.adoc[]
endif::VK_QNX_screen_surface[]


=== Platform-Independent Information

Once created, sname:VkSurfaceKHR objects can: be used in this and other
extensions, in particular the `apiext:VK_KHR_swapchain` extension.

Several WSI functions return ename:VK_ERROR_SURFACE_LOST_KHR if the surface
becomes no longer available.
After such an error, the surface (and any child swapchain, if one exists)
should: be destroyed, as there is no way to restore them to a not-lost
state.
Applications may: attempt to create a new sname:VkSurfaceKHR using the same
native platform window object, but whether such re-creation will succeed is
platform-dependent and may: depend on the reason the surface became
unavailable.
A lost surface does not otherwise cause devices to be
<<devsandqueues-lost-device,lost>>.

[open,refpage='vkDestroySurfaceKHR',desc='Destroy a VkSurfaceKHR object',type='protos']
--
To destroy a sname:VkSurfaceKHR object, call:

include::{generated}/api/protos/vkDestroySurfaceKHR.adoc[]

  * pname:instance is the instance used to create the surface.
  * pname:surface is the surface to destroy.
  * pname:pAllocator is the allocator used for host memory allocated for the
    surface object when there is no more specific allocator available (see
    <<memory-allocation,Memory Allocation>>).

Destroying a sname:VkSurfaceKHR merely severs the connection between Vulkan
and the native surface, and does not imply destroying the native surface,
closing a window, or similar behavior.

.Valid Usage
****
ifndef::VKSC_VERSION_1_0[]
  * [[VUID-vkDestroySurfaceKHR-surface-01266]]
    All sname:VkSwapchainKHR objects created for pname:surface must: have
    been destroyed prior to destroying pname:surface
  * [[VUID-vkDestroySurfaceKHR-surface-01267]]
    If sname:VkAllocationCallbacks were provided when pname:surface was
    created, a compatible set of callbacks must: be provided here
  * [[VUID-vkDestroySurfaceKHR-surface-01268]]
    If no sname:VkAllocationCallbacks were provided when pname:surface was
    created, pname:pAllocator must: be `NULL`
endif::VKSC_VERSION_1_0[]
****

include::{generated}/validity/protos/vkDestroySurfaceKHR.adoc[]
--

ifdef::VK_KHR_display[]
include::{chapters}/VK_KHR_display/display.adoc[]
endif::VK_KHR_display[]

ifdef::VK_EXT_headless_surface[]
include::{chapters}/VK_EXT_headless_surface/headless.adoc[]
endif::VK_EXT_headless_surface[]


== Querying for WSI Support

Not all physical devices will include WSI support.
Within a physical device, not all queue families will support presentation.
WSI support and compatibility can: be determined in a platform-neutral
manner (which determines support for presentation to a particular surface
object) and additionally may: be determined in platform-specific manners
(which determine support for presentation on the specified physical device
but do not guarantee support for presentation to a particular surface
object).

[open,refpage='vkGetPhysicalDeviceSurfaceSupportKHR',desc='Query if presentation is supported',type='protos']
--
:refpage: vkGetPhysicalDeviceSurfaceSupportKHR

To determine whether a queue family of a physical device supports
presentation to a given surface, call:

include::{generated}/api/protos/vkGetPhysicalDeviceSurfaceSupportKHR.adoc[]

  * pname:physicalDevice is the physical device.
  * pname:queueFamilyIndex is the queue family.
  * pname:surface is the surface.
  * pname:pSupported is a pointer to a basetype:VkBool32, which is set to
    ename:VK_TRUE to indicate support, and ename:VK_FALSE otherwise.

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
  * [[VUID-vkGetPhysicalDeviceSurfaceSupportKHR-queueFamilyIndex-01269]]
    pname:queueFamilyIndex must: be less than
    pname:pQueueFamilyPropertyCount returned by
    fname:vkGetPhysicalDeviceQueueFamilyProperties for the given
    pname:physicalDevice
****

include::{generated}/validity/protos/vkGetPhysicalDeviceSurfaceSupportKHR.adoc[]
--

ifdef::VK_KHR_android_surface[]
include::{chapters}/VK_KHR_android_surface/platformQuerySupport_android.adoc[]
endif::VK_KHR_android_surface[]

ifdef::VK_KHR_wayland_surface[]
include::{chapters}/VK_KHR_wayland_surface/platformQuerySupport_wayland.adoc[]
endif::VK_KHR_wayland_surface[]

ifdef::VK_KHR_win32_surface[]
include::{chapters}/VK_KHR_win32_surface/platformQuerySupport_win32.adoc[]
endif::VK_KHR_win32_surface[]

ifdef::VK_KHR_xcb_surface[]
include::{chapters}/VK_KHR_xcb_surface/platformQuerySupport_xcb.adoc[]
endif::VK_KHR_xcb_surface[]

ifdef::VK_KHR_xlib_surface[]
include::{chapters}/VK_KHR_xlib_surface/platformQuerySupport_xlib.adoc[]
endif::VK_KHR_xlib_surface[]

ifdef::VK_EXT_directfb_surface[]
include::{chapters}/VK_EXT_directfb_surface/platformQuerySupport_directfb.adoc[]
endif::VK_EXT_directfb_surface[]

ifdef::VK_FUCHSIA_imagepipe_surface[]
include::{chapters}/VK_FUCHSIA_imagepipe_surface/platformQuerySupport_imagepipe.adoc[]
endif::VK_FUCHSIA_imagepipe_surface[]

ifdef::VK_GGP_stream_descriptor_surface[]
include::{chapters}/VK_GGP_stream_descriptor_surface/platformQuerySupport_streamdescriptor.adoc[]
endif::VK_GGP_stream_descriptor_surface[]

ifdef::VK_MVK_ios_surface[]
include::{chapters}/VK_MVK_ios_surface/platformQuerySupport_ios.adoc[]
endif::VK_MVK_ios_surface[]

ifdef::VK_MVK_macos_surface[]
include::{chapters}/VK_MVK_macos_surface/platformQuerySupport_macos.adoc[]
endif::VK_MVK_macos_surface[]

ifdef::VK_NN_vi_surface[]
include::{chapters}/VK_NN_vi_surface/platformQuerySupport_vi.adoc[]
endif::VK_NN_vi_surface[]

ifdef::VK_QNX_screen_surface[]
include::{chapters}/VK_QNX_screen_surface/platformQuerySupport_screen.adoc[]
endif::VK_QNX_screen_surface[]


== Surface Queries

The capabilities of a swapchain targeting a surface are the intersection of
the capabilities of the WSI platform, the native window or display, and the
physical device.
The resulting capabilities can: be obtained with the queries listed below in
this section.

[NOTE]
.Note
====
In addition to the surface capabilities as obtained by surface queries
below, swapchain images are also subject to ordinary image creation limits
as reported by flink:vkGetPhysicalDeviceImageFormatProperties.
As an application is instructed by the appropriate Valid Usage sections,
both the surface capabilities and the image creation limits have to be
satisfied whenever swapchain images are created.
====


=== Surface Capabilities

[open,refpage='vkGetPhysicalDeviceSurfaceCapabilitiesKHR',desc='Query surface capabilities',type='protos']
--
:refpage: vkGetPhysicalDeviceSurfaceCapabilitiesKHR

To query the basic capabilities of a surface, needed in order to create a
swapchain, call:

include::{generated}/api/protos/vkGetPhysicalDeviceSurfaceCapabilitiesKHR.adoc[]

  * pname:physicalDevice is the physical device that will be associated with
    the swapchain to be created, as described for
    flink:vkCreateSwapchainKHR.
  * pname:surface is the surface that will be associated with the swapchain.
  * pname:pSurfaceCapabilities is a pointer to a
    slink:VkSurfaceCapabilitiesKHR structure in which the capabilities are
    returned.

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
include::{chapters}/commonvalidity/surface_physical_device_common.adoc[]
****

include::{generated}/validity/protos/vkGetPhysicalDeviceSurfaceCapabilitiesKHR.adoc[]
--

[open,refpage='VkSurfaceCapabilitiesKHR',desc='Structure describing capabilities of a surface',type='structs']
--
The sname:VkSurfaceCapabilitiesKHR structure is defined as:

include::{generated}/api/structs/VkSurfaceCapabilitiesKHR.adoc[]

// These members are defined identically in VkSurfaceCapabilities2EXT, an
// extendable structure version of this query, so they are just reused from
// here.

// tag::surface_capabilities_members[]
  * pname:minImageCount is the minimum number of images the specified device
    supports for a swapchain created for the surface, and will be at least
    one.
  * pname:maxImageCount is the maximum number of images the specified device
    supports for a swapchain created for the surface, and will be either 0,
    or greater than or equal to pname:minImageCount.
    A value of 0 means that there is no limit on the number of images,
    though there may: be limits related to the total amount of memory used
    by presentable images.
  * pname:currentExtent is the current width and height of the surface, or
    the special value [eq]#(0xFFFFFFFF, 0xFFFFFFFF)# indicating that the
    surface size will be determined by the extent of a swapchain targeting
    the surface.
  * pname:minImageExtent contains the smallest valid swapchain extent for
    the surface on the specified device.
    The pname:width and pname:height of the extent will each be less than or
    equal to the corresponding pname:width and pname:height of
    pname:currentExtent, unless pname:currentExtent has the special value
    described above.
  * pname:maxImageExtent contains the largest valid swapchain extent for the
    surface on the specified device.
    The pname:width and pname:height of the extent will each be greater than
    or equal to the corresponding pname:width and pname:height of
    pname:minImageExtent.
    The pname:width and pname:height of the extent will each be greater than
    or equal to the corresponding pname:width and pname:height of
    pname:currentExtent, unless pname:currentExtent has the special value
    described above.
  * pname:maxImageArrayLayers is the maximum number of layers presentable
    images can: have for a swapchain created for this device and surface,
    and will be at least one.
  * pname:supportedTransforms is a bitmask of
    elink:VkSurfaceTransformFlagBitsKHR indicating the presentation
    transforms supported for the surface on the specified device.
    At least one bit will be set.
  * pname:currentTransform is elink:VkSurfaceTransformFlagBitsKHR value
    indicating the surface's current transform relative to the presentation
    engine's natural orientation.
  * pname:supportedCompositeAlpha is a bitmask of
    elink:VkCompositeAlphaFlagBitsKHR, representing the alpha compositing
    modes supported by the presentation engine for the surface on the
    specified device, and at least one bit will be set.
    Opaque composition can: be achieved in any alpha compositing mode by
    either using an image format that has no alpha component, or by ensuring
    that all pixels in the presentable images have an alpha value of 1.0.
  * pname:supportedUsageFlags is a bitmask of elink:VkImageUsageFlagBits
    representing the ways the application can: use the presentable images of
    a swapchain created
ifdef::VK_KHR_shared_presentable_image[]
    with elink:VkPresentModeKHR set to ename:VK_PRESENT_MODE_IMMEDIATE_KHR,
    ename:VK_PRESENT_MODE_MAILBOX_KHR, ename:VK_PRESENT_MODE_FIFO_KHR or
    ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR
endif::VK_KHR_shared_presentable_image[]
    for the surface on the specified device.
    ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT must: be included in the set.
    Implementations may: support additional usages.
// end::surface_capabilities_members[]

ifdef::VK_KHR_shared_presentable_image[]
[NOTE]
.Note
====
Supported usage flags of a presentable image when using
ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR or
ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR presentation mode are
provided by
slink:VkSharedPresentSurfaceCapabilitiesKHR::pname:sharedPresentSupportedUsageFlags.
====
endif::VK_KHR_shared_presentable_image[]

[NOTE]
.Note
====
Formulas such as [eq]#min(N, pname:maxImageCount)# are not correct, since
pname:maxImageCount may: be zero.
====

include::{generated}/validity/structs/VkSurfaceCapabilitiesKHR.adoc[]
--

ifdef::VK_KHR_get_surface_capabilities2[]
[open,refpage='vkGetPhysicalDeviceSurfaceCapabilities2KHR',desc='Reports capabilities of a surface on a physical device',type='protos']
--
:refpage: vkGetPhysicalDeviceSurfaceCapabilities2KHR

To query the basic capabilities of a surface defined by the core or
extensions, call:

include::{generated}/api/protos/vkGetPhysicalDeviceSurfaceCapabilities2KHR.adoc[]

  * pname:physicalDevice is the physical device that will be associated with
    the swapchain to be created, as described for
    flink:vkCreateSwapchainKHR.
  * pname:pSurfaceInfo is a pointer to a
    slink:VkPhysicalDeviceSurfaceInfo2KHR structure describing the surface
    and other fixed parameters that would be consumed by
    flink:vkCreateSwapchainKHR.
  * pname:pSurfaceCapabilities is a pointer to a
    slink:VkSurfaceCapabilities2KHR structure in which the capabilities are
    returned.

fname:vkGetPhysicalDeviceSurfaceCapabilities2KHR behaves similarly to
flink:vkGetPhysicalDeviceSurfaceCapabilitiesKHR, with the ability to specify
extended inputs via chained input structures, and to return extended
information via chained output structures.

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
include::{chapters}/commonvalidity/surface_info_physical_device_surfaceless_common.adoc[]
ifdef::VK_EXT_full_screen_exclusive+VK_KHR_win32_surface[]
  * [[VUID-vkGetPhysicalDeviceSurfaceCapabilities2KHR-pNext-02671]]
    If a slink:VkSurfaceCapabilitiesFullScreenExclusiveEXT structure is
    included in the pname:pNext chain of pname:pSurfaceCapabilities, a
    slink:VkSurfaceFullScreenExclusiveWin32InfoEXT structure must: be
    included in the pname:pNext chain of pname:pSurfaceInfo
endif::VK_EXT_full_screen_exclusive+VK_KHR_win32_surface[]
ifdef::VK_EXT_surface_maintenance1[]
  * [[VUID-vkGetPhysicalDeviceSurfaceCapabilities2KHR-pNext-07776]]
    If a slink:VkSurfacePresentModeCompatibilityEXT structure is included in
    the pname:pNext chain of pname:pSurfaceCapabilities, a
    slink:VkSurfacePresentModeEXT structure must: be included in the
    pname:pNext chain of pname:pSurfaceInfo
  * [[VUID-vkGetPhysicalDeviceSurfaceCapabilities2KHR-pNext-07777]]
    If a slink:VkSurfacePresentScalingCapabilitiesEXT structure is included
    in the pname:pNext chain of pname:pSurfaceCapabilities, a
    slink:VkSurfacePresentModeEXT structure must: be included in the
    pname:pNext chain of pname:pSurfaceInfo
ifdef::VK_GOOGLE_surfaceless_query[]
  * [[VUID-vkGetPhysicalDeviceSurfaceCapabilities2KHR-pNext-07778]]
    If a slink:VkSurfacePresentModeCompatibilityEXT structure is included in
    the pname:pNext chain of pname:pSurfaceCapabilities,
    pname:pSurfaceInfo->surface must: be a valid slink:VkSurfaceKHR handle
  * [[VUID-vkGetPhysicalDeviceSurfaceCapabilities2KHR-pNext-07779]]
    If a slink:VkSurfacePresentScalingCapabilitiesEXT structure is included
    in the pname:pNext chain of pname:pSurfaceCapabilities,
    pname:pSurfaceInfo->surface must: be a valid slink:VkSurfaceKHR handle
endif::VK_GOOGLE_surfaceless_query[]
endif::VK_EXT_surface_maintenance1[]
****

include::{generated}/validity/protos/vkGetPhysicalDeviceSurfaceCapabilities2KHR.adoc[]
--

[open,refpage='VkPhysicalDeviceSurfaceInfo2KHR',desc='Structure specifying a surface and related swapchain creation parameters',type='structs']
--
The sname:VkPhysicalDeviceSurfaceInfo2KHR structure is defined as:

include::{generated}/api/structs/VkPhysicalDeviceSurfaceInfo2KHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:surface is the surface that will be associated with the swapchain.

The members of sname:VkPhysicalDeviceSurfaceInfo2KHR correspond to the
arguments to flink:vkGetPhysicalDeviceSurfaceCapabilitiesKHR, with
pname:sType and pname:pNext added for extensibility.

ifdef::VK_EXT_full_screen_exclusive[]
Additional capabilities of a surface may: be available to swapchains created
with different full-screen exclusive settings - particularly if exclusive
full-screen access is application controlled.
These additional capabilities can: be queried by adding a
slink:VkSurfaceFullScreenExclusiveInfoEXT structure to the pname:pNext chain
of this structure when used to query surface properties.
ifdef::VK_KHR_win32_surface[]
Additionally, for Win32 surfaces with application controlled exclusive
full-screen access, chaining a
slink:VkSurfaceFullScreenExclusiveWin32InfoEXT structure may: also report
additional surface capabilities.
endif::VK_KHR_win32_surface[]
These additional capabilities only apply to swapchains created with the same
parameters included in the pname:pNext chain of
slink:VkSwapchainCreateInfoKHR.
endif::VK_EXT_full_screen_exclusive[]

.Valid Usage
****
ifdef::VK_KHR_win32_surface+VK_EXT_full_screen_exclusive[]
  * [[VUID-VkPhysicalDeviceSurfaceInfo2KHR-pNext-02672]]
    If the pname:pNext chain includes a
    slink:VkSurfaceFullScreenExclusiveInfoEXT structure with its
    pname:fullScreenExclusive member set to
    ename:VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT, and
    pname:surface was created using flink:vkCreateWin32SurfaceKHR, a
    slink:VkSurfaceFullScreenExclusiveWin32InfoEXT structure must: be
    included in the pname:pNext chain
endif::VK_KHR_win32_surface+VK_EXT_full_screen_exclusive[]
  * [[VUID-VkPhysicalDeviceSurfaceInfo2KHR-surface-07919]]
ifdef::VK_GOOGLE_surfaceless_query[]
    If the `apiext:VK_GOOGLE_surfaceless_query` extension is not enabled,
endif::VK_GOOGLE_surfaceless_query[]
    pname:surface must: be a valid slink:VkSurfaceKHR handle
****

include::{generated}/validity/structs/VkPhysicalDeviceSurfaceInfo2KHR.adoc[]
--

ifdef::VK_EXT_full_screen_exclusive[]
[open,refpage='VkSurfaceFullScreenExclusiveInfoEXT',desc='Structure specifying the preferred full-screen transition behavior',type='structs']
--
If the pname:pNext chain of slink:VkSwapchainCreateInfoKHR includes a
sname:VkSurfaceFullScreenExclusiveInfoEXT structure, then that structure
specifies the application's preferred full-screen transition behavior.

The sname:VkSurfaceFullScreenExclusiveInfoEXT structure is defined as:

include::{generated}/api/structs/VkSurfaceFullScreenExclusiveInfoEXT.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:fullScreenExclusive is a elink:VkFullScreenExclusiveEXT value
    specifying the preferred full-screen transition behavior.

If this structure is not present, pname:fullScreenExclusive is considered to
be ename:VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT.

include::{generated}/validity/structs/VkSurfaceFullScreenExclusiveInfoEXT.adoc[]
--

[open,refpage='VkFullScreenExclusiveEXT',desc='Hint values an application can specify affecting full-screen transition behavior',type='enums']
--
Possible values of
sname:VkSurfaceFullScreenExclusiveInfoEXT::pname:fullScreenExclusive are:

include::{generated}/api/enums/VkFullScreenExclusiveEXT.adoc[]

  * ename:VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT indicates the implementation
    should: determine the appropriate full-screen method by whatever means
    it deems appropriate.
  * ename:VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT indicates the implementation
    may: use full-screen exclusive mechanisms when available.
    Such mechanisms may: result in better performance and/or the
    availability of different presentation capabilities, but may: require a
    more disruptive transition during swapchain initialization, first
    presentation and/or destruction.
  * ename:VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT indicates the
    implementation should: avoid using full-screen mechanisms which rely on
    disruptive transitions.
  * ename:VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT indicates the
    application will manage full-screen exclusive mode by using the
    flink:vkAcquireFullScreenExclusiveModeEXT and
    flink:vkReleaseFullScreenExclusiveModeEXT commands.
--

ifdef::VK_KHR_win32_surface[]
[open,refpage='VkSurfaceFullScreenExclusiveWin32InfoEXT',desc='Structure specifying additional creation parameters specific to Win32 fullscreen exclusive mode',type='structs']
--
The sname:VkSurfaceFullScreenExclusiveWin32InfoEXT structure is defined as:

include::{generated}/api/structs/VkSurfaceFullScreenExclusiveWin32InfoEXT.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:hmonitor is the Win32 code:HMONITOR handle identifying the display
    to create the surface with.

[NOTE]
.Note
====
If pname:hmonitor is invalidated (e.g. the monitor is unplugged) during the
lifetime of a swapchain created with this structure, operations on that
swapchain will return ename:VK_ERROR_OUT_OF_DATE_KHR.
====

[NOTE]
.Note
====
It is the responsibility of the application to change the display settings
of the targeted Win32 display using the appropriate platform APIs.
Such changes may: alter the surface capabilities reported for the created
surface.
====

.Valid Usage
****
  * [[VUID-VkSurfaceFullScreenExclusiveWin32InfoEXT-hmonitor-02673]]
    pname:hmonitor must: be a valid code:HMONITOR
****

include::{generated}/validity/structs/VkSurfaceFullScreenExclusiveWin32InfoEXT.adoc[]
--
endif::VK_KHR_win32_surface[]
endif::VK_EXT_full_screen_exclusive[]

[open,refpage='VkSurfaceCapabilities2KHR',desc='Structure describing capabilities of a surface',type='structs']
--
The sname:VkSurfaceCapabilities2KHR structure is defined as:

include::{generated}/api/structs/VkSurfaceCapabilities2KHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:surfaceCapabilities is a slink:VkSurfaceCapabilitiesKHR structure
    describing the capabilities of the specified surface.

ifdef::VK_GOOGLE_surfaceless_query[]
If the `apiext:VK_GOOGLE_surfaceless_query` extension is enabled and
slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface in the
flink:vkGetPhysicalDeviceSurfaceCapabilities2KHR call is
dlink:VK_NULL_HANDLE, the values returned in pname:minImageCount,
pname:maxImageCount, pname:currentExtent, and pname:currentTransform will
not reflect that of any surface and will instead be as such:

  * pname:minImageCount and pname:maxImageCount will be [eq]#0xFFFFFFFF#
  * pname:currentExtent will be [eq]#(0xFFFFFFFF, 0xFFFFFFFF)#
  * pname:currentTransform will be
    ename:VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR
endif::VK_GOOGLE_surfaceless_query[]

include::{generated}/validity/structs/VkSurfaceCapabilities2KHR.adoc[]
--

ifdef::VK_KHR_surface_protected_capabilities[]
[open,refpage='VkSurfaceProtectedCapabilitiesKHR',desc='Structure describing capability of a surface to be protected',type='structs']
--
An application queries if a protected slink:VkSurfaceKHR is displayable on a
specific windowing system using sname:VkSurfaceProtectedCapabilitiesKHR,
which can: be passed in pname:pNext parameter of
sname:VkSurfaceCapabilities2KHR.

The sname:VkSurfaceProtectedCapabilitiesKHR structure is defined as:

include::{generated}/api/structs/VkSurfaceProtectedCapabilitiesKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:supportsProtected specifies whether a protected swapchain created
    from slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface for a
    particular windowing system can: be displayed on screen or not.
    If pname:supportsProtected is ename:VK_TRUE, then creation of swapchains
    with the ename:VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR flag set must: be
    supported for pname:surface.

ifdef::VK_GOOGLE_surfaceless_query[]
If the `apiext:VK_GOOGLE_surfaceless_query` extension is enabled, the value
returned in pname:supportsProtected will be identical for every valid
surface created on this physical device, and so in the
flink:vkGetPhysicalDeviceSurfaceCapabilities2KHR call,
slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface can: be
dlink:VK_NULL_HANDLE.
In that case, the contents of
slink:VkSurfaceCapabilities2KHR::pname:surfaceCapabilities as well as any
other struct chained to it will be undefined:.
endif::VK_GOOGLE_surfaceless_query[]

include::{generated}/validity/structs/VkSurfaceProtectedCapabilitiesKHR.adoc[]
--
endif::VK_KHR_surface_protected_capabilities[]

ifdef::VK_EXT_surface_maintenance1[]
[open,refpage='VkSurfacePresentScalingCapabilitiesEXT',desc='Structure describing the presentation scaling capabilities of the surface',type='structs']
--
The sname:VkSurfacePresentScalingCapabilitiesEXT structure is defined as:

include::{generated}/api/structs/VkSurfacePresentScalingCapabilitiesEXT.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:supportedPresentScaling is a bitmask of
    elink:VkPresentScalingFlagBitsEXT representing the scaling methods
    supported by the surface, or `0` if application-defined scaling is not
    supported.
  * pname:supportedPresentGravityX is a bitmask of
    elink:VkPresentGravityFlagBitsEXT representing the X-axis pixel gravity
    supported by the surface, or `0` if Vulkan-defined pixel gravity is not
    supported for the X axis.
  * pname:supportedPresentGravityY is a bitmask of
    elink:VkPresentGravityFlagBitsEXT representing the Y-axis pixel gravity
    supported by the surface, or `0` if Vulkan-defined pixel gravity is not
    supported for the Y axis.
  * pname:minScaledImageExtent contains the smallest valid swapchain extent
    for the surface on the specified device when one of the scaling methods
    specified in pname:supportedPresentScaling is used, or the special value
    [eq]#(0xFFFFFFFF, 0xFFFFFFFF)# indicating that the surface size will be
    determined by the extent of a swapchain targeting the surface.
    The pname:width and pname:height of the extent will each be smaller than
    or equal to the corresponding pname:width and pname:height of
    slink:VkSurfaceCapabilitiesKHR::pname:minImageExtent.
  * pname:maxScaledImageExtent contains the largest valid swapchain extent
    for the surface on the specified device when one of the scaling methods
    specified in pname:supportedPresentScaling is used, or the special value
    described above for pname:minScaledImageExtent.
    The pname:width and pname:height of the extent will each be greater than
    or equal to the corresponding pname:width and pname:height of
    slink:VkSurfaceCapabilitiesKHR::pname:maxImageExtent.

ifdef::VK_EXT_swapchain_maintenance1[]
Before creating a swapchain whose scaling mode can: be specified through the
use of slink:VkSwapchainPresentScalingCreateInfoEXT, obtain the set of
supported scaling modes by including a slink:VkSurfacePresentModeEXT
structure in the pname:pNext chain of slink:VkPhysicalDeviceSurfaceInfo2KHR
when calling flink:vkGetPhysicalDeviceSurfaceCapabilities2KHR.
The implementation must: return the same values in
sname:VkSurfacePresentScalingCapabilitiesEXT for any of the compatible
present modes as obtained through
slink:VkSurfacePresentModeCompatibilityEXT.
endif::VK_EXT_swapchain_maintenance1[]

include::{generated}/validity/structs/VkSurfacePresentScalingCapabilitiesEXT.adoc[]
--

[open,refpage='VkPresentScalingFlagBitsEXT',desc='Bitmask specifying presentation scaling methods',type='enums']
--
Bits which may: be set in
slink:VkSurfacePresentScalingCapabilitiesEXT::pname:supportedPresentScaling,
specifying scaling modes supported by the surface, are:

include::{generated}/api/enums/VkPresentScalingFlagBitsEXT.adoc[]

  * ename:VK_PRESENT_SCALING_ONE_TO_ONE_BIT_EXT specifies that no scaling
    occurs, and pixels in the swapchain image are mapped to one and only one
    pixel in the surface.
    The mapping between pixels is defined by the chosen presentation
    gravity.
  * ename:VK_PRESENT_SCALING_ASPECT_RATIO_STRETCH_BIT_EXT specifies that the
    swapchain image will be minified or magnified such that at least one of
    the resulting width or height is equal to the corresponding surface
    dimension, and the other resulting dimension is less than or equal to
    the corresponding surface dimension, with the aspect ratio of the
    resulting image being identical to that of the original swapchain image.
  * ename:VK_PRESENT_SCALING_STRETCH_BIT_EXT specifies that the swapchain
    image will be minified or magnified such that the resulting image
    dimensions are equal to those of the surface.
--

[open,refpage='VkPresentScalingFlagsEXT',desc='Bitmask of VkPresentScalingFlagBitsEXT',type='flags']
--
include::{generated}/api/flags/VkPresentScalingFlagsEXT.adoc[]

tname:VkPresentScalingFlagsEXT is a bitmask type for setting a mask of zero
or more elink:VkPresentScalingFlagBitsEXT.
--

[open,refpage='VkPresentGravityFlagBitsEXT',desc='Bitmask specifying presentation pixel gravity on either the x or y axis',type='enums']
--
Bits which may: be set in the
slink:VkSurfacePresentScalingCapabilitiesEXT::pname:supportedPresentGravityX
or pname:supportedPresentGravityY fields, specifying the gravity of
presented pixels supported by the surface, are:

include::{generated}/api/enums/VkPresentGravityFlagBitsEXT.adoc[]

  * ename:VK_PRESENT_GRAVITY_MIN_BIT_EXT means that the pixels will
    gravitate towards the top or left side of the surface.
  * ename:VK_PRESENT_GRAVITY_MAX_BIT_EXT means that the pixels will
    gravitate towards the bottom or right side of the surface.
  * ename:VK_PRESENT_GRAVITY_CENTERED_BIT_EXT means that the pixels will be
    centered in the surface.

If the value in slink:VkSurfaceCapabilitiesKHR::pname:currentTransform is
not ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, it is
implementation-defined whether the gravity configuration applies to the
presented image before or after transformation.
--

[open,refpage='VkPresentGravityFlagsEXT',desc='Bitmask of VkPresentGravityFlagBitsEXT',type='flags']
--
include::{generated}/api/flags/VkPresentGravityFlagsEXT.adoc[]

tname:VkPresentGravityFlagsEXT is a bitmask type for setting a mask of zero
or more elink:VkPresentGravityFlagBitsEXT.
--

[open,refpage='VkSurfacePresentModeEXT',desc='Structure describing present mode of a surface',type='structs']
--
The sname:VkSurfacePresentModeEXT structure is defined as:

include::{generated}/api/structs/VkSurfacePresentModeEXT.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:presentMode is the presentation mode the swapchain will use.

If the sname:VkSurfacePresentModeEXT structure is included in the
pname:pNext chain of slink:VkPhysicalDeviceSurfaceInfo2KHR, the values
returned in slink:VkSurfaceCapabilitiesKHR::pname:minImageCount,
slink:VkSurfaceCapabilitiesKHR::pname:maxImageCount,
slink:VkSurfacePresentScalingCapabilitiesEXT::pname:minScaledImageExtent,
and slink:VkSurfacePresentScalingCapabilitiesEXT::pname:maxScaledImageExtent
are valid only for the specified pname:presentMode.
ifdef::VK_KHR_shared_presentable_image[]
If pname:presentMode is ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR or
ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR, the per-present mode
image counts must: both be one.
endif::VK_KHR_shared_presentable_image[]
The per-present mode image counts may: be less-than or greater-than the
image counts returned when sname:VkSurfacePresentModeEXT is not provided.

[NOTE]
.Note
====
If slink:VkSwapchainPresentModesCreateInfoEXT is provided to swapchain
creation, the requirements for forward progress may be less strict.
For example, a FIFO swapchain might only require 2 images to guarantee
forward progress, but a MAILBOX one might require 4.
Without the per-present image counts, such an implementation would have to
return 4 in slink:VkSurfaceCapabilitiesKHR::pname:minImageCount, which
pessimizes FIFO.
Conversely, an implementation may return a low number for minImageCount, but
internally bump the image count when application queries
flink:vkGetSwapchainImagesKHR, which can surprise applications, and is not
discoverable until swapchain creation.
Using sname:VkSurfacePresentModeEXT and
slink:VkSwapchainPresentModesCreateInfoEXT together effectively removes this
problem.

slink:VkSwapchainPresentModesCreateInfoEXT is required for the specification
to be backwards compatible with applications that do not know about, or make
use of this feature.
====

.Valid Usage
****
  * [[VUID-VkSurfacePresentModeEXT-presentMode-07780]]
    pname:presentMode must: be a value reported by
    flink:vkGetPhysicalDeviceSurfacePresentModesKHR for the specified
    surface.
****

include::{generated}/validity/structs/VkSurfacePresentModeEXT.adoc[]
--

[open,refpage='VkSurfacePresentModeCompatibilityEXT',desc='Structure describing the subset of compatible presentation modes for the purposes of switching without swapchain recreation',type='structs']
--
The sname:VkSurfacePresentModeCompatibilityEXT structure is defined as:

include::{generated}/api/structs/VkSurfacePresentModeCompatibilityEXT.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:presentModeCount is an integer related to the number of present
    modes available or queried, as described below.
  * pname:pPresentModes is a pointer to an array of elink:VkPresentModeKHR
    in which present modes compatible with a given present mode are
    returned.

If pname:pPresentModes is `NULL`, then the number of present modes that are
compatible with the one specified in slink:VkSurfacePresentModeEXT is
returned in pname:presentModeCount.
Otherwise, pname:presentModeCount must be set by the user to the number of
elements in the pname:pPresentModes array, and on return the variable is
overwritten with the number of values actually written to
pname:pPresentModes.
If the value of pname:presentModeCount is less than the number of compatible
present modes that are supported, at most pname:presentModeCount values will
be written to pname:pPresentModes.
The implementation must: include the present mode passed to
slink:VkSurfacePresentModeEXT in pname:pPresentModes, unless
pname:presentModeCount is zero.

ifdef::VK_EXT_swapchain_maintenance1[]
Before creating a swapchain whose present modes can: be modified through the
use of slink:VkSwapchainPresentModesCreateInfoEXT, obtain the set of present
modes compatible with a given initial present mode by including a
slink:VkSurfacePresentModeEXT structure in the pname:pNext chain of
slink:VkPhysicalDeviceSurfaceInfo2KHR when calling
flink:vkGetPhysicalDeviceSurfaceCapabilities2KHR.
endif::VK_EXT_swapchain_maintenance1[]

include::{generated}/validity/structs/VkSurfacePresentModeCompatibilityEXT.adoc[]
--
endif::VK_EXT_surface_maintenance1[]

ifdef::VK_KHR_shared_presentable_image[]
[open,refpage='VkSharedPresentSurfaceCapabilitiesKHR',desc='Structure describing capabilities of a surface for shared presentation',type='structs']
--
The sname:VkSharedPresentSurfaceCapabilitiesKHR structure is defined as:

include::{generated}/api/structs/VkSharedPresentSurfaceCapabilitiesKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:sharedPresentSupportedUsageFlags is a bitmask of
    elink:VkImageUsageFlagBits representing the ways the application can:
    use the shared presentable image from a swapchain created with
    elink:VkPresentModeKHR set to
    ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR or
    ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR for the surface on
    the specified device.
    ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT must: be included in the set
    but implementations may: support additional usages.

include::{generated}/validity/structs/VkSharedPresentSurfaceCapabilitiesKHR.adoc[]
--
endif::VK_KHR_shared_presentable_image[]

ifdef::VK_AMD_display_native_hdr[]
[open,refpage='VkDisplayNativeHdrSurfaceCapabilitiesAMD',desc='Structure describing display native HDR specific capabilities of a surface',type='structs']
--
The sname:VkDisplayNativeHdrSurfaceCapabilitiesAMD structure is defined as:

include::{generated}/api/structs/VkDisplayNativeHdrSurfaceCapabilitiesAMD.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:localDimmingSupport specifies whether the surface supports local
    dimming.
    If this is ename:VK_TRUE, slink:VkSwapchainDisplayNativeHdrCreateInfoAMD
    can: be used to explicitly enable or disable local dimming for the
    surface.
    Local dimming may also be overridden by flink:vkSetLocalDimmingAMD
    during the lifetime of the swapchain.

include::{generated}/validity/structs/VkDisplayNativeHdrSurfaceCapabilitiesAMD.adoc[]
--
endif::VK_AMD_display_native_hdr[]

ifdef::VK_EXT_full_screen_exclusive[]
[open,refpage='VkSurfaceCapabilitiesFullScreenExclusiveEXT',desc='Structure describing full screen exclusive capabilities of a surface',type='structs']
--
The sname:VkSurfaceCapabilitiesFullScreenExclusiveEXT structure is defined
as:

include::{generated}/api/structs/VkSurfaceCapabilitiesFullScreenExclusiveEXT.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:fullScreenExclusiveControlSupported is a boolean describing
    whether the surface is able to make use of exclusive full-screen access.

This structure can: be included in the pname:pNext chain of
slink:VkSurfaceCapabilities2KHR to determine support for exclusive
full-screen access.
If pname:fullScreenExclusiveSupported is ename:VK_FALSE, it indicates that
exclusive full-screen access is not obtainable for this surface.

Applications must: not attempt to create swapchains with
ename:VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT set if
pname:fullScreenExclusiveSupported is ename:VK_FALSE.

include::{generated}/validity/structs/VkSurfaceCapabilitiesFullScreenExclusiveEXT.adoc[]
--
endif::VK_EXT_full_screen_exclusive[]

ifdef::VK_NV_present_barrier[]
[open,refpage='VkSurfaceCapabilitiesPresentBarrierNV',desc='Structure describing present barrier capabilities of a surface',type='structs']
--
The sname:VkSurfaceCapabilitiesPresentBarrierNV structure is defined as:

include::{generated}/api/structs/VkSurfaceCapabilitiesPresentBarrierNV.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:presentBarrierSupported is a boolean describing whether the
    surface is able to make use of the present barrier feature.

This structure can: be included in the pname:pNext chain of
slink:VkSurfaceCapabilities2KHR to determine support for present barrier
access.
If pname:presentBarrierSupported is ename:VK_FALSE, it indicates that the
present barrier feature is not obtainable for this surface.

include::{generated}/validity/structs/VkSurfaceCapabilitiesPresentBarrierNV.adoc[]
--
endif::VK_NV_present_barrier[]
endif::VK_KHR_get_surface_capabilities2[]

ifdef::VK_EXT_display_surface_counter[]
include::{chapters}/VK_EXT_display_surface_counter/surface_capabilities.adoc[]
endif::VK_EXT_display_surface_counter[]

[open,refpage='VkSurfaceTransformFlagBitsKHR',desc='Presentation transforms supported on a device',type='enums']
--
Bits which may: be set in
slink:VkSurfaceCapabilitiesKHR::pname:supportedTransforms indicating the
presentation transforms supported for the surface on the specified device,
and possible values of
slink:VkSurfaceCapabilitiesKHR::pname:currentTransform indicating the
surface's current transform relative to the presentation engine's natural
orientation, are:

include::{generated}/api/enums/VkSurfaceTransformFlagBitsKHR.adoc[]

  * ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR specifies that image content
    is presented without being transformed.
  * ename:VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR specifies that image
    content is rotated 90 degrees clockwise.
  * ename:VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR specifies that image
    content is rotated 180 degrees clockwise.
  * ename:VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR specifies that image
    content is rotated 270 degrees clockwise.
  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR specifies that
    image content is mirrored horizontally.
  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR specifies
    that image content is mirrored horizontally, then rotated 90 degrees
    clockwise.
  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR
    specifies that image content is mirrored horizontally, then rotated 180
    degrees clockwise.
  * ename:VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR
    specifies that image content is mirrored horizontally, then rotated 270
    degrees clockwise.
  * ename:VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR specifies that the
    presentation transform is not specified, and is instead determined by
    platform-specific considerations and mechanisms outside Vulkan.
--

[open,refpage='VkSurfaceTransformFlagsKHR',desc='Bitmask of VkSurfaceTransformFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkSurfaceTransformFlagsKHR.adoc[]

tname:VkSurfaceTransformFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkSurfaceTransformFlagBitsKHR.
--

[open,refpage='VkCompositeAlphaFlagBitsKHR',desc='Alpha compositing modes supported on a device',type='enums']
--
The pname:supportedCompositeAlpha member is of type
elink:VkCompositeAlphaFlagBitsKHR, containing the following values:

include::{generated}/api/enums/VkCompositeAlphaFlagBitsKHR.adoc[]

These values are described as follows:

  * ename:VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR: The alpha component, if it
    exists, of the images is ignored in the compositing process.
    Instead, the image is treated as if it has a constant alpha of 1.0.
  * ename:VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR: The alpha component, if
    it exists, of the images is respected in the compositing process.
    The non-alpha components of the image are expected to already be
    multiplied by the alpha component by the application.
  * ename:VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR: The alpha component,
    if it exists, of the images is respected in the compositing process.
    The non-alpha components of the image are not expected to already be
    multiplied by the alpha component by the application; instead, the
    compositor will multiply the non-alpha components of the image by the
    alpha component during compositing.
  * ename:VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR: The way in which the
    presentation engine treats the alpha component in the images is unknown
    to the Vulkan API.
    Instead, the application is responsible for setting the composite alpha
    blending mode using native window system commands.
    If the application does not set the blending mode using native window
    system commands, then a platform-specific default will be used.
--

[open,refpage='VkCompositeAlphaFlagsKHR',desc='Bitmask of VkCompositeAlphaFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkCompositeAlphaFlagsKHR.adoc[]

tname:VkCompositeAlphaFlagsKHR is a bitmask type for setting a mask of zero
or more elink:VkCompositeAlphaFlagBitsKHR.
--


=== Surface Format Support

[open,refpage='vkGetPhysicalDeviceSurfaceFormatsKHR',desc='Query color formats supported by surface',type='protos']
--
:refpage: vkGetPhysicalDeviceSurfaceFormatsKHR

To query the supported swapchain format-color space pairs for a surface,
call:

include::{generated}/api/protos/vkGetPhysicalDeviceSurfaceFormatsKHR.adoc[]

  * pname:physicalDevice is the physical device that will be associated with
    the swapchain to be created, as described for
    flink:vkCreateSwapchainKHR.
  * pname:surface is the surface that will be associated with the swapchain.
  * pname:pSurfaceFormatCount is a pointer to an integer related to the
    number of format pairs available or queried, as described below.
  * pname:pSurfaceFormats is either `NULL` or a pointer to an array of
    sname:VkSurfaceFormatKHR structures.

If pname:pSurfaceFormats is `NULL`, then the number of format pairs
supported for the given pname:surface is returned in
pname:pSurfaceFormatCount.
Otherwise, pname:pSurfaceFormatCount must: point to a variable set by the
user to the number of elements in the pname:pSurfaceFormats array, and on
return the variable is overwritten with the number of structures actually
written to pname:pSurfaceFormats.
If the value of pname:pSurfaceFormatCount is less than the number of format
pairs supported, at most pname:pSurfaceFormatCount structures will be
written, and ename:VK_INCOMPLETE will be returned instead of
ename:VK_SUCCESS, to indicate that not all the available format pairs were
returned.

The number of format pairs supported must: be greater than or equal to 1.
pname:pSurfaceFormats must: not contain an entry whose value for
pname:format is ename:VK_FORMAT_UNDEFINED.

If pname:pSurfaceFormats includes an entry whose value for pname:colorSpace
is ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR and whose value for pname:format
is a UNORM (or SRGB) format and the corresponding SRGB (or UNORM) format is
a color renderable format for ename:VK_IMAGE_TILING_OPTIMAL, then
pname:pSurfaceFormats must: also contain an entry with the same value for
pname:colorSpace and pname:format equal to the corresponding SRGB (or UNORM)
format.

ifdef::VK_GOOGLE_surfaceless_query[]
If the `apiext:VK_GOOGLE_surfaceless_query` extension is enabled, the values
returned in pname:pSurfaceFormats will be identical for every valid surface
created on this physical device, and so pname:surface can: be
dlink:VK_NULL_HANDLE.
endif::VK_GOOGLE_surfaceless_query[]

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
include::{chapters}/commonvalidity/surface_physical_device_surfaceless_common.adoc[]
****

include::{generated}/validity/protos/vkGetPhysicalDeviceSurfaceFormatsKHR.adoc[]
--

[open,refpage='VkSurfaceFormatKHR',desc='Structure describing a supported swapchain format-color space pair',type='structs']
--
The sname:VkSurfaceFormatKHR structure is defined as:

include::{generated}/api/structs/VkSurfaceFormatKHR.adoc[]

  * pname:format is a elink:VkFormat that is compatible with the specified
    surface.
  * pname:colorSpace is a presentation elink:VkColorSpaceKHR that is
    compatible with the surface.

include::{generated}/validity/structs/VkSurfaceFormatKHR.adoc[]
--

ifdef::VK_KHR_get_surface_capabilities2[]
[open,refpage='vkGetPhysicalDeviceSurfaceFormats2KHR',desc='Query color formats supported by surface',type='protos']
--
:refpage: vkGetPhysicalDeviceSurfaceFormats2KHR

To query the supported swapchain format tuples for a surface, call:

include::{generated}/api/protos/vkGetPhysicalDeviceSurfaceFormats2KHR.adoc[]

  * pname:physicalDevice is the physical device that will be associated with
    the swapchain to be created, as described for
    flink:vkCreateSwapchainKHR.
  * pname:pSurfaceInfo is a pointer to a
    slink:VkPhysicalDeviceSurfaceInfo2KHR structure describing the surface
    and other fixed parameters that would be consumed by
    flink:vkCreateSwapchainKHR.
  * pname:pSurfaceFormatCount is a pointer to an integer related to the
    number of format tuples available or queried, as described below.
  * pname:pSurfaceFormats is either `NULL` or a pointer to an array of
    slink:VkSurfaceFormat2KHR structures.

flink:vkGetPhysicalDeviceSurfaceFormats2KHR behaves similarly to
flink:vkGetPhysicalDeviceSurfaceFormatsKHR, with the ability to be extended
via pname:pNext chains.

If pname:pSurfaceFormats is `NULL`, then the number of format tuples
supported for the given pname:surface is returned in
pname:pSurfaceFormatCount.
Otherwise, pname:pSurfaceFormatCount must: point to a variable set by the
user to the number of elements in the pname:pSurfaceFormats array, and on
return the variable is overwritten with the number of structures actually
written to pname:pSurfaceFormats.
If the value of pname:pSurfaceFormatCount is less than the number of format
tuples supported, at most pname:pSurfaceFormatCount structures will be
written, and ename:VK_INCOMPLETE will be returned instead of
ename:VK_SUCCESS, to indicate that not all the available values were
returned.

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
include::{chapters}/commonvalidity/surface_info_physical_device_surfaceless_common.adoc[]
****

include::{generated}/validity/protos/vkGetPhysicalDeviceSurfaceFormats2KHR.adoc[]
--

[open,refpage='VkSurfaceFormat2KHR',desc='Structure describing a supported swapchain format tuple',type='structs']
--
The sname:VkSurfaceFormat2KHR structure is defined as:

include::{generated}/api/structs/VkSurfaceFormat2KHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:surfaceFormat is a slink:VkSurfaceFormatKHR structure describing a
    format-color space pair that is compatible with the specified surface.

ifdef::VK_EXT_image_compression_control[]
ifdef::VK_EXT_image_compression_control_swapchain[]
If the <<features-imageCompressionControlSwapchain,
pname:imageCompressionControlSwapchain>> feature is supported and a
slink:VkImageCompressionPropertiesEXT structure is included in the
pname:pNext chain of this structure, then it will be filled with the
compression properties that are supported for the pname:surfaceFormat.
endif::VK_EXT_image_compression_control_swapchain[]
endif::VK_EXT_image_compression_control[]

ifdef::VK_EXT_image_compression_control[]
.Valid Usage
****
  * [[VUID-VkSurfaceFormat2KHR-pNext-06750]]
ifdef::VK_EXT_image_compression_control_swapchain[]
    If the <<features-imageCompressionControlSwapchain,
    pname:imageCompressionControlSwapchain>> feature is not enabled, the
endif::VK_EXT_image_compression_control_swapchain[]
ifndef::VK_EXT_image_compression_control_swapchain[The]
    pname:pNext chain must: not include an
    slink:VkImageCompressionPropertiesEXT structure
****
endif::VK_EXT_image_compression_control[]

include::{generated}/validity/structs/VkSurfaceFormat2KHR.adoc[]
--

endif::VK_KHR_get_surface_capabilities2[]

While the pname:format of a presentable image refers to the encoding of each
pixel, the pname:colorSpace determines how the presentation engine
interprets the pixel values.
A color space in this document refers to a specific color space (defined by
the chromaticities of its primaries and a white point in CIE Lab), and a
transfer function that is applied before storing or transmitting color data
in the given color space.

[open,refpage='VkColorSpaceKHR',desc='Supported color space of the presentation engine',type='enums']
--
Possible values of slink:VkSurfaceFormatKHR::pname:colorSpace, specifying
supported color spaces of a presentation engine, are:

include::{generated}/api/enums/VkColorSpaceKHR.adoc[]

  * ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR specifies support for the sRGB
    color space.
ifdef::VK_EXT_swapchain_colorspace[]
  * ename:VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT specifies support for the
    Display-P3 color space to be displayed using an sRGB-like EOTF (defined
    below).
  * ename:VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT specifies support for the
    extended sRGB color space to be displayed using a linear EOTF.
  * ename:VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT specifies support for
    the extended sRGB color space to be displayed using an sRGB EOTF.
  * ename:VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT specifies support for the
    Display-P3 color space to be displayed using a linear EOTF.
  * ename:VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT specifies support for the
    DCI-P3 color space to be displayed using the DCI-P3 EOTF.
    Note that values in such an image are interpreted as XYZ encoded color
    data by the presentation engine.
  * ename:VK_COLOR_SPACE_BT709_LINEAR_EXT specifies support for the BT709
    color space to be displayed using a linear EOTF.
  * ename:VK_COLOR_SPACE_BT709_NONLINEAR_EXT specifies support for the BT709
    color space to be displayed using the SMPTE 170M EOTF.
  * ename:VK_COLOR_SPACE_BT2020_LINEAR_EXT specifies support for the BT2020
    color space to be displayed using a linear EOTF.
  * ename:VK_COLOR_SPACE_HDR10_ST2084_EXT specifies support for the HDR10
    (BT2020 color) space to be displayed using the SMPTE ST2084 Perceptual
    Quantizer (PQ) EOTF.
  * ename:VK_COLOR_SPACE_DOLBYVISION_EXT specifies support for the Dolby
    Vision (BT2020 color space), proprietary encoding, to be displayed using
    the SMPTE ST2084 EOTF.
  * ename:VK_COLOR_SPACE_HDR10_HLG_EXT specifies support for the HDR10
    (BT2020 color space) to be displayed using the Hybrid Log Gamma (HLG)
    EOTF.
  * ename:VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT specifies support for the
    AdobeRGB color space to be displayed using a linear EOTF.
  * ename:VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT specifies support for the
    AdobeRGB color space to be displayed using the Gamma 2.2 EOTF.
  * ename:VK_COLOR_SPACE_PASS_THROUGH_EXT specifies that color components
    are used "`as is`".
    This is intended to allow applications to supply data for color spaces
    not described here.
ifdef::VK_AMD_display_native_hdr[]
  * ename:VK_COLOR_SPACE_DISPLAY_NATIVE_AMD specifies support for the
    display's native color space.
    This matches the color space expectations of AMD's FreeSync2 standard,
    for displays supporting it.
endif::VK_AMD_display_native_hdr[]

ifdef::VKSC_VERSION_1_0[]
ifdef::hidden[]
// tag::scremoved[]
  * elink:VkColorSpaceKHR (deprecated aliases)
  ** etext:VK_COLORSPACE_SRGB_NONLINEAR_KHR <<SCID-8>>
  ** etext:VK_COLOR_SPACE_DCI_P3_LINEAR_EXT <<SCID-8>>
// end::scremoved[]
endif::hidden[]
endif::VKSC_VERSION_1_0[]

ifndef::VKSC_VERSION_1_0[]
[NOTE]
.Note
====
In the initial release of the `apiext:VK_KHR_surface` and
`apiext:VK_KHR_swapchain` extensions, the token
etext:VK_COLORSPACE_SRGB_NONLINEAR_KHR was used.
Starting in the 2016-05-13 updates to the extension branches, matching
release 1.0.13 of the core API specification,
ename:VK_COLOR_SPACE_SRGB_NONLINEAR_KHR is used instead for consistency with
Vulkan naming rules.
The older enum is still available for backwards compatibility.
====

[NOTE]
.Note
====
In older versions of this extension
ename:VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT was misnamed
etext:VK_COLOR_SPACE_DCI_P3_LINEAR_EXT.
This has been updated to indicate that it uses RGB color encoding, not XYZ.
The old name is deprecated but is maintained for backwards compatibility.
====
endif::VKSC_VERSION_1_0[]

[NOTE]
.Note
====
For a traditional "`Linear`" or non-gamma transfer function color space use
ename:VK_COLOR_SPACE_PASS_THROUGH_EXT.
====

The color components of non-linear color space swapchain images must: have
had the appropriate transfer function applied.
The color space selected for the swapchain image will not affect the
processing of data written into the image by the implementation.
Vulkan requires that all implementations support the sRGB transfer function
by use of an SRGB pixel format.
Other transfer functions, such as SMPTE 170M or SMPTE2084, can: be performed
by the application shader.
This extension defines enums for elink:VkColorSpaceKHR that correspond to
the following color spaces:

[[VK_EXT_swapchain_colorspace-table]]
.Color Spaces and Attributes
[options="header"]
|====
| Name           | Red Primary  | Green Primary | Blue Primary | White-point          | Transfer function
| DCI-P3         | 1.000, 0.000 | 0.000, 1.000  | 0.000, 0.000 | 0.3333, 0.3333       | DCI P3
| Display-P3     | 0.680, 0.320 | 0.265, 0.690  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | Display-P3
| BT709          | 0.640, 0.330 | 0.300, 0.600  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | ITU (SMPTE 170M)
| sRGB           | 0.640, 0.330 | 0.300, 0.600  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | sRGB
| extended sRGB  | 0.640, 0.330 | 0.300, 0.600  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | extended sRGB
| HDR10_ST2084   | 0.708, 0.292 | 0.170, 0.797  | 0.131, 0.046 | 0.3127, 0.3290 (D65) | ST2084 PQ
| DOLBYVISION    | 0.708, 0.292 | 0.170, 0.797  | 0.131, 0.046 | 0.3127, 0.3290 (D65) | ST2084 PQ
| HDR10_HLG      | 0.708, 0.292 | 0.170, 0.797  | 0.131, 0.046 | 0.3127, 0.3290 (D65) | HLG
| AdobeRGB       | 0.640, 0.330 | 0.210, 0.710  | 0.150, 0.060 | 0.3127, 0.3290 (D65) | AdobeRGB
|====

The transfer functions are described in the "`Transfer Functions`" chapter
of the <<data-format,Khronos Data Format Specification>>.

Except Display-P3 OETF, which is:

[latexmath]
+++++++++++++++++++
\begin{aligned}
E & =
  \begin{cases}
    1.055 \times L^{1 \over 2.4} - 0.055 & \text{for}\  0.0030186 \leq L \leq 1 \\
    12.92 \times L                       & \text{for}\  0 \leq L < 0.0030186
  \end{cases}
\end{aligned}
+++++++++++++++++++

where [eq]#L# is the linear value of a color component and [eq]#E# is the
encoded value (as stored in the image in memory).

[NOTE]
.Note
====
For most uses, the sRGB OETF is equivalent.
====
endif::VK_EXT_swapchain_colorspace[]
--


=== Surface Presentation Mode Support

[open,refpage='vkGetPhysicalDeviceSurfacePresentModesKHR',desc='Query supported presentation modes',type='protos']
--
:refpage: vkGetPhysicalDeviceSurfacePresentModesKHR

To query the supported presentation modes for a surface, call:

include::{generated}/api/protos/vkGetPhysicalDeviceSurfacePresentModesKHR.adoc[]

  * pname:physicalDevice is the physical device that will be associated with
    the swapchain to be created, as described for
    flink:vkCreateSwapchainKHR.
  * pname:surface is the surface that will be associated with the swapchain.
  * pname:pPresentModeCount is a pointer to an integer related to the number
    of presentation modes available or queried, as described below.
  * pname:pPresentModes is either `NULL` or a pointer to an array of
    elink:VkPresentModeKHR values, indicating the supported presentation
    modes.

If pname:pPresentModes is `NULL`, then the number of presentation modes
supported for the given pname:surface is returned in
pname:pPresentModeCount.
Otherwise, pname:pPresentModeCount must: point to a variable set by the user
to the number of elements in the pname:pPresentModes array, and on return
the variable is overwritten with the number of values actually written to
pname:pPresentModes.
If the value of pname:pPresentModeCount is less than the number of
presentation modes supported, at most pname:pPresentModeCount values will be
written, and ename:VK_INCOMPLETE will be returned instead of
ename:VK_SUCCESS, to indicate that not all the available modes were
returned.

ifdef::VK_GOOGLE_surfaceless_query[]
If the `apiext:VK_GOOGLE_surfaceless_query` extension is enabled and
pname:surface is dlink:VK_NULL_HANDLE, the values returned in
pname:pPresentModes will only indicate support for
ifndef::VK_KHR_shared_presentable_image[]
ename:VK_PRESENT_MODE_FIFO_KHR.
endif::VK_KHR_shared_presentable_image[]
ifdef::VK_KHR_shared_presentable_image[]
ename:VK_PRESENT_MODE_FIFO_KHR,
ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR, and
ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR.
endif::VK_KHR_shared_presentable_image[]
To query support for any other present mode, a valid handle must: be
provided in pname:surface.
endif::VK_GOOGLE_surfaceless_query[]

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
include::{chapters}/commonvalidity/surface_physical_device_surfaceless_common.adoc[]
****

include::{generated}/validity/protos/vkGetPhysicalDeviceSurfacePresentModesKHR.adoc[]
--

ifdef::VK_EXT_full_screen_exclusive[]
[open,refpage='vkGetPhysicalDeviceSurfacePresentModes2EXT',desc='Query supported presentation modes',type='protos']
--
:refpage: vkGetPhysicalDeviceSurfacePresentModes2EXT

Alternatively, to query the supported presentation modes for a surface
combined with select other fixed swapchain creation parameters, call:

include::{generated}/api/protos/vkGetPhysicalDeviceSurfacePresentModes2EXT.adoc[]

  * pname:physicalDevice is the physical device that will be associated with
    the swapchain to be created, as described for
    flink:vkCreateSwapchainKHR.
  * pname:pSurfaceInfo is a pointer to a
    slink:VkPhysicalDeviceSurfaceInfo2KHR structure describing the surface
    and other fixed parameters that would be consumed by
    flink:vkCreateSwapchainKHR.
  * pname:pPresentModeCount is a pointer to an integer related to the number
    of presentation modes available or queried, as described below.
  * pname:pPresentModes is either `NULL` or a pointer to an array of
    elink:VkPresentModeKHR values, indicating the supported presentation
    modes.

fname:vkGetPhysicalDeviceSurfacePresentModes2EXT behaves similarly to
flink:vkGetPhysicalDeviceSurfacePresentModesKHR, with the ability to specify
extended inputs via chained input structures.

.Valid Usage
****
include::{chapters}/commonvalidity/surface_info_physical_device_surfaceless_common.adoc[]
****

include::{generated}/validity/protos/vkGetPhysicalDeviceSurfacePresentModes2EXT.adoc[]
--
endif::VK_EXT_full_screen_exclusive[]

[open,refpage='VkPresentModeKHR',desc='Presentation mode supported for a surface',type='enums']
--
Possible values of elements of the
flink:vkGetPhysicalDeviceSurfacePresentModesKHR::pname:pPresentModes array,
indicating the supported presentation modes for a surface, are:

include::{generated}/api/enums/VkPresentModeKHR.adoc[]

  * ename:VK_PRESENT_MODE_IMMEDIATE_KHR specifies that the presentation
    engine does not wait for a vertical blanking period to update the
    current image, meaning this mode may: result in visible tearing.
    No internal queuing of presentation requests is needed, as the requests
    are applied immediately.
  * ename:VK_PRESENT_MODE_MAILBOX_KHR specifies that the presentation engine
    waits for the next vertical blanking period to update the current image.
    Tearing cannot: be observed.
    An internal single-entry queue is used to hold pending presentation
    requests.
    If the queue is full when a new presentation request is received, the
    new request replaces the existing entry, and any images associated with
    the prior entry become available for reuse by the application.
    One request is removed from the queue and processed during each vertical
    blanking period in which the queue is non-empty.
  * ename:VK_PRESENT_MODE_FIFO_KHR specifies that the presentation engine
    waits for the next vertical blanking period to update the current image.
    Tearing cannot: be observed.
    An internal queue is used to hold pending presentation requests.
    New requests are appended to the end of the queue, and one request is
    removed from the beginning of the queue and processed during each
    vertical blanking period in which the queue is non-empty.
    This is the only value of pname:presentMode that is required: to be
    supported.
  * ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR specifies that the presentation
    engine generally waits for the next vertical blanking period to update
    the current image.
    If a vertical blanking period has already passed since the last update
    of the current image then the presentation engine does not wait for
    another vertical blanking period for the update, meaning this mode may:
    result in visible tearing in this case.
    This mode is useful for reducing visual stutter with an application that
    will mostly present a new image before the next vertical blanking
    period, but may occasionally be late, and present a new image just after
    the next vertical blanking period.
    An internal queue is used to hold pending presentation requests.
    New requests are appended to the end of the queue, and one request is
    removed from the beginning of the queue and processed during or after
    each vertical blanking period in which the queue is non-empty.
ifdef::VK_KHR_shared_presentable_image[]
  * ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR specifies that the
    presentation engine and application have concurrent access to a single
    image, which is referred to as a _shared presentable image_.
    The presentation engine is only required to update the current image
    after a new presentation request is received.
    Therefore the application must: make a presentation request whenever an
    update is required.
    However, the presentation engine may: update the current image at any
    point, meaning this mode may: result in visible tearing.
  * ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR specifies that the
    presentation engine and application have concurrent access to a single
    image, which is referred to as a _shared presentable image_.
    The presentation engine periodically updates the current image on its
    regular refresh cycle.
    The application is only required to make one initial presentation
    request, after which the presentation engine must: update the current
    image without any need for further presentation requests.
    The application can: indicate the image contents have been updated by
    making a presentation request, but this does not guarantee the timing of
    when it will be updated.
    This mode may: result in visible tearing if rendering to the image is
    not timed correctly.

The supported elink:VkImageUsageFlagBits of the presentable images of a
swapchain created for a surface may: differ depending on the presentation
mode, and can be determined as per the table below:

.Presentable image usage queries
[width="100%",cols="<50%,<50%",options="header"]
|====
| Presentation mode                                   | Image usage flags
| ename:VK_PRESENT_MODE_IMMEDIATE_KHR                 | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
| ename:VK_PRESENT_MODE_MAILBOX_KHR                   | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
| ename:VK_PRESENT_MODE_FIFO_KHR                      | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
| ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR              | slink:VkSurfaceCapabilitiesKHR::pname:supportedUsageFlags
| ename:VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR     | slink:VkSharedPresentSurfaceCapabilitiesKHR::pname:sharedPresentSupportedUsageFlags
| ename:VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR | slink:VkSharedPresentSurfaceCapabilitiesKHR::pname:sharedPresentSupportedUsageFlags
|====
endif::VK_KHR_shared_presentable_image[]

[NOTE]
.Note
====
For reference, the mode indicated by ename:VK_PRESENT_MODE_FIFO_KHR is
equivalent to the behavior of {wgl|glX|egl}SwapBuffers with a swap interval
of 1, while the mode indicated by ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR is
equivalent to the behavior of {wgl|glX}SwapBuffers with a swap interval of
-1 (from the {WGL|GLX}_EXT_swap_control_tear extensions).
====
--

ifdef::VK_EXT_full_screen_exclusive[]
== Full Screen Exclusive Control

Swapchains created with pname:fullScreenExclusive set to
ename:VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT must: acquire and
release exclusive full-screen access explicitly, using the following
commands.

[open,refpage='vkAcquireFullScreenExclusiveModeEXT',desc='Acquire full-screen exclusive mode for a swapchain',type='protos']
--
To acquire exclusive full-screen access for a swapchain, call:

include::{generated}/api/protos/vkAcquireFullScreenExclusiveModeEXT.adoc[]

  * pname:device is the device associated with pname:swapchain.
  * pname:swapchain is the swapchain to acquire exclusive full-screen access
    for.

.Valid Usage
****
  * [[VUID-vkAcquireFullScreenExclusiveModeEXT-swapchain-02674]]
    pname:swapchain must: not be in the retired state
  * [[VUID-vkAcquireFullScreenExclusiveModeEXT-swapchain-02675]]
    pname:swapchain must: be a swapchain created with a
    slink:VkSurfaceFullScreenExclusiveInfoEXT structure, with
    pname:fullScreenExclusive set to
    ename:VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT
  * [[VUID-vkAcquireFullScreenExclusiveModeEXT-swapchain-02676]]
    pname:swapchain must: not currently have exclusive full-screen access
****

A return value of ename:VK_SUCCESS indicates that the pname:swapchain
successfully acquired exclusive full-screen access.
The swapchain will retain this exclusivity until either the application
releases exclusive full-screen access with
flink:vkReleaseFullScreenExclusiveModeEXT, destroys the swapchain, or if any
of the swapchain commands return
ename:VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT indicating that the mode
was lost because of platform-specific changes.

If the swapchain was unable to acquire exclusive full-screen access to the
display then ename:VK_ERROR_INITIALIZATION_FAILED is returned.
An application can: attempt to acquire exclusive full-screen access again
for the same swapchain even if this command fails, or if
ename:VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT has been returned by a
swapchain command.

include::{generated}/validity/protos/vkAcquireFullScreenExclusiveModeEXT.adoc[]
--

[open,refpage='vkReleaseFullScreenExclusiveModeEXT',desc='Release full-screen exclusive mode from a swapchain',type='protos']
--
To release exclusive full-screen access from a swapchain, call:

include::{generated}/api/protos/vkReleaseFullScreenExclusiveModeEXT.adoc[]

  * pname:device is the device associated with pname:swapchain.
  * pname:swapchain is the swapchain to release exclusive full-screen access
    from.

[NOTE]
.Note
====
Applications will not be able to present to pname:swapchain after this call
until exclusive full-screen access is reacquired.
This is usually useful to handle when an application is minimised or
otherwise intends to stop presenting for a time.
====

.Valid Usage
****
  * [[VUID-vkReleaseFullScreenExclusiveModeEXT-swapchain-02677]]
    pname:swapchain must: not be in the retired state
  * [[VUID-vkReleaseFullScreenExclusiveModeEXT-swapchain-02678]]
    pname:swapchain must: be a swapchain created with a
    slink:VkSurfaceFullScreenExclusiveInfoEXT structure, with
    pname:fullScreenExclusive set to
    ename:VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT
****

include::{generated}/validity/protos/vkReleaseFullScreenExclusiveModeEXT.adoc[]
--
endif::VK_EXT_full_screen_exclusive[]


ifdef::VK_KHR_swapchain[]
ifdef::VK_VERSION_1_1,VK_KHR_device_group[]
== Device Group Queries

[open,refpage='vkGetDeviceGroupPresentCapabilitiesKHR',desc='Query present capabilities from other physical devices',type='protos']
--
:refpage: vkGetDeviceGroupPresentCapabilitiesKHR

A logical device that represents multiple physical devices may: support
presenting from images on more than one physical device, or combining images
from multiple physical devices.

To query these capabilities, call:

include::{generated}/api/protos/vkGetDeviceGroupPresentCapabilitiesKHR.adoc[]

  * pname:device is the logical device.
  * pname:pDeviceGroupPresentCapabilities is a pointer to a
    slink:VkDeviceGroupPresentCapabilitiesKHR structure in which the
    device's capabilities are returned.

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

include::{generated}/validity/protos/vkGetDeviceGroupPresentCapabilitiesKHR.adoc[]
--

[open,refpage='VkDeviceGroupPresentCapabilitiesKHR',desc='Present capabilities from other physical devices',type='structs']
--
The sname:VkDeviceGroupPresentCapabilitiesKHR structure is defined as:

include::{generated}/api/structs/VkDeviceGroupPresentCapabilitiesKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:presentMask is an array of ename:VK_MAX_DEVICE_GROUP_SIZE
    code:uint32_t masks, where the mask at element [eq]#i# is non-zero if
    physical device [eq]#i# has a presentation engine, and where bit [eq]#j#
    is set in element [eq]#i# if physical device [eq]#i# can: present
    swapchain images from physical device [eq]#j#.
    If element [eq]#i# is non-zero, then bit [eq]#i# must: be set.
  * pname:modes is a bitmask of elink:VkDeviceGroupPresentModeFlagBitsKHR
    indicating which device group presentation modes are supported.

pname:modes always has ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR set.

The present mode flags are also used when presenting an image, in
slink:VkDeviceGroupPresentInfoKHR::pname:mode.

If a device group only includes a single physical device, then pname:modes
must: equal ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR.

include::{generated}/validity/structs/VkDeviceGroupPresentCapabilitiesKHR.adoc[]
--


[open,refpage='VkDeviceGroupPresentModeFlagBitsKHR',desc='Bitmask specifying supported device group present modes',type='enums']
--
Bits which may: be set in
slink:VkDeviceGroupPresentCapabilitiesKHR::pname:modes, indicating which
device group presentation modes are supported, are:

include::{generated}/api/enums/VkDeviceGroupPresentModeFlagBitsKHR.adoc[]

  * ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR specifies that any
    physical device with a presentation engine can: present its own
    swapchain images.
  * ename:VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR specifies that any
    physical device with a presentation engine can: present swapchain images
    from any physical device in its pname:presentMask.
  * ename:VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR specifies that any
    physical device with a presentation engine can: present the sum of
    swapchain images from any physical devices in its pname:presentMask.
  * ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR specifies
    that multiple physical devices with a presentation engine can: each
    present their own swapchain images.
--

[open,refpage='VkDeviceGroupPresentModeFlagsKHR',desc='Bitmask of VkDeviceGroupPresentModeFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkDeviceGroupPresentModeFlagsKHR.adoc[]

tname:VkDeviceGroupPresentModeFlagsKHR is a bitmask type for setting a mask
of zero or more elink:VkDeviceGroupPresentModeFlagBitsKHR.
--

[open,refpage='vkGetDeviceGroupSurfacePresentModesKHR',desc='Query present capabilities for a surface',type='protos']
--
:refpage: vkGetDeviceGroupSurfacePresentModesKHR

Some surfaces may: not be capable of using all the device group present
modes.

To query the supported device group present modes for a particular surface,
call:

include::{generated}/api/protos/vkGetDeviceGroupSurfacePresentModesKHR.adoc[]

  * pname:device is the logical device.
  * pname:surface is the surface.
  * pname:pModes is a pointer to a tlink:VkDeviceGroupPresentModeFlagsKHR in
    which the supported device group present modes for the surface are
    returned.

The modes returned by this command are not invariant, and may: change in
response to the surface being moved, resized, or occluded.
These modes must: be a subset of the modes returned by
flink:vkGetDeviceGroupPresentCapabilitiesKHR.

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
  * [[VUID-vkGetDeviceGroupSurfacePresentModesKHR-surface-06212]]
    pname:surface must: be supported by all physical devices associated with
    pname:device, as reported by flink:vkGetPhysicalDeviceSurfaceSupportKHR
    or an equivalent platform-specific mechanism
****

include::{generated}/validity/protos/vkGetDeviceGroupSurfacePresentModesKHR.adoc[]
--

ifdef::VK_EXT_full_screen_exclusive[]
[open,refpage='vkGetDeviceGroupSurfacePresentModes2EXT',desc='Query device group present capabilities for a surface',type='protos']
--
Alternatively, to query the supported device group presentation modes for a
surface combined with select other fixed swapchain creation parameters,
call:

include::{generated}/api/protos/vkGetDeviceGroupSurfacePresentModes2EXT.adoc[]

  * pname:device is the logical device.
  * pname:pSurfaceInfo is a pointer to a
    slink:VkPhysicalDeviceSurfaceInfo2KHR structure describing the surface
    and other fixed parameters that would be consumed by
    flink:vkCreateSwapchainKHR.
  * pname:pModes is a pointer to a tlink:VkDeviceGroupPresentModeFlagsKHR in
    which the supported device group present modes for the surface are
    returned.

fname:vkGetDeviceGroupSurfacePresentModes2EXT behaves similarly to
flink:vkGetDeviceGroupSurfacePresentModesKHR, with the ability to specify
extended inputs via chained input structures.

.Valid Usage
****
  * [[VUID-vkGetDeviceGroupSurfacePresentModes2EXT-pSurfaceInfo-06213]]
    pname:pSurfaceInfo->surface must: be supported by all physical devices
    associated with pname:device, as reported by
    flink:vkGetPhysicalDeviceSurfaceSupportKHR or an equivalent
    platform-specific mechanism
****

include::{generated}/validity/protos/vkGetDeviceGroupSurfacePresentModes2EXT.adoc[]
--
endif::VK_EXT_full_screen_exclusive[]

[open,refpage='vkGetPhysicalDevicePresentRectanglesKHR',desc='Query present rectangles for a surface on a physical device',type='protos']
--
:refpage: vkGetPhysicalDevicePresentRectanglesKHR

When using ename:VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR,
the application may: need to know which regions of the surface are used when
presenting locally on each physical device.
Presentation of swapchain images to this surface need only have valid
contents in the regions returned by this command.

To query a set of rectangles used in presentation on the physical device,
call:

include::{generated}/api/protos/vkGetPhysicalDevicePresentRectanglesKHR.adoc[]

  * pname:physicalDevice is the physical device.
  * pname:surface is the surface.
  * pname:pRectCount is a pointer to an integer related to the number of
    rectangles available or queried, as described below.
  * pname:pRects is either `NULL` or a pointer to an array of slink:VkRect2D
    structures.

If pname:pRects is `NULL`, then the number of rectangles used when
presenting the given pname:surface is returned in pname:pRectCount.
Otherwise, pname:pRectCount must: point to a variable set by the user to the
number of elements in the pname:pRects array, and on return the variable is
overwritten with the number of structures actually written to pname:pRects.
If the value of pname:pRectCount is less than the number of rectangles, at
most pname:pRectCount structures will be written, and ename:VK_INCOMPLETE
will be returned instead of ename:VK_SUCCESS, to indicate that not all the
available rectangles were returned.

The values returned by this command are not invariant, and may: change in
response to the surface being moved, resized, or occluded.

The rectangles returned by this command must: not overlap.

include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[]

.Valid Usage
****
include::{chapters}/commonvalidity/surface_physical_device_common.adoc[]
****

include::{generated}/validity/protos/vkGetPhysicalDevicePresentRectanglesKHR.adoc[]
--
endif::VK_VERSION_1_1,VK_KHR_device_group[]

ifdef::VK_GOOGLE_display_timing[]
include::{chapters}/VK_GOOGLE_display_timing/queries.adoc[]
endif::VK_GOOGLE_display_timing[]

ifdef::VK_KHR_present_wait[]
include::{chapters}/VK_KHR_present_wait/present_wait.adoc[]
endif::VK_KHR_present_wait[]

include::{chapters}/VK_KHR_swapchain/wsi.adoc[]
endif::VK_KHR_swapchain[]

ifdef::VK_NV_present_barrier[]
include::{chapters}/VK_NV_present_barrier/present_barrier.adoc[]
endif::VK_NV_present_barrier[]