@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,76 @@
|
|
|
1
|
+
// Copyright 2020 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
|
+
use std::path::Path;
|
|
11
|
+
|
|
12
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedestination?language=objc>
|
|
13
|
+
#[repr(u64)]
|
|
14
|
+
#[allow(non_camel_case_types)]
|
|
15
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
16
|
+
pub enum MTLCaptureDestination {
|
|
17
|
+
DeveloperTools = 1,
|
|
18
|
+
GpuTraceDocument = 2,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor>
|
|
22
|
+
pub enum MTLCaptureDescriptor {}
|
|
23
|
+
|
|
24
|
+
foreign_obj_type! {
|
|
25
|
+
type CType = MTLCaptureDescriptor;
|
|
26
|
+
pub struct CaptureDescriptor;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
impl CaptureDescriptor {
|
|
30
|
+
pub fn new() -> Self {
|
|
31
|
+
unsafe {
|
|
32
|
+
let class = class!(MTLCaptureDescriptor);
|
|
33
|
+
msg_send![class, new]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
impl CaptureDescriptorRef {
|
|
39
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor/3237248-captureobject>
|
|
40
|
+
pub fn set_capture_device(&self, device: &DeviceRef) {
|
|
41
|
+
unsafe { msg_send![self, setCaptureObject: device] }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor/3237248-captureobject>
|
|
45
|
+
pub fn set_capture_scope(&self, scope: &CaptureScopeRef) {
|
|
46
|
+
unsafe { msg_send![self, setCaptureObject: scope] }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor/3237248-captureobject>
|
|
50
|
+
pub fn set_capture_command_queue(&self, command_queue: &CommandQueueRef) {
|
|
51
|
+
unsafe { msg_send![self, setCaptureObject: command_queue] }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor/3237250-outputurl>
|
|
55
|
+
pub fn output_url(&self) -> &Path {
|
|
56
|
+
let url: &URLRef = unsafe { msg_send![self, outputURL] };
|
|
57
|
+
Path::new(url.path())
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor/3237250-outputurl>
|
|
61
|
+
pub fn set_output_url<P: AsRef<Path>>(&self, output_url: P) {
|
|
62
|
+
let output_url_string = String::from("file://") + output_url.as_ref().to_str().unwrap();
|
|
63
|
+
let output_url = URL::new_with_string(&output_url_string);
|
|
64
|
+
unsafe { msg_send![self, setOutputURL: output_url] }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor?language=objc>
|
|
68
|
+
pub fn destination(&self) -> MTLCaptureDestination {
|
|
69
|
+
unsafe { msg_send![self, destination] }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturedescriptor?language=objc>
|
|
73
|
+
pub fn set_destination(&self, destination: MTLCaptureDestination) {
|
|
74
|
+
unsafe { msg_send![self, setDestination: destination] }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Copyright 2018 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
|
+
use std::ffi::CStr;
|
|
10
|
+
|
|
11
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturescope>
|
|
12
|
+
pub enum MTLCaptureScope {}
|
|
13
|
+
|
|
14
|
+
foreign_obj_type! {
|
|
15
|
+
type CType = MTLCaptureScope;
|
|
16
|
+
pub struct CaptureScope;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl CaptureScopeRef {
|
|
20
|
+
pub fn begin_scope(&self) {
|
|
21
|
+
unsafe { msg_send![self, beginScope] }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
pub fn end_scope(&self) {
|
|
25
|
+
unsafe { msg_send![self, endScope] }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub fn label(&self) -> &str {
|
|
29
|
+
unsafe {
|
|
30
|
+
let label = msg_send![self, label];
|
|
31
|
+
crate::nsstring_as_str(label)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturemanager>
|
|
37
|
+
pub enum MTLCaptureManager {}
|
|
38
|
+
|
|
39
|
+
foreign_obj_type! {
|
|
40
|
+
type CType = MTLCaptureManager;
|
|
41
|
+
pub struct CaptureManager;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
impl CaptureManager {
|
|
45
|
+
pub fn shared<'a>() -> &'a CaptureManagerRef {
|
|
46
|
+
unsafe {
|
|
47
|
+
let class = class!(MTLCaptureManager);
|
|
48
|
+
msg_send![class, sharedCaptureManager]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
impl CaptureManagerRef {
|
|
54
|
+
pub fn new_capture_scope_with_device(&self, device: &DeviceRef) -> CaptureScope {
|
|
55
|
+
unsafe { msg_send![self, newCaptureScopeWithDevice: device] }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
pub fn new_capture_scope_with_command_queue(
|
|
59
|
+
&self,
|
|
60
|
+
command_queue: &CommandQueueRef,
|
|
61
|
+
) -> CaptureScope {
|
|
62
|
+
unsafe { msg_send![self, newCaptureScopeWithCommandQueue: command_queue] }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
pub fn default_capture_scope(&self) -> Option<&CaptureScopeRef> {
|
|
66
|
+
unsafe { msg_send![self, defaultCaptureScope] }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
pub fn set_default_capture_scope(&self, scope: &CaptureScopeRef) {
|
|
70
|
+
unsafe { msg_send![self, setDefaultCaptureScope: scope] }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// Starts capturing with the capture session defined by a descriptor object.
|
|
74
|
+
///
|
|
75
|
+
/// This function will panic if Metal capture is not enabled. Capture can be enabled by
|
|
76
|
+
/// either:
|
|
77
|
+
/// 1. Running from Xcode
|
|
78
|
+
/// 2. Setting the environment variable `METAL_CAPTURE_ENABLED=1`
|
|
79
|
+
/// 3. Adding an info.plist file containing the `MetalCaptureEnabled` key set to `YES`
|
|
80
|
+
pub fn start_capture(&self, descriptor: &CaptureDescriptorRef) -> Result<(), String> {
|
|
81
|
+
unsafe {
|
|
82
|
+
Ok(try_objc! { err =>
|
|
83
|
+
msg_send![self, startCaptureWithDescriptor: descriptor
|
|
84
|
+
error: &mut err]
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
pub fn start_capture_with_device(&self, device: &DeviceRef) {
|
|
90
|
+
unsafe { msg_send![self, startCaptureWithDevice: device] }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
pub fn start_capture_with_command_queue(&self, command_queue: &CommandQueueRef) {
|
|
94
|
+
unsafe { msg_send![self, startCaptureWithCommandQueue: command_queue] }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
pub fn start_capture_with_scope(&self, scope: &CaptureScopeRef) {
|
|
98
|
+
unsafe { msg_send![self, startCaptureWithScope: scope] }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
pub fn stop_capture(&self) {
|
|
102
|
+
unsafe { msg_send![self, stopCapture] }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
pub fn is_capturing(&self) -> bool {
|
|
106
|
+
unsafe { msg_send![self, isCapturing] }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcapturemanager/3237260-supportsdestination?language=objc>
|
|
110
|
+
pub fn supports_destination(&self, destination: MTLCaptureDestination) -> bool {
|
|
111
|
+
unsafe { msg_send![self, supportsDestination: destination] }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
use block::Block;
|
|
11
|
+
|
|
12
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcommandbufferstatus>
|
|
13
|
+
#[repr(u32)]
|
|
14
|
+
#[allow(non_camel_case_types)]
|
|
15
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
16
|
+
pub enum MTLCommandBufferStatus {
|
|
17
|
+
NotEnqueued = 0,
|
|
18
|
+
Enqueued = 1,
|
|
19
|
+
Committed = 2,
|
|
20
|
+
Scheduled = 3,
|
|
21
|
+
Completed = 4,
|
|
22
|
+
Error = 5,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcommandbuffererror>
|
|
26
|
+
#[repr(u32)]
|
|
27
|
+
#[allow(non_camel_case_types)]
|
|
28
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
29
|
+
pub enum MTLCommandBufferError {
|
|
30
|
+
None = 0,
|
|
31
|
+
Internal = 1,
|
|
32
|
+
Timeout = 2,
|
|
33
|
+
PageFault = 3,
|
|
34
|
+
Blacklisted = 4,
|
|
35
|
+
NotPermitted = 7,
|
|
36
|
+
OutOfMemory = 8,
|
|
37
|
+
InvalidResource = 9,
|
|
38
|
+
Memoryless = 10,
|
|
39
|
+
DeviceRemoved = 11,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// See <https://developer.apple.com/documentation/metal/mtldispatchtype>
|
|
43
|
+
#[repr(u32)]
|
|
44
|
+
#[allow(non_camel_case_types)]
|
|
45
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
46
|
+
pub enum MTLDispatchType {
|
|
47
|
+
Serial = 0,
|
|
48
|
+
Concurrent = 1,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type CommandBufferHandler<'a> = Block<(&'a CommandBufferRef,), ()>;
|
|
52
|
+
|
|
53
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcommandbuffer>.
|
|
54
|
+
pub enum MTLCommandBuffer {}
|
|
55
|
+
|
|
56
|
+
foreign_obj_type! {
|
|
57
|
+
type CType = MTLCommandBuffer;
|
|
58
|
+
pub struct CommandBuffer;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
impl CommandBufferRef {
|
|
62
|
+
pub fn label(&self) -> &str {
|
|
63
|
+
unsafe {
|
|
64
|
+
let label = msg_send![self, label];
|
|
65
|
+
crate::nsstring_as_str(label)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
pub fn set_label(&self, label: &str) {
|
|
70
|
+
unsafe {
|
|
71
|
+
let nslabel = crate::nsstring_from_str(label);
|
|
72
|
+
let () = msg_send![self, setLabel: nslabel];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
pub fn enqueue(&self) {
|
|
77
|
+
unsafe { msg_send![self, enqueue] }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub fn commit(&self) {
|
|
81
|
+
unsafe { msg_send![self, commit] }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
pub fn status(&self) -> MTLCommandBufferStatus {
|
|
85
|
+
unsafe { msg_send![self, status] }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
pub fn present_drawable(&self, drawable: &DrawableRef) {
|
|
89
|
+
unsafe { msg_send![self, presentDrawable: drawable] }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
pub fn wait_until_completed(&self) {
|
|
93
|
+
unsafe { msg_send![self, waitUntilCompleted] }
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
pub fn wait_until_scheduled(&self) {
|
|
97
|
+
unsafe { msg_send![self, waitUntilScheduled] }
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
pub fn add_completed_handler(&self, block: &CommandBufferHandler) {
|
|
101
|
+
unsafe { msg_send![self, addCompletedHandler: block] }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
pub fn add_scheduled_handler(&self, block: &CommandBufferHandler) {
|
|
105
|
+
unsafe { msg_send![self, addScheduledHandler: block] }
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
pub fn new_blit_command_encoder(&self) -> &BlitCommandEncoderRef {
|
|
109
|
+
unsafe { msg_send![self, blitCommandEncoder] }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
pub fn blit_command_encoder_with_descriptor(
|
|
113
|
+
&self,
|
|
114
|
+
descriptor: &BlitPassDescriptorRef,
|
|
115
|
+
) -> &BlitCommandEncoderRef {
|
|
116
|
+
unsafe { msg_send![self, blitCommandEncoderWithDescriptor: descriptor] }
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
pub fn new_compute_command_encoder(&self) -> &ComputeCommandEncoderRef {
|
|
120
|
+
unsafe { msg_send![self, computeCommandEncoder] }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
pub fn compute_command_encoder_with_dispatch_type(
|
|
124
|
+
&self,
|
|
125
|
+
ty: MTLDispatchType,
|
|
126
|
+
) -> &ComputeCommandEncoderRef {
|
|
127
|
+
unsafe { msg_send![self, computeCommandEncoderWithDispatchType: ty] }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
pub fn compute_command_encoder_with_descriptor(
|
|
131
|
+
&self,
|
|
132
|
+
descriptor: &ComputePassDescriptorRef,
|
|
133
|
+
) -> &ComputeCommandEncoderRef {
|
|
134
|
+
unsafe { msg_send![self, computeCommandEncoderWithDescriptor: descriptor] }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
pub fn new_render_command_encoder(
|
|
138
|
+
&self,
|
|
139
|
+
descriptor: &RenderPassDescriptorRef,
|
|
140
|
+
) -> &RenderCommandEncoderRef {
|
|
141
|
+
unsafe { msg_send![self, renderCommandEncoderWithDescriptor: descriptor] }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
pub fn new_parallel_render_command_encoder(
|
|
145
|
+
&self,
|
|
146
|
+
descriptor: &RenderPassDescriptorRef,
|
|
147
|
+
) -> &ParallelRenderCommandEncoderRef {
|
|
148
|
+
unsafe { msg_send![self, parallelRenderCommandEncoderWithDescriptor: descriptor] }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
pub fn new_acceleration_structure_command_encoder(
|
|
152
|
+
&self,
|
|
153
|
+
) -> &AccelerationStructureCommandEncoderRef {
|
|
154
|
+
unsafe { msg_send![self, accelerationStructureCommandEncoder] }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
pub fn acceleration_structure_command_encoder_with_descriptor(
|
|
158
|
+
&self,
|
|
159
|
+
descriptor: &AccelerationStructurePassDescriptorRef,
|
|
160
|
+
) -> &AccelerationStructureCommandEncoderRef {
|
|
161
|
+
unsafe { msg_send![self, accelerationStructureCommandEncoderWithDescriptor: descriptor] }
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
pub fn encode_signal_event(&self, event: &EventRef, new_value: u64) {
|
|
165
|
+
unsafe {
|
|
166
|
+
msg_send![self,
|
|
167
|
+
encodeSignalEvent: event
|
|
168
|
+
value: new_value
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
pub fn encode_wait_for_event(&self, event: &EventRef, value: u64) {
|
|
174
|
+
unsafe {
|
|
175
|
+
msg_send![self,
|
|
176
|
+
encodeWaitForEvent: event
|
|
177
|
+
value: value
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
pub fn push_debug_group(&self, name: &str) {
|
|
183
|
+
unsafe {
|
|
184
|
+
let nslabel = crate::nsstring_from_str(name);
|
|
185
|
+
msg_send![self, pushDebugGroup: nslabel]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
pub fn pop_debug_group(&self) {
|
|
190
|
+
unsafe { msg_send![self, popDebugGroup] }
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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/mtlcommandqueue>.
|
|
11
|
+
pub enum MTLCommandQueue {}
|
|
12
|
+
|
|
13
|
+
foreign_obj_type! {
|
|
14
|
+
type CType = MTLCommandQueue;
|
|
15
|
+
pub struct CommandQueue;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
impl CommandQueueRef {
|
|
19
|
+
pub fn label(&self) -> &str {
|
|
20
|
+
unsafe {
|
|
21
|
+
let label = msg_send![self, label];
|
|
22
|
+
crate::nsstring_as_str(label)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
pub fn set_label(&self, label: &str) {
|
|
27
|
+
unsafe {
|
|
28
|
+
let nslabel = crate::nsstring_from_str(label);
|
|
29
|
+
let () = msg_send![self, setLabel: nslabel];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub fn new_command_buffer(&self) -> &CommandBufferRef {
|
|
34
|
+
unsafe { msg_send![self, commandBuffer] }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
pub fn new_command_buffer_with_unretained_references(&self) -> &CommandBufferRef {
|
|
38
|
+
unsafe { msg_send![self, commandBufferWithUnretainedReferences] }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
pub fn device(&self) -> &DeviceRef {
|
|
42
|
+
unsafe { msg_send![self, device] }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
use super::*;
|
|
2
|
+
|
|
3
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcomputepassdescriptor>
|
|
4
|
+
pub enum MTLComputePassDescriptor {}
|
|
5
|
+
|
|
6
|
+
foreign_obj_type! {
|
|
7
|
+
type CType = MTLComputePassDescriptor;
|
|
8
|
+
pub struct ComputePassDescriptor;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl ComputePassDescriptor {
|
|
12
|
+
/// Creates a default compute pass descriptor with no attachments.
|
|
13
|
+
pub fn new<'a>() -> &'a ComputePassDescriptorRef {
|
|
14
|
+
unsafe { msg_send![class!(MTLComputePassDescriptor), computePassDescriptor] }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
impl ComputePassDescriptorRef {
|
|
19
|
+
pub fn sample_buffer_attachments(
|
|
20
|
+
&self,
|
|
21
|
+
) -> &ComputePassSampleBufferAttachmentDescriptorArrayRef {
|
|
22
|
+
unsafe { msg_send![self, sampleBufferAttachments] }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pub fn set_dispatch_type(&self, ty: MTLDispatchType) {
|
|
26
|
+
unsafe { msg_send![self, setDispatchType: ty] }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptorarray>
|
|
31
|
+
pub enum MTLComputePassSampleBufferAttachmentDescriptorArray {}
|
|
32
|
+
|
|
33
|
+
foreign_obj_type! {
|
|
34
|
+
type CType = MTLComputePassSampleBufferAttachmentDescriptorArray;
|
|
35
|
+
pub struct ComputePassSampleBufferAttachmentDescriptorArray;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
impl ComputePassSampleBufferAttachmentDescriptorArrayRef {
|
|
39
|
+
pub fn object_at(
|
|
40
|
+
&self,
|
|
41
|
+
index: NSUInteger,
|
|
42
|
+
) -> Option<&ComputePassSampleBufferAttachmentDescriptorRef> {
|
|
43
|
+
unsafe { msg_send![self, objectAtIndexedSubscript: index] }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pub fn set_object_at(
|
|
47
|
+
&self,
|
|
48
|
+
index: NSUInteger,
|
|
49
|
+
attachment: Option<&ComputePassSampleBufferAttachmentDescriptorRef>,
|
|
50
|
+
) {
|
|
51
|
+
unsafe {
|
|
52
|
+
msg_send![self, setObject:attachment
|
|
53
|
+
atIndexedSubscript:index]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptor>
|
|
59
|
+
pub enum MTLComputePassSampleBufferAttachmentDescriptor {}
|
|
60
|
+
|
|
61
|
+
foreign_obj_type! {
|
|
62
|
+
type CType = MTLComputePassSampleBufferAttachmentDescriptor;
|
|
63
|
+
pub struct ComputePassSampleBufferAttachmentDescriptor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
impl ComputePassSampleBufferAttachmentDescriptor {
|
|
67
|
+
pub fn new() -> Self {
|
|
68
|
+
let class = class!(MTLComputePassSampleBufferAttachmentDescriptor);
|
|
69
|
+
unsafe { msg_send![class, new] }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
impl ComputePassSampleBufferAttachmentDescriptorRef {
|
|
74
|
+
pub fn sample_buffer(&self) -> Option<&CounterSampleBufferRef> {
|
|
75
|
+
unsafe { msg_send![self, sampleBuffer] }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
pub fn set_sample_buffer(&self, sample_buffer: &CounterSampleBufferRef) {
|
|
79
|
+
unsafe { msg_send![self, setSampleBuffer: sample_buffer] }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
pub fn start_of_encoder_sample_index(&self) -> NSUInteger {
|
|
83
|
+
unsafe { msg_send![self, startOfEncoderSampleIndex] }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
pub fn set_start_of_encoder_sample_index(&self, start_of_encoder_sample_index: NSUInteger) {
|
|
87
|
+
unsafe {
|
|
88
|
+
msg_send![
|
|
89
|
+
self,
|
|
90
|
+
setStartOfEncoderSampleIndex: start_of_encoder_sample_index
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
pub fn end_of_encoder_sample_index(&self) -> NSUInteger {
|
|
96
|
+
unsafe { msg_send![self, endOfEncoderSampleIndex] }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
pub fn set_end_of_encoder_sample_index(&self, end_of_encoder_sample_index: NSUInteger) {
|
|
100
|
+
unsafe {
|
|
101
|
+
msg_send![
|
|
102
|
+
self,
|
|
103
|
+
setEndOfEncoderSampleIndex: end_of_encoder_sample_index
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
/// See <https://developer.apple.com/documentation/metal/mtlpixelformat>
|
|
9
|
+
#[repr(u64)]
|
|
10
|
+
#[allow(non_camel_case_types)]
|
|
11
|
+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
|
12
|
+
pub enum MTLPixelFormat {
|
|
13
|
+
Invalid = 0,
|
|
14
|
+
A8Unorm = 1,
|
|
15
|
+
R8Unorm = 10,
|
|
16
|
+
R8Unorm_sRGB = 11,
|
|
17
|
+
R8Snorm = 12,
|
|
18
|
+
R8Uint = 13,
|
|
19
|
+
R8Sint = 14,
|
|
20
|
+
R16Unorm = 20,
|
|
21
|
+
R16Snorm = 22,
|
|
22
|
+
R16Uint = 23,
|
|
23
|
+
R16Sint = 24,
|
|
24
|
+
R16Float = 25,
|
|
25
|
+
RG8Unorm = 30,
|
|
26
|
+
RG8Unorm_sRGB = 31,
|
|
27
|
+
RG8Snorm = 32,
|
|
28
|
+
RG8Uint = 33,
|
|
29
|
+
RG8Sint = 34,
|
|
30
|
+
B5G6R5Unorm = 40,
|
|
31
|
+
A1BGR5Unorm = 41,
|
|
32
|
+
ABGR4Unorm = 42,
|
|
33
|
+
BGR5A1Unorm = 43,
|
|
34
|
+
R32Uint = 53,
|
|
35
|
+
R32Sint = 54,
|
|
36
|
+
R32Float = 55,
|
|
37
|
+
RG16Unorm = 60,
|
|
38
|
+
RG16Snorm = 62,
|
|
39
|
+
RG16Uint = 63,
|
|
40
|
+
RG16Sint = 64,
|
|
41
|
+
RG16Float = 65,
|
|
42
|
+
RGBA8Unorm = 70,
|
|
43
|
+
RGBA8Unorm_sRGB = 71,
|
|
44
|
+
RGBA8Snorm = 72,
|
|
45
|
+
RGBA8Uint = 73,
|
|
46
|
+
RGBA8Sint = 74,
|
|
47
|
+
BGRA8Unorm = 80,
|
|
48
|
+
BGRA8Unorm_sRGB = 81,
|
|
49
|
+
RGB10A2Unorm = 90,
|
|
50
|
+
RGB10A2Uint = 91,
|
|
51
|
+
RG11B10Float = 92,
|
|
52
|
+
RGB9E5Float = 93,
|
|
53
|
+
BGR10A2Unorm = 94,
|
|
54
|
+
RG32Uint = 103,
|
|
55
|
+
RG32Sint = 104,
|
|
56
|
+
RG32Float = 105,
|
|
57
|
+
RGBA16Unorm = 110,
|
|
58
|
+
RGBA16Snorm = 112,
|
|
59
|
+
RGBA16Uint = 113,
|
|
60
|
+
RGBA16Sint = 114,
|
|
61
|
+
RGBA16Float = 115,
|
|
62
|
+
RGBA32Uint = 123,
|
|
63
|
+
RGBA32Sint = 124,
|
|
64
|
+
RGBA32Float = 125,
|
|
65
|
+
BC1_RGBA = 130,
|
|
66
|
+
BC1_RGBA_sRGB = 131,
|
|
67
|
+
BC2_RGBA = 132,
|
|
68
|
+
BC2_RGBA_sRGB = 133,
|
|
69
|
+
BC3_RGBA = 134,
|
|
70
|
+
BC3_RGBA_sRGB = 135,
|
|
71
|
+
BC4_RUnorm = 140,
|
|
72
|
+
BC4_RSnorm = 141,
|
|
73
|
+
BC5_RGUnorm = 142,
|
|
74
|
+
BC5_RGSnorm = 143,
|
|
75
|
+
BC6H_RGBFloat = 150,
|
|
76
|
+
BC6H_RGBUfloat = 151,
|
|
77
|
+
BC7_RGBAUnorm = 152,
|
|
78
|
+
BC7_RGBAUnorm_sRGB = 153,
|
|
79
|
+
PVRTC_RGB_2BPP = 160,
|
|
80
|
+
PVRTC_RGB_2BPP_sRGB = 161,
|
|
81
|
+
PVRTC_RGB_4BPP = 162,
|
|
82
|
+
PVRTC_RGB_4BPP_sRGB = 163,
|
|
83
|
+
PVRTC_RGBA_2BPP = 164,
|
|
84
|
+
PVRTC_RGBA_2BPP_sRGB = 165,
|
|
85
|
+
PVRTC_RGBA_4BPP = 166,
|
|
86
|
+
PVRTC_RGBA_4BPP_sRGB = 167,
|
|
87
|
+
EAC_R11Unorm = 170,
|
|
88
|
+
EAC_R11Snorm = 172,
|
|
89
|
+
EAC_RG11Unorm = 174,
|
|
90
|
+
EAC_RG11Snorm = 176,
|
|
91
|
+
EAC_RGBA8 = 178,
|
|
92
|
+
EAC_RGBA8_sRGB = 179,
|
|
93
|
+
ETC2_RGB8 = 180,
|
|
94
|
+
ETC2_RGB8_sRGB = 181,
|
|
95
|
+
ETC2_RGB8A1 = 182,
|
|
96
|
+
ETC2_RGB8A1_sRGB = 183,
|
|
97
|
+
ASTC_4x4_sRGB = 186,
|
|
98
|
+
ASTC_5x4_sRGB = 187,
|
|
99
|
+
ASTC_5x5_sRGB = 188,
|
|
100
|
+
ASTC_6x5_sRGB = 189,
|
|
101
|
+
ASTC_6x6_sRGB = 190,
|
|
102
|
+
ASTC_8x5_sRGB = 192,
|
|
103
|
+
ASTC_8x6_sRGB = 193,
|
|
104
|
+
ASTC_8x8_sRGB = 194,
|
|
105
|
+
ASTC_10x5_sRGB = 195,
|
|
106
|
+
ASTC_10x6_sRGB = 196,
|
|
107
|
+
ASTC_10x8_sRGB = 197,
|
|
108
|
+
ASTC_10x10_sRGB = 198,
|
|
109
|
+
ASTC_12x10_sRGB = 199,
|
|
110
|
+
ASTC_12x12_sRGB = 200,
|
|
111
|
+
ASTC_4x4_LDR = 204,
|
|
112
|
+
ASTC_5x4_LDR = 205,
|
|
113
|
+
ASTC_5x5_LDR = 206,
|
|
114
|
+
ASTC_6x5_LDR = 207,
|
|
115
|
+
ASTC_6x6_LDR = 208,
|
|
116
|
+
ASTC_8x5_LDR = 210,
|
|
117
|
+
ASTC_8x6_LDR = 211,
|
|
118
|
+
ASTC_8x8_LDR = 212,
|
|
119
|
+
ASTC_10x5_LDR = 213,
|
|
120
|
+
ASTC_10x6_LDR = 214,
|
|
121
|
+
ASTC_10x8_LDR = 215,
|
|
122
|
+
ASTC_10x10_LDR = 216,
|
|
123
|
+
ASTC_12x10_LDR = 217,
|
|
124
|
+
ASTC_12x12_LDR = 218,
|
|
125
|
+
ASTC_4x4_HDR = 222,
|
|
126
|
+
ASTC_5x4_HDR = 223,
|
|
127
|
+
ASTC_5x5_HDR = 224,
|
|
128
|
+
ASTC_6x5_HDR = 225,
|
|
129
|
+
ASTC_6x6_HDR = 226,
|
|
130
|
+
ASTC_8x5_HDR = 228,
|
|
131
|
+
ASTC_8x6_HDR = 229,
|
|
132
|
+
ASTC_8x8_HDR = 230,
|
|
133
|
+
ASTC_10x5_HDR = 231,
|
|
134
|
+
ASTC_10x6_HDR = 232,
|
|
135
|
+
ASTC_10x8_HDR = 233,
|
|
136
|
+
ASTC_10x10_HDR = 234,
|
|
137
|
+
ASTC_12x10_HDR = 235,
|
|
138
|
+
ASTC_12x12_HDR = 236,
|
|
139
|
+
GBGR422 = 240,
|
|
140
|
+
BGRG422 = 241,
|
|
141
|
+
Depth16Unorm = 250,
|
|
142
|
+
Depth32Float = 252,
|
|
143
|
+
Stencil8 = 253,
|
|
144
|
+
Depth24Unorm_Stencil8 = 255,
|
|
145
|
+
Depth32Float_Stencil8 = 260,
|
|
146
|
+
X32_Stencil8 = 261,
|
|
147
|
+
X24_Stencil8 = 262,
|
|
148
|
+
BGRA10_XR = 552,
|
|
149
|
+
BGRA10_XR_SRGB = 553,
|
|
150
|
+
BGR10_XR = 554,
|
|
151
|
+
BGR10_XR_SRGB = 555,
|
|
152
|
+
}
|