1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[samplers]] 6e5c31af7Sopenharmony_ci= Samplers 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ci[open,refpage='VkSampler',desc='Opaque handle to a sampler object',type='handles'] 9e5c31af7Sopenharmony_ci-- 10e5c31af7Sopenharmony_cisname:VkSampler objects represent the state of an image sampler which is 11e5c31af7Sopenharmony_ciused by the implementation to read image data and apply filtering and other 12e5c31af7Sopenharmony_citransformations for the shader. 13e5c31af7Sopenharmony_ci 14e5c31af7Sopenharmony_ciSamplers are represented by sname:VkSampler handles: 15e5c31af7Sopenharmony_ci 16e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkSampler.txt[] 17e5c31af7Sopenharmony_ci-- 18e5c31af7Sopenharmony_ci 19e5c31af7Sopenharmony_ci[open,refpage='vkCreateSampler',desc='Create a new sampler object',type='protos'] 20e5c31af7Sopenharmony_ci-- 21e5c31af7Sopenharmony_ciTo create a sampler object, call: 22e5c31af7Sopenharmony_ci 23e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateSampler.txt[] 24e5c31af7Sopenharmony_ci 25e5c31af7Sopenharmony_ci * pname:device is the logical device that creates the sampler. 26e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a slink:VkSamplerCreateInfo structure 27e5c31af7Sopenharmony_ci specifying the state of the sampler object. 28e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 29e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 30e5c31af7Sopenharmony_ci * pname:pSampler is a pointer to a slink:VkSampler handle in which the 31e5c31af7Sopenharmony_ci resulting sampler object is returned. 32e5c31af7Sopenharmony_ci 33e5c31af7Sopenharmony_ci.Valid Usage 34e5c31af7Sopenharmony_ci**** 35e5c31af7Sopenharmony_ci * [[VUID-vkCreateSampler-maxSamplerAllocationCount-04110]] 36e5c31af7Sopenharmony_ci There must: be less than 37e5c31af7Sopenharmony_ci slink:VkPhysicalDeviceLimits::pname:maxSamplerAllocationCount 38e5c31af7Sopenharmony_ci slink:VkSampler objects currently created on the device 39e5c31af7Sopenharmony_ci**** 40e5c31af7Sopenharmony_ci 41e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateSampler.txt[] 42e5c31af7Sopenharmony_ci-- 43e5c31af7Sopenharmony_ci 44e5c31af7Sopenharmony_ci[open,refpage='VkSamplerCreateInfo',desc='Structure specifying parameters of a newly created sampler',type='structs'] 45e5c31af7Sopenharmony_ci-- 46e5c31af7Sopenharmony_ciThe sname:VkSamplerCreateInfo structure is defined as: 47e5c31af7Sopenharmony_ci 48e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerCreateInfo.txt[] 49e5c31af7Sopenharmony_ci 50e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 51e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 52e5c31af7Sopenharmony_ci structure. 53e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkSamplerCreateFlagBits describing 54e5c31af7Sopenharmony_ci additional parameters of the sampler. 55e5c31af7Sopenharmony_ci * pname:magFilter is a elink:VkFilter value specifying the magnification 56e5c31af7Sopenharmony_ci filter to apply to lookups. 57e5c31af7Sopenharmony_ci * pname:minFilter is a elink:VkFilter value specifying the minification 58e5c31af7Sopenharmony_ci filter to apply to lookups. 59e5c31af7Sopenharmony_ci * pname:mipmapMode is a elink:VkSamplerMipmapMode value specifying the 60e5c31af7Sopenharmony_ci mipmap filter to apply to lookups. 61e5c31af7Sopenharmony_ci * pname:addressModeU is a elink:VkSamplerAddressMode value specifying the 62e5c31af7Sopenharmony_ci addressing mode for U coordinates outside [eq]#[0,1)#. 63e5c31af7Sopenharmony_ci * pname:addressModeV is a elink:VkSamplerAddressMode value specifying the 64e5c31af7Sopenharmony_ci addressing mode for V coordinates outside [eq]#[0,1)#. 65e5c31af7Sopenharmony_ci * pname:addressModeW is a elink:VkSamplerAddressMode value specifying the 66e5c31af7Sopenharmony_ci addressing mode for W coordinates outside [eq]#[0,1)#. 67e5c31af7Sopenharmony_ci * [[samplers-mipLodBias]] pname:mipLodBias is the bias to be added to 68e5c31af7Sopenharmony_ci mipmap LOD (level-of-detail) calculation and bias provided by image 69e5c31af7Sopenharmony_ci sampling functions in SPIR-V, as described in the 70e5c31af7Sopenharmony_ci <<textures-level-of-detail-operation, Level-of-Detail Operation>> 71e5c31af7Sopenharmony_ci section. 72e5c31af7Sopenharmony_ci * [[samplers-maxAnisotropy]] pname:anisotropyEnable is ename:VK_TRUE to 73e5c31af7Sopenharmony_ci enable anisotropic filtering, as described in the 74e5c31af7Sopenharmony_ci <<textures-texel-anisotropic-filtering, Texel Anisotropic Filtering>> 75e5c31af7Sopenharmony_ci section, or ename:VK_FALSE otherwise. 76e5c31af7Sopenharmony_ci * pname:maxAnisotropy is the anisotropy value clamp used by the sampler 77e5c31af7Sopenharmony_ci when pname:anisotropyEnable is ename:VK_TRUE. 78e5c31af7Sopenharmony_ci If pname:anisotropyEnable is ename:VK_FALSE, pname:maxAnisotropy is 79e5c31af7Sopenharmony_ci ignored. 80e5c31af7Sopenharmony_ci * pname:compareEnable is ename:VK_TRUE to enable comparison against a 81e5c31af7Sopenharmony_ci reference value during lookups, or ename:VK_FALSE otherwise. 82e5c31af7Sopenharmony_ci ** Note: Some implementations will default to shader state if this member 83e5c31af7Sopenharmony_ci does not match. 84e5c31af7Sopenharmony_ci * pname:compareOp is a elink:VkCompareOp value specifying the comparison 85e5c31af7Sopenharmony_ci function to apply to fetched data before filtering as described in the 86e5c31af7Sopenharmony_ci <<textures-depth-compare-operation, Depth Compare Operation>> section. 87e5c31af7Sopenharmony_ci * pname:minLod is used to clamp the <<textures-level-of-detail-operation, 88e5c31af7Sopenharmony_ci minimum of the computed LOD value>>. 89e5c31af7Sopenharmony_ci * pname:maxLod is used to clamp the <<textures-level-of-detail-operation, 90e5c31af7Sopenharmony_ci maximum of the computed LOD value>>. 91e5c31af7Sopenharmony_ci To avoid clamping the maximum value, set pname:maxLod to the constant 92e5c31af7Sopenharmony_ci ename:VK_LOD_CLAMP_NONE. 93e5c31af7Sopenharmony_ci * pname:borderColor is a elink:VkBorderColor value specifying the 94e5c31af7Sopenharmony_ci predefined border color to use. 95e5c31af7Sopenharmony_ci * [[samplers-unnormalizedCoordinates]] pname:unnormalizedCoordinates 96e5c31af7Sopenharmony_ci controls whether to use unnormalized or normalized texel coordinates to 97e5c31af7Sopenharmony_ci address texels of the image. 98e5c31af7Sopenharmony_ci When set to ename:VK_TRUE, the range of the image coordinates used to 99e5c31af7Sopenharmony_ci lookup the texel is in the range of zero to the image size in each 100e5c31af7Sopenharmony_ci dimension. 101e5c31af7Sopenharmony_ci When set to ename:VK_FALSE the range of image coordinates is zero to 102e5c31af7Sopenharmony_ci one. 103e5c31af7Sopenharmony_ci+ 104e5c31af7Sopenharmony_ciWhen pname:unnormalizedCoordinates is ename:VK_TRUE, images the sampler is 105e5c31af7Sopenharmony_ciused with in the shader have the following requirements: 106e5c31af7Sopenharmony_ci+ 107e5c31af7Sopenharmony_ci ** The pname:viewType must: be either ename:VK_IMAGE_VIEW_TYPE_1D or 108e5c31af7Sopenharmony_ci ename:VK_IMAGE_VIEW_TYPE_2D. 109e5c31af7Sopenharmony_ci ** The image view must: have a single layer and a single mip level. 110e5c31af7Sopenharmony_ci+ 111e5c31af7Sopenharmony_ciWhen pname:unnormalizedCoordinates is ename:VK_TRUE, image built-in 112e5c31af7Sopenharmony_cifunctions in the shader that use the sampler have the following 113e5c31af7Sopenharmony_cirequirements: 114e5c31af7Sopenharmony_ci+ 115e5c31af7Sopenharmony_ci ** The functions must: not use projection. 116e5c31af7Sopenharmony_ci ** The functions must: not use offsets. 117e5c31af7Sopenharmony_ci 118e5c31af7Sopenharmony_ci[NOTE] 119e5c31af7Sopenharmony_ci.Mapping of OpenGL to Vulkan filter modes 120e5c31af7Sopenharmony_ci==== 121e5c31af7Sopenharmony_cipname:magFilter values of ename:VK_FILTER_NEAREST and ename:VK_FILTER_LINEAR 122e5c31af7Sopenharmony_cidirectly correspond to code:GL_NEAREST and code:GL_LINEAR magnification 123e5c31af7Sopenharmony_cifilters. 124e5c31af7Sopenharmony_cipname:minFilter and pname:mipmapMode combine to correspond to the similarly 125e5c31af7Sopenharmony_cinamed OpenGL minification filter of code:GL_minFilter_MIPMAP_mipmapMode 126e5c31af7Sopenharmony_ci(e.g. pname:minFilter of ename:VK_FILTER_LINEAR and pname:mipmapMode of 127e5c31af7Sopenharmony_ciename:VK_SAMPLER_MIPMAP_MODE_NEAREST correspond to 128e5c31af7Sopenharmony_cicode:GL_LINEAR_MIPMAP_NEAREST). 129e5c31af7Sopenharmony_ci 130e5c31af7Sopenharmony_ciThere are no Vulkan filter modes that directly correspond to OpenGL 131e5c31af7Sopenharmony_ciminification filters of code:GL_LINEAR or code:GL_NEAREST, but they can: be 132e5c31af7Sopenharmony_ciemulated using ename:VK_SAMPLER_MIPMAP_MODE_NEAREST, pname:minLod = 0, and 133e5c31af7Sopenharmony_cipname:maxLod = 0.25, and using pname:minFilter = ename:VK_FILTER_LINEAR or 134e5c31af7Sopenharmony_cipname:minFilter = ename:VK_FILTER_NEAREST, respectively. 135e5c31af7Sopenharmony_ci 136e5c31af7Sopenharmony_ciNote that using a pname:maxLod of zero would cause 137e5c31af7Sopenharmony_ci<<textures-texel-filtering,magnification>> to always be performed, and the 138e5c31af7Sopenharmony_cipname:magFilter to always be used. 139e5c31af7Sopenharmony_ciThis is valid, just not an exact match for OpenGL behavior. 140e5c31af7Sopenharmony_ciClamping the maximum LOD to 0.25 allows the [eq]#{lambda}# value to be 141e5c31af7Sopenharmony_cinon-zero and minification to be performed, while still always rounding down 142e5c31af7Sopenharmony_cito the base level. 143e5c31af7Sopenharmony_ciIf the pname:minFilter and pname:magFilter are equal, then using a 144e5c31af7Sopenharmony_cipname:maxLod of zero also works. 145e5c31af7Sopenharmony_ci==== 146e5c31af7Sopenharmony_ci 147e5c31af7Sopenharmony_ciThe maximum number of sampler objects which can: be simultaneously created 148e5c31af7Sopenharmony_cion a device is implementation-dependent and specified by the 149e5c31af7Sopenharmony_ci<<limits-maxSamplerAllocationCount,maxSamplerAllocationCount>> member of the 150e5c31af7Sopenharmony_cislink:VkPhysicalDeviceLimits structure. 151e5c31af7Sopenharmony_ci 152e5c31af7Sopenharmony_ci[NOTE] 153e5c31af7Sopenharmony_ci.Note 154e5c31af7Sopenharmony_ci==== 155e5c31af7Sopenharmony_ciFor historical reasons, if pname:maxSamplerAllocationCount is exceeded, some 156e5c31af7Sopenharmony_ciimplementations may return ename:VK_ERROR_TOO_MANY_OBJECTS. 157e5c31af7Sopenharmony_ciExceeding this limit will result in undefined: behavior, and an application 158e5c31af7Sopenharmony_cishould not rely on the use of the returned error code in order to identify 159e5c31af7Sopenharmony_ciwhen the limit is reached. 160e5c31af7Sopenharmony_ci==== 161e5c31af7Sopenharmony_ci 162e5c31af7Sopenharmony_ciSince slink:VkSampler is a non-dispatchable handle type, implementations 163e5c31af7Sopenharmony_cimay: return the same handle for sampler state vectors that are identical. 164e5c31af7Sopenharmony_ciIn such cases, all such objects would only count once against the 165e5c31af7Sopenharmony_cipname:maxSamplerAllocationCount limit. 166e5c31af7Sopenharmony_ci 167e5c31af7Sopenharmony_ci.Valid Usage 168e5c31af7Sopenharmony_ci**** 169e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-mipLodBias-01069]] 170e5c31af7Sopenharmony_ci The absolute value of pname:mipLodBias must: be less than or equal to 171e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceLimits::pname:maxSamplerLodBias 172e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 173e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-samplerMipLodBias-04467]] 174e5c31af7Sopenharmony_ci If the `apiext:VK_KHR_portability_subset` extension is enabled, and 175e5c31af7Sopenharmony_ci slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:samplerMipLodBias 176e5c31af7Sopenharmony_ci is ename:VK_FALSE, pname:mipLodBias must: be zero 177e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 178e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-maxLod-01973]] 179e5c31af7Sopenharmony_ci pname:maxLod must: be greater than or equal to pname:minLod 180e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-anisotropyEnable-01070]] 181e5c31af7Sopenharmony_ci If the <<features-samplerAnisotropy,anisotropic sampling>> feature is 182e5c31af7Sopenharmony_ci not enabled, pname:anisotropyEnable must: be ename:VK_FALSE 183e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-anisotropyEnable-01071]] 184e5c31af7Sopenharmony_ci If pname:anisotropyEnable is ename:VK_TRUE, pname:maxAnisotropy must: be 185e5c31af7Sopenharmony_ci between `1.0` and 186e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceLimits::pname:maxSamplerAnisotropy, inclusive 187e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 188e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-minFilter-01645]] 189e5c31af7Sopenharmony_ci If <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>> is enabled 190e5c31af7Sopenharmony_ci and the <<potential-format-features, potential format features>> of the 191e5c31af7Sopenharmony_ci sampler {YCbCr} conversion do not support 192e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT, 193e5c31af7Sopenharmony_ci pname:minFilter and pname:magFilter must: be equal to the sampler 194e5c31af7Sopenharmony_ci {YCbCr} conversion's pname:chromaFilter 195e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 196e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01072]] 197e5c31af7Sopenharmony_ci If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:minFilter and 198e5c31af7Sopenharmony_ci pname:magFilter must: be equal 199e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01073]] 200e5c31af7Sopenharmony_ci If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:mipmapMode 201e5c31af7Sopenharmony_ci must: be ename:VK_SAMPLER_MIPMAP_MODE_NEAREST 202e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01074]] 203e5c31af7Sopenharmony_ci If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:minLod and 204e5c31af7Sopenharmony_ci pname:maxLod must: be zero 205e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01075]] 206e5c31af7Sopenharmony_ci If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:addressModeU 207e5c31af7Sopenharmony_ci and pname:addressModeV must: each be either 208e5c31af7Sopenharmony_ci ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or 209e5c31af7Sopenharmony_ci ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER 210e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01076]] 211e5c31af7Sopenharmony_ci If pname:unnormalizedCoordinates is ename:VK_TRUE, 212e5c31af7Sopenharmony_ci pname:anisotropyEnable must: be ename:VK_FALSE 213e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01077]] 214e5c31af7Sopenharmony_ci If pname:unnormalizedCoordinates is ename:VK_TRUE, pname:compareEnable 215e5c31af7Sopenharmony_ci must: be ename:VK_FALSE 216e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-addressModeU-01078]] 217e5c31af7Sopenharmony_ci If any of pname:addressModeU, pname:addressModeV or pname:addressModeW 218e5c31af7Sopenharmony_ci are ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, pname:borderColor 219e5c31af7Sopenharmony_ci must: be a valid elink:VkBorderColor value 220e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 221e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-addressModeU-01646]] 222e5c31af7Sopenharmony_ci If <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>> is enabled, 223e5c31af7Sopenharmony_ci pname:addressModeU, pname:addressModeV, and pname:addressModeW must: be 224e5c31af7Sopenharmony_ci ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, pname:anisotropyEnable 225e5c31af7Sopenharmony_ci must: be ename:VK_FALSE, and pname:unnormalizedCoordinates must: be 226e5c31af7Sopenharmony_ci ename:VK_FALSE 227e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[] 228e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-None-01647]] 229e5c31af7Sopenharmony_ci The sampler reduction mode must: be set to 230e5c31af7Sopenharmony_ci ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE if 231e5c31af7Sopenharmony_ci <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>> is enabled 232e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[] 233e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 234e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-addressModeU-01079]] 235e5c31af7Sopenharmony_ci If <<features-samplerMirrorClampToEdge,samplerMirrorClampToEdge>> is not 236e5c31af7Sopenharmony_ci enabled, and if the `apiext:VK_KHR_sampler_mirror_clamp_to_edge` 237e5c31af7Sopenharmony_ci extension is not enabled, pname:addressModeU, pname:addressModeV and 238e5c31af7Sopenharmony_ci pname:addressModeW must: not be 239e5c31af7Sopenharmony_ci ename:VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE 240e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-compareEnable-01080]] 241e5c31af7Sopenharmony_ci If pname:compareEnable is ename:VK_TRUE, pname:compareOp must: be a 242e5c31af7Sopenharmony_ci valid elink:VkCompareOp value 243e5c31af7Sopenharmony_ciifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] 244e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-magFilter-01081]] 245e5c31af7Sopenharmony_ci If either pname:magFilter or pname:minFilter is 246e5c31af7Sopenharmony_ci ename:VK_FILTER_CUBIC_EXT, pname:anisotropyEnable must: be 247e5c31af7Sopenharmony_ci ename:VK_FALSE 248e5c31af7Sopenharmony_ciendif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] 249e5c31af7Sopenharmony_ciifdef::VK_IMG_filter_cubic+VK_EXT_sampler_filter_minmax[] 250e5c31af7Sopenharmony_ciifndef::VK_EXT_filter_cubic[] 251e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-magFilter-01422]] 252e5c31af7Sopenharmony_ci If either pname:magFilter or pname:minFilter is 253e5c31af7Sopenharmony_ci ename:VK_FILTER_CUBIC_EXT, the pname:reductionMode member of 254e5c31af7Sopenharmony_ci slink:VkSamplerReductionModeCreateInfo must: be 255e5c31af7Sopenharmony_ci ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE 256e5c31af7Sopenharmony_ciendif::VK_EXT_filter_cubic[] 257e5c31af7Sopenharmony_ciendif::VK_IMG_filter_cubic+VK_EXT_sampler_filter_minmax[] 258e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[] 259e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-compareEnable-01423]] 260e5c31af7Sopenharmony_ci If pname:compareEnable is ename:VK_TRUE, the pname:reductionMode member 261e5c31af7Sopenharmony_ci of slink:VkSamplerReductionModeCreateInfo must: be 262e5c31af7Sopenharmony_ci ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE 263e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[] 264e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 265e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-flags-02574]] 266e5c31af7Sopenharmony_ci If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then 267e5c31af7Sopenharmony_ci pname:minFilter and pname:magFilter must: be equal 268e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-flags-02575]] 269e5c31af7Sopenharmony_ci If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then 270e5c31af7Sopenharmony_ci pname:mipmapMode must: be ename:VK_SAMPLER_MIPMAP_MODE_NEAREST 271e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-flags-02576]] 272e5c31af7Sopenharmony_ci If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then 273e5c31af7Sopenharmony_ci pname:minLod and pname:maxLod must: be zero 274e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-flags-02577]] 275e5c31af7Sopenharmony_ci If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then 276e5c31af7Sopenharmony_ci pname:addressModeU and pname:addressModeV must: each be either 277e5c31af7Sopenharmony_ci ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or 278e5c31af7Sopenharmony_ci ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER 279e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-flags-02578]] 280e5c31af7Sopenharmony_ci If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then 281e5c31af7Sopenharmony_ci pname:anisotropyEnable must: be ename:VK_FALSE 282e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-flags-02579]] 283e5c31af7Sopenharmony_ci If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then 284e5c31af7Sopenharmony_ci pname:compareEnable must: be ename:VK_FALSE 285e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-flags-02580]] 286e5c31af7Sopenharmony_ci If pname:flags includes ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, then 287e5c31af7Sopenharmony_ci pname:unnormalizedCoordinates must: be ename:VK_FALSE 288e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 289e5c31af7Sopenharmony_ciifdef::VK_EXT_custom_border_color[] 290e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-borderColor-04011]] 291e5c31af7Sopenharmony_ci If pname:borderColor is one of ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT or 292e5c31af7Sopenharmony_ci ename:VK_BORDER_COLOR_INT_CUSTOM_EXT, then a 293e5c31af7Sopenharmony_ci slink:VkSamplerCustomBorderColorCreateInfoEXT must: be included in the 294e5c31af7Sopenharmony_ci pname:pNext chain 295e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-customBorderColors-04085]] 296e5c31af7Sopenharmony_ci If the <<features-customBorderColors, pname:customBorderColors>> feature 297e5c31af7Sopenharmony_ci is not enabled, pname:borderColor must: not be 298e5c31af7Sopenharmony_ci ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT or 299e5c31af7Sopenharmony_ci ename:VK_BORDER_COLOR_INT_CUSTOM_EXT 300e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-borderColor-04442]] 301e5c31af7Sopenharmony_ci If pname:borderColor is one of ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT or 302e5c31af7Sopenharmony_ci ename:VK_BORDER_COLOR_INT_CUSTOM_EXT, and 303e5c31af7Sopenharmony_ci slink:VkSamplerCustomBorderColorCreateInfoEXT::pname:format is not 304e5c31af7Sopenharmony_ci ename:VK_FORMAT_UNDEFINED, 305e5c31af7Sopenharmony_ci slink:VkSamplerCustomBorderColorCreateInfoEXT::pname:customBorderColor 306e5c31af7Sopenharmony_ci must: be within the range of values representable in pname:format 307e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCreateInfo-None-04012]] 308e5c31af7Sopenharmony_ci The maximum number of samplers with custom border colors which can: be 309e5c31af7Sopenharmony_ci simultaneously created on a device is implementation-dependent and 310e5c31af7Sopenharmony_ci specified by the 311e5c31af7Sopenharmony_ci <<limits-maxCustomBorderColorSamplers,maxCustomBorderColorSamplers>> 312e5c31af7Sopenharmony_ci member of the slink:VkPhysicalDeviceCustomBorderColorPropertiesEXT 313e5c31af7Sopenharmony_ci structure 314e5c31af7Sopenharmony_ciendif::VK_EXT_custom_border_color[] 315e5c31af7Sopenharmony_ci**** 316e5c31af7Sopenharmony_ci 317e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSamplerCreateInfo.txt[] 318e5c31af7Sopenharmony_ci-- 319e5c31af7Sopenharmony_ci 320e5c31af7Sopenharmony_ci[open,refpage='VK_LOD_CLAMP_NONE',desc='Maximum level of detail unclamped access sentinel',type='consts'] 321e5c31af7Sopenharmony_ci-- 322e5c31af7Sopenharmony_ciename:VK_LOD_CLAMP_NONE is a special constant value used for 323e5c31af7Sopenharmony_cislink:VkSamplerCreateInfo::pname:maxLod to indicate that maximum LOD 324e5c31af7Sopenharmony_ciclamping should not be performed. 325e5c31af7Sopenharmony_ci 326e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VK_LOD_CLAMP_NONE.txt[] 327e5c31af7Sopenharmony_ci-- 328e5c31af7Sopenharmony_ci 329e5c31af7Sopenharmony_ci[open,refpage='VkSamplerCreateFlagBits',desc='Bitmask specifying additional parameters of sampler',type='enums'] 330e5c31af7Sopenharmony_ci-- 331e5c31af7Sopenharmony_ciBits which can: be set in slink:VkSamplerCreateInfo::pname:flags, specifying 332e5c31af7Sopenharmony_ciadditional parameters of a sampler, are: 333e5c31af7Sopenharmony_ci 334e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerCreateFlagBits.txt[] 335e5c31af7Sopenharmony_ci 336e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 337e5c31af7Sopenharmony_ci * [[samplers-subsamplesampler]] ename:VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT 338e5c31af7Sopenharmony_ci specifies that the sampler will read from an image created with 339e5c31af7Sopenharmony_ci pname:flags containing ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT. 340e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT 341e5c31af7Sopenharmony_ci specifies that the implementation may: use approximations when 342e5c31af7Sopenharmony_ci reconstructing a full color value for texture access from a subsampled 343e5c31af7Sopenharmony_ci image. 344e5c31af7Sopenharmony_ci 345e5c31af7Sopenharmony_ci[NOTE] 346e5c31af7Sopenharmony_ci.Note 347e5c31af7Sopenharmony_ci==== 348e5c31af7Sopenharmony_ciThe approximations used when 349e5c31af7Sopenharmony_ciename:VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT is 350e5c31af7Sopenharmony_cispecified are implementation defined. 351e5c31af7Sopenharmony_ciSome implementations may: interpolate between fragment density levels in a 352e5c31af7Sopenharmony_cisubsampled image. 353e5c31af7Sopenharmony_ciIn that case, this bit may: be used to decide whether the interpolation 354e5c31af7Sopenharmony_cifactors are calculated per fragment or at a coarser granularity. 355e5c31af7Sopenharmony_ci==== 356e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 357e5c31af7Sopenharmony_ci-- 358e5c31af7Sopenharmony_ci 359e5c31af7Sopenharmony_ci[open,refpage='VkSamplerCreateFlags',desc='Reserved for future use',type='flags'] 360e5c31af7Sopenharmony_ci-- 361e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkSamplerCreateFlags.txt[] 362e5c31af7Sopenharmony_ci 363e5c31af7Sopenharmony_citname:VkSamplerCreateFlags is a bitmask type for setting a mask of zero or 364e5c31af7Sopenharmony_cimore elink:VkSamplerCreateFlagBits. 365e5c31af7Sopenharmony_ci-- 366e5c31af7Sopenharmony_ci 367e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[] 368e5c31af7Sopenharmony_ci[open,refpage='VkSamplerReductionModeCreateInfo',desc='Structure specifying sampler reduction mode',type='structs',alias='VkSamplerReductionModeCreateInfoEXT'] 369e5c31af7Sopenharmony_ci-- 370e5c31af7Sopenharmony_ciThe sname:VkSamplerReductionModeCreateInfo structure is defined as: 371e5c31af7Sopenharmony_ci 372e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerReductionModeCreateInfo.txt[] 373e5c31af7Sopenharmony_ci 374e5c31af7Sopenharmony_ciifdef::VK_EXT_sampler_filter_minmax[] 375e5c31af7Sopenharmony_cior the equivalent 376e5c31af7Sopenharmony_ci 377e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerReductionModeCreateInfoEXT.txt[] 378e5c31af7Sopenharmony_ciendif::VK_EXT_sampler_filter_minmax[] 379e5c31af7Sopenharmony_ci 380e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 381e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 382e5c31af7Sopenharmony_ci structure. 383e5c31af7Sopenharmony_ci * pname:reductionMode is a elink:VkSamplerReductionMode value controlling 384e5c31af7Sopenharmony_ci how texture filtering combines texel values. 385e5c31af7Sopenharmony_ci 386e5c31af7Sopenharmony_ciIf the pname:pNext chain of slink:VkSamplerCreateInfo includes a 387e5c31af7Sopenharmony_cisname:VkSamplerReductionModeCreateInfo structure, then that structure 388e5c31af7Sopenharmony_ciincludes a mode controlling how texture filtering combines texel values. 389e5c31af7Sopenharmony_ci 390e5c31af7Sopenharmony_ciIf this structure is not present, pname:reductionMode is considered to be 391e5c31af7Sopenharmony_ciename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE. 392e5c31af7Sopenharmony_ci 393e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSamplerReductionModeCreateInfo.txt[] 394e5c31af7Sopenharmony_ci-- 395e5c31af7Sopenharmony_ci 396e5c31af7Sopenharmony_ci[open,refpage='VkSamplerReductionMode',desc='Specify reduction mode for texture filtering',type='enums',alias='VkSamplerReductionModeEXT'] 397e5c31af7Sopenharmony_ci-- 398e5c31af7Sopenharmony_ciReduction modes are specified by elink:VkSamplerReductionMode, which takes 399e5c31af7Sopenharmony_civalues: 400e5c31af7Sopenharmony_ci 401e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerReductionMode.txt[] 402e5c31af7Sopenharmony_ci 403e5c31af7Sopenharmony_ciifdef::VK_EXT_sampler_filter_minmax[] 404e5c31af7Sopenharmony_cior the equivalent 405e5c31af7Sopenharmony_ci 406e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerReductionModeEXT.txt[] 407e5c31af7Sopenharmony_ciendif::VK_EXT_sampler_filter_minmax[] 408e5c31af7Sopenharmony_ci 409e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE specifies that texel 410e5c31af7Sopenharmony_ci values are combined by computing a weighted average of values in the 411e5c31af7Sopenharmony_ci footprint, using weights as specified in 412e5c31af7Sopenharmony_ci <<textures-unnormalized-to-integer,the image operations chapter>>. 413e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_REDUCTION_MODE_MIN specifies that texel values are 414e5c31af7Sopenharmony_ci combined by taking the component-wise minimum of values in the footprint 415e5c31af7Sopenharmony_ci with non-zero weights. 416e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_REDUCTION_MODE_MAX specifies that texel values are 417e5c31af7Sopenharmony_ci combined by taking the component-wise maximum of values in the footprint 418e5c31af7Sopenharmony_ci with non-zero weights. 419e5c31af7Sopenharmony_ci-- 420e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_sampler_filter_minmax[] 421e5c31af7Sopenharmony_ci 422e5c31af7Sopenharmony_ci[open,refpage='VkFilter',desc='Specify filters used for texture lookups',type='enums'] 423e5c31af7Sopenharmony_ci-- 424e5c31af7Sopenharmony_ciPossible values of the slink:VkSamplerCreateInfo::pname:magFilter and 425e5c31af7Sopenharmony_cipname:minFilter parameters, specifying filters used for texture lookups, 426e5c31af7Sopenharmony_ciare: 427e5c31af7Sopenharmony_ci 428e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkFilter.txt[] 429e5c31af7Sopenharmony_ci 430e5c31af7Sopenharmony_ci * ename:VK_FILTER_NEAREST specifies nearest filtering. 431e5c31af7Sopenharmony_ci * ename:VK_FILTER_LINEAR specifies linear filtering. 432e5c31af7Sopenharmony_ciifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] 433e5c31af7Sopenharmony_ci * ename:VK_FILTER_CUBIC_EXT specifies cubic filtering. 434e5c31af7Sopenharmony_ciendif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] 435e5c31af7Sopenharmony_ci 436e5c31af7Sopenharmony_ciThese filters are described in detail in <<textures-texel-filtering, Texel 437e5c31af7Sopenharmony_ciFiltering>>. 438e5c31af7Sopenharmony_ci-- 439e5c31af7Sopenharmony_ci 440e5c31af7Sopenharmony_ci[open,refpage='VkSamplerMipmapMode',desc='Specify mipmap mode used for texture lookups',type='enums'] 441e5c31af7Sopenharmony_ci-- 442e5c31af7Sopenharmony_ciPossible values of the slink:VkSamplerCreateInfo::pname:mipmapMode, 443e5c31af7Sopenharmony_cispecifying the mipmap mode used for texture lookups, are: 444e5c31af7Sopenharmony_ci 445e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerMipmapMode.txt[] 446e5c31af7Sopenharmony_ci 447e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_MIPMAP_MODE_NEAREST specifies nearest filtering. 448e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_MIPMAP_MODE_LINEAR specifies linear filtering. 449e5c31af7Sopenharmony_ci 450e5c31af7Sopenharmony_ciThese modes are described in detail in <<textures-texel-filtering, Texel 451e5c31af7Sopenharmony_ciFiltering>>. 452e5c31af7Sopenharmony_ci-- 453e5c31af7Sopenharmony_ci 454e5c31af7Sopenharmony_ci[open,refpage='VkSamplerAddressMode',desc='Specify behavior of sampling with texture coordinates outside an image',type='enums'] 455e5c31af7Sopenharmony_ci-- 456e5c31af7Sopenharmony_ciPossible values of the slink:VkSamplerCreateInfo::ptext:addressMode* 457e5c31af7Sopenharmony_ciparameters, specifying the behavior of sampling with coordinates outside the 458e5c31af7Sopenharmony_cirange [eq]#[0,1]# for the respective [eq]#u#, [eq]#v#, or [eq]#w# coordinate 459e5c31af7Sopenharmony_cias defined in the <<textures-wrapping-operation, Wrapping Operation>> 460e5c31af7Sopenharmony_cisection, are: 461e5c31af7Sopenharmony_ci 462e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerAddressMode.txt[] 463e5c31af7Sopenharmony_ci 464e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_ADDRESS_MODE_REPEAT specifies that the repeat wrap mode 465e5c31af7Sopenharmony_ci will be used. 466e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT specifies that the 467e5c31af7Sopenharmony_ci mirrored repeat wrap mode will be used. 468e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE specifies that the clamp to 469e5c31af7Sopenharmony_ci edge wrap mode will be used. 470e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER specifies that the clamp 471e5c31af7Sopenharmony_ci to border wrap mode will be used. 472e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_sampler_mirror_clamp_to_edge[] 473e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE specifies that the 474e5c31af7Sopenharmony_ci mirror clamp to edge wrap mode will be used. 475e5c31af7Sopenharmony_ci This is only valid if 476e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[<<features-samplerMirrorClampToEdge,samplerMirrorClampToEdge>> is enabled, or if] 477e5c31af7Sopenharmony_ci the `apiext:VK_KHR_sampler_mirror_clamp_to_edge` extension is enabled. 478e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_sampler_mirror_clamp_to_edge[] 479e5c31af7Sopenharmony_ci-- 480e5c31af7Sopenharmony_ci 481e5c31af7Sopenharmony_ci[open,refpage='VkBorderColor',desc='Specify border color used for texture lookups',type='enums'] 482e5c31af7Sopenharmony_ci-- 483e5c31af7Sopenharmony_ciPossible values of slink:VkSamplerCreateInfo::pname:borderColor, specifying 484e5c31af7Sopenharmony_cithe border color used for texture lookups, are: 485e5c31af7Sopenharmony_ci 486e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkBorderColor.txt[] 487e5c31af7Sopenharmony_ci 488e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK specifies a transparent, 489e5c31af7Sopenharmony_ci floating-point format, black color. 490e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_INT_TRANSPARENT_BLACK specifies a transparent, 491e5c31af7Sopenharmony_ci integer format, black color. 492e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK specifies an opaque, 493e5c31af7Sopenharmony_ci floating-point format, black color. 494e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_INT_OPAQUE_BLACK specifies an opaque, integer 495e5c31af7Sopenharmony_ci format, black color. 496e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE specifies an opaque, 497e5c31af7Sopenharmony_ci floating-point format, white color. 498e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_INT_OPAQUE_WHITE specifies an opaque, integer 499e5c31af7Sopenharmony_ci format, white color. 500e5c31af7Sopenharmony_ciifdef::VK_EXT_custom_border_color[] 501e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT indicates that a 502e5c31af7Sopenharmony_ci slink:VkSamplerCustomBorderColorCreateInfoEXT structure is included in 503e5c31af7Sopenharmony_ci the slink:VkSamplerCreateInfo::pname:pNext chain containing the color 504e5c31af7Sopenharmony_ci data in floating-point format. 505e5c31af7Sopenharmony_ci * ename:VK_BORDER_COLOR_INT_CUSTOM_EXT indicates that a 506e5c31af7Sopenharmony_ci slink:VkSamplerCustomBorderColorCreateInfoEXT structure is included in 507e5c31af7Sopenharmony_ci the slink:VkSamplerCreateInfo::pname:pNext chain containing the color 508e5c31af7Sopenharmony_ci data in integer format. 509e5c31af7Sopenharmony_ciendif::VK_EXT_custom_border_color[] 510e5c31af7Sopenharmony_ci 511e5c31af7Sopenharmony_ciThese colors are described in detail in <<textures-texel-replacement, Texel 512e5c31af7Sopenharmony_ciReplacement>>. 513e5c31af7Sopenharmony_ci-- 514e5c31af7Sopenharmony_ci 515e5c31af7Sopenharmony_ci[open,refpage='vkDestroySampler',desc='Destroy a sampler object',type='protos'] 516e5c31af7Sopenharmony_ci-- 517e5c31af7Sopenharmony_ciTo destroy a sampler, call: 518e5c31af7Sopenharmony_ci 519e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroySampler.txt[] 520e5c31af7Sopenharmony_ci 521e5c31af7Sopenharmony_ci * pname:device is the logical device that destroys the sampler. 522e5c31af7Sopenharmony_ci * pname:sampler is the sampler to destroy. 523e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 524e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 525e5c31af7Sopenharmony_ci 526e5c31af7Sopenharmony_ci.Valid Usage 527e5c31af7Sopenharmony_ci**** 528e5c31af7Sopenharmony_ci * [[VUID-vkDestroySampler-sampler-01082]] 529e5c31af7Sopenharmony_ci All submitted commands that refer to pname:sampler must: have completed 530e5c31af7Sopenharmony_ci execution 531e5c31af7Sopenharmony_ci * [[VUID-vkDestroySampler-sampler-01083]] 532e5c31af7Sopenharmony_ci If sname:VkAllocationCallbacks were provided when pname:sampler was 533e5c31af7Sopenharmony_ci created, a compatible set of callbacks must: be provided here 534e5c31af7Sopenharmony_ci * [[VUID-vkDestroySampler-sampler-01084]] 535e5c31af7Sopenharmony_ci If no sname:VkAllocationCallbacks were provided when pname:sampler was 536e5c31af7Sopenharmony_ci created, pname:pAllocator must: be `NULL` 537e5c31af7Sopenharmony_ci**** 538e5c31af7Sopenharmony_ci 539e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDestroySampler.txt[] 540e5c31af7Sopenharmony_ci-- 541e5c31af7Sopenharmony_ci 542e5c31af7Sopenharmony_ci 543e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 544e5c31af7Sopenharmony_ci[[samplers-YCbCr-conversion]] 545e5c31af7Sopenharmony_ci== Sampler {YCbCr} conversion 546e5c31af7Sopenharmony_ci 547e5c31af7Sopenharmony_ci[open,refpage='VkSamplerYcbcrConversionInfo',desc='Structure specifying {YCbCr} conversion to a sampler or image view',type='structs'] 548e5c31af7Sopenharmony_ci-- 549e5c31af7Sopenharmony_ciTo create a sampler with {YCbCr} conversion enabled, add a 550e5c31af7Sopenharmony_cislink:VkSamplerYcbcrConversionInfo structure to the pname:pNext chain of the 551e5c31af7Sopenharmony_cislink:VkSamplerCreateInfo structure. 552e5c31af7Sopenharmony_ciTo create a sampler {YCbCr} conversion, the 553e5c31af7Sopenharmony_ci<<features-samplerYcbcrConversion,pname:samplerYcbcrConversion feature>> 554e5c31af7Sopenharmony_cimust: be enabled. 555e5c31af7Sopenharmony_ciConversion must: be fixed at pipeline creation time, through use of a 556e5c31af7Sopenharmony_cicombined image sampler with an immutable sampler in 557e5c31af7Sopenharmony_cisname:VkDescriptorSetLayoutBinding. 558e5c31af7Sopenharmony_ci 559e5c31af7Sopenharmony_ciA slink:VkSamplerYcbcrConversionInfo must: be provided for samplers to be 560e5c31af7Sopenharmony_ciused with image views that access ename:VK_IMAGE_ASPECT_COLOR_BIT if the 561e5c31af7Sopenharmony_ciformat is one of the <<formats-requiring-sampler-ycbcr-conversion, formats 562e5c31af7Sopenharmony_cithat require a sampler Y'C~B~C~R~ conversion>> 563e5c31af7Sopenharmony_ciifdef::VK_ANDROID_external_memory_android_hardware_buffer[] 564e5c31af7Sopenharmony_ci, or if the image view has an 565e5c31af7Sopenharmony_ci<<memory-external-android-hardware-buffer-external-formats,external format>> 566e5c31af7Sopenharmony_ciendif::VK_ANDROID_external_memory_android_hardware_buffer[] 567e5c31af7Sopenharmony_ci. 568e5c31af7Sopenharmony_ci 569e5c31af7Sopenharmony_ciThe sname:VkSamplerYcbcrConversionInfo structure is defined as: 570e5c31af7Sopenharmony_ci 571e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerYcbcrConversionInfo.txt[] 572e5c31af7Sopenharmony_ci 573e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 574e5c31af7Sopenharmony_cior the equivalent 575e5c31af7Sopenharmony_ci 576e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerYcbcrConversionInfoKHR.txt[] 577e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 578e5c31af7Sopenharmony_ci 579e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 580e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 581e5c31af7Sopenharmony_ci structure. 582e5c31af7Sopenharmony_ci * pname:conversion is a slink:VkSamplerYcbcrConversion handle created with 583e5c31af7Sopenharmony_ci flink:vkCreateSamplerYcbcrConversion. 584e5c31af7Sopenharmony_ci 585e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSamplerYcbcrConversionInfo.txt[] 586e5c31af7Sopenharmony_ci-- 587e5c31af7Sopenharmony_ci 588e5c31af7Sopenharmony_ci[open,refpage='VkSamplerYcbcrConversion',desc='Opaque handle to a device-specific sampler {YCbCr} conversion description',type='handles'] 589e5c31af7Sopenharmony_ci-- 590e5c31af7Sopenharmony_ciA sampler {YCbCr} conversion is an opaque representation of a 591e5c31af7Sopenharmony_cidevice-specific sampler {YCbCr} conversion description, represented as a 592e5c31af7Sopenharmony_cisname:VkSamplerYcbcrConversion handle: 593e5c31af7Sopenharmony_ci 594e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkSamplerYcbcrConversion.txt[] 595e5c31af7Sopenharmony_ci 596e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 597e5c31af7Sopenharmony_cior the equivalent 598e5c31af7Sopenharmony_ci 599e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkSamplerYcbcrConversionKHR.txt[] 600e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 601e5c31af7Sopenharmony_ci-- 602e5c31af7Sopenharmony_ci 603e5c31af7Sopenharmony_ci[open,refpage='vkCreateSamplerYcbcrConversion',desc='Create a new {YCbCr} conversion',type='protos'] 604e5c31af7Sopenharmony_ci-- 605e5c31af7Sopenharmony_ciTo create a slink:VkSamplerYcbcrConversion, call: 606e5c31af7Sopenharmony_ci 607e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 608e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateSamplerYcbcrConversion.txt[] 609e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 610e5c31af7Sopenharmony_ci 611e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1+VK_KHR_sampler_ycbcr_conversion[or the equivalent command] 612e5c31af7Sopenharmony_ci 613e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 614e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateSamplerYcbcrConversionKHR.txt[] 615e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 616e5c31af7Sopenharmony_ci 617e5c31af7Sopenharmony_ci * pname:device is the logical device that creates the sampler {YCbCr} 618e5c31af7Sopenharmony_ci conversion. 619e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a 620e5c31af7Sopenharmony_ci slink:VkSamplerYcbcrConversionCreateInfo structure specifying the 621e5c31af7Sopenharmony_ci requested sampler {YCbCr} conversion. 622e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 623e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 624e5c31af7Sopenharmony_ci * pname:pYcbcrConversion is a pointer to a slink:VkSamplerYcbcrConversion 625e5c31af7Sopenharmony_ci handle in which the resulting sampler {YCbCr} conversion is returned. 626e5c31af7Sopenharmony_ci 627e5c31af7Sopenharmony_ciThe interpretation of the configured sampler {YCbCr} conversion is described 628e5c31af7Sopenharmony_ciin more detail in <<textures-sampler-YCbCr-conversion,the description of 629e5c31af7Sopenharmony_cisampler {YCbCr} conversion>> in the <<textures,Image Operations>> chapter. 630e5c31af7Sopenharmony_ci 631e5c31af7Sopenharmony_ci.Valid Usage 632e5c31af7Sopenharmony_ci**** 633e5c31af7Sopenharmony_ci * [[VUID-vkCreateSamplerYcbcrConversion-None-01648]] 634e5c31af7Sopenharmony_ci The <<features-samplerYcbcrConversion, sampler {YCbCr} conversion 635e5c31af7Sopenharmony_ci feature>> must: be enabled 636e5c31af7Sopenharmony_ci**** 637e5c31af7Sopenharmony_ci 638e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateSamplerYcbcrConversion.txt[] 639e5c31af7Sopenharmony_ci-- 640e5c31af7Sopenharmony_ci 641e5c31af7Sopenharmony_ci[open,refpage='VkSamplerYcbcrConversionCreateInfo',desc='Structure specifying the parameters of the newly created conversion',type='structs'] 642e5c31af7Sopenharmony_ci-- 643e5c31af7Sopenharmony_ciThe sname:VkSamplerYcbcrConversionCreateInfo structure is defined as: 644e5c31af7Sopenharmony_ci 645e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerYcbcrConversionCreateInfo.txt[] 646e5c31af7Sopenharmony_ci 647e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 648e5c31af7Sopenharmony_cior the equivalent 649e5c31af7Sopenharmony_ci 650e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerYcbcrConversionCreateInfoKHR.txt[] 651e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 652e5c31af7Sopenharmony_ci 653e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 654e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 655e5c31af7Sopenharmony_ci structure. 656e5c31af7Sopenharmony_ci * pname:format is the format of the image from which color information 657e5c31af7Sopenharmony_ci will be retrieved. 658e5c31af7Sopenharmony_ci * pname:ycbcrModel describes the color matrix for conversion between color 659e5c31af7Sopenharmony_ci models. 660e5c31af7Sopenharmony_ci * pname:ycbcrRange describes whether the encoded values have headroom and 661e5c31af7Sopenharmony_ci foot room, or whether the encoding uses the full numerical range. 662e5c31af7Sopenharmony_ci * pname:components applies a _swizzle_ based on elink:VkComponentSwizzle 663e5c31af7Sopenharmony_ci enums prior to range expansion and color model conversion. 664e5c31af7Sopenharmony_ci * pname:xChromaOffset describes the 665e5c31af7Sopenharmony_ci <<textures-chroma-reconstruction,sample location>> associated with 666e5c31af7Sopenharmony_ci downsampled chroma components in the x dimension. 667e5c31af7Sopenharmony_ci pname:xChromaOffset has no effect for formats in which chroma components 668e5c31af7Sopenharmony_ci are not downsampled horizontally. 669e5c31af7Sopenharmony_ci * pname:yChromaOffset describes the 670e5c31af7Sopenharmony_ci <<textures-chroma-reconstruction,sample location>> associated with 671e5c31af7Sopenharmony_ci downsampled chroma components in the y dimension. 672e5c31af7Sopenharmony_ci pname:yChromaOffset has no effect for formats in which the chroma 673e5c31af7Sopenharmony_ci components are not downsampled vertically. 674e5c31af7Sopenharmony_ci * pname:chromaFilter is the filter for chroma reconstruction. 675e5c31af7Sopenharmony_ci * pname:forceExplicitReconstruction can: be used to ensure that 676e5c31af7Sopenharmony_ci reconstruction is done explicitly, if supported. 677e5c31af7Sopenharmony_ci 678e5c31af7Sopenharmony_ci[NOTE] 679e5c31af7Sopenharmony_ci.Note 680e5c31af7Sopenharmony_ci==== 681e5c31af7Sopenharmony_ciSetting pname:forceExplicitReconstruction to ename:VK_TRUE may: have a 682e5c31af7Sopenharmony_ciperformance penalty on implementations where explicit reconstruction is not 683e5c31af7Sopenharmony_cithe default mode of operation. 684e5c31af7Sopenharmony_ci 685e5c31af7Sopenharmony_ciIf pname:format supports 686e5c31af7Sopenharmony_ciename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT 687e5c31af7Sopenharmony_cithe pname:forceExplicitReconstruction value behaves as if it was set to 688e5c31af7Sopenharmony_ciename:VK_TRUE. 689e5c31af7Sopenharmony_ci==== 690e5c31af7Sopenharmony_ci 691e5c31af7Sopenharmony_ciifdef::VK_ANDROID_external_memory_android_hardware_buffer[] 692e5c31af7Sopenharmony_ciIf the pname:pNext chain includes a slink:VkExternalFormatANDROID structure 693e5c31af7Sopenharmony_ciwith non-zero pname:externalFormat member, the sampler {YCbCr} conversion 694e5c31af7Sopenharmony_ciobject represents an _external format conversion_, and pname:format must: be 695e5c31af7Sopenharmony_ciename:VK_FORMAT_UNDEFINED. 696e5c31af7Sopenharmony_ciSuch conversions must: only be used to sample image views with a matching 697e5c31af7Sopenharmony_ci<<memory-external-android-hardware-buffer-external-formats,external 698e5c31af7Sopenharmony_ciformat>>. 699e5c31af7Sopenharmony_ciWhen creating an external format conversion, the value of pname:components 700e5c31af7Sopenharmony_ciis ignored. 701e5c31af7Sopenharmony_ciendif::VK_ANDROID_external_memory_android_hardware_buffer[] 702e5c31af7Sopenharmony_ciifndef::VK_ANDROID_external_memory_android_hardware_buffer[] 703e5c31af7Sopenharmony_ciSampler {YCbCr} conversion objects do not support _external format 704e5c31af7Sopenharmony_ciconversion_ without additional extensions defining _external formats_. 705e5c31af7Sopenharmony_ciendif::VK_ANDROID_external_memory_android_hardware_buffer[] 706e5c31af7Sopenharmony_ci 707e5c31af7Sopenharmony_ci.Valid Usage 708e5c31af7Sopenharmony_ci**** 709e5c31af7Sopenharmony_ciifndef::VK_ANDROID_external_memory_android_hardware_buffer[] 710e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-format-04060]] 711e5c31af7Sopenharmony_ci pname:format must: represent unsigned normalized values (i.e. the format 712e5c31af7Sopenharmony_ci must be a etext:UNORM format) 713e5c31af7Sopenharmony_ciendif::VK_ANDROID_external_memory_android_hardware_buffer[] 714e5c31af7Sopenharmony_ciifdef::VK_ANDROID_external_memory_android_hardware_buffer[] 715e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-format-01904]] 716e5c31af7Sopenharmony_ci If an external format conversion is being created, pname:format must: be 717e5c31af7Sopenharmony_ci ename:VK_FORMAT_UNDEFINED 718e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-format-04061]] 719e5c31af7Sopenharmony_ci If an external format conversion is not being created, pname:format 720e5c31af7Sopenharmony_ci must: represent unsigned normalized values (i.e. the format must be a 721e5c31af7Sopenharmony_ci etext:UNORM format) 722e5c31af7Sopenharmony_ciendif::VK_ANDROID_external_memory_android_hardware_buffer[] 723e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-format-01650]] 724e5c31af7Sopenharmony_ci The <<potential-format-features, potential format features>> of the 725e5c31af7Sopenharmony_ci sampler {YCbCr} conversion must: support 726e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT or 727e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT 728e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-xChromaOffset-01651]] 729e5c31af7Sopenharmony_ci If the <<potential-format-features, potential format features>> of the 730e5c31af7Sopenharmony_ci sampler {YCbCr} conversion do not support 731e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT, pname:xChromaOffset 732e5c31af7Sopenharmony_ci and pname:yChromaOffset must: not be 733e5c31af7Sopenharmony_ci ename:VK_CHROMA_LOCATION_COSITED_EVEN if the corresponding components 734e5c31af7Sopenharmony_ci are <<textures-chroma-reconstruction, downsampled>> 735e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-xChromaOffset-01652]] 736e5c31af7Sopenharmony_ci If the <<potential-format-features, potential format features>> of the 737e5c31af7Sopenharmony_ci sampler {YCbCr} conversion do not support 738e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT, pname:xChromaOffset 739e5c31af7Sopenharmony_ci and pname:yChromaOffset must: not be ename:VK_CHROMA_LOCATION_MIDPOINT 740e5c31af7Sopenharmony_ci if the corresponding components are <<textures-chroma-reconstruction, 741e5c31af7Sopenharmony_ci downsampled>> 742e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02581]] 743e5c31af7Sopenharmony_ci If the format has a etext:_422 or etext:_420 suffix, then 744e5c31af7Sopenharmony_ci pname:components.g must: be the 745e5c31af7Sopenharmony_ci <<resources-image-views-identity-mappings,identity swizzle>> 746e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02582]] 747e5c31af7Sopenharmony_ci If the format has a etext:_422 or etext:_420 suffix, then 748e5c31af7Sopenharmony_ci pname:components.a must: be the 749e5c31af7Sopenharmony_ci <<resources-image-views-identity-mappings,identity swizzle>>, 750e5c31af7Sopenharmony_ci ename:VK_COMPONENT_SWIZZLE_ONE, or ename:VK_COMPONENT_SWIZZLE_ZERO 751e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02583]] 752e5c31af7Sopenharmony_ci If the format has a etext:_422 or etext:_420 suffix, then 753e5c31af7Sopenharmony_ci pname:components.r must: be the 754e5c31af7Sopenharmony_ci <<resources-image-views-identity-mappings,identity swizzle>> or 755e5c31af7Sopenharmony_ci ename:VK_COMPONENT_SWIZZLE_B 756e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02584]] 757e5c31af7Sopenharmony_ci If the format has a etext:_422 or etext:_420 suffix, then 758e5c31af7Sopenharmony_ci pname:components.b must: be the 759e5c31af7Sopenharmony_ci <<resources-image-views-identity-mappings,identity swizzle>> or 760e5c31af7Sopenharmony_ci ename:VK_COMPONENT_SWIZZLE_R 761e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-components-02585]] 762e5c31af7Sopenharmony_ci If the format has a etext:_422 or etext:_420 suffix, and if either 763e5c31af7Sopenharmony_ci pname:components.r or pname:components.b is the 764e5c31af7Sopenharmony_ci <<resources-image-views-identity-mappings,identity swizzle>>, both 765e5c31af7Sopenharmony_ci values must: be the identity swizzle 766e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-ycbcrModel-01655]] 767e5c31af7Sopenharmony_ci If pname:ycbcrModel is not 768e5c31af7Sopenharmony_ci ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY, then 769e5c31af7Sopenharmony_ci pname:components.r, pname:components.g, and pname:components.b must: 770e5c31af7Sopenharmony_ci correspond to components of the pname:format; that is, 771e5c31af7Sopenharmony_ci pname:components.r, pname:components.g, and pname:components.b must: not 772e5c31af7Sopenharmony_ci be ename:VK_COMPONENT_SWIZZLE_ZERO or ename:VK_COMPONENT_SWIZZLE_ONE, 773e5c31af7Sopenharmony_ci and must: not correspond to a component containing zero or one as a 774e5c31af7Sopenharmony_ci consequence of <<textures-conversion-to-rgba,conversion to RGBA>> 775e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-ycbcrRange-02748]] 776e5c31af7Sopenharmony_ci If pname:ycbcrRange is ename:VK_SAMPLER_YCBCR_RANGE_ITU_NARROW then the 777e5c31af7Sopenharmony_ci R, G and B components obtained by applying the pname:component swizzle 778e5c31af7Sopenharmony_ci to pname:format must: each have a bit-depth greater than or equal to 8 779e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-forceExplicitReconstruction-01656]] 780e5c31af7Sopenharmony_ci If the <<potential-format-features, potential format features>> of the 781e5c31af7Sopenharmony_ci sampler {YCbCr} conversion do not support 782e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT 783e5c31af7Sopenharmony_ci pname:forceExplicitReconstruction must: be ename:VK_FALSE 784e5c31af7Sopenharmony_ci * [[VUID-VkSamplerYcbcrConversionCreateInfo-chromaFilter-01657]] 785e5c31af7Sopenharmony_ci If the <<potential-format-features, potential format features>> of the 786e5c31af7Sopenharmony_ci sampler {YCbCr} conversion do not support 787e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT, 788e5c31af7Sopenharmony_ci pname:chromaFilter must: not be ename:VK_FILTER_LINEAR 789e5c31af7Sopenharmony_ci**** 790e5c31af7Sopenharmony_ci 791e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSamplerYcbcrConversionCreateInfo.txt[] 792e5c31af7Sopenharmony_ci 793e5c31af7Sopenharmony_ciIf pname:chromaFilter is ename:VK_FILTER_NEAREST, chroma samples are 794e5c31af7Sopenharmony_cireconstructed to luma component resolution using nearest-neighbour sampling. 795e5c31af7Sopenharmony_ciOtherwise, chroma samples are reconstructed using interpolation. 796e5c31af7Sopenharmony_ciMore details can be found in <<textures-sampler-YCbCr-conversion,the 797e5c31af7Sopenharmony_cidescription of sampler {YCbCr} conversion>> in the <<textures,Image 798e5c31af7Sopenharmony_ciOperations>> chapter. 799e5c31af7Sopenharmony_ci-- 800e5c31af7Sopenharmony_ci 801e5c31af7Sopenharmony_ci[open,refpage='VkSamplerYcbcrModelConversion',desc='Color model component of a color space',type='enums'] 802e5c31af7Sopenharmony_ci-- 803e5c31af7Sopenharmony_cielink:VkSamplerYcbcrModelConversion defines the conversion from the source 804e5c31af7Sopenharmony_cicolor model to the shader color model. 805e5c31af7Sopenharmony_ciPossible values are: 806e5c31af7Sopenharmony_ci 807e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerYcbcrModelConversion.txt[] 808e5c31af7Sopenharmony_ci 809e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 810e5c31af7Sopenharmony_cior the equivalent 811e5c31af7Sopenharmony_ci 812e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerYcbcrModelConversionKHR.txt[] 813e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 814e5c31af7Sopenharmony_ci 815e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY specifies that the 816e5c31af7Sopenharmony_ci input values to the conversion are unmodified. 817e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY specifies no 818e5c31af7Sopenharmony_ci model conversion but the inputs are range expanded as for {YCbCr}. 819e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 specifies the color 820e5c31af7Sopenharmony_ci model conversion from {YCbCr} to {RGBprime} defined in BT.709 and 821e5c31af7Sopenharmony_ci described in the "`BT.709 {YCbCr} conversion`" section of the 822e5c31af7Sopenharmony_ci <<data-format,Khronos Data Format Specification>>. 823e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 specifies the color 824e5c31af7Sopenharmony_ci model conversion from {YCbCr} to {RGBprime} defined in BT.601 and 825e5c31af7Sopenharmony_ci described in the "`BT.601 {YCbCr} conversion`" section of the 826e5c31af7Sopenharmony_ci <<data-format,Khronos Data Format Specification>>. 827e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 specifies the color 828e5c31af7Sopenharmony_ci model conversion from {YCbCr} to {RGBprime} defined in BT.2020 and 829e5c31af7Sopenharmony_ci described in the "`BT.2020 {YCbCr} conversion`" section of the 830e5c31af7Sopenharmony_ci <<data-format,Khronos Data Format Specification>>. 831e5c31af7Sopenharmony_ci 832e5c31af7Sopenharmony_ciIn the etext:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_* color models, for the 833e5c31af7Sopenharmony_ciinput to the sampler {YCbCr} range expansion and model conversion: 834e5c31af7Sopenharmony_ci 835e5c31af7Sopenharmony_ci * the Y (Y{prime} luma) component corresponds to the G component of an RGB 836e5c31af7Sopenharmony_ci image. 837e5c31af7Sopenharmony_ci * the CB (C~B~ or "`U`" blue color difference) component corresponds to 838e5c31af7Sopenharmony_ci the B component of an RGB image. 839e5c31af7Sopenharmony_ci * the CR (C~R~ or "`V`" red color difference) component corresponds to the 840e5c31af7Sopenharmony_ci R component of an RGB image. 841e5c31af7Sopenharmony_ci * the alpha component, if present, is not modified by color model 842e5c31af7Sopenharmony_ci conversion. 843e5c31af7Sopenharmony_ci 844e5c31af7Sopenharmony_ciThese rules reflect the mapping of components after the component swizzle 845e5c31af7Sopenharmony_cioperation (controlled by 846e5c31af7Sopenharmony_cislink:VkSamplerYcbcrConversionCreateInfo::pname:components). 847e5c31af7Sopenharmony_ci 848e5c31af7Sopenharmony_ci[NOTE] 849e5c31af7Sopenharmony_ci.Note 850e5c31af7Sopenharmony_ci==== 851e5c31af7Sopenharmony_ciFor example, an "`YUVA`" 32-bit format comprising four 8-bit components can 852e5c31af7Sopenharmony_cibe implemented as ename:VK_FORMAT_R8G8B8A8_UNORM with a component mapping: 853e5c31af7Sopenharmony_ci 854e5c31af7Sopenharmony_ci * pname:components.a = ename:VK_COMPONENT_SWIZZLE_IDENTITY 855e5c31af7Sopenharmony_ci * pname:components.r = ename:VK_COMPONENT_SWIZZLE_B 856e5c31af7Sopenharmony_ci * pname:components.g = ename:VK_COMPONENT_SWIZZLE_R 857e5c31af7Sopenharmony_ci * pname:components.b = ename:VK_COMPONENT_SWIZZLE_G 858e5c31af7Sopenharmony_ci==== 859e5c31af7Sopenharmony_ci-- 860e5c31af7Sopenharmony_ci 861e5c31af7Sopenharmony_ci[open,refpage='VkSamplerYcbcrRange',desc='Range of encoded values in a color space',type='enums'] 862e5c31af7Sopenharmony_ci-- 863e5c31af7Sopenharmony_ciThe elink:VkSamplerYcbcrRange enum describes whether color components are 864e5c31af7Sopenharmony_ciencoded using the full range of numerical values or whether values are 865e5c31af7Sopenharmony_cireserved for headroom and foot room. 866e5c31af7Sopenharmony_cielink:VkSamplerYcbcrRange is defined as: 867e5c31af7Sopenharmony_ci 868e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerYcbcrRange.txt[] 869e5c31af7Sopenharmony_ci 870e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 871e5c31af7Sopenharmony_cior the equivalent 872e5c31af7Sopenharmony_ci 873e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSamplerYcbcrRangeKHR.txt[] 874e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 875e5c31af7Sopenharmony_ci 876e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_YCBCR_RANGE_ITU_FULL specifies that the full range of 877e5c31af7Sopenharmony_ci the encoded values are valid and interpreted according to the ITU "`full 878e5c31af7Sopenharmony_ci range`" quantization rules. 879e5c31af7Sopenharmony_ci * ename:VK_SAMPLER_YCBCR_RANGE_ITU_NARROW specifies that headroom and foot 880e5c31af7Sopenharmony_ci room are reserved in the numerical range of encoded values, and the 881e5c31af7Sopenharmony_ci remaining values are expanded according to the ITU "`narrow range`" 882e5c31af7Sopenharmony_ci quantization rules. 883e5c31af7Sopenharmony_ci 884e5c31af7Sopenharmony_ciThe formulae for these conversions is described in the 885e5c31af7Sopenharmony_ci<<textures-sampler-YCbCr-conversion-rangeexpand,Sampler {YCbCr} Range 886e5c31af7Sopenharmony_ciExpansion>> section of the <<textures,Image Operations>> chapter. 887e5c31af7Sopenharmony_ci 888e5c31af7Sopenharmony_ciNo range modification takes place if pname:ycbcrModel is 889e5c31af7Sopenharmony_ciename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY; the pname:ycbcrRange 890e5c31af7Sopenharmony_cifield of slink:VkSamplerYcbcrConversionCreateInfo is ignored in this case. 891e5c31af7Sopenharmony_ci-- 892e5c31af7Sopenharmony_ci 893e5c31af7Sopenharmony_ci[open,refpage='VkChromaLocation',desc='Position of downsampled chroma samples',type='enums'] 894e5c31af7Sopenharmony_ci-- 895e5c31af7Sopenharmony_ciThe elink:VkChromaLocation enum defines the location of downsampled chroma 896e5c31af7Sopenharmony_cicomponent samples relative to the luma samples, and is defined as: 897e5c31af7Sopenharmony_ci 898e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkChromaLocation.txt[] 899e5c31af7Sopenharmony_ci 900e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 901e5c31af7Sopenharmony_cior the equivalent 902e5c31af7Sopenharmony_ci 903e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkChromaLocationKHR.txt[] 904e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 905e5c31af7Sopenharmony_ci 906e5c31af7Sopenharmony_ci * ename:VK_CHROMA_LOCATION_COSITED_EVEN specifies that downsampled chroma 907e5c31af7Sopenharmony_ci samples are aligned with luma samples with even coordinates. 908e5c31af7Sopenharmony_ci * ename:VK_CHROMA_LOCATION_MIDPOINT specifies that downsampled chroma 909e5c31af7Sopenharmony_ci samples are located half way between each even luma sample and the 910e5c31af7Sopenharmony_ci nearest higher odd luma sample. 911e5c31af7Sopenharmony_ci-- 912e5c31af7Sopenharmony_ci 913e5c31af7Sopenharmony_ci[open,refpage='vkDestroySamplerYcbcrConversion',desc='Destroy a created {YCbCr} conversion',type='protos'] 914e5c31af7Sopenharmony_ci-- 915e5c31af7Sopenharmony_ciTo destroy a sampler {YCbCr} conversion, call: 916e5c31af7Sopenharmony_ci 917e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 918e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroySamplerYcbcrConversion.txt[] 919e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 920e5c31af7Sopenharmony_ci 921e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1+VK_KHR_sampler_ycbcr_conversion[or the equivalent command] 922e5c31af7Sopenharmony_ci 923e5c31af7Sopenharmony_ciifdef::VK_KHR_sampler_ycbcr_conversion[] 924e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroySamplerYcbcrConversionKHR.txt[] 925e5c31af7Sopenharmony_ciendif::VK_KHR_sampler_ycbcr_conversion[] 926e5c31af7Sopenharmony_ci 927e5c31af7Sopenharmony_ci * pname:device is the logical device that destroys the {YCbCr} conversion. 928e5c31af7Sopenharmony_ci * pname:ycbcrConversion is the conversion to destroy. 929e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 930e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 931e5c31af7Sopenharmony_ci 932e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDestroySamplerYcbcrConversion.txt[] 933e5c31af7Sopenharmony_ci-- 934e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 935e5c31af7Sopenharmony_ci 936e5c31af7Sopenharmony_ciifdef::VK_EXT_custom_border_color[] 937e5c31af7Sopenharmony_ci[open,refpage='VkSamplerCustomBorderColorCreateInfoEXT',desc='Structure specifying custom border color',type='structs'] 938e5c31af7Sopenharmony_ci-- 939e5c31af7Sopenharmony_ciIn addition to the predefined border color values, applications can: provide 940e5c31af7Sopenharmony_cia custom border color value by including the 941e5c31af7Sopenharmony_cisname:VkSamplerCustomBorderColorCreateInfoEXT structure in the 942e5c31af7Sopenharmony_cislink:VkSamplerCreateInfo::pname:pNext chain. 943e5c31af7Sopenharmony_ci 944e5c31af7Sopenharmony_ciThe sname:VkSamplerCustomBorderColorCreateInfoEXT structure is defined as: 945e5c31af7Sopenharmony_ci 946e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerCustomBorderColorCreateInfoEXT.txt[] 947e5c31af7Sopenharmony_ci 948e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 949e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 950e5c31af7Sopenharmony_ci structure. 951e5c31af7Sopenharmony_ci * pname:customBorderColor is a slink:VkClearColorValue representing the 952e5c31af7Sopenharmony_ci desired custom sampler border color. 953e5c31af7Sopenharmony_ci * pname:format is a elink:VkFormat representing the format of the sampled 954e5c31af7Sopenharmony_ci image view(s). 955e5c31af7Sopenharmony_ci This field may be ename:VK_FORMAT_UNDEFINED if the 956e5c31af7Sopenharmony_ci <<features-customBorderColorWithoutFormat,customBorderColorWithoutFormat>> 957e5c31af7Sopenharmony_ci feature is enabled. 958e5c31af7Sopenharmony_ci 959e5c31af7Sopenharmony_ci.Valid Usage 960e5c31af7Sopenharmony_ci**** 961e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04013]] 962e5c31af7Sopenharmony_ci If provided pname:format is not ename:VK_FORMAT_UNDEFINED then the 963e5c31af7Sopenharmony_ci slink:VkSamplerCreateInfo::pname:borderColor type must: match the 964e5c31af7Sopenharmony_ci sampled type of the provided pname:format, as shown in the _SPIR-V 965e5c31af7Sopenharmony_ci Sampled Type_ column of the <<formats-numericformat>> table 966e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04014]] 967e5c31af7Sopenharmony_ci If the 968e5c31af7Sopenharmony_ci <<features-customBorderColorWithoutFormat,customBorderColorWithoutFormat>> 969e5c31af7Sopenharmony_ci feature is not enabled then pname:format must: not be 970e5c31af7Sopenharmony_ci ename:VK_FORMAT_UNDEFINED 971e5c31af7Sopenharmony_ci * [[VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04015]] 972e5c31af7Sopenharmony_ci If the sampler is used to sample an image view of 973e5c31af7Sopenharmony_ci ename:VK_FORMAT_B4G4R4A4_UNORM_PACK16, 974e5c31af7Sopenharmony_ci ename:VK_FORMAT_B5G6R5_UNORM_PACK16, or 975e5c31af7Sopenharmony_ci ename:VK_FORMAT_B5G5R5A1_UNORM_PACK16 format then pname:format must: not 976e5c31af7Sopenharmony_ci be ename:VK_FORMAT_UNDEFINED 977e5c31af7Sopenharmony_ci**** 978e5c31af7Sopenharmony_ci 979e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSamplerCustomBorderColorCreateInfoEXT.txt[] 980e5c31af7Sopenharmony_ci-- 981e5c31af7Sopenharmony_ciendif::VK_EXT_custom_border_color[] 982e5c31af7Sopenharmony_ci 983e5c31af7Sopenharmony_ciifdef::VK_EXT_border_color_swizzle[] 984e5c31af7Sopenharmony_ci[open,refpage='VkSamplerBorderColorComponentMappingCreateInfoEXT',desc='Structure specifying the component mapping of the border color',type='structs'] 985e5c31af7Sopenharmony_ci-- 986e5c31af7Sopenharmony_ci 987e5c31af7Sopenharmony_ciIf the sampler is created with ename:VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK, 988e5c31af7Sopenharmony_ciename:VK_BORDER_COLOR_INT_OPAQUE_BLACK, 989e5c31af7Sopenharmony_ciename:VK_BORDER_COLOR_FLOAT_CUSTOM_EXT, or 990e5c31af7Sopenharmony_ciename:VK_BORDER_COLOR_INT_CUSTOM_EXT pname:borderColor, and that sampler 991e5c31af7Sopenharmony_ciwill be combined with an image view that does not have an 992e5c31af7Sopenharmony_ci<<resources-image-views-identity-mappings,identity swizzle>>, and 993e5c31af7Sopenharmony_cislink:VkPhysicalDeviceBorderColorSwizzleFeaturesEXT::pname:borderColorSwizzleFromImage 994e5c31af7Sopenharmony_ciis not enabled, then it is necessary to specify the component mapping of the 995e5c31af7Sopenharmony_ciborder color, by including the 996e5c31af7Sopenharmony_cisname:VkSamplerBorderColorComponentMappingCreateInfoEXT structure in the 997e5c31af7Sopenharmony_cislink:VkSamplerCreateInfo::pname:pNext chain, to get defined results. 998e5c31af7Sopenharmony_ci 999e5c31af7Sopenharmony_ciThe sname:VkSamplerBorderColorComponentMappingCreateInfoEXT structure is 1000e5c31af7Sopenharmony_cidefined as: 1001e5c31af7Sopenharmony_ci 1002e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSamplerBorderColorComponentMappingCreateInfoEXT.txt[] 1003e5c31af7Sopenharmony_ci 1004e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 1005e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1006e5c31af7Sopenharmony_ci structure. 1007e5c31af7Sopenharmony_ci * pname:components is a slink:VkComponentMapping structure specifying a 1008e5c31af7Sopenharmony_ci remapping of the border color components. 1009e5c31af7Sopenharmony_ci * pname:srgb indicates that the sampler will be combined with an image 1010e5c31af7Sopenharmony_ci view that has an image format which is sRGB encoded. 1011e5c31af7Sopenharmony_ci 1012e5c31af7Sopenharmony_ciThe slink:VkComponentMapping pname:components member describes a remapping 1013e5c31af7Sopenharmony_cifrom components of the border color to components of the vector returned by 1014e5c31af7Sopenharmony_cishader image instructions when the border color is used. 1015e5c31af7Sopenharmony_ci 1016e5c31af7Sopenharmony_ci.Valid Usage 1017e5c31af7Sopenharmony_ci**** 1018e5c31af7Sopenharmony_ci * [[VUID-VkSamplerBorderColorComponentMappingCreateInfoEXT-borderColorSwizzle-06437]] 1019e5c31af7Sopenharmony_ci The <<features-borderColorSwizzle, pname:borderColorSwizzle>> feature 1020e5c31af7Sopenharmony_ci must: be enabled. 1021e5c31af7Sopenharmony_ci**** 1022e5c31af7Sopenharmony_ci 1023e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSamplerBorderColorComponentMappingCreateInfoEXT.txt[] 1024e5c31af7Sopenharmony_ci-- 1025e5c31af7Sopenharmony_ciendif::VK_EXT_border_color_swizzle[] 1026