From 5e4ee1b34ef83730905fed0b1656d6c0c4e8aadb Mon Sep 17 00:00:00 2001 From: Raphael Amorim Date: Thu, 16 Jan 2025 00:50:40 -0300 Subject: [PATCH] update wgpu to 24.0.0 --- Cargo.lock | 93 ++++++++++++++----- Cargo.toml | 2 +- docs/docs/releases.md | 4 +- frontends/wasm/Cargo.toml | 4 +- sugarloaf/Cargo.toml | 12 +-- .../src/components/filters/runtime/luts.rs | 4 +- .../src/components/filters/runtime/mipmap.rs | 1 + .../src/components/filters/runtime/texture.rs | 1 + sugarloaf/src/components/layer/atlas.rs | 10 +- .../components/rich_text/image_cache/cache.rs | 8 +- .../src/components/text/pipeline/cache.rs | 4 +- sugarloaf/src/context/mod.rs | 5 +- sugarloaf/tests/util/image.rs | 2 +- 13 files changed, 97 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31b6fe2c53..3084513585 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1190,9 +1190,9 @@ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "glow" -version = "0.14.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51fa363f025f5c111e03f13eda21162faeacb6911fe8caa0c0349f9cf0c4483" +checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" dependencies = [ "js-sys", "slotmap", @@ -1782,7 +1782,7 @@ dependencies = [ "librashader-pack", "librashader-preprocess", "librashader-presets", - "naga", + "naga 23.1.0", "rspirv", "rustc-hash 2.1.0", "serde", @@ -1913,9 +1913,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" +checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" dependencies = [ "bitflags 2.8.0", "block", @@ -1993,7 +1993,6 @@ dependencies = [ "bitflags 2.8.0", "cfg_aliases 0.1.1", "codespan-reporting", - "hexf-parse", "indexmap", "log 0.4.25", "petgraph", @@ -2001,6 +2000,27 @@ dependencies = [ "spirv", "termcolor", "thiserror 1.0.69", +] + +[[package]] +name = "naga" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.8.0", + "cfg_aliases 0.2.1", + "codespan-reporting", + "hexf-parse", + "indexmap", + "log 0.4.25", + "rustc-hash 1.1.0", + "spirv", + "strum", + "termcolor", + "thiserror 2.0.11", "unicode-xid", ] @@ -3194,6 +3214,28 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[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", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "sugarloaf" version = "0.2.4" @@ -3902,9 +3944,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -3928,16 +3970,17 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "wgpu" -version = "23.0.1" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80f70000db37c469ea9d67defdc13024ddf9a5f1b89cb2941b812ad7cde1735a" +checksum = "e41253fc7b660735e2a2d9a58c563f2a047d3cc3445293d8f4095538c9e8afbe" dependencies = [ "arrayvec", - "cfg_aliases 0.1.1", + "bitflags 2.8.0", + "cfg_aliases 0.2.1", "document-features", "js-sys", "log 0.4.25", - "naga", + "naga 24.0.0", "parking_lot", "profiling", "raw-window-handle", @@ -3953,34 +3996,34 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "23.0.1" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63c3c478de8e7e01786479919c8769f62a22eec16788d8c2ac77ce2c132778a" +checksum = "82a39b8842dc9ffcbe34346e3ab6d496b32a47f6497e119d762c97fcaae3cb37" dependencies = [ "arrayvec", "bit-vec", "bitflags 2.8.0", - "cfg_aliases 0.1.1", + "cfg_aliases 0.2.1", "document-features", "indexmap", "log 0.4.25", - "naga", + "naga 24.0.0", "once_cell", "parking_lot", "profiling", "raw-window-handle", "rustc-hash 1.1.0", "smallvec", - "thiserror 1.0.69", + "thiserror 2.0.11", "wgpu-hal", "wgpu-types", ] [[package]] name = "wgpu-hal" -version = "23.0.1" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89364b8a0b211adc7b16aeaf1bd5ad4a919c1154b44c9ce27838213ba05fd821" +checksum = "5a782e5056b060b0b4010881d1decddd059e44f2ecd01e2db2971b48ad3627e5" dependencies = [ "android_system_properties", "arrayvec", @@ -3989,7 +4032,7 @@ dependencies = [ "bitflags 2.8.0", "block", "bytemuck", - "cfg_aliases 0.1.1", + "cfg_aliases 0.2.1", "core-graphics-types 0.1.3", "glow", "glutin_wgl_sys", @@ -4002,10 +4045,11 @@ dependencies = [ "libloading", "log 0.4.25", "metal", - "naga", + "naga 24.0.0", "ndk-sys", "objc", "once_cell", + "ordered-float", "parking_lot", "profiling", "range-alloc", @@ -4013,7 +4057,7 @@ dependencies = [ "renderdoc-sys", "rustc-hash 1.1.0", "smallvec", - "thiserror 1.0.69", + "thiserror 2.0.11", "wasm-bindgen", "web-sys", "wgpu-types", @@ -4023,12 +4067,13 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "23.0.0" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "610f6ff27778148c31093f3b03abc4840f9636d58d597ca2f5977433acfe0068" +checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c" dependencies = [ "bitflags 2.8.0", "js-sys", + "log 0.4.25", "web-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 43ed915b84..b214096f7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ image_rs = { package = "image", version = "0.25.5", default-features = false, fe regex = "1.11.1" bytemuck = { version = "1.21.0", features = [ "derive" ] } serde = { version = "1.0.217", features = ["derive"] } -wgpu = "23.0.1" +wgpu = "24.0.0" libc = "0.2.169" smol_str = "0.3.2" futures = "0.3.31" diff --git a/docs/docs/releases.md b/docs/docs/releases.md index 6d901c98e4..13168954cc 100644 --- a/docs/docs/releases.md +++ b/docs/docs/releases.md @@ -14,15 +14,13 @@ language: 'en' - OSC 7 Escape sequences to advise the terminal of the working directory. - OSC 133 Escape sequence to define Input, Output and Prompt zones. - OSC 1337 Escape sequences to set user vars for tracking additional shell state. - -## 0.2.4 - - Breaking: Rio now doesn't allow anymore disable kitty keyboard protocol. - Fullwidth semantic escape characters. - Fix: Relax libc requirements on ubuntu by compiling Rio in a 22.04 runner instead of 24.04 [#906](https://github.com/raphamorim/rio/pull/906) by [@marc2332](https://github.com/marc2332). - Fix: report of Enter/Tab/Backspace in kitty keyboard. - Fix: use-kitty-keyboard-protocol = true doesn't work with tmux [#599](https://github.com/raphamorim/rio/issues/599). - Fix: use-kitty-keyboard-protocol breaks F[5-12] on macOS [#904](https://github.com/raphamorim/rio/issues/904). +- Update wgpu to 24.0.0. ## 0.2.3 diff --git a/frontends/wasm/Cargo.toml b/frontends/wasm/Cargo.toml index 8df40fef5c..3d5caedcbf 100644 --- a/frontends/wasm/Cargo.toml +++ b/frontends/wasm/Cargo.toml @@ -72,8 +72,8 @@ web-sys = { version = "0.3.62", features = [ "GpuFrontFace", "GpuImageCopyBuffer", "GpuImageCopyExternalImage", - "GpuImageCopyTexture", - "GpuImageCopyTextureTagged", + "GpuTexelCopyTextureInfo", + "GpuTexelCopyTextureInfoTagged", "GpuImageDataLayout", "GpuIndexFormat", "GpuLoadOp", diff --git a/sugarloaf/Cargo.toml b/sugarloaf/Cargo.toml index 2a1d322068..fa7c698d68 100644 --- a/sugarloaf/Cargo.toml +++ b/sugarloaf/Cargo.toml @@ -94,7 +94,7 @@ js-sys = "0.3.61" wasm-bindgen = "0.2.87" wasm-bindgen-futures = "0.4.34" wasm-bindgen-test = "0.3.42" -web-sys = { version = "0.3.61", features = [ +web-sys = { version = "0.3.77", features = [ "Location", "Document", "Navigator", @@ -150,11 +150,11 @@ web-sys = { version = "0.3.61", features = [ "GpuFilterMode", "GpuFragmentState", "GpuFrontFace", - "GpuImageCopyBuffer", - "GpuImageCopyExternalImage", - "GpuImageCopyTexture", - "GpuImageCopyTextureTagged", - "GpuImageDataLayout", + # "GpuImageCopyBuffer", + # "GpuImageCopyExternalImage", + # "GpuTexelCopyTextureInfo", + # "GpuTexelCopyTextureInfoTagged", + # "GpuImageDataLayout", "GpuIndexFormat", "GpuLoadOp", "gpu_map_mode", diff --git a/sugarloaf/src/components/filters/runtime/luts.rs b/sugarloaf/src/components/filters/runtime/luts.rs index 814c45740d..42eaf14c90 100644 --- a/sugarloaf/src/components/filters/runtime/luts.rs +++ b/sugarloaf/src/components/filters/runtime/luts.rs @@ -53,14 +53,14 @@ impl LutTexture { }); queue.write_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, &image.bytes, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4 * image.size.width), rows_per_image: None, diff --git a/sugarloaf/src/components/filters/runtime/mipmap.rs b/sugarloaf/src/components/filters/runtime/mipmap.rs index 5ac83ed52b..236b8bccf2 100644 --- a/sugarloaf/src/components/filters/runtime/mipmap.rs +++ b/sugarloaf/src/components/filters/runtime/mipmap.rs @@ -81,6 +81,7 @@ impl MipmapGen { mip_level_count: Some(1), base_array_layer: 0, array_layer_count: None, + ..Default::default() }) }) .collect::>(); diff --git a/sugarloaf/src/components/filters/runtime/texture.rs b/sugarloaf/src/components/filters/runtime/texture.rs index 2d6949fc4d..6d7956f6ea 100644 --- a/sugarloaf/src/components/filters/runtime/texture.rs +++ b/sugarloaf/src/components/filters/runtime/texture.rs @@ -70,6 +70,7 @@ impl OwnedImage { mip_level_count: None, base_array_layer: 0, array_layer_count: None, + ..Default::default() }); Self { diff --git a/sugarloaf/src/components/layer/atlas.rs b/sugarloaf/src/components/layer/atlas.rs index b212793531..ed4f225730 100644 --- a/sugarloaf/src/components/layer/atlas.rs +++ b/sugarloaf/src/components/layer/atlas.rs @@ -313,15 +313,15 @@ impl Atlas { }); encoder.copy_buffer_to_texture( - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: offset as u64, bytes_per_row: Some(4 * image_dimensions.0 + padding), rows_per_image: Some(image_dimensions.1), }, }, - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &self.texture, mip_level: 0, origin: wgpu::Origin3d { @@ -375,7 +375,7 @@ impl Atlas { } encoder.copy_texture_to_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &self.texture, mip_level: 0, origin: wgpu::Origin3d { @@ -385,7 +385,7 @@ impl Atlas { }, aspect: wgpu::TextureAspect::default(), }, - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &new_texture, mip_level: 0, origin: wgpu::Origin3d { diff --git a/sugarloaf/src/components/rich_text/image_cache/cache.rs b/sugarloaf/src/components/rich_text/image_cache/cache.rs index 6578e9a4fb..30ddaa2ff7 100644 --- a/sugarloaf/src/components/rich_text/image_cache/cache.rs +++ b/sugarloaf/src/components/rich_text/image_cache/cache.rs @@ -226,7 +226,7 @@ impl ImageCache { context.queue.write_texture( // Tells wgpu where to copy the pixel data - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &new_texture, mip_level: 0, origin: wgpu::Origin3d::ZERO, @@ -235,7 +235,7 @@ impl ImageCache { // The actual pixel data &self.atlas.buffer, // The layout of the texture - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some((self.max_texture_size * 4).into()), rows_per_image: Some((self.max_texture_size).into()), @@ -256,7 +256,7 @@ impl ImageCache { context.queue.write_texture( // Tells wgpu where to copy the pixel data - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &self.texture, mip_level: 0, origin: wgpu::Origin3d { x: 0, y: 0, z: 0 }, @@ -265,7 +265,7 @@ impl ImageCache { // The actual pixel data &self.atlas.buffer, // The layout of the texture - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some((self.max_texture_size * 4).into()), rows_per_image: Some((self.max_texture_size).into()), diff --git a/sugarloaf/src/components/text/pipeline/cache.rs b/sugarloaf/src/components/text/pipeline/cache.rs index 9d6603aefb..17dbae30bd 100644 --- a/sugarloaf/src/components/text/pipeline/cache.rs +++ b/sugarloaf/src/components/text/pipeline/cache.rs @@ -36,7 +36,7 @@ impl Cache { let height = size[1] as usize; queue.write_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &self.texture, mip_level: 0, origin: wgpu::Origin3d { @@ -47,7 +47,7 @@ impl Cache { aspect: wgpu::TextureAspect::All, }, data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(width as u32), rows_per_image: Some(height as u32), diff --git a/sugarloaf/src/context/mod.rs b/sugarloaf/src/context/mod.rs index d02b927ba6..651e70bea3 100644 --- a/sugarloaf/src/context/mod.rs +++ b/sugarloaf/src/context/mod.rs @@ -67,9 +67,8 @@ impl Context<'_> { // - `gl` // - `webgpu` // - `primary` - let backend = - wgpu::util::backend_bits_from_env().unwrap_or(renderer_config.backend); - let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { + let backend = wgpu::Backends::from_env().unwrap_or(renderer_config.backend); + let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { backends: backend, ..Default::default() }); diff --git a/sugarloaf/tests/util/image.rs b/sugarloaf/tests/util/image.rs index 15581ed853..dd9a33c8e5 100644 --- a/sugarloaf/tests/util/image.rs +++ b/sugarloaf/tests/util/image.rs @@ -376,7 +376,7 @@ fn copy_texture_to_buffer_with_aspect( let block_size = texture.format().block_size(Some(aspect)).unwrap(); let mip_level = 0; encoder.copy_texture_to_buffer( - ImageCopyTexture { + TexelCopyTextureInfo { texture, mip_level, origin: Origin3d::ZERO,