Merge pull request #2832 from codewing/feature/wgpu-24
Update `wgpu` to `24` and use `cryoglyph` fork
This commit is contained in:
commit
bae25b74f6
9 changed files with 126 additions and 90 deletions
118
Cargo.lock
generated
118
Cargo.lock
generated
|
|
@ -620,6 +620,9 @@ name = "bitflags"
|
||||||
version = "2.9.0"
|
version = "2.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitstream-io"
|
name = "bitstream-io"
|
||||||
|
|
@ -807,12 +810,6 @@ version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg_aliases"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg_aliases"
|
name = "cfg_aliases"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|
@ -1214,6 +1211,18 @@ version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929"
|
checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cryoglyph"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/iced-rs/cryoglyph.git?rev=a886f2427e612b23788a4e36658ff8cd55ba6695#a886f2427e612b23788a4e36658ff8cd55ba6695"
|
||||||
|
dependencies = [
|
||||||
|
"cosmic-text",
|
||||||
|
"etagere",
|
||||||
|
"lru",
|
||||||
|
"rustc-hash 2.1.1",
|
||||||
|
"wgpu",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crypto-common"
|
name = "crypto-common"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
|
@ -2054,9 +2063,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glow"
|
name = "glow"
|
||||||
version = "0.14.2"
|
version = "0.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d51fa363f025f5c111e03f13eda21162faeacb6911fe8caa0c0349f9cf0c4483"
|
checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"slotmap",
|
"slotmap",
|
||||||
|
|
@ -2073,18 +2082,6 @@ dependencies = [
|
||||||
"gl_generator",
|
"gl_generator",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glyphon"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "git+https://github.com/hecrj/glyphon.git?rev=09712a70df7431e9a3b1ac1bbd4fb634096cb3b4#09712a70df7431e9a3b1ac1bbd4fb634096cb3b4"
|
|
||||||
dependencies = [
|
|
||||||
"cosmic-text",
|
|
||||||
"etagere",
|
|
||||||
"lru",
|
|
||||||
"rustc-hash 2.1.1",
|
|
||||||
"wgpu",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gobject-sys"
|
name = "gobject-sys"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
|
|
@ -2635,9 +2632,9 @@ version = "0.14.0-dev"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
"cryoglyph",
|
||||||
"futures",
|
"futures",
|
||||||
"glam",
|
"glam",
|
||||||
"glyphon",
|
|
||||||
"guillotiere",
|
"guillotiere",
|
||||||
"iced_graphics",
|
"iced_graphics",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -3371,9 +3368,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "metal"
|
name = "metal"
|
||||||
version = "0.29.0"
|
version = "0.31.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21"
|
checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"block",
|
"block",
|
||||||
|
|
@ -3476,22 +3473,23 @@ checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "23.1.0"
|
version = "24.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "364f94bc34f61332abebe8cad6f6cd82a5b65cff22c828d05d0968911462ca4f"
|
checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bit-set",
|
"bit-set",
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"cfg_aliases 0.1.1",
|
"cfg_aliases",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"hexf-parse",
|
"hexf-parse",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"log",
|
"log",
|
||||||
"rustc-hash 1.1.0",
|
"rustc-hash 1.1.0",
|
||||||
"spirv",
|
"spirv",
|
||||||
|
"strum",
|
||||||
"termcolor",
|
"termcolor",
|
||||||
"thiserror 1.0.69",
|
"thiserror 2.0.12",
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -3565,7 +3563,7 @@ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cfg_aliases 0.2.1",
|
"cfg_aliases",
|
||||||
"libc",
|
"libc",
|
||||||
"memoffset",
|
"memoffset",
|
||||||
]
|
]
|
||||||
|
|
@ -4038,6 +4036,15 @@ dependencies = [
|
||||||
"libredox",
|
"libredox",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ordered-float"
|
||||||
|
version = "4.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ordered-stream"
|
name = "ordered-stream"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
@ -5390,7 +5397,7 @@ checksum = "18051cdd562e792cad055119e0cdb2cfc137e44e3987532e0f9659a77931bb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as-raw-xcb-connection",
|
"as-raw-xcb-connection",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cfg_aliases 0.2.1",
|
"cfg_aliases",
|
||||||
"core-graphics 0.24.0",
|
"core-graphics 0.24.0",
|
||||||
"drm",
|
"drm",
|
||||||
"fastrand 2.3.0",
|
"fastrand 2.3.0",
|
||||||
|
|
@ -5466,6 +5473,28 @@ dependencies = [
|
||||||
"float-cmp",
|
"float-cmp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strum"
|
||||||
|
version = "0.26.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||||
|
dependencies = [
|
||||||
|
"strum_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strum_macros"
|
||||||
|
version = "0.26.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||||
|
dependencies = [
|
||||||
|
"heck 0.5.0",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"rustversion",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "styling"
|
name = "styling"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -6688,12 +6717,13 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu"
|
name = "wgpu"
|
||||||
version = "23.0.1"
|
version = "24.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "80f70000db37c469ea9d67defdc13024ddf9a5f1b89cb2941b812ad7cde1735a"
|
checksum = "47f55718f85c2fa756edffa0e7f0e0a60aba463d1362b57e23123c58f035e4b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"cfg_aliases 0.1.1",
|
"bitflags 2.9.0",
|
||||||
|
"cfg_aliases",
|
||||||
"document-features",
|
"document-features",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -6713,14 +6743,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-core"
|
name = "wgpu-core"
|
||||||
version = "23.0.1"
|
version = "24.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d63c3c478de8e7e01786479919c8769f62a22eec16788d8c2ac77ce2c132778a"
|
checksum = "671c25545d479b47d3f0a8e373aceb2060b67c6eb841b24ac8c32348151c7a0c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bit-vec",
|
"bit-vec",
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"cfg_aliases 0.1.1",
|
"cfg_aliases",
|
||||||
"document-features",
|
"document-features",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -6731,16 +6761,16 @@ dependencies = [
|
||||||
"raw-window-handle 0.6.2",
|
"raw-window-handle 0.6.2",
|
||||||
"rustc-hash 1.1.0",
|
"rustc-hash 1.1.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror 1.0.69",
|
"thiserror 2.0.12",
|
||||||
"wgpu-hal",
|
"wgpu-hal",
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-hal"
|
name = "wgpu-hal"
|
||||||
version = "23.0.1"
|
version = "24.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89364b8a0b211adc7b16aeaf1bd5ad4a919c1154b44c9ce27838213ba05fd821"
|
checksum = "4317a17171dc20e6577bf606796794580accae0716a69edbc7388c86a3ec9f23"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_system_properties",
|
"android_system_properties",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
|
|
@ -6749,7 +6779,7 @@ dependencies = [
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"block",
|
"block",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cfg_aliases 0.1.1",
|
"cfg_aliases",
|
||||||
"core-graphics-types 0.1.3",
|
"core-graphics-types 0.1.3",
|
||||||
"glow",
|
"glow",
|
||||||
"glutin_wgl_sys",
|
"glutin_wgl_sys",
|
||||||
|
|
@ -6766,6 +6796,7 @@ dependencies = [
|
||||||
"ndk-sys 0.5.0+25.2.9519653",
|
"ndk-sys 0.5.0+25.2.9519653",
|
||||||
"objc",
|
"objc",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"ordered-float",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"profiling",
|
"profiling",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
|
|
@ -6773,7 +6804,7 @@ dependencies = [
|
||||||
"renderdoc-sys",
|
"renderdoc-sys",
|
||||||
"rustc-hash 1.1.0",
|
"rustc-hash 1.1.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror 1.0.69",
|
"thiserror 2.0.12",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
|
|
@ -6783,12 +6814,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-types"
|
name = "wgpu-types"
|
||||||
version = "23.0.0"
|
version = "24.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "610f6ff27778148c31093f3b03abc4840f9636d58d597ca2f5977433acfe0068"
|
checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.0",
|
"bitflags 2.9.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
"log",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -7206,7 +7238,7 @@ dependencies = [
|
||||||
"block2",
|
"block2",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"calloop",
|
"calloop",
|
||||||
"cfg_aliases 0.2.1",
|
"cfg_aliases",
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"core-foundation 0.9.4",
|
"core-foundation 0.9.4",
|
||||||
"core-graphics 0.23.2",
|
"core-graphics 0.23.2",
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ cosmic-text = "0.12"
|
||||||
dark-light = "2.0"
|
dark-light = "2.0"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
glam = "0.25"
|
glam = "0.25"
|
||||||
glyphon = { git = "https://github.com/hecrj/glyphon.git", rev = "09712a70df7431e9a3b1ac1bbd4fb634096cb3b4" }
|
cryoglyph = { git = "https://github.com/iced-rs/cryoglyph.git", rev = "a886f2427e612b23788a4e36658ff8cd55ba6695" }
|
||||||
guillotiere = "0.6"
|
guillotiere = "0.6"
|
||||||
half = "2.2"
|
half = "2.2"
|
||||||
image = { version = "0.25", default-features = false }
|
image = { version = "0.25", default-features = false }
|
||||||
|
|
@ -188,7 +188,7 @@ wasm-bindgen-futures = "0.4"
|
||||||
wasmtimer = "0.4.1"
|
wasmtimer = "0.4.1"
|
||||||
web-sys = "0.3.69"
|
web-sys = "0.3.69"
|
||||||
web-time = "1.1"
|
web-time = "1.1"
|
||||||
wgpu = "23.0"
|
wgpu = "24.0"
|
||||||
window_clipboard = "0.4.1"
|
window_clipboard = "0.4.1"
|
||||||
winit = { git = "https://github.com/iced-rs/winit.git", rev = "11414b6aa45699f038114e61b4ddf5102b2d3b4b" }
|
winit = { git = "https://github.com/iced-rs/winit.git", rev = "11414b6aa45699f038114e61b4ddf5102b2d3b4b" }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pub fn wgpu_benchmark(c: &mut Criterion) {
|
||||||
use iced_futures::futures::executor;
|
use iced_futures::futures::executor;
|
||||||
use iced_wgpu::wgpu;
|
use iced_wgpu::wgpu;
|
||||||
|
|
||||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||||
backends: wgpu::Backends::all(),
|
backends: wgpu::Backends::all(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,9 @@ pub fn main() -> Result<(), winit::error::EventLoopError> {
|
||||||
);
|
);
|
||||||
let clipboard = Clipboard::connect(window.clone());
|
let clipboard = Clipboard::connect(window.clone());
|
||||||
|
|
||||||
let backend =
|
let backend = wgpu::Backends::from_env().unwrap_or_default();
|
||||||
wgpu::util::backend_bits_from_env().unwrap_or_default();
|
|
||||||
|
|
||||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||||
backends: backend,
|
backends: backend,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,9 @@ pub enum SurfaceError {
|
||||||
/// There is no more memory left to allocate a new frame.
|
/// There is no more memory left to allocate a new frame.
|
||||||
#[error("There is no more memory left to allocate a new frame")]
|
#[error("There is no more memory left to allocate a new frame")]
|
||||||
OutOfMemory,
|
OutOfMemory,
|
||||||
|
/// Acquiring a texture failed with a generic error.
|
||||||
|
#[error("Acquiring a texture failed with a generic error")]
|
||||||
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Contains information about the graphics (e.g. graphics adapter, graphics backend).
|
/// Contains information about the graphics (e.g. graphics adapter, graphics backend).
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ bitflags.workspace = true
|
||||||
bytemuck.workspace = true
|
bytemuck.workspace = true
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
glam.workspace = true
|
glam.workspace = true
|
||||||
glyphon.workspace = true
|
cryoglyph.workspace = true
|
||||||
guillotiere.workspace = true
|
guillotiere.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
rustc-hash.workspace = true
|
rustc-hash.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -344,15 +344,15 @@ impl Atlas {
|
||||||
});
|
});
|
||||||
|
|
||||||
encoder.copy_buffer_to_texture(
|
encoder.copy_buffer_to_texture(
|
||||||
wgpu::ImageCopyBuffer {
|
wgpu::TexelCopyBufferInfo {
|
||||||
buffer: &buffer,
|
buffer: &buffer,
|
||||||
layout: wgpu::ImageDataLayout {
|
layout: wgpu::TexelCopyBufferLayout {
|
||||||
offset: offset as u64,
|
offset: offset as u64,
|
||||||
bytes_per_row: Some(4 * image_width + padding),
|
bytes_per_row: Some(4 * image_width + padding),
|
||||||
rows_per_image: Some(image_height),
|
rows_per_image: Some(image_height),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
wgpu::ImageCopyTexture {
|
wgpu::TexelCopyTextureInfo {
|
||||||
texture: &self.texture,
|
texture: &self.texture,
|
||||||
mip_level: 0,
|
mip_level: 0,
|
||||||
origin: wgpu::Origin3d {
|
origin: wgpu::Origin3d {
|
||||||
|
|
@ -407,7 +407,7 @@ impl Atlas {
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder.copy_texture_to_texture(
|
encoder.copy_texture_to_texture(
|
||||||
wgpu::ImageCopyTexture {
|
wgpu::TexelCopyTextureInfo {
|
||||||
texture: &self.texture,
|
texture: &self.texture,
|
||||||
mip_level: 0,
|
mip_level: 0,
|
||||||
origin: wgpu::Origin3d {
|
origin: wgpu::Origin3d {
|
||||||
|
|
@ -417,7 +417,7 @@ impl Atlas {
|
||||||
},
|
},
|
||||||
aspect: wgpu::TextureAspect::default(),
|
aspect: wgpu::TextureAspect::default(),
|
||||||
},
|
},
|
||||||
wgpu::ImageCopyTexture {
|
wgpu::TexelCopyTextureInfo {
|
||||||
texture: &new_texture,
|
texture: &new_texture,
|
||||||
mip_level: 0,
|
mip_level: 0,
|
||||||
origin: wgpu::Origin3d {
|
origin: wgpu::Origin3d {
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ use std::sync::{self, Arc};
|
||||||
|
|
||||||
pub use crate::graphics::Text;
|
pub use crate::graphics::Text;
|
||||||
|
|
||||||
const COLOR_MODE: glyphon::ColorMode = if color::GAMMA_CORRECTION {
|
const COLOR_MODE: cryoglyph::ColorMode = if color::GAMMA_CORRECTION {
|
||||||
glyphon::ColorMode::Accurate
|
cryoglyph::ColorMode::Accurate
|
||||||
} else {
|
} else {
|
||||||
glyphon::ColorMode::Web
|
cryoglyph::ColorMode::Web
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type Batch = Vec<Item>;
|
pub type Batch = Vec<Item>;
|
||||||
|
|
@ -70,7 +70,7 @@ impl Cache {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Upload {
|
struct Upload {
|
||||||
renderer: glyphon::TextRenderer,
|
renderer: cryoglyph::TextRenderer,
|
||||||
buffer_cache: BufferCache,
|
buffer_cache: BufferCache,
|
||||||
transformation: Transformation,
|
transformation: Transformation,
|
||||||
version: usize,
|
version: usize,
|
||||||
|
|
@ -86,7 +86,7 @@ pub struct Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
atlas: glyphon::TextAtlas,
|
atlas: cryoglyph::TextAtlas,
|
||||||
version: usize,
|
version: usize,
|
||||||
should_trim: bool,
|
should_trim: bool,
|
||||||
handle: Arc<()>, // Keeps track of active uploads
|
handle: Arc<()>, // Keeps track of active uploads
|
||||||
|
|
@ -97,7 +97,7 @@ impl Storage {
|
||||||
Self::default()
|
Self::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get(&self, cache: &Cache) -> Option<(&glyphon::TextAtlas, &Upload)> {
|
fn get(&self, cache: &Cache) -> Option<(&cryoglyph::TextAtlas, &Upload)> {
|
||||||
if cache.text.is_empty() {
|
if cache.text.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
@ -112,10 +112,10 @@ impl Storage {
|
||||||
&mut self,
|
&mut self,
|
||||||
device: &wgpu::Device,
|
device: &wgpu::Device,
|
||||||
queue: &wgpu::Queue,
|
queue: &wgpu::Queue,
|
||||||
viewport: &glyphon::Viewport,
|
viewport: &cryoglyph::Viewport,
|
||||||
encoder: &mut wgpu::CommandEncoder,
|
encoder: &mut wgpu::CommandEncoder,
|
||||||
format: wgpu::TextureFormat,
|
format: wgpu::TextureFormat,
|
||||||
state: &glyphon::Cache,
|
state: &cryoglyph::Cache,
|
||||||
cache: &Cache,
|
cache: &Cache,
|
||||||
new_transformation: Transformation,
|
new_transformation: Transformation,
|
||||||
bounds: Rectangle,
|
bounds: Rectangle,
|
||||||
|
|
@ -130,7 +130,7 @@ impl Storage {
|
||||||
);
|
);
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
atlas: glyphon::TextAtlas::with_color_mode(
|
atlas: cryoglyph::TextAtlas::with_color_mode(
|
||||||
device, queue, state, format, COLOR_MODE,
|
device, queue, state, format, COLOR_MODE,
|
||||||
),
|
),
|
||||||
version: 0,
|
version: 0,
|
||||||
|
|
@ -175,7 +175,7 @@ impl Storage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hash_map::Entry::Vacant(entry) => {
|
hash_map::Entry::Vacant(entry) => {
|
||||||
let mut renderer = glyphon::TextRenderer::new(
|
let mut renderer = cryoglyph::TextRenderer::new(
|
||||||
&mut group.atlas,
|
&mut group.atlas,
|
||||||
device,
|
device,
|
||||||
wgpu::MultisampleState::default(),
|
wgpu::MultisampleState::default(),
|
||||||
|
|
@ -257,13 +257,13 @@ impl Storage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Viewport(glyphon::Viewport);
|
pub struct Viewport(cryoglyph::Viewport);
|
||||||
|
|
||||||
impl Viewport {
|
impl Viewport {
|
||||||
pub fn update(&mut self, queue: &wgpu::Queue, resolution: Size<u32>) {
|
pub fn update(&mut self, queue: &wgpu::Queue, resolution: Size<u32>) {
|
||||||
self.0.update(
|
self.0.update(
|
||||||
queue,
|
queue,
|
||||||
glyphon::Resolution {
|
cryoglyph::Resolution {
|
||||||
width: resolution.width,
|
width: resolution.width,
|
||||||
height: resolution.height,
|
height: resolution.height,
|
||||||
},
|
},
|
||||||
|
|
@ -273,10 +273,10 @@ impl Viewport {
|
||||||
|
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct Pipeline {
|
pub struct Pipeline {
|
||||||
state: glyphon::Cache,
|
state: cryoglyph::Cache,
|
||||||
format: wgpu::TextureFormat,
|
format: wgpu::TextureFormat,
|
||||||
atlas: glyphon::TextAtlas,
|
atlas: cryoglyph::TextAtlas,
|
||||||
renderers: Vec<glyphon::TextRenderer>,
|
renderers: Vec<cryoglyph::TextRenderer>,
|
||||||
prepare_layer: usize,
|
prepare_layer: usize,
|
||||||
cache: BufferCache,
|
cache: BufferCache,
|
||||||
}
|
}
|
||||||
|
|
@ -287,8 +287,8 @@ impl Pipeline {
|
||||||
queue: &wgpu::Queue,
|
queue: &wgpu::Queue,
|
||||||
format: wgpu::TextureFormat,
|
format: wgpu::TextureFormat,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let state = glyphon::Cache::new(device);
|
let state = cryoglyph::Cache::new(device);
|
||||||
let atlas = glyphon::TextAtlas::with_color_mode(
|
let atlas = cryoglyph::TextAtlas::with_color_mode(
|
||||||
device, queue, &state, format, COLOR_MODE,
|
device, queue, &state, format, COLOR_MODE,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -320,7 +320,7 @@ impl Pipeline {
|
||||||
text,
|
text,
|
||||||
} => {
|
} => {
|
||||||
if self.renderers.len() <= self.prepare_layer {
|
if self.renderers.len() <= self.prepare_layer {
|
||||||
self.renderers.push(glyphon::TextRenderer::new(
|
self.renderers.push(cryoglyph::TextRenderer::new(
|
||||||
&mut self.atlas,
|
&mut self.atlas,
|
||||||
device,
|
device,
|
||||||
wgpu::MultisampleState::default(),
|
wgpu::MultisampleState::default(),
|
||||||
|
|
@ -346,7 +346,7 @@ impl Pipeline {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
self.prepare_layer += 1;
|
self.prepare_layer += 1;
|
||||||
}
|
}
|
||||||
Err(glyphon::PrepareError::AtlasFull) => {
|
Err(cryoglyph::PrepareError::AtlasFull) => {
|
||||||
// If the atlas cannot grow, then all bets are off.
|
// If the atlas cannot grow, then all bets are off.
|
||||||
// Instead of panicking, we will just pray that the result
|
// Instead of panicking, we will just pray that the result
|
||||||
// will be somewhat readable...
|
// will be somewhat readable...
|
||||||
|
|
@ -417,7 +417,7 @@ impl Pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_viewport(&self, device: &wgpu::Device) -> Viewport {
|
pub fn create_viewport(&self, device: &wgpu::Device) -> Viewport {
|
||||||
Viewport(glyphon::Viewport::new(device, &self.state))
|
Viewport(cryoglyph::Viewport::new(device, &self.state))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn end_frame(&mut self) {
|
pub fn end_frame(&mut self) {
|
||||||
|
|
@ -431,15 +431,15 @@ impl Pipeline {
|
||||||
fn prepare(
|
fn prepare(
|
||||||
device: &wgpu::Device,
|
device: &wgpu::Device,
|
||||||
queue: &wgpu::Queue,
|
queue: &wgpu::Queue,
|
||||||
viewport: &glyphon::Viewport,
|
viewport: &cryoglyph::Viewport,
|
||||||
encoder: &mut wgpu::CommandEncoder,
|
encoder: &mut wgpu::CommandEncoder,
|
||||||
renderer: &mut glyphon::TextRenderer,
|
renderer: &mut cryoglyph::TextRenderer,
|
||||||
atlas: &mut glyphon::TextAtlas,
|
atlas: &mut cryoglyph::TextAtlas,
|
||||||
buffer_cache: &mut BufferCache,
|
buffer_cache: &mut BufferCache,
|
||||||
sections: &[Text],
|
sections: &[Text],
|
||||||
layer_bounds: Rectangle,
|
layer_bounds: Rectangle,
|
||||||
layer_transformation: Transformation,
|
layer_transformation: Transformation,
|
||||||
) -> Result<(), glyphon::PrepareError> {
|
) -> Result<(), cryoglyph::PrepareError> {
|
||||||
let mut font_system = font_system().write().expect("Write font system");
|
let mut font_system = font_system().write().expect("Write font system");
|
||||||
let font_system = font_system.raw();
|
let font_system = font_system.raw();
|
||||||
|
|
||||||
|
|
@ -447,7 +447,7 @@ fn prepare(
|
||||||
Paragraph(Paragraph),
|
Paragraph(Paragraph),
|
||||||
Editor(Editor),
|
Editor(Editor),
|
||||||
Cache(text_cache::KeyHash),
|
Cache(text_cache::KeyHash),
|
||||||
Raw(Arc<glyphon::Buffer>),
|
Raw(Arc<cryoglyph::Buffer>),
|
||||||
}
|
}
|
||||||
|
|
||||||
let allocations: Vec<_> = sections
|
let allocations: Vec<_> = sections
|
||||||
|
|
@ -618,13 +618,13 @@ fn prepare(
|
||||||
&(clip_bounds * transformation * layer_transformation),
|
&(clip_bounds * transformation * layer_transformation),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Some(glyphon::TextArea {
|
Some(cryoglyph::TextArea {
|
||||||
buffer,
|
buffer,
|
||||||
left,
|
left,
|
||||||
top,
|
top,
|
||||||
scale: transformation.scale_factor()
|
scale: transformation.scale_factor()
|
||||||
* layer_transformation.scale_factor(),
|
* layer_transformation.scale_factor(),
|
||||||
bounds: glyphon::TextBounds {
|
bounds: cryoglyph::TextBounds {
|
||||||
left: clip_bounds.x as i32,
|
left: clip_bounds.x as i32,
|
||||||
top: clip_bounds.y as i32,
|
top: clip_bounds.y as i32,
|
||||||
right: (clip_bounds.x + clip_bounds.width) as i32,
|
right: (clip_bounds.x + clip_bounds.width) as i32,
|
||||||
|
|
@ -643,6 +643,6 @@ fn prepare(
|
||||||
atlas,
|
atlas,
|
||||||
viewport,
|
viewport,
|
||||||
text_areas,
|
text_areas,
|
||||||
&mut glyphon::SwashCache::new(),
|
&mut cryoglyph::SwashCache::new(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ impl Compositor {
|
||||||
settings: Settings,
|
settings: Settings,
|
||||||
compatible_window: Option<W>,
|
compatible_window: Option<W>,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||||
backends: settings.backends,
|
backends: settings.backends,
|
||||||
flags: if cfg!(feature = "strict-assertions") {
|
flags: if cfg!(feature = "strict-assertions") {
|
||||||
wgpu::InstanceFlags::debugging()
|
wgpu::InstanceFlags::debugging()
|
||||||
|
|
@ -81,12 +81,13 @@ impl Compositor {
|
||||||
.and_then(|window| instance.create_surface(window).ok());
|
.and_then(|window| instance.create_surface(window).ok());
|
||||||
|
|
||||||
let adapter_options = wgpu::RequestAdapterOptions {
|
let adapter_options = wgpu::RequestAdapterOptions {
|
||||||
power_preference: wgpu::util::power_preference_from_env()
|
power_preference: wgpu::PowerPreference::from_env().unwrap_or(
|
||||||
.unwrap_or(if settings.antialiasing.is_none() {
|
if settings.antialiasing.is_none() {
|
||||||
wgpu::PowerPreference::LowPower
|
wgpu::PowerPreference::LowPower
|
||||||
} else {
|
} else {
|
||||||
wgpu::PowerPreference::HighPerformance
|
wgpu::PowerPreference::HighPerformance
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
compatible_surface: compatible_surface.as_ref(),
|
compatible_surface: compatible_surface.as_ref(),
|
||||||
force_fallback_adapter: false,
|
force_fallback_adapter: false,
|
||||||
};
|
};
|
||||||
|
|
@ -263,6 +264,7 @@ pub fn present<T: AsRef<str>>(
|
||||||
wgpu::SurfaceError::OutOfMemory => {
|
wgpu::SurfaceError::OutOfMemory => {
|
||||||
Err(compositor::SurfaceError::OutOfMemory)
|
Err(compositor::SurfaceError::OutOfMemory)
|
||||||
}
|
}
|
||||||
|
wgpu::SurfaceError::Other => Err(compositor::SurfaceError::Other),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +282,7 @@ impl graphics::Compositor for Compositor {
|
||||||
None | Some("wgpu") => {
|
None | Some("wgpu") => {
|
||||||
let mut settings = Settings::from(settings);
|
let mut settings = Settings::from(settings);
|
||||||
|
|
||||||
if let Some(backends) = wgpu::util::backend_bits_from_env() {
|
if let Some(backends) = wgpu::Backends::from_env() {
|
||||||
settings.backends = backends;
|
settings.backends = backends;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -451,9 +453,9 @@ pub fn screenshot<T: AsRef<str>>(
|
||||||
|
|
||||||
encoder.copy_texture_to_buffer(
|
encoder.copy_texture_to_buffer(
|
||||||
texture.as_image_copy(),
|
texture.as_image_copy(),
|
||||||
wgpu::ImageCopyBuffer {
|
wgpu::TexelCopyBufferInfo {
|
||||||
buffer: &output_buffer,
|
buffer: &output_buffer,
|
||||||
layout: wgpu::ImageDataLayout {
|
layout: wgpu::TexelCopyBufferLayout {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
bytes_per_row: Some(dimensions.padded_bytes_per_row as u32),
|
bytes_per_row: Some(dimensions.padded_bytes_per_row as u32),
|
||||||
rows_per_image: None,
|
rows_per_image: None,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue