summaryrefslogtreecommitdiff
path: root/chapters/samplers.adoc
blob: 1522ff9188d3034be6035d77a4ec648c5c50900e (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
// Copyright 2015-2023 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

[[samplers]]
= Samplers

[open,refpage='VkSampler',desc='Opaque handle to a sampler object',type='handles']
--
sname:VkSampler objects represent the state of an image sampler which is
used by the implementation to read image data and apply filtering and other
transformations for the shader.

Samplers are represented by sname:VkSampler handles:

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

[open,refpage='vkCreateSampler',desc='Create a new sampler object',type='protos']
--
:refpage: vkCreateSampler
:objectnameplural: samplers
:objectnamecamelcase: sampler
:objectcount: 1

To create a sampler object, call:

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

  * pname:device is the logical device that creates the sampler.
  * pname:pCreateInfo is a pointer to a slink:VkSamplerCreateInfo structure
    specifying the state of the sampler object.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.
  * pname:pSampler is a pointer to a slink:VkSampler handle in which the
    resulting sampler object is returned.

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

.Valid Usage
****
  * [[VUID-vkCreateSampler-maxSamplerAllocationCount-04110]]
    There must: be less than
    slink:VkPhysicalDeviceLimits::pname:maxSamplerAllocationCount
    slink:VkSampler objects currently created on the device
include::{chapters}/commonvalidity/memory_reservation_request_count_common.adoc[]
****

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

[open,refpage='VkSamplerCreateInfo',desc='Structure specifying parameters of a newly created sampler',type='structs']
--
The sname:VkSamplerCreateInfo structure is defined as:

include::{generated}/api/structs/VkSamplerCreateInfo.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:flags is a bitmask of elink:VkSamplerCreateFlagBits describing
    additional parameters of the sampler.
  * pname:magFilter is a elink:VkFilter value specifying the magnification
    filter to apply to lookups.
  * pname:minFilter is a elink:VkFilter value specifying the minification
    filter to apply to lookups.
  * pname:mipmapMode is a elink:VkSamplerMipmapMode value specifying the
    mipmap filter to apply to lookups.
  * pname:addressModeU is a elink:VkSamplerAddressMode value specifying the
    addressing mode for U coordinates outside [eq]#[0,1)#.
  * pname:addressModeV is a elink:VkSamplerAddressMode value specifying the
    addressing mode for V coordinates outside [eq]#[0,1)#.
  * pname:addressModeW is a elink:VkSamplerAddressMode value specifying the
    addressing mode for W coordinates outside [eq]#[0,1)#.
  * [[samplers-mipLodBias]] pname:mipLodBias is the bias to be added to
    mipmap LOD calculation and bias provided by image sampling functions in
    SPIR-V, as described in the <<textures-level-of-detail-operation, LOD
    Operation>> section.
  * [[samplers-maxAnisotropy]] pname:anisotropyEnable is ename:VK_TRUE to
    enable anisotropic filtering, as described in the
    <<textures-texel-anisotropic-filtering, Texel Anisotropic Filtering>>
    section, or ename:VK_FALSE otherwise.
  * pname:maxAnisotropy is the anisotropy value clamp used by the sampler
    when pname:anisotropyEnable is ename:VK_TRUE.
    If pname:anisotropyEnable is ename:VK_FALSE, pname:maxAnisotropy is
    ignored.
  * pname:compareEnable is ename:VK_TRUE to enable comparison against a
    reference value during lookups, or ename:VK_FALSE otherwise.
  ** Note: Some implementations will default to shader state if this member
     does not match.
  * pname:compareOp is a elink:VkCompareOp value specifying the comparison
    operator to apply to fetched data before filtering as described in the
    <<textures-depth-compare-operation, Depth Compare Operation>> section.
  * pname:minLod is used to clamp the <<textures-level-of-detail-operation,
    minimum of the computed LOD value>>.
  * pname:maxLod is used to clamp the <<textures-level-of-detail-operation,
    maximum of the computed LOD value>>.
    To avoid clamping the maximum value, set pname:maxLod to the constant
    ename:VK_LOD_CLAMP_NONE.
  * pname:borderColor is a elink:VkBorderColor value specifying the
    predefined border color to use.
  * [[samplers-unnormalizedCoordinates]] pname:unnormalizedCoordinates
    controls whether to use unnormalized or normalized texel coordinates to
    address texels of the image.
    When set to ename:VK_TRUE, the range of the image coordinates used to
    lookup the texel is in the range of zero to the image size in each
    dimension.
    When set to ename:VK_FALSE the range of image coordinates is zero to
    one.
+
When pname:unnormalizedCoordinates is ename:VK_TRUE, images the sampler is
used with in the shader have the following requirements:
+
  ** The pname:viewType must: be either ename:VK_IMAGE_VIEW_TYPE_1D or
     ename:VK_IMAGE_VIEW_TYPE_2D.
  ** The image view must: have a single layer and a single mip level.
+
When pname:unnormalizedCoordinates is ename:VK_TRUE, image built-in
functions in the shader that use the sampler have the following
requirements:
+
  ** The functions must: not use projection.
  ** The functions must: not use offsets.

[NOTE]
.Mapping of OpenGL to Vulkan filter modes
====
pname:magFilter values of ename:VK_FILTER_NEAREST and ename:VK_FILTER_LINEAR
directly correspond to code:GL_NEAREST and code:GL_LINEAR magnification
filters.
pname:minFilter and pname:mipmapMode combine to correspond to the similarly
named OpenGL minification filter of code:GL_minFilter_MIPMAP_mipmapMode
(e.g. pname:minFilter of ename:VK_FILTER_LINEAR and pname:mipmapMode of
ename:VK_SAMPLER_MIPMAP_MODE_NEAREST correspond to
code:GL_LINEAR_MIPMAP_NEAREST).

There are no Vulkan filter modes that directly correspond to OpenGL
minification filters of code:GL_LINEAR or code:GL_NEAREST, but they can: be
emulated using ename:VK_SAMPLER_MIPMAP_MODE_NEAREST, pname:minLod = 0, and
pname:maxLod = 0.25, and using pname:minFilter = ename:VK_FILTER_LINEAR or
pname:minFilter = ename:VK_FILTER_NEAREST, respectively.

Note that using a pname:maxLod of zero would cause
<<textures-texel-filtering,magnification>> to always be performed, and the
pname:magFilter to always be used.
This is valid, just not an exact match for OpenGL behavior.
Clamping the maximum LOD to 0.25 allows the [eq]#{lambda}# value to be
non-zero and minification to be performed, while still always rounding down
to the base level.
If the pname:minFilter and pname:magFilter are equal, then using a
pname:maxLod of zero also works.
====

The maximum number of sampler objects which can: be simultaneously created
on a device is implementation-dependent and specified by the
<<limits-maxSamplerAllocationCount, pname:maxSamplerAllocationCount>> member
of the slink:VkPhysicalDeviceLimits structure.

[NOTE]
.Note
====
For historical reasons, if pname:maxSamplerAllocationCount is exceeded, some
implementations may return ename:VK_ERROR_TOO_MANY_OBJECTS.
Exceeding this limit will result in undefined: behavior, and an application
should not rely on the use of the returned error code in order to identify
when the limit is reached.
====

Since slink:VkSampler is a non-dispatchable handle type, implementations
may: return the same handle for sampler state vectors that are identical.
In such cases, all such objects would only count once against the
pname:maxSamplerAllocationCount limit.

.Valid Usage
****
  * [[VUID-VkSamplerCreateInfo-mipLodBias-01069]]
    The absolute value of pname:mipLodBias must: be less than or equal to
    sname:VkPhysicalDeviceLimits::pname:maxSamplerLodBias
ifdef::VK_KHR_portability_subset[]
  * [[VUID-VkSamplerCreateInfo-samplerMipLodBias-04467]]
    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:samplerMipLodBias
    is ename:VK_FALSE, pname:mipLodBias must: be zero
endif::VK_KHR_portability_subset[]
  * [[VUID-VkSamplerCreateInfo-maxLod-01973]]
    pname:maxLod must: be greater than or equal to pname:minLod
  * [[VUID-VkSamplerCreateInfo-anisotropyEnable-01070]]
    If the <<features-samplerAnisotropy, pname:samplerAnisotropy>> feature
    is not enabled, pname:anisotropyEnable must: be ename:VK_FALSE
  * [[VUID-VkSamplerCreateInfo-anisotropyEnable-01071]]
    If pname:anisotropyEnable is ename:VK_TRUE, pname:maxAnisotropy must: be
    between `1.0` and
    sname:VkPhysicalDeviceLimits::pname:maxSamplerAnisotropy, inclusive
ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-VkSamplerCreateInfo-minFilter-01645]]
    If <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>> is enabled
    and the <<potential-format-features, potential format features>> of the
    sampler {YCbCr} conversion do not support
    ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT,
    pname:minFilter and pname:magFilter must: be equal to the sampler
    {YCbCr} conversion's pname:chromaFilter
endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01072]]
    If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:minFilter and
    pname:magFilter must: be equal
  * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01073]]
    If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:mipmapMode
    must: be ename:VK_SAMPLER_MIPMAP_MODE_NEAREST
  * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01074]]
    If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:minLod and
    pname:maxLod must: be zero
  * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01075]]
    If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:addressModeU
    and pname:addressModeV must: each be either
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
  * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01076]]
    If pname:unnormalizedCoordinates is ename:VK_TRUE,
    pname:anisotropyEnable must: be ename:VK_FALSE
  * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01077]]
    If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:compareEnable
    must: be ename:VK_FALSE
  * [[VUID-VkSamplerCreateInfo-addressModeU-01078]]
    If any of pname:addressModeU, pname:addressModeV or pname:addressModeW
    are ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, pname:borderColor
    must: be a valid elink:VkBorderColor value
ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-VkSamplerCreateInfo-addressModeU-01646]]
    If <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>> is enabled,
    pname:addressModeU, pname:addressModeV, and pname:addressModeW must: be
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, pname:anisotropyEnable
    must: be ename:VK_FALSE, and pname:unnormalizedCoordinates must: be
    ename:VK_FALSE
ifdef::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[]
  * [[VUID-VkSamplerCreateInfo-None-01647]]
    If <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>> is enabled
    and the pname:pNext chain includes a
    slink:VkSamplerReductionModeCreateInfo structure, then the sampler
    reduction mode must: be set to
    ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE
endif::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[]
endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
ifdef::VK_VERSION_1_2[]
  * [[VUID-VkSamplerCreateInfo-pNext-06726]]
    If <<features-samplerFilterMinmax, pname:samplerFilterMinmax>> is not
    enabled and the pname:pNext chain includes a
    slink:VkSamplerReductionModeCreateInfo structure, then the sampler
    reduction mode must: be set to
    ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE
endif::VK_VERSION_1_2[]
  * [[VUID-VkSamplerCreateInfo-addressModeU-01079]]
    If <<features-samplerMirrorClampToEdge, pname:samplerMirrorClampToEdge>>
    is not enabled, and if the `apiext:VK_KHR_sampler_mirror_clamp_to_edge`
    extension is not enabled, pname:addressModeU, pname:addressModeV and
    pname:addressModeW must: not be
    ename:VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE
  * [[VUID-VkSamplerCreateInfo-compareEnable-01080]]
    If pname:compareEnable is ename:VK_TRUE, pname:compareOp must: be a
    valid elink:VkCompareOp value
ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[]
  * [[VUID-VkSamplerCreateInfo-magFilter-01081]]
    If either pname:magFilter or pname:minFilter is
    ename:VK_FILTER_CUBIC_EXT, pname:anisotropyEnable must: be
    ename:VK_FALSE
endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[]
ifdef::VK_IMG_filter_cubic+VK_EXT_sampler_filter_minmax[]
  * [[VUID-VkSamplerCreateInfo-magFilter-07911]]
    If
ifdef::VK_EXT_filter_cubic[]
    the apiext:VK_EXT_filter_cubic extension is not enabled and
endif::VK_EXT_filter_cubic[]
    either pname:magFilter or pname:minFilter is ename:VK_FILTER_CUBIC_EXT,
    the pname:reductionMode member of slink:VkSamplerReductionModeCreateInfo
    must: be ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE
endif::VK_IMG_filter_cubic+VK_EXT_sampler_filter_minmax[]
ifdef::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[]
  * [[VUID-VkSamplerCreateInfo-compareEnable-01423]]
    If pname:compareEnable is ename:VK_TRUE, the pname:reductionMode member
    of slink:VkSamplerReductionModeCreateInfo must: be
    ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE
endif::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[]
ifdef::VK_EXT_fragment_density_map[]
  * [[VUID-VkSamplerCreateInfo-flags-02574]]
    If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then
    pname:minFilter and pname:magFilter must: be equal
  * [[VUID-VkSamplerCreateInfo-flags-02575]]
    If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then
    pname:mipmapMode must: be ename:VK_SAMPLER_MIPMAP_MODE_NEAREST
  * [[VUID-VkSamplerCreateInfo-flags-02576]]
    If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then
    pname:minLod and pname:maxLod must: be zero
  * [[VUID-VkSamplerCreateInfo-flags-02577]]
    If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then
    pname:addressModeU and pname:addressModeV must: each be either
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
  * [[VUID-VkSamplerCreateInfo-flags-02578]]
    If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then
    pname:anisotropyEnable must: be ename:VK_FALSE
  * [[VUID-VkSamplerCreateInfo-flags-02579]]
    If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then
    pname:compareEnable must: be ename:VK_FALSE
  * [[VUID-VkSamplerCreateInfo-flags-02580]]
    If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then
    pname:unnormalizedCoordinates must: be ename:VK_FALSE
endif::VK_EXT_fragment_density_map[]
ifdef::VK_EXT_non_seamless_cube_map[]
  * [[VUID-VkSamplerCreateInfo-nonSeamlessCubeMap-06788]]
    If the <<features-nonSeamlessCubeMap, pname:nonSeamlessCubeMap>> feature
    is not enabled, pname:flags must: not include
    ename:VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT
endif::VK_EXT_non_seamless_cube_map[]
ifdef::VK_EXT_custom_border_color[]
  * [[VUID-VkSamplerCreateInfo-borderColor-04011]]
    If pname:borderColor is one of ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT or
    ename:VK_BORDER_COLOR_INT_CUSTOM_EXT, then a
    slink:VkSamplerCustomBorderColorCreateInfoEXT must: be included in the
    pname:pNext chain
  * [[VUID-VkSamplerCreateInfo-customBorderColors-04085]]
    If the <<features-customBorderColors, pname:customBorderColors>> feature
    is not enabled, pname:borderColor must: not be
    ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT or
    ename:VK_BORDER_COLOR_INT_CUSTOM_EXT
  * [[VUID-VkSamplerCreateInfo-borderColor-04442]]
    If pname:borderColor is one of ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT or
    ename:VK_BORDER_COLOR_INT_CUSTOM_EXT, and
    slink:VkSamplerCustomBorderColorCreateInfoEXT::pname:format is not
    ename:VK_FORMAT_UNDEFINED,
    slink:VkSamplerCustomBorderColorCreateInfoEXT::pname:customBorderColor
    must: be within the range of values representable in pname:format
  * [[VUID-VkSamplerCreateInfo-None-04012]]
    The maximum number of samplers with custom border colors which can: be
    simultaneously created on a device is implementation-dependent and
    specified by the <<limits-maxCustomBorderColorSamplers,
    pname:maxCustomBorderColorSamplers>> member of the
    slink:VkPhysicalDeviceCustomBorderColorPropertiesEXT structure
endif::VK_EXT_custom_border_color[]
ifdef::VK_EXT_descriptor_buffer[]
  * [[VUID-VkSamplerCreateInfo-flags-08110]]
    If pname:flags includes
    ename:VK_SAMPLER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT, the
    <<features-descriptorBufferCaptureReplay,
    pname:descriptorBufferCaptureReplay>> feature must: be enabled
  * [[VUID-VkSamplerCreateInfo-pNext-08111]]
    If the pname:pNext chain includes a
    slink:VkOpaqueCaptureDescriptorDataCreateInfoEXT structure, pname:flags
    must: contain
    ename:VK_SAMPLER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT
endif::VK_EXT_descriptor_buffer[]
ifdef::VK_QCOM_image_processing[]
  * [[VUID-VkSamplerCreateInfo-flags-06964]]
    If pname:flags includes
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM, then pname:minFilter
    and pname:magFilter must: be ename:VK_FILTER_NEAREST
  * [[VUID-VkSamplerCreateInfo-flags-06965]]
    If pname:flags includes
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM, then pname:mipmapMode
    must: be ename:VK_SAMPLER_MIPMAP_MODE_NEAREST
  * [[VUID-VkSamplerCreateInfo-flags-06966]]
    [If pname:flags includes
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM, then pname:minLod and
    pname:maxLod must: be zero
  * [[VUID-VkSamplerCreateInfo-flags-06967]]
    If pname:flags includes
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM, then
    pname:addressModeU and pname:addressModeV must: each be either
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
  * [[VUID-VkSamplerCreateInfo-flags-06968]]
    If pname:flags includes
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM, and if
    pname:addressModeU or pname:addressModeV is
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, then pname:borderColor
    must: be ename:VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK
  * [[VUID-VkSamplerCreateInfo-flags-06969]]
    If pname:flags includes
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM, then
    pname:anisotropyEnable must: be ename:VK_FALSE
  * [[VUID-VkSamplerCreateInfo-flags-06970]]
    If pname:flags includes
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM, then
    pname:compareEnable must: be ename:VK_FALSE
endif::VK_QCOM_image_processing[]
****

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

[open,refpage='VK_LOD_CLAMP_NONE',desc='Maximum LOD unclamped access sentinel',type='consts']
--
ename:VK_LOD_CLAMP_NONE is a special constant value used for
slink:VkSamplerCreateInfo::pname:maxLod to indicate that maximum LOD
clamping should not be performed.

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

[open,refpage='VkSamplerCreateFlagBits',desc='Bitmask specifying additional parameters of sampler',type='enums']
--
Bits which can: be set in slink:VkSamplerCreateInfo::pname:flags, specifying
additional parameters of a sampler, are:

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

ifdef::VK_EXT_fragment_density_map[]
  * [[samplers-subsamplesampler]] ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT
    specifies that the sampler will read from an image created with
    pname:flags containing ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT.
  * ename:VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT
    specifies that the implementation may: use approximations when
    reconstructing a full color value for texture access from a subsampled
    image.
endif::VK_EXT_fragment_density_map[]
ifdef::VK_EXT_non_seamless_cube_map[]
  * ename:VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT specifies that
    <<textures-cubemapedge, cube map edge handling>> is not performed.
endif::VK_EXT_non_seamless_cube_map[]
ifdef::VK_QCOM_image_processing[]
  * [[samplers-imageprocessingsampler]]
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM specifies that the
    sampler will read from images using only code:OpImageWeightedSampleQCOM,
    code:OpImageBoxFilterQCOM,
ifdef::VK_QCOM_image_processing2[]
    code:OpImageBlockMatchGatherSSDQCOM,
    code:OpImageBlockMatchGatherSADQCOM,
    code:OpImageBlockMatchWindowSSDQCOM,
    code:OpImageBlockMatchWindowSADQCOM,
endif::VK_QCOM_image_processing2[]
    code:OpImageBlockMatchSSDQCOM, or code:OpImageBlockMatchSADQCOM.
endif::VK_QCOM_image_processing[]

ifdef::VK_EXT_fragment_density_map[]
[NOTE]
.Note
====
The approximations used when
ename:VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT is
specified are implementation defined.
Some implementations may: interpolate between fragment density levels in a
subsampled image.
In that case, this bit may: be used to decide whether the interpolation
factors are calculated per fragment or at a coarser granularity.
====
endif::VK_EXT_fragment_density_map[]
ifdef::VK_EXT_descriptor_buffer[]
  * ename:VK_SAMPLER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT
    specifies that the sampler can: be used with descriptor buffers when
    capturing and replaying (e.g. for trace capture and replay), see
    slink:VkOpaqueCaptureDescriptorDataCreateInfoEXT for more detail.
endif::VK_EXT_descriptor_buffer[]
--

[open,refpage='VkSamplerCreateFlags',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkSamplerCreateFlags.adoc[]

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

ifdef::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[]
[open,refpage='VkSamplerReductionModeCreateInfo',desc='Structure specifying sampler reduction mode',type='structs',alias='VkSamplerReductionModeCreateInfoEXT']
--
The sname:VkSamplerReductionModeCreateInfo structure is defined as:

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

ifdef::VK_EXT_sampler_filter_minmax[]
or the equivalent

include::{generated}/api/structs/VkSamplerReductionModeCreateInfoEXT.adoc[]
endif::VK_EXT_sampler_filter_minmax[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:reductionMode is a elink:VkSamplerReductionMode value controlling
    how texture filtering combines texel values.

If the pname:pNext chain of slink:VkSamplerCreateInfo includes a
sname:VkSamplerReductionModeCreateInfo structure, then that structure
includes a mode controlling how texture filtering combines texel values.

If this structure is not present, pname:reductionMode is considered to be
ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE.

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

[open,refpage='VkSamplerReductionMode',desc='Specify reduction mode for texture filtering',type='enums',alias='VkSamplerReductionModeEXT']
--
Reduction modes are specified by elink:VkSamplerReductionMode, which takes
values:

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

ifdef::VK_EXT_sampler_filter_minmax[]
or the equivalent

include::{generated}/api/enums/VkSamplerReductionModeEXT.adoc[]
endif::VK_EXT_sampler_filter_minmax[]

  * ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE specifies that texel
    values are combined by computing a weighted average of values in the
    footprint, using weights as specified in
    <<textures-unnormalized-to-integer,the image operations chapter>>.
  * ename:VK_SAMPLER_REDUCTION_MODE_MIN specifies that texel values are
    combined by taking the component-wise minimum of values in the footprint
    with non-zero weights.
  * ename:VK_SAMPLER_REDUCTION_MODE_MAX specifies that texel values are
    combined by taking the component-wise maximum of values in the footprint
    with non-zero weights.
ifdef::VK_QCOM_filter_cubic_clamp[]
  * ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_RANGECLAMP_QCOM
    specifies values are combined as described by
    ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE, followed by a
    <<textures-texel-range-clamp,texel range clamp>>.
endif::VK_QCOM_filter_cubic_clamp[]
--
endif::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[]

ifdef::VK_QCOM_filter_cubic_weights[]
[open,refpage='VkSamplerCubicWeightsCreateInfoQCOM',desc='Structure specifying sampler cubic weights',type='structs']
--
The sname:VkSamplerCubicWeightsCreateInfoQCOM structure is defined as:

include::{generated}/api/structs/VkSamplerCubicWeightsCreateInfoQCOM.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:cubicWeights is a elink:VkCubicFilterWeightsQCOM value controlling
    which cubic weights are used.

If the pname:pNext chain of slink:VkSamplerCreateInfo includes a
sname:VkSamplerCubicWeightsCreateInfoQCOM structure, then that structure
specifies which cubic weights are used.

If that structure is not present, pname:cubicWeights is considered to be
ename:VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM.

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

[open,refpage='VkCubicFilterWeightsQCOM',desc='Specify cubic weights for texture filtering',type='enums']
--
Possible values of the
slink:VkSamplerCubicWeightsCreateInfoQCOM::pname:cubicWeights, specifying
cubic weights used in <<textures-texel-cubic-filtering, Texel Cubic
Filtering>> are:

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

  * ename:VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM specifies Catmull-Rom
    weights.
  * ename:VK_CUBIC_FILTER_WEIGHTS_ZERO_TANGENT_CARDINAL_QCOM specifies Zero
    Tangent Cardinal weights.
  * ename:VK_CUBIC_FILTER_WEIGHTS_B_SPLINE_QCOM specifies B-Spline weights.
  * ename:VK_CUBIC_FILTER_WEIGHTS_MITCHELL_NETRAVALI_QCOM specifies
    Mitchell-Netravali weights.
--
endif::VK_QCOM_filter_cubic_weights[]

[open,refpage='VkFilter',desc='Specify filters used for texture lookups',type='enums']
--
Possible values of the slink:VkSamplerCreateInfo::pname:magFilter and
pname:minFilter parameters, specifying filters used for texture lookups,
are:

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

  * ename:VK_FILTER_NEAREST specifies nearest filtering.
  * ename:VK_FILTER_LINEAR specifies linear filtering.
ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[]
  * ename:VK_FILTER_CUBIC_EXT specifies cubic filtering.
endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[]

These filters are described in detail in <<textures-texel-filtering, Texel
Filtering>>.
--

[open,refpage='VkSamplerMipmapMode',desc='Specify mipmap mode used for texture lookups',type='enums']
--
Possible values of the slink:VkSamplerCreateInfo::pname:mipmapMode,
specifying the mipmap mode used for texture lookups, are:

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

  * ename:VK_SAMPLER_MIPMAP_MODE_NEAREST specifies nearest filtering.
  * ename:VK_SAMPLER_MIPMAP_MODE_LINEAR specifies linear filtering.

These modes are described in detail in <<textures-texel-filtering, Texel
Filtering>>.
--

[open,refpage='VkSamplerAddressMode',desc='Specify behavior of sampling with texture coordinates outside an image',type='enums']
--
Possible values of the slink:VkSamplerCreateInfo::ptext:addressMode*
parameters, specifying the behavior of sampling with coordinates outside the
range [eq]#[0,1]# for the respective [eq]#u#, [eq]#v#, or [eq]#w# coordinate
as defined in the <<textures-wrapping-operation, Wrapping Operation>>
section, are:

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

  * ename:VK_SAMPLER_ADDRESS_MODE_REPEAT specifies that the repeat wrap mode
    will be used.
  * ename:VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT specifies that the
    mirrored repeat wrap mode will be used.
  * ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE specifies that the clamp to
    edge wrap mode will be used.
  * ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER specifies that the clamp
    to border wrap mode will be used.
ifdef::VK_VERSION_1_2,VK_KHR_sampler_mirror_clamp_to_edge[]
  * ename:VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE specifies that the
    mirror clamp to edge wrap mode will be used.
    This is only valid if
ifdef::VK_VERSION_1_2[<<features-samplerMirrorClampToEdge, pname:samplerMirrorClampToEdge>> is enabled, or if]
    the `apiext:VK_KHR_sampler_mirror_clamp_to_edge` extension is enabled.
endif::VK_VERSION_1_2,VK_KHR_sampler_mirror_clamp_to_edge[]
--

[open,refpage='VkCompareOp',desc='Comparison operator for depth, stencil, and sampler operations',type='enums']
--
_Comparison operators_ compare a _reference_ and a _test_ value, and return
a true ("`passed`") or false ("`failed`") value depending on the comparison
operator chosen.
The supported operators are:

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

  * ename:VK_COMPARE_OP_NEVER specifies that the comparison always evaluates
    false.
  * ename:VK_COMPARE_OP_LESS specifies that the comparison evaluates
    [eq]#_reference_ < _test_#.
  * ename:VK_COMPARE_OP_EQUAL specifies that the comparison evaluates
    [eq]#_reference_ = _test_#.
  * ename:VK_COMPARE_OP_LESS_OR_EQUAL specifies that the comparison
    evaluates [eq]#_reference_ {leq} _test_#.
  * ename:VK_COMPARE_OP_GREATER specifies that the comparison evaluates
    [eq]#_reference_ > _test_#.
  * ename:VK_COMPARE_OP_NOT_EQUAL specifies that the comparison evaluates
    [eq]#_reference_ {neq} _test_#.
  * ename:VK_COMPARE_OP_GREATER_OR_EQUAL specifies that the comparison
    evaluates [eq]#_reference_ {geq} _test_#.
  * ename:VK_COMPARE_OP_ALWAYS specifies that the comparison always
    evaluates true.

Comparison operators are used for:

  * The <<textures-depth-compare-operation, Depth Compare Operation>>
    operator for a sampler, specified by
    slink:VkSamplerCreateInfo::pname:compareOp.
  * The stencil comparison operator for the <<fragops-stencil, stencil
    test>>, specified by
ifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[]
flink:vkCmdSetStencilOp::pname:compareOp or
endif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[]
    slink:VkStencilOpState::pname:compareOp.
  * The <<fragops-depth-comparison, Depth Comparison>> operator for the
    <<fragops-depth,depth test>>, specified by
ifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[]
flink:vkCmdSetDepthCompareOp::pname:depthCompareOp or
endif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[]
    slink:VkPipelineDepthStencilStateCreateInfo::pname:depthCompareOp.

Each such use describes how the _reference_ and _test_ values for that
comparison are determined.
--

[open,refpage='VkBorderColor',desc='Specify border color used for texture lookups',type='enums']
--
Possible values of slink:VkSamplerCreateInfo::pname:borderColor, specifying
the border color used for texture lookups, are:

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

  * ename:VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK specifies a transparent,
    floating-point format, black color.
  * ename:VK_BORDER_COLOR_INT_TRANSPARENT_BLACK specifies a transparent,
    integer format, black color.
  * ename:VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK specifies an opaque,
    floating-point format, black color.
  * ename:VK_BORDER_COLOR_INT_OPAQUE_BLACK specifies an opaque, integer
    format, black color.
  * ename:VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE specifies an opaque,
    floating-point format, white color.
  * ename:VK_BORDER_COLOR_INT_OPAQUE_WHITE specifies an opaque, integer
    format, white color.
ifdef::VK_EXT_custom_border_color[]
  * ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT indicates that a
    slink:VkSamplerCustomBorderColorCreateInfoEXT structure is included in
    the slink:VkSamplerCreateInfo::pname:pNext chain containing the color
    data in floating-point format.
  * ename:VK_BORDER_COLOR_INT_CUSTOM_EXT indicates that a
    slink:VkSamplerCustomBorderColorCreateInfoEXT structure is included in
    the slink:VkSamplerCreateInfo::pname:pNext chain containing the color
    data in integer format.
endif::VK_EXT_custom_border_color[]

These colors are described in detail in <<textures-texel-replacement, Texel
Replacement>>.
--

[open,refpage='vkDestroySampler',desc='Destroy a sampler object',type='protos']
--
To destroy a sampler, call:

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

  * pname:device is the logical device that destroys the sampler.
  * pname:sampler is the sampler to destroy.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.

.Valid Usage
****
  * [[VUID-vkDestroySampler-sampler-01082]]
    All submitted commands that refer to pname:sampler must: have completed
    execution
ifndef::VKSC_VERSION_1_0[]
  * [[VUID-vkDestroySampler-sampler-01083]]
    If sname:VkAllocationCallbacks were provided when pname:sampler was
    created, a compatible set of callbacks must: be provided here
  * [[VUID-vkDestroySampler-sampler-01084]]
    If no sname:VkAllocationCallbacks were provided when pname:sampler was
    created, pname:pAllocator must: be `NULL`
endif::VKSC_VERSION_1_0[]
****

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


ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
[[samplers-YCbCr-conversion]]
== Sampler {YCbCr} Conversion

[open,refpage='VkSamplerYcbcrConversionInfo',desc='Structure specifying {YCbCr} conversion to a sampler or image view',type='structs']
--
To create a sampler with {YCbCr} conversion enabled, add a
slink:VkSamplerYcbcrConversionInfo structure to the pname:pNext chain of the
slink:VkSamplerCreateInfo structure.
To create a sampler {YCbCr} conversion, the
<<features-samplerYcbcrConversion, pname:samplerYcbcrConversion>> feature
must: be enabled.
Conversion must: be fixed at pipeline creation time, through use of a
combined image sampler with an immutable sampler in
sname:VkDescriptorSetLayoutBinding.

A slink:VkSamplerYcbcrConversionInfo must: be provided for samplers to be
used with image views that access ename:VK_IMAGE_ASPECT_COLOR_BIT if the
format is one of the <<formats-requiring-sampler-ycbcr-conversion, formats
that require a sampler {YCbCr} conversion>>
ifdef::VK_ANDROID_external_memory_android_hardware_buffer[]
, or if the image view has an
<<memory-external-android-hardware-buffer-external-formats,external format>>
endif::VK_ANDROID_external_memory_android_hardware_buffer[]
.

The sname:VkSamplerYcbcrConversionInfo structure is defined as:

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

ifdef::VK_KHR_sampler_ycbcr_conversion[]
or the equivalent

include::{generated}/api/structs/VkSamplerYcbcrConversionInfoKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:conversion is a slink:VkSamplerYcbcrConversion handle created with
    flink:vkCreateSamplerYcbcrConversion.

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

[open,refpage='VkSamplerYcbcrConversion',desc='Opaque handle to a device-specific sampler {YCbCr} conversion description',type='handles']
--
A sampler {YCbCr} conversion is an opaque representation of a
device-specific sampler {YCbCr} conversion description, represented as a
sname:VkSamplerYcbcrConversion handle:

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

ifdef::VK_KHR_sampler_ycbcr_conversion[]
or the equivalent

include::{generated}/api/handles/VkSamplerYcbcrConversionKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]
--

[open,refpage='vkCreateSamplerYcbcrConversion',desc='Create a new {YCbCr} conversion',type='protos']
--
:refpage: vkCreateSamplerYcbcrConversion
:objectnameplural: sampler conversions
:objectnamecamelcase: samplerYcbcrConversion
:objectcount: 1

To create a slink:VkSamplerYcbcrConversion, call:

ifdef::VK_VERSION_1_1[]
include::{generated}/api/protos/vkCreateSamplerYcbcrConversion.adoc[]
endif::VK_VERSION_1_1[]

ifdef::VK_VERSION_1_1+VK_KHR_sampler_ycbcr_conversion[or the equivalent command]

ifdef::VK_KHR_sampler_ycbcr_conversion[]
include::{generated}/api/protos/vkCreateSamplerYcbcrConversionKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]

  * pname:device is the logical device that creates the sampler {YCbCr}
    conversion.
  * pname:pCreateInfo is a pointer to a
    slink:VkSamplerYcbcrConversionCreateInfo structure specifying the
    requested sampler {YCbCr} conversion.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.
  * pname:pYcbcrConversion is a pointer to a slink:VkSamplerYcbcrConversion
    handle in which the resulting sampler {YCbCr} conversion is returned.

The interpretation of the configured sampler {YCbCr} conversion is described
in more detail in <<textures-sampler-YCbCr-conversion,the description of
sampler {YCbCr} conversion>> in the <<textures,Image Operations>> chapter.

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

.Valid Usage
****
  * [[VUID-vkCreateSamplerYcbcrConversion-None-01648]]
    The <<features-samplerYcbcrConversion, pname:samplerYcbcrConversion>>
    feature must: be enabled
include::{chapters}/commonvalidity/memory_reservation_request_count_common.adoc[]
****

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

[open,refpage='VkSamplerYcbcrConversionCreateInfo',desc='Structure specifying the parameters of the newly created conversion',type='structs']
--
The sname:VkSamplerYcbcrConversionCreateInfo structure is defined as:

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

ifdef::VK_KHR_sampler_ycbcr_conversion[]
or the equivalent

include::{generated}/api/structs/VkSamplerYcbcrConversionCreateInfoKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:format is the format of the image from which color information
    will be retrieved.
  * pname:ycbcrModel describes the color matrix for conversion between color
    models.
  * pname:ycbcrRange describes whether the encoded values have headroom and
    foot room, or whether the encoding uses the full numerical range.
  * pname:components applies a _swizzle_ based on elink:VkComponentSwizzle
    enums prior to range expansion and color model conversion.
  * pname:xChromaOffset describes the
    <<textures-chroma-reconstruction,sample location>> associated with
    downsampled chroma components in the x dimension.
    pname:xChromaOffset has no effect for formats in which chroma components
    are not downsampled horizontally.
  * pname:yChromaOffset describes the
    <<textures-chroma-reconstruction,sample location>> associated with
    downsampled chroma components in the y dimension.
    pname:yChromaOffset has no effect for formats in which the chroma
    components are not downsampled vertically.
  * pname:chromaFilter is the filter for chroma reconstruction.
  * pname:forceExplicitReconstruction can: be used to ensure that
    reconstruction is done explicitly, if supported.

[NOTE]
.Note
====
Setting pname:forceExplicitReconstruction to ename:VK_TRUE may: have a
performance penalty on implementations where explicit reconstruction is not
the default mode of operation.

If pname:format supports
ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT
the pname:forceExplicitReconstruction value behaves as if it was set to
ename:VK_TRUE.
====

ifdef::VK_ANDROID_external_memory_android_hardware_buffer[]
If the pname:pNext chain includes a slink:VkExternalFormatANDROID structure
with non-zero pname:externalFormat member, the sampler {YCbCr} conversion
object represents an _external format conversion_, and pname:format must: be
ename:VK_FORMAT_UNDEFINED.
Such conversions must: only be used to sample image views with a matching
<<memory-external-android-hardware-buffer-external-formats,external
format>>.
When creating an external format conversion, the value of pname:components
is ignored.
endif::VK_ANDROID_external_memory_android_hardware_buffer[]
ifndef::VK_ANDROID_external_memory_android_hardware_buffer[]
Sampler {YCbCr} conversion objects do not support _external format
conversion_ without additional extensions defining _external formats_.
endif::VK_ANDROID_external_memory_android_hardware_buffer[]

.Valid Usage
****
ifdef::VK_ANDROID_external_memory_android_hardware_buffer[]
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-format-01904]]
    If an external format conversion is being created, pname:format must: be
    ename:VK_FORMAT_UNDEFINED
endif::VK_ANDROID_external_memory_android_hardware_buffer[]
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-format-04061]]
ifdef::VK_ANDROID_external_memory_android_hardware_buffer[]
    If an external format conversion is not being created,
endif::VK_ANDROID_external_memory_android_hardware_buffer[]
    pname:format must: represent unsigned normalized values (i.e. the format
    must: be a etext:UNORM format)
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-format-01650]]
    The <<potential-format-features, potential format features>> of the
    sampler {YCbCr} conversion must: support
    ename:VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT or
    ename:VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-xChromaOffset-01651]]
    If the <<potential-format-features, potential format features>> of the
    sampler {YCbCr} conversion do not support
    ename:VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT, pname:xChromaOffset
    and pname:yChromaOffset must: not be
    ename:VK_CHROMA_LOCATION_COSITED_EVEN if the corresponding components
    are <<textures-chroma-reconstruction, downsampled>>
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-xChromaOffset-01652]]
    If the <<potential-format-features, potential format features>> of the
    sampler {YCbCr} conversion do not support
    ename:VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT, pname:xChromaOffset
    and pname:yChromaOffset must: not be ename:VK_CHROMA_LOCATION_MIDPOINT
    if the corresponding components are <<textures-chroma-reconstruction,
    downsampled>>
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02581]]
    If the format has a etext:_422 or etext:_420 suffix, then
    pname:components.g must: be the
    <<resources-image-views-identity-mappings,identity swizzle>>
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02582]]
    If the format has a etext:_422 or etext:_420 suffix, then
    pname:components.a must: be the
    <<resources-image-views-identity-mappings,identity swizzle>>,
    ename:VK_COMPONENT_SWIZZLE_ONE, or ename:VK_COMPONENT_SWIZZLE_ZERO
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02583]]
    If the format has a etext:_422 or etext:_420 suffix, then
    pname:components.r must: be the
    <<resources-image-views-identity-mappings,identity swizzle>> or
    ename:VK_COMPONENT_SWIZZLE_B
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02584]]
    If the format has a etext:_422 or etext:_420 suffix, then
    pname:components.b must: be the
    <<resources-image-views-identity-mappings,identity swizzle>> or
    ename:VK_COMPONENT_SWIZZLE_R
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02585]]
    If the format has a etext:_422 or etext:_420 suffix, and if either
    pname:components.r or pname:components.b is the
    <<resources-image-views-identity-mappings,identity swizzle>>, both
    values must: be the identity swizzle
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-ycbcrModel-01655]]
    If pname:ycbcrModel is not
    ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY, then
    pname:components.r, pname:components.g, and pname:components.b must:
    correspond to components of the pname:format; that is,
    pname:components.r, pname:components.g, and pname:components.b must: not
    be ename:VK_COMPONENT_SWIZZLE_ZERO or ename:VK_COMPONENT_SWIZZLE_ONE,
    and must: not correspond to a component containing zero or one as a
    consequence of <<textures-conversion-to-rgba,conversion to RGBA>>
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-ycbcrRange-02748]]
    If pname:ycbcrRange is ename:VK_SAMPLER_YCBCR_RANGE_ITU_NARROW then the
    R, G and B components obtained by applying the pname:component swizzle
    to pname:format must: each have a bit-depth greater than or equal to 8
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-forceExplicitReconstruction-01656]]
    If the <<potential-format-features, potential format features>> of the
    sampler {YCbCr} conversion do not support
    ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT
    pname:forceExplicitReconstruction must: be ename:VK_FALSE
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-chromaFilter-01657]]
    If the <<potential-format-features, potential format features>> of the
    sampler {YCbCr} conversion do not support
    ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT,
    pname:chromaFilter must: not be ename:VK_FILTER_LINEAR
ifdef::VK_QCOM_ycbcr_degamma[]
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-pNext-09207]]
    If the pname:pNext chain includes a
    slink:VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM structure, and
    if the <<features-ycbcr-degamma,pname:ycbcrDegamma>> feature is not
    enabled, then
    slink:VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM::pname:enableYDegamma
    must: be ename:VK_FALSE
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-pNext-09208]]
    If the pname:pNext chain includes a
    slink:VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM structure, and
    if the <<features-ycbcr-degamma,pname:ycbcrDegamma>> feature is not
    enabled, then
    slink:VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM::pname:enableCbCrDegamma
    must: be ename:VK_FALSE
  * [[VUID-VkSamplerYcbcrConversionCreateInfo-pNext-09209]]
    If the pname:pNext chain includes a
    slink:VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM structure,
    pname:format must: be a format with 8-bit R, G, and B components.
endif::VK_QCOM_ycbcr_degamma[]
****

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

If pname:chromaFilter is ename:VK_FILTER_NEAREST, chroma samples are
reconstructed to luma component resolution using nearest-neighbour sampling.
Otherwise, chroma samples are reconstructed using interpolation.
More details can be found in <<textures-sampler-YCbCr-conversion,the
description of sampler {YCbCr} conversion>> in the <<textures,Image
Operations>> chapter.
--

[open,refpage='VkSamplerYcbcrModelConversion',desc='Color model component of a color space',type='enums']
--
elink:VkSamplerYcbcrModelConversion defines the conversion from the source
color model to the shader color model.
Possible values are:

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

ifdef::VK_KHR_sampler_ycbcr_conversion[]
or the equivalent

include::{generated}/api/enums/VkSamplerYcbcrModelConversionKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]

  * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY specifies that the
    input values to the conversion are unmodified.
  * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY specifies no
    model conversion but the inputs are range expanded as for {YCbCr}.
  * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 specifies the color
    model conversion from {YCbCr} to {RGBprime} defined in BT.709 and
    described in the "`BT.709 {YCbCr} conversion`" section of the
    <<data-format,Khronos Data Format Specification>>.
  * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 specifies the color
    model conversion from {YCbCr} to {RGBprime} defined in BT.601 and
    described in the "`BT.601 {YCbCr} conversion`" section of the
    <<data-format,Khronos Data Format Specification>>.
  * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 specifies the color
    model conversion from {YCbCr} to {RGBprime} defined in BT.2020 and
    described in the "`BT.2020 {YCbCr} conversion`" section of the
    <<data-format,Khronos Data Format Specification>>.

In the etext:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_* color models, for the
input to the sampler {YCbCr} range expansion and model conversion:

  * the Y (Y{prime} luma) component corresponds to the G component of an RGB
    image.
  * the CB (C~B~ or "`U`" blue color difference) component corresponds to
    the B component of an RGB image.
  * the CR (C~R~ or "`V`" red color difference) component corresponds to the
    R component of an RGB image.
  * the alpha component, if present, is not modified by color model
    conversion.

These rules reflect the mapping of components after the component swizzle
operation (controlled by
slink:VkSamplerYcbcrConversionCreateInfo::pname:components).

[NOTE]
.Note
====
For example, an "`YUVA`" 32-bit format comprising four 8-bit components can
be implemented as ename:VK_FORMAT_R8G8B8A8_UNORM with a component mapping:

  * pname:components.a = ename:VK_COMPONENT_SWIZZLE_IDENTITY
  * pname:components.r = ename:VK_COMPONENT_SWIZZLE_B
  * pname:components.g = ename:VK_COMPONENT_SWIZZLE_R
  * pname:components.b = ename:VK_COMPONENT_SWIZZLE_G
====
--

[open,refpage='VkSamplerYcbcrRange',desc='Range of encoded values in a color space',type='enums']
--
The elink:VkSamplerYcbcrRange enum describes whether color components are
encoded using the full range of numerical values or whether values are
reserved for headroom and foot room.
elink:VkSamplerYcbcrRange is defined as:

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

ifdef::VK_KHR_sampler_ycbcr_conversion[]
or the equivalent

include::{generated}/api/enums/VkSamplerYcbcrRangeKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]

  * ename:VK_SAMPLER_YCBCR_RANGE_ITU_FULL specifies that the full range of
    the encoded values are valid and interpreted according to the ITU "`full
    range`" quantization rules.
  * ename:VK_SAMPLER_YCBCR_RANGE_ITU_NARROW specifies that headroom and foot
    room are reserved in the numerical range of encoded values, and the
    remaining values are expanded according to the ITU "`narrow range`"
    quantization rules.

The formulae for these conversions is described in the
<<textures-sampler-YCbCr-conversion-rangeexpand,Sampler {YCbCr} Range
Expansion>> section of the <<textures,Image Operations>> chapter.

No range modification takes place if pname:ycbcrModel is
ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY; the pname:ycbcrRange
field of slink:VkSamplerYcbcrConversionCreateInfo is ignored in this case.
--

[open,refpage='VkChromaLocation',desc='Position of downsampled chroma samples',type='enums']
--
The elink:VkChromaLocation enum defines the location of downsampled chroma
component samples relative to the luma samples, and is defined as:

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

ifdef::VK_KHR_sampler_ycbcr_conversion[]
or the equivalent

include::{generated}/api/enums/VkChromaLocationKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]

  * ename:VK_CHROMA_LOCATION_COSITED_EVEN specifies that downsampled chroma
    samples are aligned with luma samples with even coordinates.
  * ename:VK_CHROMA_LOCATION_MIDPOINT specifies that downsampled chroma
    samples are located half way between each even luma sample and the
    nearest higher odd luma sample.
--

ifdef::VK_QCOM_ycbcr_degamma[]
[open,refpage='VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM',desc='Structure specifying {YCbCr} degamma parameters',type='structs']
--
Applications can: enable sRGB to linear conversion for the R, G, and B
components of a {YCbCr} image during <<textures-ycbcr-degamma, format
conversion>> by including
sname:VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM structure in the
pname:pNext chain of slink:VkSamplerYcbcrConversionCreateInfo.

The sname:VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM structure is
defined as:

include::{generated}/api/structs/VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM.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:enableYDegamma indicates <<textures-ycbcr-degamma,sRGB to linear>>
    conversion is enabled for the G component.
  * pname:enableCbCrDegamma indicates <<textures-ycbcr-degamma,sRGB to
    linear>> conversion is enabled for the R and B components.

include::{generated}/validity/structs/VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM.adoc[]
--
endif::VK_QCOM_ycbcr_degamma[]

[open,refpage='vkDestroySamplerYcbcrConversion',desc='Destroy a created {YCbCr} conversion',type='protos']
--
To destroy a sampler {YCbCr} conversion, call:

ifdef::VK_VERSION_1_1[]
include::{generated}/api/protos/vkDestroySamplerYcbcrConversion.adoc[]
endif::VK_VERSION_1_1[]

ifdef::VK_VERSION_1_1+VK_KHR_sampler_ycbcr_conversion[or the equivalent command]

ifdef::VK_KHR_sampler_ycbcr_conversion[]
include::{generated}/api/protos/vkDestroySamplerYcbcrConversionKHR.adoc[]
endif::VK_KHR_sampler_ycbcr_conversion[]

  * pname:device is the logical device that destroys the {YCbCr} conversion.
  * pname:ycbcrConversion is the conversion to destroy.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.

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

ifdef::VK_EXT_custom_border_color[]
[open,refpage='VkSamplerCustomBorderColorCreateInfoEXT',desc='Structure specifying custom border color',type='structs']
--
In addition to the predefined border color values, applications can: provide
a custom border color value by including the
sname:VkSamplerCustomBorderColorCreateInfoEXT structure in the
slink:VkSamplerCreateInfo::pname:pNext chain.

The sname:VkSamplerCustomBorderColorCreateInfoEXT structure is defined as:

include::{generated}/api/structs/VkSamplerCustomBorderColorCreateInfoEXT.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:customBorderColor is a slink:VkClearColorValue representing the
    desired custom sampler border color.
  * pname:format is a elink:VkFormat representing the format of the sampled
    image view(s).
    This field may be ename:VK_FORMAT_UNDEFINED if the
    <<features-customBorderColorWithoutFormat,
    pname:customBorderColorWithoutFormat>> feature is enabled.

[NOTE]
.Note
====
If pname:format is a depth/stencil format, the aspect is determined by the
value of slink:VkSamplerCreateInfo::pname:borderColor.
If slink:VkSamplerCreateInfo::pname:borderColor is
ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT, the depth aspect is considered.
If slink:VkSamplerCreateInfo::pname:borderColor is
ename:VK_BORDER_COLOR_INT_CUSTOM_EXT, the stencil aspect is considered.

If pname:format is ename:VK_FORMAT_UNDEFINED, the
slink:VkSamplerCreateInfo::pname:borderColor is
ename:VK_BORDER_COLOR_INT_CUSTOM_EXT, and the sampler is used with an image
with a stencil format, then the implementation must: source the custom
border color from either the first or second components of
slink:VkSamplerCreateInfo::pname:customBorderColor and should: source it
from the first component.
====

.Valid Usage
****
  * [[VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-07605]]
    If pname:format is not ename:VK_FORMAT_UNDEFINED and pname:format is not
    a depth/stencil format then the
    slink:VkSamplerCreateInfo::pname:borderColor type must: match the
    sampled type of the provided pname:format, as shown in the _SPIR-V Type_
    column of the <<formats-numericformat>> table
  * [[VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04014]]
    If the <<features-customBorderColorWithoutFormat,
    pname:customBorderColorWithoutFormat>> feature is not enabled then
    pname:format must: not be ename:VK_FORMAT_UNDEFINED
  * [[VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04015]]
    If the sampler is used to sample an image view of
    ename:VK_FORMAT_B4G4R4A4_UNORM_PACK16,
    ename:VK_FORMAT_B5G6R5_UNORM_PACK16,
ifdef::VK_KHR_maintenance5[]
    ename:VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR,
endif::VK_KHR_maintenance5[]
    or ename:VK_FORMAT_B5G5R5A1_UNORM_PACK16 format then pname:format must:
    not be ename:VK_FORMAT_UNDEFINED
****

include::{generated}/validity/structs/VkSamplerCustomBorderColorCreateInfoEXT.adoc[]
--
endif::VK_EXT_custom_border_color[]

ifdef::VK_EXT_border_color_swizzle[]
[open,refpage='VkSamplerBorderColorComponentMappingCreateInfoEXT',desc='Structure specifying the component mapping of the border color',type='structs']
--
If the sampler is created with ename:VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK,
ename:VK_BORDER_COLOR_INT_OPAQUE_BLACK,
ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT, or
ename:VK_BORDER_COLOR_INT_CUSTOM_EXT pname:borderColor, and that sampler
will be combined with an image view that does not have an
<<resources-image-views-identity-mappings,identity swizzle>>, and
slink:VkPhysicalDeviceBorderColorSwizzleFeaturesEXT::pname:borderColorSwizzleFromImage
is not enabled, then it is necessary to specify the component mapping of the
border color, by including the
sname:VkSamplerBorderColorComponentMappingCreateInfoEXT structure in the
slink:VkSamplerCreateInfo::pname:pNext chain, to get defined results.

The sname:VkSamplerBorderColorComponentMappingCreateInfoEXT structure is
defined as:

include::{generated}/api/structs/VkSamplerBorderColorComponentMappingCreateInfoEXT.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:components is a slink:VkComponentMapping structure specifying a
    remapping of the border color components.
  * pname:srgb indicates that the sampler will be combined with an image
    view that has an image format which is sRGB encoded.

The slink:VkComponentMapping pname:components member describes a remapping
from components of the border color to components of the vector returned by
shader image instructions when the border color is used.

.Valid Usage
****
  * [[VUID-VkSamplerBorderColorComponentMappingCreateInfoEXT-borderColorSwizzle-06437]]
    The <<features-borderColorSwizzle, pname:borderColorSwizzle>> feature
    must: be enabled
****

include::{generated}/validity/structs/VkSamplerBorderColorComponentMappingCreateInfoEXT.adoc[]
--
endif::VK_EXT_border_color_swizzle[]

ifdef::VK_QCOM_image_processing2[]
[open,refpage='VkSamplerBlockMatchWindowCreateInfoQCOM',desc='Structure specifying the block match window parameters',type='structs']
--

The sname:VkSamplerBlockMatchWindowCreateInfoQCOM structure is defined as:

include::{generated}/api/structs/VkSamplerBlockMatchWindowCreateInfoQCOM.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:windowExtent is a slink:VkExtent2D specifying a the width and
    height of the block match window.
  * pname:windowCompareMode is a elink:VkBlockMatchWindowCompareModeQCOM
    specifying the compare mode.

.Valid Usage
****
  * [[VUID-VkSamplerBlockMatchWindowCreateInfoQCOM-WindowExtent-09210]]
    pname:WindowExtent must: not be larger than
    slink:VkPhysicalDeviceImageProcessing2PropertiesQCOM::pname:maxBlockMatchWindow.
****

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

[open,refpage='VkBlockMatchWindowCompareModeQCOM',desc='Block match window compare modes',type='enums']
--
The elink:VkBlockMatchWindowCompareModeQCOM enum describes how block match
values within the window are compared.
elink:VkBlockMatchWindowCompareModeQCOM is defined as:

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

  * ename:VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MIN_QCOM specifies that
    windowed block match operations return the minimum error within the
    window.
  * ename:VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MAX_QCOM specifies that
    windowed block match operations return the maximum error within the
    window.
--
endif::VK_QCOM_image_processing2[]