@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,119 @@
|
|
|
1
|
+
use crate::{MTLStorageMode, NSUInteger};
|
|
2
|
+
use std::mem;
|
|
3
|
+
|
|
4
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcountersamplebufferdescriptor>
|
|
5
|
+
pub enum MTLCounterSampleBufferDescriptor {}
|
|
6
|
+
|
|
7
|
+
foreign_obj_type! {
|
|
8
|
+
type CType = MTLCounterSampleBufferDescriptor;
|
|
9
|
+
pub struct CounterSampleBufferDescriptor;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl CounterSampleBufferDescriptor {
|
|
13
|
+
pub fn new() -> Self {
|
|
14
|
+
let class = class!(MTLCounterSampleBufferDescriptor);
|
|
15
|
+
unsafe { msg_send![class, new] }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl CounterSampleBufferDescriptorRef {
|
|
20
|
+
pub fn counter_set(&self) -> &CounterSetRef {
|
|
21
|
+
unsafe { msg_send![self, counterSet] }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
pub fn set_counter_set(&self, counter_set: &CounterSetRef) {
|
|
25
|
+
unsafe { msg_send![self, setCounterSet: counter_set] }
|
|
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
|
+
pub fn set_label(&self, label: &str) {
|
|
36
|
+
unsafe {
|
|
37
|
+
let nslabel = crate::nsstring_from_str(label);
|
|
38
|
+
let () = msg_send![self, setLabel: nslabel];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn sample_count(&self) -> u64 {
|
|
43
|
+
unsafe { msg_send![self, sampleCount] }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pub fn set_sample_count(&self, sample_count: u64) {
|
|
47
|
+
unsafe { msg_send![self, setSampleCount: sample_count] }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pub fn storage_mode(&self) -> MTLStorageMode {
|
|
51
|
+
unsafe { msg_send![self, storageMode] }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pub fn set_storage_mode(&self, storage_mode: MTLStorageMode) {
|
|
55
|
+
unsafe { msg_send![self, setStorageMode: storage_mode] }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcountersamplebuffer>
|
|
60
|
+
pub enum MTLCounterSampleBuffer {}
|
|
61
|
+
|
|
62
|
+
foreign_obj_type! {
|
|
63
|
+
type CType = MTLCounterSampleBuffer;
|
|
64
|
+
pub struct CounterSampleBuffer;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
impl CounterSampleBufferRef {
|
|
68
|
+
pub fn sample_count(&self) -> u64 {
|
|
69
|
+
unsafe { msg_send![self, sampleCount] }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
pub fn resolve_counter_range(&self, range: crate::NSRange) -> Vec<NSUInteger> {
|
|
73
|
+
let mut data = vec![0 as NSUInteger; range.length as usize];
|
|
74
|
+
let total_bytes = range.length * mem::size_of::<NSUInteger>() as u64;
|
|
75
|
+
unsafe {
|
|
76
|
+
let ns_data: *mut crate::Object = msg_send![self, resolveCounterRange: range];
|
|
77
|
+
let () = msg_send![ns_data, getBytes: data.as_mut_ptr() length: total_bytes];
|
|
78
|
+
}
|
|
79
|
+
data
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcounter>
|
|
84
|
+
pub enum MTLCounter {}
|
|
85
|
+
|
|
86
|
+
foreign_obj_type! {
|
|
87
|
+
type CType = MTLCounter;
|
|
88
|
+
pub struct Counter;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
impl CounterRef {}
|
|
92
|
+
|
|
93
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcounterset>
|
|
94
|
+
pub enum MTLCounterSet {}
|
|
95
|
+
|
|
96
|
+
foreign_obj_type! {
|
|
97
|
+
type CType = MTLCounterSet;
|
|
98
|
+
pub struct CounterSet;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
impl CounterSetRef {
|
|
102
|
+
pub fn name(&self) -> &str {
|
|
103
|
+
unsafe {
|
|
104
|
+
let name = msg_send![self, name];
|
|
105
|
+
crate::nsstring_as_str(name)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcommoncounterset>
|
|
111
|
+
pub enum MTLCommonCounterSet {}
|
|
112
|
+
|
|
113
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcommoncounter>
|
|
114
|
+
pub enum MTLCommonCounter {}
|
|
115
|
+
|
|
116
|
+
foreign_obj_type! {
|
|
117
|
+
type CType = MTLCommonCounter;
|
|
118
|
+
pub struct CommonCounter;
|
|
119
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
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 crate::DeviceRef;
|
|
9
|
+
use objc::runtime::{NO, YES};
|
|
10
|
+
|
|
11
|
+
/// See <https://developer.apple.com/documentation/metal/mtlcomparefunction>
|
|
12
|
+
#[repr(u64)]
|
|
13
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
14
|
+
pub enum MTLCompareFunction {
|
|
15
|
+
Never = 0,
|
|
16
|
+
Less = 1,
|
|
17
|
+
Equal = 2,
|
|
18
|
+
LessEqual = 3,
|
|
19
|
+
Greater = 4,
|
|
20
|
+
NotEqual = 5,
|
|
21
|
+
GreaterEqual = 6,
|
|
22
|
+
Always = 7,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// See <https://developer.apple.com/documentation/metal/mtlstenciloperation>
|
|
26
|
+
#[repr(u64)]
|
|
27
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
28
|
+
pub enum MTLStencilOperation {
|
|
29
|
+
Keep = 0,
|
|
30
|
+
Zero = 1,
|
|
31
|
+
Replace = 2,
|
|
32
|
+
IncrementClamp = 3,
|
|
33
|
+
DecrementClamp = 4,
|
|
34
|
+
Invert = 5,
|
|
35
|
+
IncrementWrap = 6,
|
|
36
|
+
DecrementWrap = 7,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/// See <https://developer.apple.com/documentation/metal/mtlstencildescriptor>
|
|
40
|
+
pub enum MTLStencilDescriptor {}
|
|
41
|
+
|
|
42
|
+
foreign_obj_type! {
|
|
43
|
+
type CType = MTLStencilDescriptor;
|
|
44
|
+
pub struct StencilDescriptor;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
impl StencilDescriptor {
|
|
48
|
+
pub fn new() -> Self {
|
|
49
|
+
unsafe {
|
|
50
|
+
let class = class!(MTLStencilDescriptor);
|
|
51
|
+
msg_send![class, new]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
impl StencilDescriptorRef {
|
|
57
|
+
pub fn stencil_compare_function(&self) -> MTLCompareFunction {
|
|
58
|
+
unsafe { msg_send![self, stencilCompareFunction] }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
pub fn set_stencil_compare_function(&self, func: MTLCompareFunction) {
|
|
62
|
+
unsafe { msg_send![self, setStencilCompareFunction: func] }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
pub fn stencil_failure_operation(&self) -> MTLStencilOperation {
|
|
66
|
+
unsafe { msg_send![self, stencilFailureOperation] }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
pub fn set_stencil_failure_operation(&self, operation: MTLStencilOperation) {
|
|
70
|
+
unsafe { msg_send![self, setStencilFailureOperation: operation] }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub fn depth_failure_operation(&self) -> MTLStencilOperation {
|
|
74
|
+
unsafe { msg_send![self, depthFailureOperation] }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
pub fn set_depth_failure_operation(&self, operation: MTLStencilOperation) {
|
|
78
|
+
unsafe { msg_send![self, setDepthFailureOperation: operation] }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pub fn depth_stencil_pass_operation(&self) -> MTLStencilOperation {
|
|
82
|
+
unsafe { msg_send![self, depthStencilPassOperation] }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
pub fn set_depth_stencil_pass_operation(&self, operation: MTLStencilOperation) {
|
|
86
|
+
unsafe { msg_send![self, setDepthStencilPassOperation: operation] }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
pub fn read_mask(&self) -> u32 {
|
|
90
|
+
unsafe { msg_send![self, readMask] }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
pub fn set_read_mask(&self, mask: u32) {
|
|
94
|
+
unsafe { msg_send![self, setReadMask: mask] }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
pub fn write_mask(&self) -> u32 {
|
|
98
|
+
unsafe { msg_send![self, writeMask] }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
pub fn set_write_mask(&self, mask: u32) {
|
|
102
|
+
unsafe { msg_send![self, setWriteMask: mask] }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// See <https://developer.apple.com/documentation/metal/mtldepthstencildescriptor>
|
|
107
|
+
pub enum MTLDepthStencilDescriptor {}
|
|
108
|
+
|
|
109
|
+
foreign_obj_type! {
|
|
110
|
+
type CType = MTLDepthStencilDescriptor;
|
|
111
|
+
pub struct DepthStencilDescriptor;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
impl DepthStencilDescriptor {
|
|
115
|
+
pub fn new() -> Self {
|
|
116
|
+
unsafe {
|
|
117
|
+
let class = class!(MTLDepthStencilDescriptor);
|
|
118
|
+
msg_send![class, new]
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
impl DepthStencilDescriptorRef {
|
|
124
|
+
pub fn depth_compare_function(&self) -> MTLCompareFunction {
|
|
125
|
+
unsafe { msg_send![self, depthCompareFunction] }
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
pub fn set_depth_compare_function(&self, func: MTLCompareFunction) {
|
|
129
|
+
unsafe { msg_send![self, setDepthCompareFunction: func] }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
pub fn depth_write_enabled(&self) -> bool {
|
|
133
|
+
unsafe { msg_send_bool![self, isDepthWriteEnabled] }
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
pub fn set_depth_write_enabled(&self, enabled: bool) {
|
|
137
|
+
unsafe { msg_send![self, setDepthWriteEnabled: enabled] }
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
pub fn front_face_stencil(&self) -> Option<&StencilDescriptorRef> {
|
|
141
|
+
unsafe { msg_send![self, frontFaceStencil] }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
pub fn set_front_face_stencil(&self, descriptor: Option<&StencilDescriptorRef>) {
|
|
145
|
+
unsafe { msg_send![self, setFrontFaceStencil: descriptor] }
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
pub fn back_face_stencil(&self) -> Option<&StencilDescriptorRef> {
|
|
149
|
+
unsafe { msg_send![self, backFaceStencil] }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
pub fn set_back_face_stencil(&self, descriptor: Option<&StencilDescriptorRef>) {
|
|
153
|
+
unsafe { msg_send![self, setBackFaceStencil: descriptor] }
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
pub fn label(&self) -> &str {
|
|
157
|
+
unsafe {
|
|
158
|
+
let label = msg_send![self, label];
|
|
159
|
+
crate::nsstring_as_str(label)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
pub fn set_label(&self, label: &str) {
|
|
164
|
+
unsafe {
|
|
165
|
+
let nslabel = crate::nsstring_from_str(label);
|
|
166
|
+
let () = msg_send![self, setLabel: nslabel];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/// See <https://developer.apple.com/documentation/metal/mtldepthstencilstate>
|
|
172
|
+
pub enum MTLDepthStencilState {}
|
|
173
|
+
|
|
174
|
+
foreign_obj_type! {
|
|
175
|
+
type CType = MTLDepthStencilState;
|
|
176
|
+
pub struct DepthStencilState;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
impl DepthStencilStateRef {
|
|
180
|
+
pub fn device(&self) -> &DeviceRef {
|
|
181
|
+
unsafe { msg_send![self, device] }
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
pub fn label(&self) -> &str {
|
|
185
|
+
unsafe {
|
|
186
|
+
let label = msg_send![self, label];
|
|
187
|
+
crate::nsstring_as_str(label)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|