| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Core10.Sampler
Synopsis
- createSampler :: forall a io. (Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) => Device -> SamplerCreateInfo a -> ("allocator" ::: Maybe AllocationCallbacks) -> io Sampler
- withSampler :: forall a io r. (Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) => Device -> SamplerCreateInfo a -> Maybe AllocationCallbacks -> (io Sampler -> (Sampler -> io ()) -> r) -> 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. (Extendss SamplerCreateInfo a, 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 io r. (Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) => Device -> SamplerCreateInfo a -> Maybe AllocationCallbacks -> (io Sampler -> (Sampler -> io ()) -> r) -> r Source #
A convenience wrapper to make a compatible pair of calls to
createSampler and destroySampler
To ensure that destroySampler is always called: pass
bracket (or the allocate function from your
favourite resource management library) as the first argument.
To just extract the pair pass (,) as the first argument.
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 the
sampler Y′CBCR conversion’s features
do not support
FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT,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
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 - If
borderColoris set to one ofBORDER_COLOR_FLOAT_CUSTOM_EXTorBORDER_COLOR_INT_CUSTOM_EXT, then aSamplerCustomBorderColorCreateInfoEXTmust be present in thepNextchain - The maximum number of samplers with custom border colors which can
be simultaneously created on a device is implementation-dependent
and specified by the
maxCustomBorderColorSamplers
member of the
PhysicalDeviceCustomBorderColorPropertiesEXTstructure
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 ofSamplerCustomBorderColorCreateInfoEXT,SamplerReductionModeCreateInfo, orSamplerYcbcrConversionInfo - 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
| |