This change vendors `wgpu` library in-tree and hooks up the initialization bits. It implements adapter and device initialization and adds a simple test.
Current status:
- [x] Architecture
- [x] figure out the IPC story
- [ ] move wgpu crates into a dedicated folder (let's follow up with this)
- [x] Review
- [x] WebIDL changes by DOM peers
- [x] Linux
- [x] avoid depending on spirv_cross - https://github.com/gfx-rs/wgpu/pull/371
- [x] macOS
- [x] due to cross-compiling shaders - https://github.com/gfx-rs/gfx/pull/3047
- [x] need the dependency update
- [x] stop using gcc - https://github.com/SSheldon/rust-objc-exception/pull/5
- [x] unexpected SSL header collision - https://phabricator.services.mozilla.com/D51148
- [x] undefined Metal symbols
- [x] missing webrtc headers for IPDL magic - https://phabricator.services.mozilla.com/D51558
- [x] Windows
- [x] due to "ipc-channel" not supporting Windows yet - https://github.com/servo/ipc-channel/pull/233~~
- [x] due to some exceptional stuff - https://github.com/grovesNL/spirv_cross/issues/121
- [x] undefined symbol: `D3D12CreateDevice`
- [x] d3d12.dll is not found, dxgi1_4 doesn't present
- [x] d3d11.dll and dxgi.dll need to be explicitly loaded on win32 mingw - https://github.com/gfx-rs/gfx/pull/3076
- [x] libbacktrace fails to link on win32 mingw
- [x] cc mislinking C++ standard library - https://github.com/alexcrichton/cc-rs/pull/455
- [x] Android
- [x] spirv-cross fails to build - https://github.com/KhronosGroup/SPIRV-Cross/pull/1193
Update-1:
We decided to go with IPDL mechanism instead of Rust based ipc-channel (or any alternatives), which unblocks Windows build.
Update-2:
It appears that WebGPUThreading isn't needed any more as the child thread (and its event loop) is now managed by IPDL infrastructure. This PR removes it 🎉 .
Update-3:
InstanceProvider is also removed.
Update-4:
All set, the try is green, waiting for dependent changes to go in.
Differential Revision: https://phabricator.services.mozilla.com/D49458
91 lines
2.0 KiB
Rust
91 lines
2.0 KiB
Rust
|
||
extern crate arrayvec;
|
||
#[macro_use] extern crate bencher;
|
||
|
||
use arrayvec::ArrayString;
|
||
|
||
use bencher::Bencher;
|
||
|
||
fn try_push_c(b: &mut Bencher) {
|
||
let mut v = ArrayString::<[u8; 512]>::new();
|
||
b.iter(|| {
|
||
v.clear();
|
||
while v.try_push('c').is_ok() {
|
||
}
|
||
v.len()
|
||
});
|
||
b.bytes = v.capacity() as u64;
|
||
}
|
||
|
||
fn try_push_alpha(b: &mut Bencher) {
|
||
let mut v = ArrayString::<[u8; 512]>::new();
|
||
b.iter(|| {
|
||
v.clear();
|
||
while v.try_push('α').is_ok() {
|
||
}
|
||
v.len()
|
||
});
|
||
b.bytes = v.capacity() as u64;
|
||
}
|
||
|
||
// Yes, pushing a string char-by-char is slow. Use .push_str.
|
||
fn try_push_string(b: &mut Bencher) {
|
||
let mut v = ArrayString::<[u8; 512]>::new();
|
||
let input = "abcαβγ“”";
|
||
b.iter(|| {
|
||
v.clear();
|
||
for ch in input.chars().cycle() {
|
||
if !v.try_push(ch).is_ok() {
|
||
break;
|
||
}
|
||
}
|
||
v.len()
|
||
});
|
||
b.bytes = v.capacity() as u64;
|
||
}
|
||
|
||
fn push_c(b: &mut Bencher) {
|
||
let mut v = ArrayString::<[u8; 512]>::new();
|
||
b.iter(|| {
|
||
v.clear();
|
||
while !v.is_full() {
|
||
v.push('c');
|
||
}
|
||
v.len()
|
||
});
|
||
b.bytes = v.capacity() as u64;
|
||
}
|
||
|
||
fn push_alpha(b: &mut Bencher) {
|
||
let mut v = ArrayString::<[u8; 512]>::new();
|
||
b.iter(|| {
|
||
v.clear();
|
||
while !v.is_full() {
|
||
v.push('α');
|
||
}
|
||
v.len()
|
||
});
|
||
b.bytes = v.capacity() as u64;
|
||
}
|
||
|
||
fn push_string(b: &mut Bencher) {
|
||
let mut v = ArrayString::<[u8; 512]>::new();
|
||
let input = "abcαβγ“”";
|
||
b.iter(|| {
|
||
v.clear();
|
||
for ch in input.chars().cycle() {
|
||
if !v.is_full() {
|
||
v.push(ch);
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
v.len()
|
||
});
|
||
b.bytes = v.capacity() as u64;
|
||
}
|
||
|
||
benchmark_group!(benches, try_push_c, try_push_alpha, try_push_string, push_c,
|
||
push_alpha, push_string);
|
||
benchmark_main!(benches);
|