@bloomengine/engine 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/native/tvos/metal-patched/Cargo.toml +178 -0
- package/native/tvos/metal-patched/LICENSE-APACHE +201 -0
- package/native/tvos/metal-patched/LICENSE-MIT +25 -0
- package/native/tvos/metal-patched/src/acceleration_structure.rs +667 -0
- package/native/tvos/metal-patched/src/acceleration_structure_pass.rs +108 -0
- package/native/tvos/metal-patched/src/argument.rs +366 -0
- package/native/tvos/metal-patched/src/blitpass.rs +102 -0
- package/native/tvos/metal-patched/src/buffer.rs +71 -0
- package/native/tvos/metal-patched/src/capturedescriptor.rs +76 -0
- package/native/tvos/metal-patched/src/capturemanager.rs +113 -0
- package/native/tvos/metal-patched/src/commandbuffer.rs +192 -0
- package/native/tvos/metal-patched/src/commandqueue.rs +44 -0
- package/native/tvos/metal-patched/src/computepass.rs +107 -0
- package/native/tvos/metal-patched/src/constants.rs +152 -0
- package/native/tvos/metal-patched/src/counters.rs +119 -0
- package/native/tvos/metal-patched/src/depthstencil.rs +190 -0
- package/native/tvos/metal-patched/src/device.rs +2134 -0
- package/native/tvos/metal-patched/src/drawable.rs +39 -0
- package/native/tvos/metal-patched/src/encoder.rs +2041 -0
- package/native/tvos/metal-patched/src/heap.rs +281 -0
- package/native/tvos/metal-patched/src/indirect_encoder.rs +344 -0
- package/native/tvos/metal-patched/src/lib.rs +657 -0
- package/native/tvos/metal-patched/src/library.rs +902 -0
- package/native/tvos/metal-patched/src/mps.rs +575 -0
- package/native/tvos/metal-patched/src/pipeline/compute.rs +475 -0
- package/native/tvos/metal-patched/src/pipeline/mod.rs +71 -0
- package/native/tvos/metal-patched/src/pipeline/render.rs +762 -0
- package/native/tvos/metal-patched/src/renderpass.rs +443 -0
- package/native/tvos/metal-patched/src/resource.rs +182 -0
- package/native/tvos/metal-patched/src/sampler.rs +165 -0
- package/native/tvos/metal-patched/src/sync.rs +178 -0
- package/native/tvos/metal-patched/src/texture.rs +352 -0
- package/native/tvos/metal-patched/src/types.rs +90 -0
- package/native/tvos/metal-patched/src/vertexdescriptor.rs +250 -0
- package/package.json +5 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
use super::{CounterSampleBufferRef, NSUInteger};
|
|
2
|
+
|
|
3
|
+
/// See <https://developer.apple.com/documentation/metal/mtlaccelerationstructurepassdescriptor>
|
|
4
|
+
pub enum MTLAccelerationStructurePassDescriptor {}
|
|
5
|
+
|
|
6
|
+
foreign_obj_type! {
|
|
7
|
+
type CType = MTLAccelerationStructurePassDescriptor;
|
|
8
|
+
pub struct AccelerationStructurePassDescriptor;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl AccelerationStructurePassDescriptor {
|
|
12
|
+
/// Creates a default compute pass descriptor with no attachments.
|
|
13
|
+
pub fn new<'a>() -> &'a AccelerationStructurePassDescriptorRef {
|
|
14
|
+
unsafe {
|
|
15
|
+
msg_send![
|
|
16
|
+
class!(MTLAccelerationStructurePassDescriptor),
|
|
17
|
+
accelerationStructurePassDescriptor
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
impl AccelerationStructurePassDescriptorRef {
|
|
24
|
+
pub fn sample_buffer_attachments(
|
|
25
|
+
&self,
|
|
26
|
+
) -> &AccelerationStructurePassSampleBufferAttachmentDescriptorArrayRef {
|
|
27
|
+
unsafe { msg_send![self, sampleBufferAttachments] }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// See <https://developer.apple.com/documentation/metal/mtlaccelerationstructurepasssamplebufferattachmentdescriptorarray>
|
|
32
|
+
pub enum MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray {}
|
|
33
|
+
|
|
34
|
+
foreign_obj_type! {
|
|
35
|
+
type CType = MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray;
|
|
36
|
+
pub struct AccelerationStructurePassSampleBufferAttachmentDescriptorArray;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
impl AccelerationStructurePassSampleBufferAttachmentDescriptorArrayRef {
|
|
40
|
+
pub fn object_at(
|
|
41
|
+
&self,
|
|
42
|
+
index: NSUInteger,
|
|
43
|
+
) -> Option<&AccelerationStructurePassSampleBufferAttachmentDescriptorRef> {
|
|
44
|
+
unsafe { msg_send![self, objectAtIndexedSubscript: index] }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pub fn set_object_at(
|
|
48
|
+
&self,
|
|
49
|
+
index: NSUInteger,
|
|
50
|
+
attachment: Option<&AccelerationStructurePassSampleBufferAttachmentDescriptorRef>,
|
|
51
|
+
) {
|
|
52
|
+
unsafe {
|
|
53
|
+
msg_send![self, setObject:attachment
|
|
54
|
+
atIndexedSubscript:index]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// See <https://developer.apple.com/documentation/metal/mtlaccelerationstructurepasssamplebufferattachmentdescriptor>
|
|
60
|
+
pub enum MTLAccelerationStructurePassSampleBufferAttachmentDescriptor {}
|
|
61
|
+
|
|
62
|
+
foreign_obj_type! {
|
|
63
|
+
type CType = MTLAccelerationStructurePassSampleBufferAttachmentDescriptor;
|
|
64
|
+
pub struct AccelerationStructurePassSampleBufferAttachmentDescriptor;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
impl AccelerationStructurePassSampleBufferAttachmentDescriptor {
|
|
68
|
+
pub fn new() -> Self {
|
|
69
|
+
let class = class!(MTLAccelerationStructurePassSampleBufferAttachmentDescriptor);
|
|
70
|
+
unsafe { msg_send![class, new] }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
impl AccelerationStructurePassSampleBufferAttachmentDescriptorRef {
|
|
75
|
+
pub fn sample_buffer(&self) -> Option<&CounterSampleBufferRef> {
|
|
76
|
+
unsafe { msg_send![self, sampleBuffer] }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
pub fn set_sample_buffer(&self, sample_buffer: &CounterSampleBufferRef) {
|
|
80
|
+
unsafe { msg_send![self, setSampleBuffer: sample_buffer] }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
pub fn start_of_encoder_sample_index(&self) -> NSUInteger {
|
|
84
|
+
unsafe { msg_send![self, startOfEncoderSampleIndex] }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
pub fn set_start_of_encoder_sample_index(&self, start_of_encoder_sample_index: NSUInteger) {
|
|
88
|
+
unsafe {
|
|
89
|
+
msg_send![
|
|
90
|
+
self,
|
|
91
|
+
setStartOfEncoderSampleIndex: start_of_encoder_sample_index
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
pub fn end_of_encoder_sample_index(&self) -> NSUInteger {
|
|
97
|
+
unsafe { msg_send![self, endOfEncoderSampleIndex] }
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
pub fn set_end_of_encoder_sample_index(&self, end_of_encoder_sample_index: NSUInteger) {
|
|
101
|
+
unsafe {
|
|
102
|
+
msg_send![
|
|
103
|
+
self,
|
|
104
|
+
setEndOfEncoderSampleIndex: end_of_encoder_sample_index
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// Copyright 2017 GFX developers
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
|
4
|
+
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
|
5
|
+
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
|
6
|
+
// copied, modified, or distributed except according to those terms.
|
|
7
|
+
|
|
8
|
+
use super::{MTLTextureType, NSUInteger};
|
|
9
|
+
use objc::runtime::{NO, YES};
|
|
10
|
+
|
|
11
|
+
/// See <https://developer.apple.com/documentation/metal/mtldatatype>
|
|
12
|
+
#[repr(u64)]
|
|
13
|
+
#[allow(non_camel_case_types)]
|
|
14
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
15
|
+
pub enum MTLDataType {
|
|
16
|
+
None = 0,
|
|
17
|
+
|
|
18
|
+
Struct = 1,
|
|
19
|
+
Array = 2,
|
|
20
|
+
|
|
21
|
+
Float = 3,
|
|
22
|
+
Float2 = 4,
|
|
23
|
+
Float3 = 5,
|
|
24
|
+
Float4 = 6,
|
|
25
|
+
|
|
26
|
+
Float2x2 = 7,
|
|
27
|
+
Float2x3 = 8,
|
|
28
|
+
Float2x4 = 9,
|
|
29
|
+
|
|
30
|
+
Float3x2 = 10,
|
|
31
|
+
Float3x3 = 11,
|
|
32
|
+
Float3x4 = 12,
|
|
33
|
+
|
|
34
|
+
Float4x2 = 13,
|
|
35
|
+
Float4x3 = 14,
|
|
36
|
+
Float4x4 = 15,
|
|
37
|
+
|
|
38
|
+
Half = 16,
|
|
39
|
+
Half2 = 17,
|
|
40
|
+
Half3 = 18,
|
|
41
|
+
Half4 = 19,
|
|
42
|
+
|
|
43
|
+
Half2x2 = 20,
|
|
44
|
+
Half2x3 = 21,
|
|
45
|
+
Half2x4 = 22,
|
|
46
|
+
|
|
47
|
+
Half3x2 = 23,
|
|
48
|
+
Half3x3 = 24,
|
|
49
|
+
Half3x4 = 25,
|
|
50
|
+
|
|
51
|
+
Half4x2 = 26,
|
|
52
|
+
Half4x3 = 27,
|
|
53
|
+
Half4x4 = 28,
|
|
54
|
+
|
|
55
|
+
Int = 29,
|
|
56
|
+
Int2 = 30,
|
|
57
|
+
Int3 = 31,
|
|
58
|
+
Int4 = 32,
|
|
59
|
+
|
|
60
|
+
UInt = 33,
|
|
61
|
+
UInt2 = 34,
|
|
62
|
+
UInt3 = 35,
|
|
63
|
+
UInt4 = 36,
|
|
64
|
+
|
|
65
|
+
Short = 37,
|
|
66
|
+
Short2 = 38,
|
|
67
|
+
Short3 = 39,
|
|
68
|
+
Short4 = 40,
|
|
69
|
+
|
|
70
|
+
UShort = 41,
|
|
71
|
+
UShort2 = 42,
|
|
72
|
+
UShort3 = 43,
|
|
73
|
+
UShort4 = 44,
|
|
74
|
+
|
|
75
|
+
Char = 45,
|
|
76
|
+
Char2 = 46,
|
|
77
|
+
Char3 = 47,
|
|
78
|
+
Char4 = 48,
|
|
79
|
+
|
|
80
|
+
UChar = 49,
|
|
81
|
+
UChar2 = 50,
|
|
82
|
+
UChar3 = 51,
|
|
83
|
+
UChar4 = 52,
|
|
84
|
+
|
|
85
|
+
Bool = 53,
|
|
86
|
+
Bool2 = 54,
|
|
87
|
+
Bool3 = 55,
|
|
88
|
+
Bool4 = 56,
|
|
89
|
+
|
|
90
|
+
Texture = 58,
|
|
91
|
+
Sampler = 59,
|
|
92
|
+
Pointer = 60,
|
|
93
|
+
R8Unorm = 62,
|
|
94
|
+
R8Snorm = 63,
|
|
95
|
+
R16Unorm = 64,
|
|
96
|
+
R16Snorm = 65,
|
|
97
|
+
RG8Unorm = 66,
|
|
98
|
+
RG8Snorm = 67,
|
|
99
|
+
RG16Unorm = 68,
|
|
100
|
+
RG16Snorm = 69,
|
|
101
|
+
RGBA8Unorm = 70,
|
|
102
|
+
RGBA8Unorm_sRGB = 71,
|
|
103
|
+
RGBA8Snorm = 72,
|
|
104
|
+
RGBA16Unorm = 73,
|
|
105
|
+
RGBA16Snorm = 74,
|
|
106
|
+
RGB10A2Unorm = 75,
|
|
107
|
+
RG11B10Float = 76,
|
|
108
|
+
RGB9E5Float = 77,
|
|
109
|
+
|
|
110
|
+
RenderPipeline = 78,
|
|
111
|
+
ComputePipeline = 79,
|
|
112
|
+
IndirectCommandBuffer = 80,
|
|
113
|
+
|
|
114
|
+
Long = 81,
|
|
115
|
+
Long2 = 82,
|
|
116
|
+
Long3 = 83,
|
|
117
|
+
Long4 = 84,
|
|
118
|
+
|
|
119
|
+
ULong = 85,
|
|
120
|
+
ULong2 = 86,
|
|
121
|
+
ULong3 = 87,
|
|
122
|
+
ULong4 = 88,
|
|
123
|
+
|
|
124
|
+
VisibleFunctionTable = 115,
|
|
125
|
+
IntersectionFunctionTable = 116,
|
|
126
|
+
PrimitiveAccelerationStructure = 117,
|
|
127
|
+
InstanceAccelerationStructure = 118,
|
|
128
|
+
|
|
129
|
+
BFloat = 121,
|
|
130
|
+
BFloat2 = 122,
|
|
131
|
+
BFloat3 = 123,
|
|
132
|
+
BFloat4 = 124,
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/// See <https://developer.apple.com/documentation/metal/mtlargumenttype>
|
|
136
|
+
#[repr(u64)]
|
|
137
|
+
#[deprecated(
|
|
138
|
+
note = "Since: iOS 8.0–16.0, iPadOS 8.0–16.0, macOS 10.11–13.0, Mac Catalyst 13.1–16.0, tvOS 9.0–16.0"
|
|
139
|
+
)]
|
|
140
|
+
#[allow(non_camel_case_types)]
|
|
141
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
142
|
+
pub enum MTLArgumentType {
|
|
143
|
+
Buffer = 0,
|
|
144
|
+
ThreadgroupMemory = 1,
|
|
145
|
+
Texture = 2,
|
|
146
|
+
Sampler = 3,
|
|
147
|
+
ImageblockData = 16,
|
|
148
|
+
Imageblock = 17,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/// See <https://developer.apple.com/documentation/metal/mtlargumentaccess>
|
|
152
|
+
#[repr(u64)]
|
|
153
|
+
#[allow(non_camel_case_types)]
|
|
154
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
155
|
+
pub enum MTLArgumentAccess {
|
|
156
|
+
ReadOnly = 0,
|
|
157
|
+
ReadWrite = 1,
|
|
158
|
+
WriteOnly = 2,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/// See <https://developer.apple.com/documentation/metal/mtlstructmember>
|
|
162
|
+
pub enum MTLStructMember {}
|
|
163
|
+
|
|
164
|
+
foreign_obj_type! {
|
|
165
|
+
type CType = MTLStructMember;
|
|
166
|
+
pub struct StructMember;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
impl StructMemberRef {
|
|
170
|
+
pub fn name(&self) -> &str {
|
|
171
|
+
unsafe {
|
|
172
|
+
let name = msg_send![self, name];
|
|
173
|
+
crate::nsstring_as_str(name)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
pub fn offset(&self) -> NSUInteger {
|
|
178
|
+
unsafe { msg_send![self, offset] }
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
pub fn data_type(&self) -> MTLDataType {
|
|
182
|
+
unsafe { msg_send![self, dataType] }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
pub fn struct_type(&self) -> MTLStructType {
|
|
186
|
+
unsafe { msg_send![self, structType] }
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
pub fn array_type(&self) -> MTLArrayType {
|
|
190
|
+
unsafe { msg_send![self, arrayType] }
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
pub enum MTLStructMemberArray {}
|
|
195
|
+
|
|
196
|
+
foreign_obj_type! {
|
|
197
|
+
type CType = MTLStructMemberArray;
|
|
198
|
+
pub struct StructMemberArray;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
impl StructMemberArrayRef {
|
|
202
|
+
pub fn object_at(&self, index: NSUInteger) -> Option<&StructMemberRef> {
|
|
203
|
+
unsafe { msg_send![self, objectAtIndexedSubscript: index] }
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
pub fn count(&self) -> NSUInteger {
|
|
207
|
+
unsafe { msg_send![self, count] }
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/// See <https://developer.apple.com/documentation/metal/mtlstructtype>
|
|
212
|
+
pub enum MTLStructType {}
|
|
213
|
+
|
|
214
|
+
foreign_obj_type! {
|
|
215
|
+
type CType = MTLStructType;
|
|
216
|
+
pub struct StructType;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
impl StructTypeRef {
|
|
220
|
+
pub fn members(&self) -> &StructMemberArrayRef {
|
|
221
|
+
unsafe { msg_send![self, members] }
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
pub fn member_from_name(&self, name: &str) -> Option<&StructMemberRef> {
|
|
225
|
+
let nsname = crate::nsstring_from_str(name);
|
|
226
|
+
|
|
227
|
+
unsafe { msg_send![self, memberByName: nsname] }
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/// See <https://developer.apple.com/documentation/metal/mtlarraytype>
|
|
232
|
+
pub enum MTLArrayType {}
|
|
233
|
+
|
|
234
|
+
foreign_obj_type! {
|
|
235
|
+
type CType = MTLArrayType;
|
|
236
|
+
pub struct ArrayType;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
impl ArrayTypeRef {
|
|
240
|
+
pub fn array_length(&self) -> NSUInteger {
|
|
241
|
+
unsafe { msg_send![self, arrayLength] }
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
pub fn stride(&self) -> NSUInteger {
|
|
245
|
+
unsafe { msg_send![self, stride] }
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
pub fn element_type(&self) -> MTLDataType {
|
|
249
|
+
unsafe { msg_send![self, elementType] }
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
pub fn element_struct_type(&self) -> MTLStructType {
|
|
253
|
+
unsafe { msg_send![self, elementStructType] }
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
pub fn element_array_type(&self) -> MTLArrayType {
|
|
257
|
+
unsafe { msg_send![self, elementArrayType] }
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/// <https://developer.apple.com/documentation/metal/mtlargument>
|
|
262
|
+
#[deprecated(
|
|
263
|
+
note = "Since iOS 8.0–16.0, iPadOS 8.0–16.0, macOS 10.11–13.0, Mac Catalyst 13.1–16.0, tvOS 9.0–16.0"
|
|
264
|
+
)]
|
|
265
|
+
pub enum MTLArgument {}
|
|
266
|
+
|
|
267
|
+
foreign_obj_type! {
|
|
268
|
+
type CType = MTLArgument;
|
|
269
|
+
pub struct Argument;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
impl ArgumentRef {
|
|
273
|
+
pub fn name(&self) -> &str {
|
|
274
|
+
unsafe {
|
|
275
|
+
let name = msg_send![self, name];
|
|
276
|
+
crate::nsstring_as_str(name)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
pub fn type_(&self) -> MTLArgumentType {
|
|
281
|
+
unsafe { msg_send![self, type] }
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
pub fn access(&self) -> MTLArgumentAccess {
|
|
285
|
+
unsafe { msg_send![self, access] }
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
pub fn index(&self) -> NSUInteger {
|
|
289
|
+
unsafe { msg_send![self, index] }
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
pub fn is_active(&self) -> bool {
|
|
293
|
+
unsafe { msg_send_bool![self, isActive] }
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
pub fn buffer_alignment(&self) -> NSUInteger {
|
|
297
|
+
unsafe { msg_send![self, bufferAlignment] }
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
pub fn buffer_data_size(&self) -> NSUInteger {
|
|
301
|
+
unsafe { msg_send![self, bufferDataSize] }
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
pub fn buffer_data_type(&self) -> MTLDataType {
|
|
305
|
+
unsafe { msg_send![self, bufferDataType] }
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
pub fn buffer_struct_type(&self) -> &StructTypeRef {
|
|
309
|
+
unsafe { msg_send![self, bufferStructType] }
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
pub fn threadgroup_memory_alignment(&self) -> NSUInteger {
|
|
313
|
+
unsafe { msg_send![self, threadgroupMemoryAlignment] }
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
pub fn threadgroup_memory_data_size(&self) -> NSUInteger {
|
|
317
|
+
unsafe { msg_send![self, threadgroupMemoryDataSize] }
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
pub fn texture_type(&self) -> MTLTextureType {
|
|
321
|
+
unsafe { msg_send![self, textureType] }
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
pub fn texture_data_type(&self) -> MTLDataType {
|
|
325
|
+
unsafe { msg_send![self, textureDataType] }
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/// See <https://developer.apple.com/documentation/metal/mtlargumentdescriptor>
|
|
330
|
+
pub enum MTLArgumentDescriptor {}
|
|
331
|
+
|
|
332
|
+
foreign_obj_type! {
|
|
333
|
+
type CType = MTLArgumentDescriptor;
|
|
334
|
+
pub struct ArgumentDescriptor;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
impl ArgumentDescriptor {
|
|
338
|
+
pub fn new<'a>() -> &'a ArgumentDescriptorRef {
|
|
339
|
+
unsafe {
|
|
340
|
+
let class = class!(MTLArgumentDescriptor);
|
|
341
|
+
msg_send![class, argumentDescriptor]
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
impl ArgumentDescriptorRef {
|
|
347
|
+
pub fn set_data_type(&self, ty: MTLDataType) {
|
|
348
|
+
unsafe { msg_send![self, setDataType: ty] }
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
pub fn set_index(&self, index: NSUInteger) {
|
|
352
|
+
unsafe { msg_send![self, setIndex: index] }
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
pub fn set_access(&self, access: MTLArgumentAccess) {
|
|
356
|
+
unsafe { msg_send![self, setAccess: access] }
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
pub fn set_array_length(&self, length: NSUInteger) {
|
|
360
|
+
unsafe { msg_send![self, setArrayLength: length] }
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
pub fn set_texture_type(&self, ty: MTLTextureType) {
|
|
364
|
+
unsafe { msg_send![self, setTextureType: ty] }
|
|
365
|
+
}
|
|
366
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
use super::*;
|
|
2
|
+
|
|
3
|
+
/// See <https://developer.apple.com/documentation/metal/mtlblitpassdescriptor>
|
|
4
|
+
pub enum MTLBlitPassDescriptor {}
|
|
5
|
+
|
|
6
|
+
foreign_obj_type! {
|
|
7
|
+
type CType = MTLBlitPassDescriptor;
|
|
8
|
+
pub struct BlitPassDescriptor;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl BlitPassDescriptor {
|
|
12
|
+
/// Creates a default blit command pass descriptor with no attachments.
|
|
13
|
+
pub fn new<'a>() -> &'a BlitPassDescriptorRef {
|
|
14
|
+
unsafe { msg_send![class!(MTLBlitPassDescriptor), blitPassDescriptor] }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
impl BlitPassDescriptorRef {
|
|
19
|
+
// See <https://developer.apple.com/documentation/metal/mtlblitpassdescriptor>
|
|
20
|
+
pub fn sample_buffer_attachments(&self) -> &BlitPassSampleBufferAttachmentDescriptorArrayRef {
|
|
21
|
+
unsafe { msg_send![self, sampleBufferAttachments] }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// See <https://developer.apple.com/documentation/metal/mtlblitpasssamplebufferattachmentdescriptorarray>
|
|
26
|
+
pub enum MTLBlitPassSampleBufferAttachmentDescriptorArray {}
|
|
27
|
+
|
|
28
|
+
foreign_obj_type! {
|
|
29
|
+
type CType = MTLBlitPassSampleBufferAttachmentDescriptorArray;
|
|
30
|
+
pub struct BlitPassSampleBufferAttachmentDescriptorArray;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
impl BlitPassSampleBufferAttachmentDescriptorArrayRef {
|
|
34
|
+
pub fn object_at(
|
|
35
|
+
&self,
|
|
36
|
+
index: NSUInteger,
|
|
37
|
+
) -> Option<&BlitPassSampleBufferAttachmentDescriptorRef> {
|
|
38
|
+
unsafe { msg_send![self, objectAtIndexedSubscript: index] }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
pub fn set_object_at(
|
|
42
|
+
&self,
|
|
43
|
+
index: NSUInteger,
|
|
44
|
+
attachment: Option<&BlitPassSampleBufferAttachmentDescriptorRef>,
|
|
45
|
+
) {
|
|
46
|
+
unsafe {
|
|
47
|
+
msg_send![self, setObject:attachment
|
|
48
|
+
atIndexedSubscript:index]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/// See <https://developer.apple.com/documentation/metal/mtlblitpasssamplebufferattachmentdescriptor>
|
|
54
|
+
pub enum MTLBlitPassSampleBufferAttachmentDescriptor {}
|
|
55
|
+
|
|
56
|
+
foreign_obj_type! {
|
|
57
|
+
type CType = MTLBlitPassSampleBufferAttachmentDescriptor;
|
|
58
|
+
pub struct BlitPassSampleBufferAttachmentDescriptor;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
impl BlitPassSampleBufferAttachmentDescriptor {
|
|
62
|
+
pub fn new() -> Self {
|
|
63
|
+
let class = class!(MTLBlitPassSampleBufferAttachmentDescriptor);
|
|
64
|
+
unsafe { msg_send![class, new] }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
impl BlitPassSampleBufferAttachmentDescriptorRef {
|
|
69
|
+
pub fn sample_buffer(&self) -> Option<&CounterSampleBufferRef> {
|
|
70
|
+
unsafe { msg_send![self, sampleBuffer] }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub fn set_sample_buffer(&self, sample_buffer: &CounterSampleBufferRef) {
|
|
74
|
+
unsafe { msg_send![self, setSampleBuffer: sample_buffer] }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
pub fn start_of_encoder_sample_index(&self) -> NSUInteger {
|
|
78
|
+
unsafe { msg_send![self, startOfEncoderSampleIndex] }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pub fn set_start_of_encoder_sample_index(&self, start_of_encoder_sample_index: NSUInteger) {
|
|
82
|
+
unsafe {
|
|
83
|
+
msg_send![
|
|
84
|
+
self,
|
|
85
|
+
setStartOfEncoderSampleIndex: start_of_encoder_sample_index
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
pub fn end_of_encoder_sample_index(&self) -> NSUInteger {
|
|
91
|
+
unsafe { msg_send![self, endOfEncoderSampleIndex] }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
pub fn set_end_of_encoder_sample_index(&self, end_of_encoder_sample_index: NSUInteger) {
|
|
95
|
+
unsafe {
|
|
96
|
+
msg_send![
|
|
97
|
+
self,
|
|
98
|
+
setEndOfEncoderSampleIndex: end_of_encoder_sample_index
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Copyright 2016 GFX developers
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
|
4
|
+
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
|
5
|
+
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
|
6
|
+
// copied, modified, or distributed except according to those terms.
|
|
7
|
+
|
|
8
|
+
use super::*;
|
|
9
|
+
|
|
10
|
+
/// See <https://developer.apple.com/documentation/metal/mtlbuffer>
|
|
11
|
+
pub enum MTLBuffer {}
|
|
12
|
+
|
|
13
|
+
foreign_obj_type! {
|
|
14
|
+
type CType = MTLBuffer;
|
|
15
|
+
pub struct Buffer;
|
|
16
|
+
type ParentType = Resource;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl BufferRef {
|
|
20
|
+
pub fn length(&self) -> u64 {
|
|
21
|
+
unsafe { msg_send![self, length] }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
pub fn contents(&self) -> *mut std::ffi::c_void {
|
|
25
|
+
unsafe { msg_send![self, contents] }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub fn did_modify_range(&self, range: crate::NSRange) {
|
|
29
|
+
unsafe { msg_send![self, didModifyRange: range] }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pub fn new_texture_with_descriptor(
|
|
33
|
+
&self,
|
|
34
|
+
descriptor: &TextureDescriptorRef,
|
|
35
|
+
offset: u64,
|
|
36
|
+
bytes_per_row: u64,
|
|
37
|
+
) -> Texture {
|
|
38
|
+
unsafe {
|
|
39
|
+
msg_send![self,
|
|
40
|
+
newTextureWithDescriptor:descriptor
|
|
41
|
+
offset:offset
|
|
42
|
+
bytesPerRow:bytes_per_row
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// Only available on macos(10.15), NOT available on (ios)
|
|
48
|
+
pub fn remote_storage_buffer(&self) -> &BufferRef {
|
|
49
|
+
unsafe { msg_send![self, remoteStorageBuffer] }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// Only available on (macos(10.15), NOT available on (ios)
|
|
53
|
+
pub fn new_remote_buffer_view_for_device(&self, device: &DeviceRef) -> Buffer {
|
|
54
|
+
unsafe { msg_send![self, newRemoteBufferViewForDevice: device] }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
pub fn add_debug_marker(&self, name: &str, range: crate::NSRange) {
|
|
58
|
+
unsafe {
|
|
59
|
+
let name = crate::nsstring_from_str(name);
|
|
60
|
+
msg_send![self, addDebugMarker:name range:range]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pub fn remove_all_debug_markers(&self) {
|
|
65
|
+
unsafe { msg_send![self, removeAllDebugMarkers] }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pub fn gpu_address(&self) -> u64 {
|
|
69
|
+
unsafe { msg_send![self, gpuAddress] }
|
|
70
|
+
}
|
|
71
|
+
}
|