objc2_metal/generated/
MTLResourceViewPool.rs

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