mtl-rs 0.1.10

Rust bindings for Apple's Metal API
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use objc2::{Encode, Encoding, RefEncode};

/// Identify a sample within a pixel. Origin is top-left with a range [0,1) for both x and y.
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct MTLSamplePosition {
    pub x: f32,
    pub y: f32,
}

unsafe impl Encode for MTLSamplePosition {
    const ENCODING: Encoding = Encoding::Struct("?", &[f32::ENCODING, f32::ENCODING]);
}

unsafe impl RefEncode for MTLSamplePosition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}