1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// Provides parameters for creating a resource view pool.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlresourceviewpooldescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLResourceViewPoolDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLResourceViewPoolDescriptor {}
);
unsafe impl CopyingHelper for MTLResourceViewPoolDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLResourceViewPoolDescriptor {}
);
impl MTLResourceViewPoolDescriptor {
extern_methods!(
/// Configures the number of resource views with which Metal creates the resource view pool.
#[unsafe(method(resourceViewCount))]
#[unsafe(method_family = none)]
pub fn resourceViewCount(&self) -> NSUInteger;
/// Setter for [`resourceViewCount`][Self::resourceViewCount].
///
/// # Safety
///
/// This might not be bounds-checked.
#[unsafe(method(setResourceViewCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setResourceViewCount(&self, resource_view_count: NSUInteger);
/// Assigns an optional label you to the resource view pool for debugging purposes.
#[unsafe(method(label))]
#[unsafe(method_family = none)]
pub fn label(&self) -> Option<Retained<NSString>>;
/// Setter for [`label`][Self::label].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLabel:))]
#[unsafe(method_family = none)]
pub fn setLabel(&self, label: Option<&NSString>);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLResourceViewPoolDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLResourceViewPoolDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
/// Contains views over resources of a specific type, and allows you to manage those views.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlresourceviewpool?language=objc)
pub unsafe trait MTLResourceViewPool: NSObjectProtocol {
#[cfg(feature = "MTLTypes")]
/// Obtains the resource ID corresponding to the resource view at index 0 in this resource view pool.
#[unsafe(method(baseResourceID))]
#[unsafe(method_family = none)]
fn baseResourceID(&self) -> MTLResourceID;
/// Queries the number of resource views that this pool contains.
#[unsafe(method(resourceViewCount))]
#[unsafe(method_family = none)]
fn resourceViewCount(&self) -> NSUInteger;
#[cfg(feature = "MTLDevice")]
/// Obtains a reference to the GPU device this pool belongs to.
#[unsafe(method(device))]
#[unsafe(method_family = none)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
/// Queries the optional debug label of this resource view pool.
#[unsafe(method(label))]
#[unsafe(method_family = none)]
fn label(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "MTLTypes")]
/// Copies a range of resource views from a source view pool to a destination location in this view pool.
///
/// - Parameters:
/// - sourcePool: resource view pool from which to copy resource views.
/// - sourceRange: The range in the source resource view pool to copy.
/// - destinationIndex: The starting index in this destination view pool into which to copy the source range of resource views.
///
/// - Returns: The ``MTLResourceID`` of the resource view corresponding to `destinationIndex` of the copy in this resource view pool.
///
/// # Safety
///
/// - `sourceRange` might not be bounds-checked.
/// - `destinationIndex` might not be bounds-checked.
#[unsafe(method(copyResourceViewsFromPool:sourceRange:destinationIndex:))]
#[unsafe(method_family = none)]
unsafe fn copyResourceViewsFromPool_sourceRange_destinationIndex(
&self,
source_pool: &ProtocolObject<dyn MTLResourceViewPool>,
source_range: NSRange,
destination_index: NSUInteger,
) -> MTLResourceID;
}
);