pub fn unnormalized(
        device: Arc<Device>,
        filter: Filter,
        address_u: UnnormalizedSamplerAddressMode,
        address_v: UnnormalizedSamplerAddressMode,
    ) -> Result<Arc<Sampler>, SamplerCreationError> {
        let fns = device.fns();

        let border_color = address_u.border_color();
        let border_color = match (border_color, address_v.border_color()) {
            (Some(b1), Some(b2)) => {
                assert_eq!(b1, b2);
                Some(b1)
            }
            (None, b) => b,
            (b, None) => b,
        };

        let handle = unsafe {
            let infos = ash::vk::SamplerCreateInfo {
                flags: ash::vk::SamplerCreateFlags::empty(),
                mag_filter: filter.into(),
                min_filter: filter.into(),
                mipmap_mode: ash::vk::SamplerMipmapMode::NEAREST,
                address_mode_u: address_u.into(),
                address_mode_v: address_v.into(),
                address_mode_w: ash::vk::SamplerAddressMode::CLAMP_TO_EDGE, // unused by the impl
                mip_lod_bias: 0.0,
                anisotropy_enable: ash::vk::FALSE,
                max_anisotropy: 1.0,
                compare_enable: ash::vk::FALSE,
                compare_op: ash::vk::CompareOp::NEVER,
                min_lod: 0.0,
                max_lod: 0.0,
                border_color: border_color
                    .map(|b| b.into())
                    .unwrap_or(ash::vk::BorderColor::FLOAT_TRANSPARENT_BLACK),
                unnormalized_coordinates: ash::vk::TRUE,
                ..Default::default()
            };

            let mut output = MaybeUninit::uninit();
            check_errors(fns.v1_0.create_sampler(
                device.internal_object(),
                &infos,
                ptr::null(),
                output.as_mut_ptr(),
            ))?;
            output.assume_init()
        };

        Ok(Arc::new(Sampler {
            handle,
            device: device.clone(),
            compare_mode: false,
            unnormalized: true,
            usable_with_float_formats: match border_color {
                Some(BorderColor::FloatTransparentBlack) => true,
                Some(BorderColor::FloatOpaqueBlack) => true,
                Some(BorderColor::FloatOpaqueWhite) => true,
                Some(_) => false,
                None => true,
            },
            usable_with_int_formats: match border_color {
                Some(BorderColor::IntTransparentBlack) => true,
                Some(BorderColor::IntOpaqueBlack) => true,
                Some(BorderColor::IntOpaqueWhite) => true,
                Some(_) => false,
                None => true,
            },
            usable_with_swizzling: match border_color {
                Some(BorderColor::FloatOpaqueBlack) => false,
                Some(BorderColor::IntOpaqueBlack) => false,
                _ => true,
            },
        }))
    }
/// 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.
///
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.
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 .
pub fn unnormalized(
        device: Arc<Device>,
        filter: Filter,
        address_u: UnnormalizedSamplerAddressMode,
        address_v: UnnormalizedSamplerAddressMode,
    ) -> Result<Arc<Sampler>, SamplerCreationError> {
        let fns = device.fns();
        let border_color = address_u.border_color();
        let border_color = match (border_color, address_v.border_color()) {
            (Some(b1), Some(b2)) => {
                assert_eq!(b1, b2);
                Some(b1)
            }
            (None, b) => b,
            (b, None) => b,
        };
        let handle = unsafe {
            let infos = ash::vk::SamplerCreateInfo {
                flags: ash::vk::SamplerCreateFlags::empty(),
                mag_filter: filter.into(),
                min_filter: filter.into(),
                mipmap_mode: ash::vk::SamplerMipmapMode::NEAREST,
                address_mode_u: address_u.into(),
                address_mode_v: address_v.into(),
                address_mode_w: ash::vk::SamplerAddressMode::CLAMP_TO_EDGE, // unused by the impl
                mip_lod_bias: 0.0,
                anisotropy_enable: ash::vk::FALSE,
                max_anisotropy: 1.0,
                compare_enable: ash::vk::FALSE,
                compare_op: ash::vk::CompareOp::NEVER,
                min_lod: 0.0,
                max_lod: 0.0,
                border_color: border_color
                    .map(|b| b.into())
                    .unwrap_or(ash::vk::BorderColor::FLOAT_TRANSPARENT_BLACK),
                unnormalized_coordinates: ash::vk::TRUE,
                ..Default::default()
            };
            let mut output = MaybeUninit::uninit();
            check_errors(fns.v1_0.create_sampler(
                device.internal_object(),
                &infos,
                ptr::null(),
                output.as_mut_ptr(),
            ))?;
            output.assume_init()
        };
        Ok(Arc::new(Sampler {
            handle,
            device: device.clone(),
            compare_mode: false,
            unnormalized: true,
            usable_with_float_formats: match border_color {
                Some(BorderColor::FloatTransparentBlack) => true,
                Some(BorderColor::FloatOpaqueBlack) => true,
                Some(BorderColor::FloatOpaqueWhite) => true,
                Some(_) => false,
                None => true,
            },
            usable_with_int_formats: match border_color {
                Some(BorderColor::IntTransparentBlack) => true,
                Some(BorderColor::IntOpaqueBlack) => true,
                Some(BorderColor::IntOpaqueWhite) => true,
                Some(_) => false,
                None => true,
            },
            usable_with_swizzling: match border_color {
                Some(BorderColor::FloatOpaqueBlack) => false,
                Some(BorderColor::IntOpaqueBlack) => false,
                _ => true,
            },
        }))
    }
pub fn unnormalized ( device : Arc < Device > , filter : Filter , address_u : UnnormalizedSamplerAddressMode , address_v : UnnormalizedSamplerAddressMode , ) -> Result < Arc < Sampler > , SamplerCreationError > { let fns = device . fns ( ) ; let border_color = address_u . border_color ( ) ; let border_color = match ( border_color , address_v . border_color ( ) ) { ( Some ( b1 ) , Some ( b2 ) ) => { assert_eq ! ( b1 b2 ) ; Some ( b1 ) } ( None , b ) => b , ( b , None ) => b , } ; let handle = unsafe { let infos = ash :: vk :: SamplerCreateInfo { flags : ash :: vk :: SamplerCreateFlags :: empty ( ) , mag_filter : filter . into ( ) , min_filter : filter . into ( ) , mipmap_mode : ash :: vk :: SamplerMipmapMode :: NEAREST , address_mode_u : address_u . into ( ) , address_mode_v : address_v . into ( ) , address_mode_w : ash :: vk :: SamplerAddressMode :: CLAMP_TO_EDGE , // unused by the impl mip_lod_bias : 0.0 , anisotropy_enable : ash :: vk :: FALSE , max_anisotropy : 1.0 , compare_enable : ash :: vk :: FALSE , compare_op : ash :: vk :: CompareOp :: NEVER , min_lod : 0.0 , max_lod : 0.0 , border_color : border_color . map ( | b | b . into ( ) ) . unwrap_or ( ash :: vk :: BorderColor :: FLOAT_TRANSPARENT_BLACK ) , unnormalized_coordinates : ash :: vk :: TRUE , .. Default :: default ( ) } ; let mut output = MaybeUninit :: uninit ( ) ; check_errors ( fns . v1_0 . create_sampler ( device . internal_object ( ) , & infos , ptr :: null ( ) , output . as_mut_ptr ( ) , ) ) ? ; output . assume_init ( ) } ; Ok ( Arc :: new ( Sampler { handle , device : device . clone ( ) , compare_mode : false , unnormalized : true , usable_with_float_formats : match border_color { Some ( BorderColor :: FloatTransparentBlack ) => true , Some ( BorderColor :: FloatOpaqueBlack ) => true , Some ( BorderColor :: FloatOpaqueWhite ) => true , Some ( _ ) => false , None => true , } , usable_with_int_formats : match border_color { Some ( BorderColor :: IntTransparentBlack ) => true , Some ( BorderColor :: IntOpaqueBlack ) => true , Some ( BorderColor :: IntOpaqueWhite ) => true , Some ( _ ) => false , None => true , } , usable_with_swizzling : match border_color { Some ( BorderColor :: FloatOpaqueBlack ) => false , Some ( BorderColor :: IntOpaqueBlack ) => false , _ => true , } , } ) ) }
Creates a sampler with unnormalized coordinates.
Creates a sampler with unnormalized coordinates .
device
Arc<Device>
filter
Filter
address_u
UnnormalizedSamplerAddressMode
address_v
UnnormalizedSamplerAddressMode
device
Arc<Device>
filter
Filter
address_u
UnnormalizedSamplerAddressMode
address_v
UnnormalizedSamplerAddressMode
panic
Panics if multiple `ClampToBorder` values are passed and the border color is different.
Panics if multiple ` ClampToBorder ` values are passed and the border color is different .