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

pub struct Sampler { /* fields omitted */ }
Expand description

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

Implementations

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.

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.

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.

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.

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.

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

Returns true if the sampler is unnormalized.

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

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

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

Formats the value using the given formatter. Read more

Returns the device that owns Self.

Executes the destructor for this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type of the object.

Returns a reference to the object.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

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.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.