| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Graphics.Vulkan.Core10.Sampler
Synopsis
- createSampler :: forall a io. (PokeChain a, MonadIO io) => Device -> SamplerCreateInfo a -> ("allocator" ::: Maybe AllocationCallbacks) -> io Sampler
- withSampler :: forall a r. PokeChain a => Device -> SamplerCreateInfo a -> Maybe AllocationCallbacks -> (Sampler -> IO r) -> IO r
- destroySampler :: forall io. MonadIO io => Device -> Sampler -> ("allocator" ::: Maybe AllocationCallbacks) -> io ()
- data SamplerCreateInfo (es :: [Type]) = SamplerCreateInfo {
- next :: Chain es
- flags :: SamplerCreateFlags
- magFilter :: Filter
- minFilter :: Filter
- mipmapMode :: SamplerMipmapMode
- addressModeU :: SamplerAddressMode
- addressModeV :: SamplerAddressMode
- addressModeW :: SamplerAddressMode
- mipLodBias :: Float
- anisotropyEnable :: Bool
- maxAnisotropy :: Float
- compareEnable :: Bool
- compareOp :: CompareOp
- minLod :: Float
- maxLod :: Float
- borderColor :: BorderColor
- unnormalizedCoordinates :: Bool
Documentation
createSampler :: forall a io. (PokeChain a, MonadIO io) => Device -> SamplerCreateInfo a -> ("allocator" ::: Maybe AllocationCallbacks) -> io Sampler Source #
vkCreateSampler - Create a new sampler object
Parameters
deviceis the logical device that creates the sampler.
pCreateInfois a pointer to aSamplerCreateInfostructure specifying the state of the sampler object.pAllocatorcontrols host memory allocation as described in the Memory Allocation chapter.pSampleris a pointer to aSamplerhandle in which the resulting sampler object is returned.
Valid Usage (Implicit)
devicemust be a validDevicehandle
pCreateInfomust be a valid pointer to a validSamplerCreateInfostructure- If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validAllocationCallbacksstructure pSamplermust be a valid pointer to aSamplerhandle
Return Codes
See Also
withSampler :: forall a r. PokeChain a => Device -> SamplerCreateInfo a -> Maybe AllocationCallbacks -> (Sampler -> IO r) -> IO r Source #
A safe wrapper for createSampler and destroySampler using bracket
The allocated value must not be returned from the provided computation
destroySampler :: forall io. MonadIO io => Device -> Sampler -> ("allocator" ::: Maybe AllocationCallbacks) -> io () Source #
vkDestroySampler - Destroy a sampler object
Parameters
deviceis the logical device that destroys the sampler.
sampleris the sampler to destroy.pAllocatorcontrols host memory allocation as described in the Memory Allocation chapter.
Valid Usage
- All submitted commands that refer to
samplermust have completed execution
- If
AllocationCallbackswere provided whensamplerwas created, a compatible set of callbacks must be provided here - If no
AllocationCallbackswere provided whensamplerwas created,pAllocatormust beNULL
Valid Usage (Implicit)
devicemust be a validDevicehandle
- If
sampleris notNULL_HANDLE,samplermust be a validSamplerhandle - If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validAllocationCallbacksstructure - If
sampleris a valid handle, it must have been created, allocated, or retrieved fromdevice
Host Synchronization
- Host access to
samplermust be externally synchronized
See Also
data SamplerCreateInfo (es :: [Type]) Source #
VkSamplerCreateInfo - Structure specifying parameters of a newly created sampler
Description
Mapping of OpenGL to Vulkan filter modes
magFilter values of
FILTER_NEAREST and
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 FILTER_LINEAR and
mipmapMode of
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
SAMPLER_MIPMAP_MODE_NEAREST,
minLod = 0, and maxLod = 0.25, and using minFilter =
FILTER_LINEAR or minFilter =
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
PhysicalDeviceLimits
structure. If maxSamplerAllocationCount is exceeded, createSampler
will return
ERROR_TOO_MANY_OBJECTS.
Since Sampler 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
mipLodBiasmust be less than or equal toPhysicalDeviceLimits::maxSamplerLodBias
maxLodmust be greater than or equal tominLod- If the
anisotropic sampling
feature is not enabled,
anisotropyEnablemust beFALSE - If
anisotropyEnableisTRUE,maxAnisotropymust be between1.0andPhysicalDeviceLimits::maxSamplerAnisotropy, inclusive - If
sampler Y′CBCR conversion
is enabled and
FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BITis not set for the format,minFilterandmagFiltermust be equal to the sampler Y′CBCR conversion’schromaFilter - If
unnormalizedCoordinatesisTRUE,minFilterandmagFiltermust be equal - If
unnormalizedCoordinatesisTRUE,mipmapModemust beSAMPLER_MIPMAP_MODE_NEAREST - If
unnormalizedCoordinatesisTRUE,minLodandmaxLodmust be zero - If
unnormalizedCoordinatesisTRUE,addressModeUandaddressModeVmust each be eitherSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGEorSAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - If
unnormalizedCoordinatesisTRUE,anisotropyEnablemust beFALSE - If
unnormalizedCoordinatesisTRUE,compareEnablemust beFALSE - If any of
addressModeU,addressModeVoraddressModeWareSAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,borderColormust be a validBorderColorvalue - If
sampler Y′CBCR conversion
is enabled,
addressModeU,addressModeV, andaddressModeWmust beSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,anisotropyEnablemust beFALSE, andunnormalizedCoordinatesmust beFALSE - The sampler reduction mode must be set to
SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGEif sampler Y′CBCR conversion is enabled - If
samplerMirrorClampToEdge
is not enabled, and if the
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_sampler_mirror_clamp_to_edgeextension is not enabled,addressModeU,addressModeVandaddressModeWmust not beSAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - If
compareEnableisTRUE,compareOpmust be a validCompareOpvalue - If either
magFilterorminFilterisFILTER_CUBIC_EXT,anisotropyEnablemust beFALSE - If
compareEnableisTRUE, thereductionModemember ofSamplerReductionModeCreateInfomust beSAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE - If
flagsincludesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT, thenminFilterandmagFiltermust be equal. - If
flagsincludesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT, thenmipmapModemust beSAMPLER_MIPMAP_MODE_NEAREST. - If
flagsincludesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT, thenminLodandmaxLodmust be zero. - If
flagsincludesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT, thenaddressModeUandaddressModeVmust each be eitherSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGEorSAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER. - If
flagsincludesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT, thenanisotropyEnablemust beFALSE. - If
flagsincludesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT, thencompareEnablemust beFALSE. - If
flagsincludesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT, thenunnormalizedCoordinatesmust beFALSE.
Valid Usage (Implicit)
sTypemust beSTRUCTURE_TYPE_SAMPLER_CREATE_INFO
- Each
pNextmember of any structure (including this one) in thepNextchain must be eitherNULLor a pointer to a valid instance ofSamplerReductionModeCreateInfoorSamplerYcbcrConversionInfo - The
sTypevalue of each struct in thepNextchain must be unique flagsmust be a valid combination ofSamplerCreateFlagBitsvaluesmagFiltermust be a validFiltervalueminFiltermust be a validFiltervaluemipmapModemust be a validSamplerMipmapModevalueaddressModeUmust be a validSamplerAddressModevalueaddressModeVmust be a validSamplerAddressModevalueaddressModeWmust be a validSamplerAddressModevalue
See Also
Bool32,
BorderColor,
CompareOp,
Filter,
SamplerAddressMode,
SamplerCreateFlags,
SamplerMipmapMode,
StructureType,
createSampler
Constructors
| SamplerCreateInfo | |
Fields
| |