Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- createSampler :: PokeChain a => Device -> SamplerCreateInfo a -> ("allocator" ::: Maybe AllocationCallbacks) -> IO Sampler
- withSampler :: PokeChain a => Device -> SamplerCreateInfo a -> Maybe AllocationCallbacks -> (Sampler -> IO r) -> IO r
- destroySampler :: 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 :: PokeChain a => Device -> SamplerCreateInfo a -> ("allocator" ::: Maybe AllocationCallbacks) -> IO Sampler Source #
vkCreateSampler - Create a new sampler object
Parameters
Device
is the logical device that creates the sampler.
pCreateInfo
is a pointer to aSamplerCreateInfo
structure specifying the state of the sampler object.pAllocator
controls host memory allocation as described in the Memory Allocation chapter.pSampler
is a pointer to aSampler
handle in which the resulting sampler object is returned.
Valid Usage (Implicit)
pCreateInfo
must be a valid pointer to a validSamplerCreateInfo
structure- If
pAllocator
is notNULL
,pAllocator
must be a valid pointer to a validAllocationCallbacks
structure pSampler
must be a valid pointer to aSampler
handle
Return Codes
See Also
withSampler :: 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 :: Device -> Sampler -> ("allocator" ::: Maybe AllocationCallbacks) -> 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
AllocationCallbacks
were provided whenSampler
was created, a compatible set of callbacks must be provided here - If no
AllocationCallbacks
were provided whenSampler
was created,pAllocator
must beNULL
Valid Usage (Implicit)
- If
Sampler
is notNULL_HANDLE
,Sampler
must be a validSampler
handle - If
pAllocator
is notNULL
,pAllocator
must be a valid pointer to a validAllocationCallbacks
structure - If
Sampler
is a valid handle, it must have been created, allocated, or retrieved fromDevice
Host Synchronization
- Host access to
Sampler
must 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
mipLodBias
must be less than or equal toPhysicalDeviceLimits
::maxSamplerLodBias
maxLod
must be greater than or equal tominLod
- If the
anisotropic sampling
feature is not enabled,
anisotropyEnable
must beFALSE
- If
anisotropyEnable
isTRUE
,maxAnisotropy
must be between1.0
andPhysicalDeviceLimits
::maxSamplerAnisotropy
, inclusive - If
sampler Y′CBCR conversion
is enabled and
FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT
is not set for the format,minFilter
andmagFilter
must be equal to the sampler Y′CBCR conversion’schromaFilter
- If
unnormalizedCoordinates
isTRUE
,minFilter
andmagFilter
must be equal - If
unnormalizedCoordinates
isTRUE
,mipmapMode
must beSAMPLER_MIPMAP_MODE_NEAREST
- If
unnormalizedCoordinates
isTRUE
,minLod
andmaxLod
must be zero - If
unnormalizedCoordinates
isTRUE
,addressModeU
andaddressModeV
must each be eitherSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE
orSAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
- If
unnormalizedCoordinates
isTRUE
,anisotropyEnable
must beFALSE
- If
unnormalizedCoordinates
isTRUE
,compareEnable
must beFALSE
- If any of
addressModeU
,addressModeV
oraddressModeW
areSAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
,BorderColor
must be a validBorderColor
value - If
sampler Y′CBCR conversion
is enabled,
addressModeU
,addressModeV
, andaddressModeW
must beSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE
,anisotropyEnable
must beFALSE
, andunnormalizedCoordinates
must beFALSE
- The sampler reduction mode must be set to
SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE
if 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_edge
extension is not enabled,addressModeU
,addressModeV
andaddressModeW
must not beSAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE
- If
compareEnable
isTRUE
,CompareOp
must be a validCompareOp
value - If either
magFilter
orminFilter
isFILTER_CUBIC_EXT
,anisotropyEnable
must beFALSE
- If
compareEnable
isTRUE
, thereductionMode
member ofSamplerReductionModeCreateInfo
must beSAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE
- If
Flags
includesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT
, thenminFilter
andmagFilter
must be equal. - If
Flags
includesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT
, thenmipmapMode
must beSAMPLER_MIPMAP_MODE_NEAREST
. - If
Flags
includesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT
, thenminLod
andmaxLod
must be zero. - If
Flags
includesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT
, thenaddressModeU
andaddressModeV
must each be eitherSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE
orSAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
. - If
Flags
includesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT
, thenanisotropyEnable
must beFALSE
. - If
Flags
includesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT
, thencompareEnable
must beFALSE
. - If
Flags
includesSAMPLER_CREATE_SUBSAMPLED_BIT_EXT
, thenunnormalizedCoordinates
must beFALSE
.
Valid Usage (Implicit)
sType
must beSTRUCTURE_TYPE_SAMPLER_CREATE_INFO
- Each
pNext
member of any structure (including this one) in thepNext
chain must be eitherNULL
or a pointer to a valid instance ofSamplerReductionModeCreateInfo
orSamplerYcbcrConversionInfo
- The
sType
value of each struct in thepNext
chain must be unique Flags
must be a valid combination ofSamplerCreateFlagBits
valuesmagFilter
must be a validFilter
valueminFilter
must be a validFilter
valuemipmapMode
must be a validSamplerMipmapMode
valueaddressModeU
must be a validSamplerAddressMode
valueaddressModeV
must be a validSamplerAddressMode
valueaddressModeW
must be a validSamplerAddressMode
value
See Also
Bool32
,
BorderColor
,
CompareOp
,
Filter
,
SamplerAddressMode
,
SamplerCreateFlags
,
SamplerMipmapMode
,
StructureType
,
createSampler
SamplerCreateInfo | |
|