Skip to content

Commit 6f3b06a

Browse files
committed
Update wgpu
gfx-rs/wgpu@0f5f058 Most notable change is gfx-rs/wgpu#6785 Signed-off-by: sagudev <[email protected]>
1 parent 1296c71 commit 6f3b06a

File tree

5 files changed

+69
-40
lines changed

5 files changed

+69
-40
lines changed

Cargo.lock

Lines changed: 41 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ webrender_api = { git = "https://github.com/servo/webrender", branch = "0.65" }
155155
webrender_traits = { path = "components/shared/webrender" }
156156
webxr = { git = "https://github.com/servo/webxr" }
157157
webxr-api = { git = "https://github.com/servo/webxr" }
158-
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "53f40794f275329a48efc7d1c637c91b8e51327d" }
159-
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "53f40794f275329a48efc7d1c637c91b8e51327d" }
158+
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" }
159+
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93" }
160160
windows-sys = "0.59"
161161
wr_malloc_size_of = { git = "https://github.com/servo/webrender", branch = "0.65" }
162162
xi-unicode = "0.3.0"

components/script/dom/webgpu/gpucommandencoder.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
2121
use crate::dom::bindings::root::{Dom, DomRoot};
2222
use crate::dom::bindings::str::USVString;
2323
use crate::dom::globalscope::GlobalScope;
24+
use crate::dom::gpuconvert::convert_load_op;
2425
use crate::dom::webgpu::gpubuffer::GPUBuffer;
2526
use crate::dom::webgpu::gpucommandbuffer::GPUCommandBuffer;
2627
use crate::dom::webgpu::gpucomputepassencoder::GPUComputePassEncoder;
@@ -156,15 +157,19 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> for GPUCommandEncoder {
156157
let depth_stencil_attachment = descriptor.depthStencilAttachment.as_ref().map(|ds| {
157158
wgpu_com::RenderPassDepthStencilAttachment {
158159
depth: wgpu_com::PassChannel {
159-
load_op: ds.depthLoadOp.as_ref().map(Convert::convert),
160+
load_op: ds
161+
.depthLoadOp
162+
.as_ref()
163+
.map(|l| convert_load_op(l, ds.depthClearValue.map(|v| *v))),
160164
store_op: ds.depthStoreOp.as_ref().map(Convert::convert),
161-
clear_value: ds.depthClearValue.map(|v| *v),
162165
read_only: ds.depthReadOnly,
163166
},
164167
stencil: wgpu_com::PassChannel {
165-
load_op: ds.stencilLoadOp.as_ref().map(Convert::convert),
168+
load_op: ds
169+
.stencilLoadOp
170+
.as_ref()
171+
.map(|l| convert_load_op(l, Some(ds.stencilClearValue))),
166172
store_op: ds.stencilStoreOp.as_ref().map(Convert::convert),
167-
clear_value: Some(ds.stencilClearValue),
168173
read_only: ds.stencilReadOnly,
169174
},
170175
view: ds.view.id().0,
@@ -177,14 +182,16 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> for GPUCommandEncoder {
177182
.map(|color| -> Fallible<_> {
178183
Ok(Some(wgpu_com::RenderPassColorAttachment {
179184
resolve_target: color.resolveTarget.as_ref().map(|t| t.id().0),
180-
load_op: color.loadOp.convert(),
185+
load_op: convert_load_op(
186+
&color.loadOp,
187+
color
188+
.clearValue
189+
.as_ref()
190+
.map(|color| (color).try_convert())
191+
.transpose()?
192+
.unwrap_or_default(),
193+
),
181194
store_op: color.storeOp.convert(),
182-
clear_value: color
183-
.clearValue
184-
.as_ref()
185-
.map(|color| (color).try_convert())
186-
.transpose()?
187-
.unwrap_or_default(),
188195
view: color.view.id().0,
189196
}))
190197
})

components/script/dom/webgpu/gpuconvert.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,10 @@ impl Convert<wgt::BlendComponent> for &GPUBlendComponent {
406406
}
407407
}
408408

409-
impl Convert<wgpu_com::LoadOp> for &GPULoadOp {
410-
fn convert(self) -> wgpu_com::LoadOp {
411-
match self {
412-
GPULoadOp::Load => wgpu_com::LoadOp::Load,
413-
GPULoadOp::Clear => wgpu_com::LoadOp::Clear,
414-
}
409+
pub(crate) fn convert_load_op<T>(load: &GPULoadOp, clear: T) -> wgpu_com::LoadOp<T> {
410+
match load {
411+
GPULoadOp::Load => wgpu_com::LoadOp::Load,
412+
GPULoadOp::Clear => wgpu_com::LoadOp::Clear(clear),
415413
}
416414
}
417415

deny.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ skip = [
153153

154154
# wgpu crates still depend on 1.1.0
155155
"rustc-hash",
156+
157+
# wgpu depends on thiserror 2, while rest is still on 1
158+
"thiserror",
159+
"thiserror-impl",
156160
]
157161

158162
# github.com organizations to allow git sources for

0 commit comments

Comments
 (0)