vulkan-2.0.0.1: Bindings to the Vulkan graphics API.

Safe HaskellNone
LanguageHaskell2010

Graphics.Vulkan.Core10.Sampler

Synopsis

Documentation

newtype VkBorderColor Source #

VkBorderColor - Specify border color used for texture lookups

Description

  • VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK specifies a transparent, floating-point format, black color.
  • VK_BORDER_COLOR_INT_TRANSPARENT_BLACK specifies a transparent, integer format, black color.
  • VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK specifies an opaque, floating-point format, black color.
  • VK_BORDER_COLOR_INT_OPAQUE_BLACK specifies an opaque, integer format, black color.
  • VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE specifies an opaque, floating-point format, white color.
  • VK_BORDER_COLOR_INT_OPAQUE_WHITE specifies an opaque, integer format, white color.

These colors are described in detail in Texel Replacement.

See Also

VkSamplerCreateInfo

Constructors

VkBorderColor Int32 

newtype VkSamplerAddressMode Source #

VkSamplerAddressMode - Specify behavior of sampling with texture coordinates outside an image

See Also

VkSamplerCreateInfo

Instances
Eq VkSamplerAddressMode Source # 
Instance details
Ord VkSamplerAddressMode Source # 
Instance details
Read VkSamplerAddressMode Source # 
Instance details
Show VkSamplerAddressMode Source # 
Instance details
Storable VkSamplerAddressMode Source # 
Instance details

pattern VK_SAMPLER_ADDRESS_MODE_REPEAT :: VkSamplerAddressMode Source #

VK_SAMPLER_ADDRESS_MODE_REPEAT specifies that the repeat wrap mode will be used.

pattern VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT :: VkSamplerAddressMode Source #

VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT specifies that the mirrored repeat wrap mode will be used.

pattern VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE :: VkSamplerAddressMode Source #

VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE specifies that the clamp to edge wrap mode will be used.

pattern VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER :: VkSamplerAddressMode Source #

VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER specifies that the clamp to border wrap mode will be used.

newtype VkFilter Source #

VkFilter - Specify filters used for texture lookups

Description

  • VK_FILTER_NEAREST specifies nearest filtering.
  • VK_FILTER_LINEAR specifies linear filtering.
  • VK_FILTER_CUBIC_IMG specifies cubic filtering.

These filters are described in detail in Texel Filtering.

See Also

VkSamplerCreateInfo, VkSamplerYcbcrConversionCreateInfo, vkCmdBlitImage

Constructors

VkFilter Int32 

newtype VkSamplerMipmapMode Source #

VkSamplerMipmapMode - Specify mipmap mode used for texture lookups

Description

  • VK_SAMPLER_MIPMAP_MODE_NEAREST specifies nearest filtering.
  • VK_SAMPLER_MIPMAP_MODE_LINEAR specifies linear filtering.

These modes are described in detail in Texel Filtering.

See Also

VkSamplerCreateInfo

Instances
Eq VkSamplerMipmapMode Source # 
Instance details
Ord VkSamplerMipmapMode Source # 
Instance details
Read VkSamplerMipmapMode Source # 
Instance details
Show VkSamplerMipmapMode Source # 
Instance details
Storable VkSamplerMipmapMode Source # 
Instance details

newtype VkSamplerCreateFlags Source #

VkSamplerCreateFlags - Reserved for future use

Description

VkSamplerCreateFlags is a bitmask type for setting a mask, but is currently reserved for future use.

See Also

VkSamplerCreateInfo

Instances
Eq VkSamplerCreateFlags Source # 
Instance details
Ord VkSamplerCreateFlags Source # 
Instance details
Read VkSamplerCreateFlags Source # 
Instance details
Show VkSamplerCreateFlags Source # 
Instance details
Storable VkSamplerCreateFlags Source # 
Instance details
Bits VkSamplerCreateFlags Source # 
Instance details
FiniteBits VkSamplerCreateFlags Source # 
Instance details

type VkSampler = Ptr VkSampler_T Source #

VkSampler - Opaque handle to a sampler object

See Also

VkDescriptorImageInfo, VkDescriptorSetLayoutBinding, vkCreateSampler, vkDestroySampler

vkCreateSampler :: ("device" ::: VkDevice) -> ("pCreateInfo" ::: Ptr VkSamplerCreateInfo) -> ("pAllocator" ::: Ptr VkAllocationCallbacks) -> ("pSampler" ::: Ptr VkSampler) -> IO VkResult Source #

vkCreateSampler - Create a new sampler object

Parameters

  • device is the logical device that creates the sampler.
  • pCreateInfo is a pointer to an instance of the VkSamplerCreateInfo structure specifying the state of the sampler object.
  • pAllocator controls host memory allocation as described in the Memory Allocation chapter.
  • pSampler points to a VkSampler handle in which the resulting sampler object is returned.

Valid Usage (Implicit)

  • device must be a valid VkDevice handle
  • pCreateInfo must be a valid pointer to a valid VkSamplerCreateInfo structure
  • If pAllocator is not NULL, pAllocator must be a valid pointer to a valid VkAllocationCallbacks structure
  • pSampler must be a valid pointer to a VkSampler handle

Return Codes

[Success] - VK_SUCCESS

[Failure] - VK_ERROR_OUT_OF_HOST_MEMORY

  • VK_ERROR_OUT_OF_DEVICE_MEMORY
  • VK_ERROR_TOO_MANY_OBJECTS

See Also

VkAllocationCallbacks, VkDevice, VkSampler, VkSamplerCreateInfo

vkDestroySampler :: ("device" ::: VkDevice) -> ("sampler" ::: VkSampler) -> ("pAllocator" ::: Ptr VkAllocationCallbacks) -> IO () Source #

vkDestroySampler - Destroy a sampler object

Parameters

  • device is the logical device that destroys the sampler.
  • sampler is the sampler to destroy.
  • pAllocator controls host memory allocation as described in the Memory Allocation chapter.

Valid Usage

  • All submitted commands that refer to sampler must have completed execution
  • If VkAllocationCallbacks were provided when sampler was created, a compatible set of callbacks must be provided here
  • If no VkAllocationCallbacks were provided when sampler was created, pAllocator must be NULL

Valid Usage (Implicit)

  • device must be a valid VkDevice handle
  • If sampler is not VK_NULL_HANDLE, sampler must be a valid VkSampler handle
  • If pAllocator is not NULL, pAllocator must be a valid pointer to a valid VkAllocationCallbacks structure
  • If sampler is a valid handle, it must have been created, allocated, or retrieved from device

Host Synchronization

  • Host access to sampler must be externally synchronized

See Also

VkAllocationCallbacks, VkDevice, VkSampler

data VkSamplerCreateInfo Source #

VkSamplerCreateInfo - Structure specifying parameters of a newly created sampler

Members

  • sType is the type of this structure.
  • pNext is NULL or a pointer to an extension-specific structure.
  • flags is reserved for future use.
  • magFilter is a VkFilter value specifying the magnification filter to apply to lookups.
  • minFilter is a VkFilter value specifying the minification filter to apply to lookups.
  • mipmapMode is a VkSamplerMipmapMode value specifying the mipmap filter to apply to lookups.
  • addressModeU is a VkSamplerAddressMode value specifying the addressing mode for outside [0..1] range for U coordinate.
  • addressModeV is a VkSamplerAddressMode value specifying the addressing mode for outside [0..1] range for V coordinate.
  • addressModeW is a VkSamplerAddressMode value specifying the addressing mode for outside [0..1] range for W coordinate.
  • mipLodBias is the bias to be added to mipmap LOD (level-of-detail) calculation and bias provided by image sampling functions in SPIR-V, as described in the Level-of-Detail Operation section.
  • anisotropyEnable is VK_TRUE to enable anisotropic filtering, as described in the Texel Anisotropic Filtering section, or VK_FALSE otherwise.
  • maxAnisotropy is the anisotropy value clamp used by the sampler when anisotropyEnable is VK_TRUE. If anisotropyEnable is VK_FALSE, maxAnisotropy is ignored.
  • compareEnable is 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.
  • compareOp is a VkCompareOp value specifying the comparison function to apply to fetched data before filtering as described in the Depth Compare Operation section.
  • minLod and maxLod are the values used to clamp the computed LOD value, as described in the Level-of-Detail Operation section. maxLod must be greater than or equal to minLod.
  • borderColor is a VkBorderColor value specifying the predefined border color to use.
  • unnormalizedCoordinates controls whether to use unnormalized or normalized texel coordinates to address texels of the image. When set to VK_TRUE, the range of the image coordinates used to lookup the texel is in the range of zero to the image dimensions for x, y and z. When set to VK_FALSE the range of image coordinates is zero to one. When unnormalizedCoordinates is VK_TRUE, samplers have the following requirements:

    • minFilter and magFilter must be equal.
    • mipmapMode must be VK_SAMPLER_MIPMAP_MODE_NEAREST.
    • minLod and maxLod must be zero.
    • addressModeU and addressModeV must each be either VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER.
    • anisotropyEnable must be VK_FALSE.
    • compareEnable must be VK_FALSE.
    • The sampler must not enable sampler Y’CBCR conversion.
  • When unnormalizedCoordinates is VK_TRUE, images the sampler is used with in the shader have the following requirements:

    • The viewType must 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 unnormalizedCoordinates is 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

magFilter values of VK_FILTER_NEAREST and VK_FILTER_LINEAR directly correspond to GL_NEAREST and GL_LINEAR magnification filters. minFilter and mipmapMode combine to correspond to the similarly named OpenGL minification filter of GL_minFilter_MIPMAP_mipmapMode (e.g. minFilter of VK_FILTER_LINEAR and mipmapMode of VK_SAMPLER_MIPMAP_MODE_NEAREST correspond to GL_LINEAR_MIPMAP_NEAREST).

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

Note that using a maxLod of zero would cause magnification to always be performed, and the 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 λ value to be non-zero and minification to be performed, while still always rounding down to the base level. If the minFilter and magFilter are equal, then using a 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 maxSamplerAllocationCount member of the VkPhysicalDeviceLimits structure. If maxSamplerAllocationCount is exceeded, vkCreateSampler will return VK_ERROR_TOO_MANY_OBJECTS.

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.

Valid Usage

  • The absolute value of mipLodBias must be less than or equal to VkPhysicalDeviceLimits::maxSamplerLodBias
  • If the anisotropic sampling feature is not enabled, anisotropyEnable must be VK_FALSE
  • If anisotropyEnable is VK_TRUE, maxAnisotropy must be between 1.0 and VkPhysicalDeviceLimits::maxSamplerAnisotropy, inclusive
  • If sampler Y’CBCR conversion is enabled and VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT is not set for the format, minFilter and magFilter must be equal to the sampler Y’CBCR conversion’s chromaFilter
  • If unnormalizedCoordinates is VK_TRUE, minFilter and magFilter must be equal
  • If unnormalizedCoordinates is VK_TRUE, mipmapMode must be VK_SAMPLER_MIPMAP_MODE_NEAREST
  • If unnormalizedCoordinates is VK_TRUE, minLod and maxLod must be zero
  • If unnormalizedCoordinates is VK_TRUE, addressModeU and addressModeV must each be either VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
  • If unnormalizedCoordinates is VK_TRUE, anisotropyEnable must be VK_FALSE
  • If unnormalizedCoordinates is VK_TRUE, compareEnable must be VK_FALSE
  • If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a valid VkBorderColor value
  • If sampler Y’CBCR conversion is enabled, addressModeU, addressModeV, and addressModeW must be VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, anisotropyEnable must be VK_FALSE, and unnormalizedCoordinates must be VK_FALSE
  • The sampler reduction mode must be set to VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT if sampler Y’CBCR conversion is enabled
  • If the {html_spec_relative}#VK_KHR_sampler_mirror_clamp_to_edge extension is not enabled, addressModeU, addressModeV and addressModeW must not be VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE
  • If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value
  • If either magFilter or minFilter is VK_FILTER_CUBIC_IMG, anisotropyEnable must be VK_FALSE
  • If either magFilter or minFilter is VK_FILTER_CUBIC_IMG, the reductionMode member of VkSamplerReductionModeCreateInfoEXT must be VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT
  • If compareEnable is VK_TRUE, the reductionMode member of VkSamplerReductionModeCreateInfoEXT must be VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT

Valid Usage (Implicit)

  • sType must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO

See Also

VkBool32, VkBorderColor, VkCompareOp, VkFilter, VkSamplerAddressMode, VkSamplerCreateFlags, VkSamplerMipmapMode, VkStructureType, vkCreateSampler