[][src]Struct vulkano::sampler::Sampler

pub struct Sampler { /* fields omitted */ }

Describes how to retrieve data from an image within a shader.

Methods

impl Sampler[src]

pub fn simple_repeat_linear(device: Arc<Device>) -> Arc<Sampler>[src]

Shortcut for creating a sampler with linear sampling, linear mipmaps, and with the repeat mode for borders.

Useful for prototyping, but can also be used in real projects.

Panic

  • Panics if out of memory or the maximum number of samplers has exceeded.

pub fn simple_repeat_linear_no_mipmap(device: Arc<Device>) -> Arc<Sampler>[src]

Shortcut for creating a sampler with linear sampling, that only uses the main level of images, and with the repeat mode for borders.

Useful for prototyping, but can also be used in real projects.

Panic

  • Panics if out of memory or the maximum number of samplers has exceeded.

pub fn new(
    device: Arc<Device>,
    mag_filter: Filter,
    min_filter: Filter,
    mipmap_mode: MipmapMode,
    address_u: SamplerAddressMode,
    address_v: SamplerAddressMode,
    address_w: SamplerAddressMode,
    mip_lod_bias: f32,
    max_anisotropy: f32,
    min_lod: f32,
    max_lod: f32
) -> Result<Arc<Sampler>, SamplerCreationError>
[src]

Creates a new Sampler with the given behavior.

mag_filter and min_filter define how the implementation should sample from the image when it is respectively larger and smaller than the original.

mipmap_mode defines how the implementation should choose which mipmap to use.

address_u, address_v and address_w define how the implementation should behave when sampling outside of the texture coordinates range [0.0, 1.0].

mip_lod_bias is a value to add to .

max_anisotropy must be greater than or equal to 1.0. If greater than 1.0, the implementation will use anisotropic filtering. Using a value greater than 1.0 requires the sampler_anisotropy feature to be enabled when creating the device.

min_lod and max_lod are respectively the minimum and maximum mipmap level to use. max_lod must always be greater than or equal to min_lod.

Panic

  • Panics if multiple ClampToBorder values are passed and the border color is different.
  • Panics if max_anisotropy < 1.0.
  • Panics if min_lod > max_lod.

pub fn compare(
    device: Arc<Device>,
    mag_filter: Filter,
    min_filter: Filter,
    mipmap_mode: MipmapMode,
    address_u: SamplerAddressMode,
    address_v: SamplerAddressMode,
    address_w: SamplerAddressMode,
    mip_lod_bias: f32,
    max_anisotropy: f32,
    min_lod: f32,
    max_lod: f32,
    compare: Compare
) -> Result<Arc<Sampler>, SamplerCreationError>
[src]

Creates a new Sampler with the given behavior.

Contrary to new, this creates a sampler that is used to compare depth values.

A sampler like this can only operate on depth or depth-stencil textures. Instead of returning the value of the texture, this sampler will return a value between 0.0 and 1.0 indicating how much the reference value (passed by the shader) compares to the value in the texture.

Note that it doesn't make sense to create a compare-mode sampler with an integer border color, as such a sampler would be unusable.

Panic

Same panic reasons as new.

pub fn unnormalized(
    device: Arc<Device>,
    filter: Filter,
    address_u: UnnormalizedSamplerAddressMode,
    address_v: UnnormalizedSamplerAddressMode
) -> Result<Arc<Sampler>, SamplerCreationError>
[src]

Creates a sampler with unnormalized coordinates. This means that texture coordinates won't range between 0.0 and 1.0 but use plain pixel offsets.

Using an unnormalized sampler adds a few restrictions:

  • It can only be used with non-array 1D or 2D images.
  • It can only be used with images with a single mipmap.
  • Projection and offsets can't be used by shaders. Only the first mipmap can be accessed.

Panic

  • Panics if multiple ClampToBorder values are passed and the border color is different.

pub fn compare_mode(&self) -> bool[src]

Returns true if the sampler is a compare-mode sampler.

pub fn is_unnormalized(&self) -> bool[src]

Returns true if the sampler is unnormalized.

pub fn usable_with_float_formats(&self) -> bool[src]

Returns true if the sampler can be used with floating-point image views. See the documentation of the sampler module for more info.

pub fn usable_with_int_formats(&self) -> bool[src]

Returns true if the sampler can be used with integer image views. See the documentation of the sampler module for more info.

pub fn usable_with_swizzling(&self) -> bool[src]

Returns true if the sampler can be used with image views that have non-identity swizzling. See the documentation of the sampler module for more info.

Trait Implementations

impl DeviceOwned for Sampler[src]

impl VulkanObject for Sampler[src]

type Object = Sampler

The type of the object.

impl Drop for Sampler[src]

impl Debug for Sampler[src]

Auto Trait Implementations

impl Send for Sampler

impl Sync for Sampler

impl Unpin for Sampler

impl UnwindSafe for Sampler

impl RefUnwindSafe for Sampler

Blanket Implementations

impl<T> DeviceOwned for T where
    T: Deref,
    <T as Deref>::Target: DeviceOwned
[src]

impl<T> Content for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]