objc2_metal/generated/
MTLTypes.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// Identify a pixel in an image. MTLOrigin is ususally used as the upper-left corner of a region of a texture.
9///
10/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlorigin?language=objc)
11#[repr(C)]
12#[derive(Clone, Copy, Debug, PartialEq)]
13pub struct MTLOrigin {
14    pub x: NSUInteger,
15    pub y: NSUInteger,
16    pub z: NSUInteger,
17}
18
19unsafe impl Encode for MTLOrigin {
20    const ENCODING: Encoding = Encoding::Struct(
21        "?",
22        &[
23            <NSUInteger>::ENCODING,
24            <NSUInteger>::ENCODING,
25            <NSUInteger>::ENCODING,
26        ],
27    );
28}
29
30unsafe impl RefEncode for MTLOrigin {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34impl MTLOrigin {
35    // TODO: pub fn MTLOriginMake(x: NSUInteger,y: NSUInteger,z: NSUInteger,) -> MTLOrigin;
36}
37
38/// A set of dimensions to declare the size of an object, such as an image, texture, threadgroup, or grid.
39///
40/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlsize?language=objc)
41#[repr(C)]
42#[derive(Clone, Copy, Debug, PartialEq)]
43pub struct MTLSize {
44    pub width: NSUInteger,
45    pub height: NSUInteger,
46    pub depth: NSUInteger,
47}
48
49unsafe impl Encode for MTLSize {
50    const ENCODING: Encoding = Encoding::Struct(
51        "?",
52        &[
53            <NSUInteger>::ENCODING,
54            <NSUInteger>::ENCODING,
55            <NSUInteger>::ENCODING,
56        ],
57    );
58}
59
60unsafe impl RefEncode for MTLSize {
61    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64impl MTLSize {
65    // TODO: pub fn MTLSizeMake(width: NSUInteger,height: NSUInteger,depth: NSUInteger,) -> MTLSize;
66}
67
68/// Identify a region in an image or texture.
69///
70/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlregion?language=objc)
71#[repr(C)]
72#[derive(Clone, Copy, Debug, PartialEq)]
73pub struct MTLRegion {
74    pub origin: MTLOrigin,
75    pub size: MTLSize,
76}
77
78unsafe impl Encode for MTLRegion {
79    const ENCODING: Encoding = Encoding::Struct("?", &[<MTLOrigin>::ENCODING, <MTLSize>::ENCODING]);
80}
81
82unsafe impl RefEncode for MTLRegion {
83    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
84}
85
86impl MTLRegion {
87    // TODO: pub fn MTLRegionMake1D(x: NSUInteger,width: NSUInteger,) -> MTLRegion;
88
89    // TODO: pub fn MTLRegionMake2D(x: NSUInteger,y: NSUInteger,width: NSUInteger,height: NSUInteger,) -> MTLRegion;
90
91    // TODO: pub fn MTLRegionMake3D(x: NSUInteger,y: NSUInteger,z: NSUInteger,width: NSUInteger,height: NSUInteger,depth: NSUInteger,) -> MTLRegion;
92}
93
94/// Identify a sample within a pixel. Origin is top-left with a range [0,1) for both x and y.
95///
96/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlsampleposition?language=objc)
97#[repr(C)]
98#[derive(Clone, Copy, Debug, PartialEq)]
99pub struct MTLSamplePosition {
100    pub x: c_float,
101    pub y: c_float,
102}
103
104unsafe impl Encode for MTLSamplePosition {
105    const ENCODING: Encoding = Encoding::Struct("?", &[<c_float>::ENCODING, <c_float>::ENCODING]);
106}
107
108unsafe impl RefEncode for MTLSamplePosition {
109    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
110}
111
112impl MTLSamplePosition {
113    // TODO: pub fn MTLSamplePositionMake(x: c_float,y: c_float,) -> MTLSamplePosition;
114}
115
116/// A floating point coordinate in an abstract 2D space.
117/// Refer to location of use for concrete information on the space in which the coordinate exists.
118///
119/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcoordinate2d?language=objc)
120pub type MTLCoordinate2D = MTLSamplePosition;
121
122// TODO: pub fn MTLCoordinate2DMake(x: c_float,y: c_float,) -> MTLCoordinate2D;
123
124/// Handle of the GPU resource used for binding resources to argument tables, navigating resource view pools and storing resources in an argument buffer
125///
126/// MTLResourceID represents a specific GPU resource. This handle can be mutated by modifying textureID or samplerID values to get to individual resource views in a resource view pool.
127///
128/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlresourceid?language=objc)
129#[repr(C)]
130#[derive(Clone, Copy, Debug, PartialEq)]
131pub struct MTLResourceID {
132    pub(crate) _impl: u64,
133}
134
135unsafe impl Encode for MTLResourceID {
136    const ENCODING: Encoding = Encoding::Struct("MTLResourceID", &[<u64>::ENCODING]);
137}
138
139unsafe impl RefEncode for MTLResourceID {
140    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
141}