Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- newtype Sampler = Sampler Word64
- newtype BorderColor where
- BorderColor Int32
- pattern BORDER_COLOR_FLOAT_TRANSPARENT_BLACK :: BorderColor
- pattern BORDER_COLOR_INT_TRANSPARENT_BLACK :: BorderColor
- pattern BORDER_COLOR_FLOAT_OPAQUE_BLACK :: BorderColor
- pattern BORDER_COLOR_INT_OPAQUE_BLACK :: BorderColor
- pattern BORDER_COLOR_FLOAT_OPAQUE_WHITE :: BorderColor
- pattern BORDER_COLOR_INT_OPAQUE_WHITE :: BorderColor
- pattern BORDER_COLOR_INT_CUSTOM_EXT :: BorderColor
- pattern BORDER_COLOR_FLOAT_CUSTOM_EXT :: BorderColor
- newtype Filter where
- Filter Int32
- pattern FILTER_NEAREST :: Filter
- pattern FILTER_LINEAR :: Filter
- pattern FILTER_CUBIC_IMG :: Filter
- newtype SamplerMipmapMode where
- newtype SamplerAddressMode where
- SamplerAddressMode Int32
- pattern SAMPLER_ADDRESS_MODE_REPEAT :: SamplerAddressMode
- pattern SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT :: SamplerAddressMode
- pattern SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE :: SamplerAddressMode
- pattern SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER :: SamplerAddressMode
- pattern SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE :: SamplerAddressMode
- newtype SamplerCreateFlagBits where
- type SamplerCreateFlags = SamplerCreateFlagBits
Documentation
:: forall a io. (Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) | |
=> Device |
|
-> SamplerCreateInfo a |
|
-> ("allocator" ::: Maybe AllocationCallbacks) |
|
-> io Sampler |
vkCreateSampler - Create a new sampler object
Valid Usage
- There must be less than
PhysicalDeviceLimits
::maxSamplerAllocationCount
VkSampler objects currently created on the device.
Valid Usage (Implicit)
device
must be a validDevice
handle
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 :: 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.
:: forall io. MonadIO io | |
=> Device |
|
-> Sampler |
|
-> ("allocator" ::: Maybe AllocationCallbacks) |
|
-> io () |
vkDestroySampler - Destroy a sampler object
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)
device
must be a validDevice
handle
- 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.
Note
For historical reasons, if maxSamplerAllocationCount
is exceeded, some
implementations may return
ERROR_TOO_MANY_OBJECTS
. Exceeding this
limit will result in undefined behavior, and an application should not
rely on the use of the returned error code in order to identify when the
limit is reached.
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 the
potential format features
of the sampler Y′CBCR conversion do not support
FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT
,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
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
- If
borderColor
is set to one ofBORDER_COLOR_FLOAT_CUSTOM_EXT
orBORDER_COLOR_INT_CUSTOM_EXT
, then aSamplerCustomBorderColorCreateInfoEXT
must be present in thepNext
chain - If the
customBorderColors
feature is not enabled,
borderColor
must not be set toBORDER_COLOR_FLOAT_CUSTOM_EXT
orBORDER_COLOR_INT_CUSTOM_EXT
- 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
PhysicalDeviceCustomBorderColorPropertiesEXT
structure
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 ofSamplerCustomBorderColorCreateInfoEXT
,SamplerReductionModeCreateInfo
, 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 | |
|
Instances
VkSampler - Opaque handle to a sampler object
See Also
DescriptorImageInfo
,
DescriptorSetLayoutBinding
,
ImageViewHandleInfoNVX
,
createSampler
,
destroySampler
Instances
Eq Sampler Source # | |
Ord Sampler Source # | |
Show Sampler Source # | |
Storable Sampler Source # | |
Zero Sampler Source # | |
Defined in Vulkan.Core10.Handles | |
HasObjectType Sampler Source # | |
Defined in Vulkan.Core10.Handles objectTypeAndHandle :: Sampler -> (ObjectType, Word64) Source # | |
IsHandle Sampler Source # | |
Defined in Vulkan.Core10.Handles |
newtype BorderColor Source #
VkBorderColor - Specify border color used for texture lookups
Description
These colors are described in detail in Texel Replacement.
See Also
Instances
VkFilter - Specify filters used for texture lookups
Description
These filters are described in detail in Texel Filtering.
See Also
SamplerCreateInfo
,
SamplerYcbcrConversionCreateInfo
,
cmdBlitImage
pattern FILTER_NEAREST :: Filter |
|
pattern FILTER_LINEAR :: Filter |
|
pattern FILTER_CUBIC_IMG :: Filter |
Instances
Eq Filter Source # | |
Ord Filter Source # | |
Read Filter Source # | |
Show Filter Source # | |
Storable Filter Source # | |
Zero Filter Source # | |
Defined in Vulkan.Core10.Enums.Filter |
newtype SamplerMipmapMode Source #
VkSamplerMipmapMode - Specify mipmap mode used for texture lookups
Description
These modes are described in detail in Texel Filtering.
See Also
pattern SAMPLER_MIPMAP_MODE_NEAREST :: SamplerMipmapMode |
|
pattern SAMPLER_MIPMAP_MODE_LINEAR :: SamplerMipmapMode |
|
Instances
newtype SamplerAddressMode Source #
VkSamplerAddressMode - Specify behavior of sampling with texture coordinates outside an image
See Also
pattern SAMPLER_ADDRESS_MODE_REPEAT :: SamplerAddressMode |
|
pattern SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT :: SamplerAddressMode |
|
pattern SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE :: SamplerAddressMode |
|
pattern SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER :: SamplerAddressMode |
|
pattern SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE :: SamplerAddressMode |
|
Instances
newtype SamplerCreateFlagBits Source #
VkSamplerCreateFlagBits - Bitmask specifying additional parameters of sampler
Description
Note
The approximations used when
SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT
is specified
are implementation defined. Some implementations may interpolate
between fragment density levels in a subsampled image. In that case,
this bit may be used to decide whether the interpolation factors are
calculated per fragment or at a coarser granularity.
See Also
pattern SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT :: SamplerCreateFlagBits |
|
pattern SAMPLER_CREATE_SUBSAMPLED_BIT_EXT :: SamplerCreateFlagBits |
|