pub struct Sampler { /* private fields */ }
Expand description
Describes how to retrieve data from a sampled image within a shader.
Examples
A simple sampler for most usages:
use vulkano::image::sampler::{Sampler, SamplerCreateInfo};
let _sampler = Sampler::new(device.clone(), SamplerCreateInfo::simple_repeat_linear_no_mipmap());
More detailed sampler creation:
use vulkano::image::sampler::{Filter, Sampler, SamplerAddressMode, SamplerCreateInfo};
let _sampler = Sampler::new(device.clone(), SamplerCreateInfo {
mag_filter: Filter::Linear,
min_filter: Filter::Linear,
address_mode: [SamplerAddressMode::Repeat; 3],
mip_lod_bias: 1.0,
lod: 0.0..=100.0,
..Default::default()
})
.unwrap();
Implementations§
source§impl Sampler
impl Sampler
sourcepub fn new(
device: Arc<Device>,
create_info: SamplerCreateInfo
) -> Result<Arc<Sampler>, Validated<VulkanError>>
pub fn new( device: Arc<Device>, create_info: SamplerCreateInfo ) -> Result<Arc<Sampler>, Validated<VulkanError>>
Creates a new Sampler
.
sourcepub unsafe fn from_handle(
device: Arc<Device>,
handle: Sampler,
create_info: SamplerCreateInfo
) -> Arc<Sampler>
pub unsafe fn from_handle( device: Arc<Device>, handle: Sampler, create_info: SamplerCreateInfo ) -> Arc<Sampler>
Creates a new Sampler
from a raw object handle.
Safety
handle
must be a valid Vulkan object handle created fromdevice
.create_info
must match the info used to create the object.
sourcepub fn address_mode(&self) -> [SamplerAddressMode; 3]
pub fn address_mode(&self) -> [SamplerAddressMode; 3]
Returns the address modes for the u, v and w coordinates.
sourcepub fn anisotropy(&self) -> Option<f32>
pub fn anisotropy(&self) -> Option<f32>
Returns the anisotropy mode.
sourcepub fn border_color(&self) -> Option<BorderColor>
pub fn border_color(&self) -> Option<BorderColor>
Returns the border color if one is used by this sampler.
sourcepub fn compare(&self) -> Option<CompareOp>
pub fn compare(&self) -> Option<CompareOp>
Returns the compare operation if the sampler is a compare-mode sampler.
sourcepub fn lod(&self) -> RangeInclusive<f32>
pub fn lod(&self) -> RangeInclusive<f32>
Returns the LOD range.
sourcepub fn mag_filter(&self) -> Filter
pub fn mag_filter(&self) -> Filter
Returns the magnification filter.
sourcepub fn min_filter(&self) -> Filter
pub fn min_filter(&self) -> Filter
Returns the minification filter.
sourcepub fn mip_lod_bias(&self) -> f32
pub fn mip_lod_bias(&self) -> f32
Returns the mip LOD bias.
sourcepub fn mipmap_mode(&self) -> SamplerMipmapMode
pub fn mipmap_mode(&self) -> SamplerMipmapMode
Returns the mipmap mode.
sourcepub fn reduction_mode(&self) -> SamplerReductionMode
pub fn reduction_mode(&self) -> SamplerReductionMode
Returns the reduction mode.
sourcepub fn sampler_ycbcr_conversion(&self) -> Option<&Arc<SamplerYcbcrConversion>>
pub fn sampler_ycbcr_conversion(&self) -> Option<&Arc<SamplerYcbcrConversion>>
Returns a reference to the sampler YCbCr conversion of this sampler, if any.
sourcepub fn unnormalized_coordinates(&self) -> bool
pub fn unnormalized_coordinates(&self) -> bool
Returns true if the sampler uses unnormalized coordinates.
Trait Implementations§
source§impl DeviceOwned for Sampler
impl DeviceOwned for Sampler
source§impl PartialEq for Sampler
impl PartialEq for Sampler
source§impl VulkanObject for Sampler
impl VulkanObject for Sampler
impl Eq for Sampler
Auto Trait Implementations§
impl !RefUnwindSafe for Sampler
impl Send for Sampler
impl Sync for Sampler
impl Unpin for Sampler
impl !UnwindSafe for Sampler
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> DeviceOwnedVulkanObject for Twhere
T: DeviceOwned + VulkanObject,
impl<T> DeviceOwnedVulkanObject for Twhere T: DeviceOwned + VulkanObject,
source§fn set_debug_utils_object_name(
&self,
object_name: Option<&str>
) -> Result<(), VulkanError>
fn set_debug_utils_object_name( &self, object_name: Option<&str> ) -> Result<(), VulkanError>
Assigns a human-readable name to the object for debugging purposes. Read more