@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,90 @@
|
|
|
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::NSUInteger;
|
|
9
|
+
use std::default::Default;
|
|
10
|
+
|
|
11
|
+
/// See <https://developer.apple.com/documentation/metal/mtlorigin>
|
|
12
|
+
#[repr(C)]
|
|
13
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
|
|
14
|
+
pub struct MTLOrigin {
|
|
15
|
+
pub x: NSUInteger,
|
|
16
|
+
pub y: NSUInteger,
|
|
17
|
+
pub z: NSUInteger,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/// See <https://developer.apple.com/documentation/metal/mtlsize>
|
|
21
|
+
#[repr(C)]
|
|
22
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
|
|
23
|
+
pub struct MTLSize {
|
|
24
|
+
pub width: NSUInteger,
|
|
25
|
+
pub height: NSUInteger,
|
|
26
|
+
pub depth: NSUInteger,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
impl MTLSize {
|
|
30
|
+
pub fn new(width: NSUInteger, height: NSUInteger, depth: NSUInteger) -> Self {
|
|
31
|
+
Self {
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
34
|
+
depth,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/// See <https://developer.apple.com/documentation/metal/mtlregion>
|
|
40
|
+
#[repr(C)]
|
|
41
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
|
|
42
|
+
pub struct MTLRegion {
|
|
43
|
+
pub origin: MTLOrigin,
|
|
44
|
+
pub size: MTLSize,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
impl MTLRegion {
|
|
48
|
+
#[inline]
|
|
49
|
+
pub fn new_1d(x: NSUInteger, width: NSUInteger) -> Self {
|
|
50
|
+
Self::new_2d(x, 0, width, 1)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#[inline]
|
|
54
|
+
pub fn new_2d(x: NSUInteger, y: NSUInteger, width: NSUInteger, height: NSUInteger) -> Self {
|
|
55
|
+
Self::new_3d(x, y, 0, width, height, 1)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#[inline]
|
|
59
|
+
pub fn new_3d(
|
|
60
|
+
x: NSUInteger,
|
|
61
|
+
y: NSUInteger,
|
|
62
|
+
z: NSUInteger,
|
|
63
|
+
width: NSUInteger,
|
|
64
|
+
height: NSUInteger,
|
|
65
|
+
depth: NSUInteger,
|
|
66
|
+
) -> Self {
|
|
67
|
+
Self {
|
|
68
|
+
origin: MTLOrigin { x, y, z },
|
|
69
|
+
size: MTLSize {
|
|
70
|
+
width,
|
|
71
|
+
height,
|
|
72
|
+
depth,
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// See <https://developer.apple.com/documentation/metal/mtlsampleposition>
|
|
79
|
+
#[repr(C)]
|
|
80
|
+
#[derive(Copy, Clone, Debug, PartialEq, Default)]
|
|
81
|
+
pub struct MTLSamplePosition {
|
|
82
|
+
pub x: f32,
|
|
83
|
+
pub y: f32,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#[repr(C)]
|
|
87
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
|
|
88
|
+
pub struct MTLResourceID {
|
|
89
|
+
pub _impl: u64,
|
|
90
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
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::NSUInteger;
|
|
9
|
+
|
|
10
|
+
/// See <https://developer.apple.com/documentation/metal/mtlvertexformat>
|
|
11
|
+
#[repr(u64)]
|
|
12
|
+
#[allow(non_camel_case_types)]
|
|
13
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
14
|
+
pub enum MTLVertexFormat {
|
|
15
|
+
Invalid = 0,
|
|
16
|
+
UChar2 = 1,
|
|
17
|
+
UChar3 = 2,
|
|
18
|
+
UChar4 = 3,
|
|
19
|
+
Char2 = 4,
|
|
20
|
+
Char3 = 5,
|
|
21
|
+
Char4 = 6,
|
|
22
|
+
UChar2Normalized = 7,
|
|
23
|
+
UChar3Normalized = 8,
|
|
24
|
+
UChar4Normalized = 9,
|
|
25
|
+
Char2Normalized = 10,
|
|
26
|
+
Char3Normalized = 11,
|
|
27
|
+
Char4Normalized = 12,
|
|
28
|
+
UShort2 = 13,
|
|
29
|
+
UShort3 = 14,
|
|
30
|
+
UShort4 = 15,
|
|
31
|
+
Short2 = 16,
|
|
32
|
+
Short3 = 17,
|
|
33
|
+
Short4 = 18,
|
|
34
|
+
UShort2Normalized = 19,
|
|
35
|
+
UShort3Normalized = 20,
|
|
36
|
+
UShort4Normalized = 21,
|
|
37
|
+
Short2Normalized = 22,
|
|
38
|
+
Short3Normalized = 23,
|
|
39
|
+
Short4Normalized = 24,
|
|
40
|
+
Half2 = 25,
|
|
41
|
+
Half3 = 26,
|
|
42
|
+
Half4 = 27,
|
|
43
|
+
Float = 28,
|
|
44
|
+
Float2 = 29,
|
|
45
|
+
Float3 = 30,
|
|
46
|
+
Float4 = 31,
|
|
47
|
+
Int = 32,
|
|
48
|
+
Int2 = 33,
|
|
49
|
+
Int3 = 34,
|
|
50
|
+
Int4 = 35,
|
|
51
|
+
UInt = 36,
|
|
52
|
+
UInt2 = 37,
|
|
53
|
+
UInt3 = 38,
|
|
54
|
+
UInt4 = 39,
|
|
55
|
+
Int1010102Normalized = 40,
|
|
56
|
+
UInt1010102Normalized = 41,
|
|
57
|
+
UChar4Normalized_BGRA = 42,
|
|
58
|
+
UChar = 45,
|
|
59
|
+
Char = 46,
|
|
60
|
+
UCharNormalized = 47,
|
|
61
|
+
CharNormalized = 48,
|
|
62
|
+
UShort = 49,
|
|
63
|
+
Short = 50,
|
|
64
|
+
UShortNormalized = 51,
|
|
65
|
+
ShortNormalized = 52,
|
|
66
|
+
Half = 53,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// See <https://developer.apple.com/documentation/metal/mtlvertexstepfunction>
|
|
70
|
+
#[repr(u64)]
|
|
71
|
+
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
72
|
+
pub enum MTLVertexStepFunction {
|
|
73
|
+
Constant = 0,
|
|
74
|
+
PerVertex = 1,
|
|
75
|
+
PerInstance = 2,
|
|
76
|
+
PerPatch = 3,
|
|
77
|
+
PerPatchControlPoint = 4,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// See <https://developer.apple.com/documentation/metal/mtlvertexbufferlayoutdescriptor>
|
|
81
|
+
pub enum MTLVertexBufferLayoutDescriptor {}
|
|
82
|
+
|
|
83
|
+
foreign_obj_type! {
|
|
84
|
+
type CType = MTLVertexBufferLayoutDescriptor;
|
|
85
|
+
pub struct VertexBufferLayoutDescriptor;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
impl VertexBufferLayoutDescriptor {
|
|
89
|
+
pub fn new() -> Self {
|
|
90
|
+
unsafe {
|
|
91
|
+
let class = class!(MTLVertexBufferLayoutDescriptor);
|
|
92
|
+
msg_send![class, new]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
impl VertexBufferLayoutDescriptorRef {
|
|
98
|
+
pub fn stride(&self) -> NSUInteger {
|
|
99
|
+
unsafe { msg_send![self, stride] }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
pub fn set_stride(&self, stride: NSUInteger) {
|
|
103
|
+
unsafe { msg_send![self, setStride: stride] }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
pub fn step_function(&self) -> MTLVertexStepFunction {
|
|
107
|
+
unsafe { msg_send![self, stepFunction] }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
pub fn set_step_function(&self, func: MTLVertexStepFunction) {
|
|
111
|
+
unsafe { msg_send![self, setStepFunction: func] }
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
pub fn step_rate(&self) -> NSUInteger {
|
|
115
|
+
unsafe { msg_send![self, stepRate] }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
pub fn set_step_rate(&self, step_rate: NSUInteger) {
|
|
119
|
+
unsafe { msg_send![self, setStepRate: step_rate] }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// See <https://developer.apple.com/documentation/metal/mtlvertexbufferlayoutdescriptorarray>
|
|
124
|
+
pub enum MTLVertexBufferLayoutDescriptorArray {}
|
|
125
|
+
|
|
126
|
+
foreign_obj_type! {
|
|
127
|
+
type CType = MTLVertexBufferLayoutDescriptorArray;
|
|
128
|
+
pub struct VertexBufferLayoutDescriptorArray;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
impl VertexBufferLayoutDescriptorArrayRef {
|
|
132
|
+
pub fn object_at(&self, index: NSUInteger) -> Option<&VertexBufferLayoutDescriptorRef> {
|
|
133
|
+
unsafe { msg_send![self, objectAtIndexedSubscript: index] }
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
pub fn set_object_at(
|
|
137
|
+
&self,
|
|
138
|
+
index: NSUInteger,
|
|
139
|
+
layout: Option<&VertexBufferLayoutDescriptorRef>,
|
|
140
|
+
) {
|
|
141
|
+
unsafe {
|
|
142
|
+
msg_send![self, setObject:layout
|
|
143
|
+
atIndexedSubscript:index]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// See <https://developer.apple.com/documentation/metal/mtlvertexattributedescriptor>
|
|
149
|
+
pub enum MTLVertexAttributeDescriptor {}
|
|
150
|
+
|
|
151
|
+
foreign_obj_type! {
|
|
152
|
+
type CType = MTLVertexAttributeDescriptor;
|
|
153
|
+
pub struct VertexAttributeDescriptor;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
impl VertexAttributeDescriptor {
|
|
157
|
+
pub fn new() -> Self {
|
|
158
|
+
unsafe {
|
|
159
|
+
let class = class!(MTLVertexAttributeDescriptor);
|
|
160
|
+
msg_send![class, new]
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
impl VertexAttributeDescriptorRef {
|
|
166
|
+
pub fn format(&self) -> MTLVertexFormat {
|
|
167
|
+
unsafe { msg_send![self, format] }
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
pub fn set_format(&self, format: MTLVertexFormat) {
|
|
171
|
+
unsafe { msg_send![self, setFormat: format] }
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
pub fn offset(&self) -> NSUInteger {
|
|
175
|
+
unsafe { msg_send![self, offset] }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
pub fn set_offset(&self, offset: NSUInteger) {
|
|
179
|
+
unsafe { msg_send![self, setOffset: offset] }
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
pub fn buffer_index(&self) -> NSUInteger {
|
|
183
|
+
unsafe { msg_send![self, bufferIndex] }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
pub fn set_buffer_index(&self, index: NSUInteger) {
|
|
187
|
+
unsafe { msg_send![self, setBufferIndex: index] }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/// See <https://developer.apple.com/documentation/metal/mtlvertexattributedescriptorarray>
|
|
192
|
+
pub enum MTLVertexAttributeDescriptorArray {}
|
|
193
|
+
|
|
194
|
+
foreign_obj_type! {
|
|
195
|
+
type CType = MTLVertexAttributeDescriptorArray;
|
|
196
|
+
pub struct VertexAttributeDescriptorArray;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
impl VertexAttributeDescriptorArrayRef {
|
|
200
|
+
pub fn object_at(&self, index: NSUInteger) -> Option<&VertexAttributeDescriptorRef> {
|
|
201
|
+
unsafe { msg_send![self, objectAtIndexedSubscript: index] }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
pub fn set_object_at(
|
|
205
|
+
&self,
|
|
206
|
+
index: NSUInteger,
|
|
207
|
+
attribute: Option<&VertexAttributeDescriptorRef>,
|
|
208
|
+
) {
|
|
209
|
+
unsafe {
|
|
210
|
+
msg_send![self, setObject:attribute
|
|
211
|
+
atIndexedSubscript:index]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/// See <https://developer.apple.com/documentation/metal/mtlvertexdescriptor>
|
|
217
|
+
pub enum MTLVertexDescriptor {}
|
|
218
|
+
|
|
219
|
+
foreign_obj_type! {
|
|
220
|
+
type CType = MTLVertexDescriptor;
|
|
221
|
+
pub struct VertexDescriptor;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
impl VertexDescriptor {
|
|
225
|
+
pub fn new<'a>() -> &'a VertexDescriptorRef {
|
|
226
|
+
unsafe {
|
|
227
|
+
let class = class!(MTLVertexDescriptor);
|
|
228
|
+
msg_send![class, vertexDescriptor]
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
impl VertexDescriptorRef {
|
|
234
|
+
pub fn layouts(&self) -> &VertexBufferLayoutDescriptorArrayRef {
|
|
235
|
+
unsafe { msg_send![self, layouts] }
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
pub fn attributes(&self) -> &VertexAttributeDescriptorArrayRef {
|
|
239
|
+
unsafe { msg_send![self, attributes] }
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
#[cfg(feature = "private")]
|
|
243
|
+
pub unsafe fn serialize_descriptor(&self) -> *mut std::ffi::c_void {
|
|
244
|
+
msg_send![self, newSerializedDescriptor]
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
pub fn reset(&self) {
|
|
248
|
+
unsafe { msg_send![self, reset] }
|
|
249
|
+
}
|
|
250
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloomengine/engine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Bloom Engine: native TypeScript game engine compiled by Perry",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"native/tvos/Cargo.toml",
|
|
37
37
|
"native/tvos/Cargo.lock",
|
|
38
38
|
"native/tvos/src/**",
|
|
39
|
+
"native/tvos/metal-patched/Cargo.toml",
|
|
40
|
+
"native/tvos/metal-patched/src/**",
|
|
41
|
+
"native/tvos/metal-patched/LICENSE-APACHE",
|
|
42
|
+
"native/tvos/metal-patched/LICENSE-MIT",
|
|
39
43
|
"native/watchos/Cargo.toml",
|
|
40
44
|
"native/watchos/Cargo.lock",
|
|
41
45
|
"native/watchos/src/**",
|