objc2_metal/generated/
MTLTextureViewPool.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern_protocol!(
9    /// A pool of lightweight texture views.
10    ///
11    /// Use texture view pools to create lightweight texture view objects of ``MTLTexture``
12    /// and ``MTLBuffer`` instances.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtltextureviewpool?language=objc)
15    #[cfg(feature = "MTLResourceViewPool")]
16    pub unsafe trait MTLTextureViewPool: MTLResourceViewPool {
17        #[cfg(all(
18            feature = "MTLAllocation",
19            feature = "MTLResource",
20            feature = "MTLTexture",
21            feature = "MTLTypes"
22        ))]
23        /// Copies a default texture view to a slot in this texture view pool at an index provided.
24        ///
25        /// - Parameters:
26        /// - texture: An ``MTLTexture`` instance for which to copy its texture view.
27        /// - index: An index of a slot in this texture pool into which this method copies the texture view.
28        /// - Returns: The ``MTLResourceID`` of a newly created texture view in this pool.
29        ///
30        /// # Safety
31        ///
32        /// - `texture` may need to be synchronized.
33        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
34        /// - `index` might not be bounds-checked.
35        #[unsafe(method(setTextureView:atIndex:))]
36        #[unsafe(method_family = none)]
37        unsafe fn setTextureView_atIndex(
38            &self,
39            texture: &ProtocolObject<dyn MTLTexture>,
40            index: NSUInteger,
41        ) -> MTLResourceID;
42
43        #[cfg(all(
44            feature = "MTLAllocation",
45            feature = "MTLResource",
46            feature = "MTLTexture",
47            feature = "MTLTypes"
48        ))]
49        /// Creates a new lightweight texture view.
50        ///
51        /// This method creates a lightweight texture view over a texture according to
52        /// a descriptor you provide. It then associates the texture view with a slot
53        /// in this texture view pool at the index you specify.
54        ///
55        /// - Parameters:
56        /// - texture: An ``MTLTexture`` instance for which to create a new lightweight texture view.
57        /// - descriptor: A descriptor specifying properties of the texture view to create.
58        /// - index: An index of a slot in the texture pool into which this method writes the new texture view.
59        /// - Returns: The ``MTLResourceID`` of a newly created texture view in this pool.
60        ///
61        /// # Safety
62        ///
63        /// - `texture` may need to be synchronized.
64        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
65        /// - `index` might not be bounds-checked.
66        #[unsafe(method(setTextureView:descriptor:atIndex:))]
67        #[unsafe(method_family = none)]
68        unsafe fn setTextureView_descriptor_atIndex(
69            &self,
70            texture: &ProtocolObject<dyn MTLTexture>,
71            descriptor: &MTLTextureViewDescriptor,
72            index: NSUInteger,
73        ) -> MTLResourceID;
74
75        #[cfg(all(
76            feature = "MTLAllocation",
77            feature = "MTLBuffer",
78            feature = "MTLResource",
79            feature = "MTLTexture",
80            feature = "MTLTypes"
81        ))]
82        /// Creates a new lightweight texture view of a buffer.
83        ///
84        /// This method creates a lightweight texture view over a buffer, according to
85        /// a descriptor you provide. It then associates the texture view with a slot
86        /// in this texture view pool at the index you specify.
87        ///
88        /// - Parameters:
89        /// - buffer: An ``MTLBuffer`` instance for which to create a new texture view.
90        /// - descriptor: A descriptor specifying properties of the texture view to create.
91        /// - offset: A byte offset, within the `buffer` parameter, at which the data for the texture view starts.
92        /// - bytesPerRow: The number of bytes between adjacent rows of pixels in the source buffer’s memory.
93        /// - index: An index of a slot in the table into which this method writes the new texture view.
94        /// - Returns: The ``MTLResourceID`` of a new buffer view in this pool.
95        ///
96        /// # Safety
97        ///
98        /// - `buffer` may need to be synchronized.
99        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
100        /// - `buffer` contents should be of the correct type.
101        /// - `offset` might not be bounds-checked.
102        /// - `index` might not be bounds-checked.
103        #[unsafe(method(setTextureViewFromBuffer:descriptor:offset:bytesPerRow:atIndex:))]
104        #[unsafe(method_family = none)]
105        unsafe fn setTextureViewFromBuffer_descriptor_offset_bytesPerRow_atIndex(
106            &self,
107            buffer: &ProtocolObject<dyn MTLBuffer>,
108            descriptor: &MTLTextureDescriptor,
109            offset: NSUInteger,
110            bytes_per_row: NSUInteger,
111            index: NSUInteger,
112        ) -> MTLResourceID;
113    }
114);