зеркало из https://github.com/mozilla/gecko-dev.git
1c5b01ed15
This change vendors `wgpu` library in-tree and hooks up the initialization bits. It implements adapter and device initialization and adds a simple test. Complementary ecosystem tracker - https://github.com/gfx-rs/wgpu/issues/374 Current status: - [x] General - [x] figure out the IPC story - [ ] move wgpu crates into a dedicated folder (postponed as https://bugzilla.mozilla.org/show_bug.cgi?id=1594182) - [x] neko rebasing disaster - [x] Linux - [x] avoid depending on spirv_cross - [x] macOS - [x] due to cross-compiling shaders - [x] need the dependency update - [x] stop using gcc - [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] spirv-cross linking failure in ASAN - https://phabricator.services.mozilla.com/D52688 - [x] Windows - [x] due to "ipc-channel" not supporting Windows yet - [x] due to some exceptional stuff - [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 - [x] libbacktrace fails to link on win32 mingw - [x] cc mislinking C++ standard library - [x] Android - [x] spirv-cross fails to build due to exceptions 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 --HG-- rename : dom/webgpu/Adapter.cpp => dom/webgpu/ipc/WebGPUTypes.h rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/ash/Cargo.toml rename : third_party/rust/uluru/Cargo.toml => third_party/rust/atom/Cargo.toml rename : third_party/rust/core-graphics/Cargo.toml => third_party/rust/cocoa/Cargo.toml rename : third_party/rust/crossbeam-deque/LICENSE-MIT => third_party/rust/cocoa/LICENSE-MIT rename : third_party/rust/core-graphics/src/lib.rs => third_party/rust/cocoa/src/lib.rs rename : third_party/rust/uluru/Cargo.toml => third_party/rust/colorful/Cargo.toml rename : third_party/rust/uluru/Cargo.toml => third_party/rust/copyless/Cargo.toml rename : third_party/rust/crossbeam-utils/.cargo-checksum.json => third_party/rust/crossbeam-utils-0.6.5/.cargo-checksum.json rename : third_party/rust/crossbeam-utils/CHANGELOG.md => third_party/rust/crossbeam-utils-0.6.5/CHANGELOG.md rename : third_party/rust/crossbeam-utils/Cargo.toml => third_party/rust/crossbeam-utils-0.6.5/Cargo.toml rename : third_party/rust/crossbeam-deque/LICENSE-MIT => third_party/rust/crossbeam-utils-0.6.5/LICENSE-MIT rename : third_party/rust/crossbeam-utils/README.md => third_party/rust/crossbeam-utils-0.6.5/README.md rename : third_party/rust/crossbeam-utils/benches/atomic_cell.rs => third_party/rust/crossbeam-utils-0.6.5/benches/atomic_cell.rs rename : third_party/rust/crossbeam-utils/src/atomic/atomic_cell.rs => third_party/rust/crossbeam-utils-0.6.5/src/atomic/atomic_cell.rs rename : third_party/rust/crossbeam-utils/src/atomic/mod.rs => third_party/rust/crossbeam-utils-0.6.5/src/atomic/mod.rs rename : third_party/rust/crossbeam-utils/src/backoff.rs => third_party/rust/crossbeam-utils-0.6.5/src/backoff.rs rename : third_party/rust/crossbeam-utils/src/cache_padded.rs => third_party/rust/crossbeam-utils-0.6.5/src/cache_padded.rs rename : third_party/rust/crossbeam-utils/src/lib.rs => third_party/rust/crossbeam-utils-0.6.5/src/lib.rs rename : third_party/rust/crossbeam-utils/src/thread.rs => third_party/rust/crossbeam-utils-0.6.5/src/thread.rs rename : third_party/rust/crossbeam-utils/tests/atomic_cell.rs => third_party/rust/crossbeam-utils-0.6.5/tests/atomic_cell.rs rename : third_party/rust/crossbeam-utils/tests/parker.rs => third_party/rust/crossbeam-utils-0.6.5/tests/parker.rs rename : third_party/rust/crossbeam-utils/tests/sharded_lock.rs => third_party/rust/crossbeam-utils-0.6.5/tests/sharded_lock.rs rename : third_party/rust/crossbeam-utils/tests/thread.rs => third_party/rust/crossbeam-utils-0.6.5/tests/thread.rs rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/gfx-auxil/Cargo.toml rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/gfx-backend-empty/Cargo.toml rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/hibitset/Cargo.toml rename : third_party/rust/crossbeam-deque/LICENSE-MIT => third_party/rust/hibitset/LICENSE-MIT rename : third_party/rust/crossbeam-deque/LICENSE-MIT => third_party/rust/metal/LICENSE-MIT rename : third_party/rust/uluru/Cargo.toml => third_party/rust/range-alloc/Cargo.toml rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/raw-window-handle/Cargo.toml rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/relevant/Cargo.toml rename : third_party/rust/crossbeam-deque/LICENSE-MIT => third_party/rust/relevant/LICENSE-MIT rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/rendy-descriptor/Cargo.toml rename : third_party/rust/uluru/Cargo.toml => third_party/rust/shared_library/Cargo.toml rename : third_party/rust/crossbeam-deque/LICENSE-MIT => third_party/rust/shared_library/LICENSE-MIT rename : third_party/rust/blake2b_simd/Cargo.toml => third_party/rust/storage-map/Cargo.toml rename : third_party/rust/core-graphics/Cargo.toml => third_party/rust/x11/Cargo.toml extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
src | ||
tests | ||
.cargo-checksum.json | ||
Cargo.toml | ||
CodeOfConduct.md | ||
README.md | ||
license | ||
rustfmt.toml |
README.md
Colorful
Usage
Basic Usage
extern crate colorful;
use colorful::Color;
use colorful::Colorful;
//use colorful::HSL;
//use colorful::RGB;
fn main() {
let s = "Hello world";
println!("{}", s.color(Color::Blue).bg_color(Color::Yellow).bold());
// println!("{}", s.color(HSL::new(1.0, 1.0, 0.5)).bold());
// println!("{}", s.color(RGB::new(255, 0, 0)).bold());
println!("{}", s.blue().bg_yellow());
}
Gradient
extern crate colorful;
use colorful::Color;
use colorful::Colorful;
fn main() {
println!("{}", "This code is editable and runnable!".gradient(Color::Red));
println!("{}", "¡Este código es editable y ejecutable!".gradient(Color::Green));
println!("{}", "Ce code est modifiable et exécutable !".gradient(Color::Yellow));
println!("{}", "Questo codice è modificabile ed eseguibile!".gradient(Color::Blue));
println!("{}", "このコードは編集して実行出来ます!".gradient(Color::Magenta));
println!("{}", "여기에서 코드를 수정하고 실행할 수 있습니다!".gradient(Color::Cyan));
println!("{}", "Ten kod można edytować oraz uruchomić!".gradient(Color::LightGray));
println!("{}", "Este código é editável e executável!".gradient(Color::DarkGray));
println!("{}", "Этот код можно отредактировать и запустить!".gradient(Color::LightRed));
println!("{}", "Bạn có thể edit và run code trực tiếp!".gradient(Color::LightGreen));
println!("{}", "这段代码是可以编辑并且能够运行的!".gradient(Color::LightYellow));
println!("{}", "Dieser Code kann bearbeitet und ausgeführt werden!".gradient(Color::LightBlue));
println!("{}", "Den här koden kan redigeras och köras!".gradient(Color::LightMagenta));
println!("{}", "Tento kód můžete upravit a spustit".gradient(Color::LightCyan));
println!("{}", "این کد قابلیت ویرایش و اجرا دارد!".gradient(Color::White));
println!("{}", "โค้ดนี้สามารถแก้ไขได้และรันได้".gradient(Color::Grey0));
}
Gradient with style
extern crate colorful;
use colorful::Colorful;
fn main() {
println!("{}", "言葉にできず 凍えたままで 人前ではやさしく生きていた しわよせで こんなふうに雑に 雨の夜にきみを 抱きしめてた".gradient_with_color(HSL::new(0.0, 1.0, 0.5), HSL::new(0.833, 1.0, 0.5)).underlined());
}
Bar chart
extern crate colorful;
use colorful::Colorful;
use colorful::HSL;
fn main() {
let s = "█";
println!("{}\n", "Most Loved, Dreaded, and Wanted Languages".red());
let values = vec![78.9, 75.1, 68.0, 67.0, 65.6, 65.1, 61.9, 60.4];
let languages = vec!["Rust", "Kotlin", "Python", "TypeScript", "Go", "Swift", "JavaScript", "C#"];
let c = languages.iter().max_by_key(|x| x.len()).unwrap();
for (i, value) in values.iter().enumerate() {
let h = (*value as f32 * 15.0 % 360.0) / 360.0;
let length = (value - 30.0) as usize;
println!("{:<width$} | {} {}%\n", languages.get(i).unwrap(), s.repeat(length).gradient(HSL::new(h, 1.0, 0.5)), value, width = c.len());
}
}
Output
Animation
Rainbow
extern crate colorful;
use colorful::Colorful;
fn main() {
let text = format!("{:^50}\n{}\r\n{}", "岳飞 小重山", "昨夜寒蛩不住鸣 惊回千里梦 已三更 起身独自绕阶行 人悄悄 帘外月胧明",
"白首为功名 旧山松竹老 阻归程 欲将心事付瑶琴 知音少 弦断有谁听");
text.rainbow();
}
Output
Neon
extern crate colorful;
use colorful::Colorful;
fn main() {
let text = format!("{:^28}\n{}", "WARNING", "BIG BROTHER IS WATCHING YOU!!!");
text.neon(RGB::new(226, 14, 14), RGB::new(158, 158, 158));
// or you can use text.warn();
}
Output
Terminals compatibility
Terminal | Formatting | Color | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Bold | Dim | Underlined | Blink | Invert | Hidden | 8 | 16 | 88 | 256 | |
aTerm | ~ | |||||||||
Eterm | ~ | ~ | ||||||||
GNOME Terminal | ||||||||||
Guake | ||||||||||
Konsole | ||||||||||
Nautilus Terminal | ||||||||||
rxvt | ~ | |||||||||
Terminator | ||||||||||
Tilda | ||||||||||
XFCE4 Terminal | ||||||||||
XTerm | ||||||||||
xvt | ||||||||||
Linux TTY | ~ | |||||||||
VTE Terminal |
~: Supported in a special way by the terminal.
Todo
- Basic 16 color
- Extra 240 color
- HSL support
- RGB support
- Gradient mode
- Rainbow mode
- Animation mode
- Document
- Terminals compatibility