From 6f3b06ae5097439f5d4ce8032359feec20e2af39 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Mon, 30 Dec 2024 08:16:01 +0100 Subject: [PATCH] Update wgpu https://github.com/gfx-rs/wgpu/commit/0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93 Most notable change is https://github.com/gfx-rs/wgpu/pull/6785 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- Cargo.lock | 62 ++++++++++++------- Cargo.toml | 4 +- .../script/dom/webgpu/gpucommandencoder.rs | 29 +++++---- components/script/dom/webgpu/gpuconvert.rs | 10 ++- deny.toml | 4 ++ 5 files changed, 69 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b6209d73288fc..a178094a40c2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,7 +141,7 @@ dependencies = [ "ndk-context", "ndk-sys 0.6.0+11769913", "num_enum", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -224,7 +224,7 @@ dependencies = [ "objc-foundation", "objc_id", "parking_lot", - "thiserror", + "thiserror 1.0.69", "windows-sys 0.48.0", "x11rb", ] @@ -665,7 +665,7 @@ dependencies = [ "polling", "rustix", "slab", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2438,7 +2438,7 @@ dependencies = [ "libc", "memchr", "smallvec", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2538,7 +2538,7 @@ checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" dependencies = [ "log", "presser", - "thiserror", + "thiserror 1.0.69", "windows", ] @@ -2590,7 +2590,7 @@ dependencies = [ "paste", "pin-project-lite", "smallvec", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2834,7 +2834,7 @@ dependencies = [ "gstreamer-video-sys", "libc", "once_cell", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3745,7 +3745,7 @@ dependencies = [ "combine", "jni-sys", "log", - "thiserror", + "thiserror 1.0.69", "walkdir", "windows-sys 0.45.0", ] @@ -4483,7 +4483,7 @@ checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0" [[package]] name = "naga" version = "23.0.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=53f40794f275329a48efc7d1c637c91b8e51327d#53f40794f275329a48efc7d1c637c91b8e51327d" +source = "git+https://github.com/gfx-rs/wgpu?rev=0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93#0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" dependencies = [ "arrayvec", "bit-set", @@ -4496,7 +4496,7 @@ dependencies = [ "rustc-hash 1.1.0", "spirv", "termcolor", - "thiserror", + "thiserror 2.0.9", "unicode-xid", ] @@ -4559,7 +4559,7 @@ dependencies = [ "ndk-sys 0.6.0+11769913", "num_enum", "raw-window-handle", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5763,7 +5763,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -6279,7 +6279,7 @@ dependencies = [ "foreign-types 0.3.2", "objc", "objc-foundation", - "thiserror", + "thiserror 1.0.69", "time-point", ] @@ -6768,7 +6768,7 @@ dependencies = [ "log", "memmap2", "rustix", - "thiserror", + "thiserror 1.0.69", "wayland-backend", "wayland-client", "wayland-csd-frame", @@ -7189,7 +7189,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +dependencies = [ + "thiserror-impl 2.0.9", ] [[package]] @@ -7203,6 +7212,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread-id" version = "4.2.2" @@ -7645,7 +7665,7 @@ dependencies = [ "rand", "rustls", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", ] @@ -8326,7 +8346,7 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "wgpu-core" version = "23.0.1" -source = "git+https://github.com/gfx-rs/wgpu?rev=53f40794f275329a48efc7d1c637c91b8e51327d#53f40794f275329a48efc7d1c637c91b8e51327d" +source = "git+https://github.com/gfx-rs/wgpu?rev=0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93#0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" dependencies = [ "arrayvec", "bit-vec", @@ -8342,7 +8362,7 @@ dependencies = [ "rustc-hash 1.1.0", "serde", "smallvec", - "thiserror", + "thiserror 2.0.9", "wgpu-hal", "wgpu-types", ] @@ -8350,7 +8370,7 @@ dependencies = [ [[package]] name = "wgpu-hal" version = "23.0.1" -source = "git+https://github.com/gfx-rs/wgpu?rev=53f40794f275329a48efc7d1c637c91b8e51327d#53f40794f275329a48efc7d1c637c91b8e51327d" +source = "git+https://github.com/gfx-rs/wgpu?rev=0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93#0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" dependencies = [ "android_system_properties", "arrayvec", @@ -8382,7 +8402,7 @@ dependencies = [ "raw-window-handle", "rustc-hash 1.1.0", "smallvec", - "thiserror", + "thiserror 2.0.9", "wasm-bindgen", "web-sys", "wgpu-types", @@ -8393,7 +8413,7 @@ dependencies = [ [[package]] name = "wgpu-types" version = "23.0.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=53f40794f275329a48efc7d1c637c91b8e51327d#53f40794f275329a48efc7d1c637c91b8e51327d" +source = "git+https://github.com/gfx-rs/wgpu?rev=0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93#0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" dependencies = [ "bitflags 2.6.0", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 632a7c26b26b9..7abe17ac53247 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -155,8 +155,8 @@ webrender_api = { git = "https://github.com/servo/webrender", branch = "0.65" } webrender_traits = { path = "components/shared/webrender" } webxr = { git = "https://github.com/servo/webxr" } webxr-api = { git = "https://github.com/servo/webxr" } -wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "53f40794f275329a48efc7d1c637c91b8e51327d" } -wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "53f40794f275329a48efc7d1c637c91b8e51327d" } +wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" } +wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" } windows-sys = "0.59" wr_malloc_size_of = { git = "https://github.com/servo/webrender", branch = "0.65" } xi-unicode = "0.3.0" diff --git a/components/script/dom/webgpu/gpucommandencoder.rs b/components/script/dom/webgpu/gpucommandencoder.rs index 779b0af95b052..85b5e106ea9a9 100644 --- a/components/script/dom/webgpu/gpucommandencoder.rs +++ b/components/script/dom/webgpu/gpucommandencoder.rs @@ -21,6 +21,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; +use crate::dom::gpuconvert::convert_load_op; use crate::dom::webgpu::gpubuffer::GPUBuffer; use crate::dom::webgpu::gpucommandbuffer::GPUCommandBuffer; use crate::dom::webgpu::gpucomputepassencoder::GPUComputePassEncoder; @@ -156,15 +157,19 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder { let depth_stencil_attachment = descriptor.depthStencilAttachment.as_ref().map(|ds| { wgpu_com::RenderPassDepthStencilAttachment { depth: wgpu_com::PassChannel { - load_op: ds.depthLoadOp.as_ref().map(Convert::convert), + load_op: ds + .depthLoadOp + .as_ref() + .map(|l| convert_load_op(l, ds.depthClearValue.map(|v| *v))), store_op: ds.depthStoreOp.as_ref().map(Convert::convert), - clear_value: ds.depthClearValue.map(|v| *v), read_only: ds.depthReadOnly, }, stencil: wgpu_com::PassChannel { - load_op: ds.stencilLoadOp.as_ref().map(Convert::convert), + load_op: ds + .stencilLoadOp + .as_ref() + .map(|l| convert_load_op(l, Some(ds.stencilClearValue))), store_op: ds.stencilStoreOp.as_ref().map(Convert::convert), - clear_value: Some(ds.stencilClearValue), read_only: ds.stencilReadOnly, }, view: ds.view.id().0, @@ -177,14 +182,16 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder { .map(|color| -> Fallible<_> { Ok(Some(wgpu_com::RenderPassColorAttachment { resolve_target: color.resolveTarget.as_ref().map(|t| t.id().0), - load_op: color.loadOp.convert(), + load_op: convert_load_op( + &color.loadOp, + color + .clearValue + .as_ref() + .map(|color| (color).try_convert()) + .transpose()? + .unwrap_or_default(), + ), store_op: color.storeOp.convert(), - clear_value: color - .clearValue - .as_ref() - .map(|color| (color).try_convert()) - .transpose()? - .unwrap_or_default(), view: color.view.id().0, })) }) diff --git a/components/script/dom/webgpu/gpuconvert.rs b/components/script/dom/webgpu/gpuconvert.rs index ee4e6e7f09c09..7f03c507e1bf4 100644 --- a/components/script/dom/webgpu/gpuconvert.rs +++ b/components/script/dom/webgpu/gpuconvert.rs @@ -406,12 +406,10 @@ impl Convert for &GPUBlendComponent { } } -impl Convert for &GPULoadOp { - fn convert(self) -> wgpu_com::LoadOp { - match self { - GPULoadOp::Load => wgpu_com::LoadOp::Load, - GPULoadOp::Clear => wgpu_com::LoadOp::Clear, - } +pub(crate) fn convert_load_op(load: &GPULoadOp, clear: T) -> wgpu_com::LoadOp { + match load { + GPULoadOp::Load => wgpu_com::LoadOp::Load, + GPULoadOp::Clear => wgpu_com::LoadOp::Clear(clear), } } diff --git a/deny.toml b/deny.toml index 3cb1abe62cfad..363d86840e2f6 100644 --- a/deny.toml +++ b/deny.toml @@ -153,6 +153,10 @@ skip = [ # wgpu crates still depend on 1.1.0 "rustc-hash", + + # wgpu depends on thiserror 2, while rest is still on 1 + "thiserror", + "thiserror-impl", ] # github.com organizations to allow git sources for