Struct vulkano::sampler::SamplerBuilder
source · [−]pub struct SamplerBuilder { /* private fields */ }
Expand description
Used to construct a new Sampler
.
Implementations
How the sampled value of a single mipmap should be calculated, for both magnification and minification.
The default value is Nearest
.
How the sampled value of a single mipmap should be calculated, when magnification is applied (LOD <= 0.0).
The default value is Nearest
.
How the sampled value of a single mipmap should be calculated, when minification is applied (LOD > 0.0).
The default value is Nearest
.
How the final sampled value should be calculated from the samples of individual mipmaps.
The default value is Nearest
.
How out-of-range texture coordinates should be treated, for all texture coordinate indices.
The default value is ClampToEdge
.
How out-of-range texture coordinates should be treated, for the u coordinate.
The default value is ClampToEdge
.
How out-of-range texture coordinates should be treated, for the v coordinate.
The default value is ClampToEdge
.
How out-of-range texture coordinates should be treated, for the w coordinate.
The default value is ClampToEdge
.
The bias value to be added to the base LOD before clamping.
The absolute value of the provided value must not exceed the
max_sampler_lod_bias
limit of the
device.
The default value is 0.0
.
Sets whether anisotropic texel filtering is enabled (Some
) and provides the maximum
anisotropy value if it is enabled.
Anisotropic filtering is a special filtering mode that takes into account the differences in scaling between the horizontal and vertical framebuffer axes.
If set to Some
, the sampler_anisotropy
feature must be enabled on the device, the provided maximum value must not exceed the
max_sampler_anisotropy
limit, and
the Cubic
filter must not be used.
The default value is None
.
Panics
- Panics if
anisotropy
isSome
and contains a value less than 1.0.
Sets whether depth comparison is enabled (Some
) and provides a comparison operator if it
is enabled.
Depth comparison is an alternative mode for samplers that can be used in combination with
image views specifying the depth aspect. Instead of returning a value that is sampled from
the image directly, a comparison operation is applied between the sampled value and a
reference value that is specified as part of the operation. The result is binary: 1.0 if the
operation returns true
, 0.0 if it returns false
.
If set to Some
, the reduction_mode
must be set to
WeightedAverage
.
The default value is None
.
The range that LOD values must be clamped to.
The default value is 0.0..
.
Panics
- Panics if
range
is empty.
The minimum value that LOD values must be clamped to. The maximum LOD is left unbounded.
The default value is 0.0..
.
Panics
- Panics if
min
is greater than 1000.0.
The border color to use if address_mode
is set to
ClampToBorder
.
The default value is FloatTransparentBlack
.
Sets whether unnormalized texture coordinates are enabled.
When a sampler is set to use unnormalized coordinates as input, the texture coordinates are not scaled by the size of the image, and therefore range up to the size of the image rather than 1.0. Enabling this comes with several restrictions:
min_filter
andmag_filter
must be equal.mipmap_mode
must beNearest
.- The
lod
range must be0.0..=0.0
. address_mode
for u and v must be eitherClampToEdge
orClampToBorder
.- Anisotropy and depth comparison must be disabled.
Some restrictions also apply to the image view being sampled:
- The view type must be
Dim1d
orDim2d
. Arrayed types are not allowed. - It must have a single mipmap level.
Finally, restrictions apply to the sampling operations that can be used in a shader:
- Only explicit LOD operations are allowed, implicit LOD operations are not.
- Sampling with projection is not allowed.
- Sampling with an LOD bias is not allowed.
- Sampling with an offset is not allowed.
The default value is false
.
Sets how the value sampled from a mipmap should be calculated from the selected
pixels, for the Linear
and Cubic
filters.
The default value is WeightedAverage
.
pub fn sampler_ycbcr_conversion(
self,
conversion: Option<Arc<SamplerYcbcrConversion>>
) -> Self
pub fn sampler_ycbcr_conversion(
self,
conversion: Option<Arc<SamplerYcbcrConversion>>
) -> Self
Adds a sampler YCbCr conversion to the sampler.
If set to Some
, several restrictions apply:
- If the
format
ofconversion
does not supportsampled_image_ycbcr_conversion_separate_reconstruction_filter
, thenmag_filter
andmin_filter
must be equal to thechroma_filter
ofconversion
. address_mode
for u, v and w must beClampToEdge
.- Anisotropy and unnormalized coordinates must be disabled.
- The
reduction_mode
must beWeightedAverage
.
In addition, the sampler must only be used as an immutable sampler within a descriptor set layout, and only in a combined image sampler descriptor.
The default value is None
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for SamplerBuilder
impl Send for SamplerBuilder
impl Sync for SamplerBuilder
impl Unpin for SamplerBuilder
impl UnwindSafe for SamplerBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
Builds a pointer to this type from a raw pointer.
Returns true if the size is suitable to store a type like this.
Returns the size of an individual element.