C Specification
The VkSamplerCreateInfo structure is defined as:
// Provided by VK_VERSION_1_0
typedef struct VkSamplerCreateInfo {
VkStructureType sType;
const void* pNext;
VkSamplerCreateFlags flags;
VkFilter magFilter;
VkFilter minFilter;
VkSamplerMipmapMode mipmapMode;
VkSamplerAddressMode addressModeU;
VkSamplerAddressMode addressModeV;
VkSamplerAddressMode addressModeW;
float mipLodBias;
VkBool32 anisotropyEnable;
float maxAnisotropy;
VkBool32 compareEnable;
VkCompareOp compareOp;
float minLod;
float maxLod;
VkBorderColor borderColor;
VkBool32 unnormalizedCoordinates;
} VkSamplerCreateInfo;
Members
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
flagsis a bitmask of VkSamplerCreateFlagBits describing additional parameters of the sampler. -
magFilteris a VkFilter value specifying the magnification filter to apply to lookups. -
minFilteris a VkFilter value specifying the minification filter to apply to lookups. -
mipmapModeis a VkSamplerMipmapMode value specifying the mipmap filter to apply to lookups. -
addressModeUis a VkSamplerAddressMode value specifying the wrapping operation used when the i coordinate used to sample the image would be out of bounds. -
addressModeVis a VkSamplerAddressMode value specifying the wrapping operation used when the j coordinate used to sample the image would be out of bounds. -
addressModeWis a VkSamplerAddressMode value specifying the wrapping operation used when the k coordinate used to sample the image would be out of bounds. IfunnormalizedCoordinatesis VK_TRUE,addressModeWis ignored. -
mipLodBiasis the bias to be added to mipmap LOD calculation and bias provided by image sampling functions in SPIR-V, as described in the LOD Operation section. -
anisotropyEnableis VK_TRUE to enable anisotropic filtering, as described in the Texel Anisotropic Filtering section, or VK_FALSE otherwise. -
maxAnisotropyis the anisotropy value clamp used by the sampler whenanisotropyEnableis VK_TRUE. IfanisotropyEnableis VK_FALSE,maxAnisotropyis ignored. -
compareEnableis VK_TRUE to enable comparison against a reference value during lookups, or VK_FALSE otherwise.-
Note: Some implementations will default to shader state if this member does not match.
-
-
compareOpis a VkCompareOp value specifying the comparison operator to apply to fetched data before filtering as described in the Depth Compare Operation section. -
minLodis used to clamp the minimum of the computed LOD value. -
maxLodis used to clamp the maximum of the computed LOD value. To avoid clamping the maximum value, setmaxLodto the constant VK_LOD_CLAMP_NONE. -
borderColoris a VkBorderColor value specifying the predefined border color to use. -
unnormalizedCoordinatescontrols whether to use unnormalized or normalized texel coordinates to address texels of the image. WhenunnormalizedCoordinatesis 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. WhenunnormalizedCoordinatesis VK_FALSE, the range of image coordinates is zero to one.When
unnormalizedCoordinatesis VK_TRUE, images the sampler is used with in the shader have the following requirements:-
The
viewTypemust be either VK_IMAGE_VIEW_TYPE_1D or VK_IMAGE_VIEW_TYPE_2D. -
The image view must have a single layer and a single mip level.
When
unnormalizedCoordinatesis 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.
-
Description
|
Note
|
Mapping of OpenGL to Vulkan Filter Modes
There are no Vulkan filter modes that directly correspond to OpenGL
minification filters of Note that using a |
The maximum number of sampler objects which can be simultaneously created
on a device is implementation-dependent and specified by the
maxSamplerAllocationCount member
of the VkPhysicalDeviceLimits structure.
|
Note
|
For historical reasons, if |
Since 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
maxSamplerAllocationCount limit.
When this structure is used to write a descriptor via
vkWriteSamplerDescriptorsEXT, applications can give the descriptor a
debug name in a similar way to naming an object, via the
VkDebugUtilsObjectNameInfoEXT structure.
However, as there is no actual object, VkDebugUtilsObjectNameInfoEXT
must be passed via the pNext chain of this structure, with a
objectType of VK_OBJECT_TYPE_UNKNOWN and a objectHandle of
VK_NULL_HANDLE.
The name is attached to the unique set of descriptor bits written by the
implementation, and writing the same bits again with new debug info may
rename the original descriptor.
|
Note
|
Implementations are not prevented from returning the same bits for different descriptors. This can result in multiple different samplers mapping to the same name. |
VkDescriptorSetAndBindingMappingEXT can also be chained in the same way when defining an embedded sampler via VkDescriptorSetAndBindingMappingEXT, naming the embedded sampler.
See Also
VK_VERSION_1_0, VkBool32, VkBorderColor, VkCompareOp, VkDescriptorMappingSourceConstantOffsetEXT, VkDescriptorMappingSourceIndirectIndexArrayEXT, VkDescriptorMappingSourceIndirectIndexEXT, VkDescriptorMappingSourcePushIndexEXT, VkDescriptorMappingSourceShaderRecordIndexEXT, VkFilter, VkSamplerAddressMode, VkSamplerCreateFlags, VkSamplerMipmapMode, VkStructureType, vkCreateSampler, vkWriteSamplerDescriptorsEXT
Document Notes
For more information, see the Vulkan Specification.
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.