Skip to content

Commit

Permalink
Update wgpu
Browse files Browse the repository at this point in the history
gfx-rs/wgpu@0f5f058

Most notable change is gfx-rs/wgpu#6785

Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Dec 30, 2024
1 parent 1296c71 commit 6f3b06a
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 40 deletions.
62 changes: 41 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
29 changes: 18 additions & 11 deletions components/script/dom/webgpu/gpucommandencoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -156,15 +157,19 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> 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,
Expand All @@ -177,14 +182,16 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> 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,
}))
})
Expand Down
10 changes: 4 additions & 6 deletions components/script/dom/webgpu/gpuconvert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,10 @@ impl Convert<wgt::BlendComponent> for &GPUBlendComponent {
}
}

impl Convert<wgpu_com::LoadOp> 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<T>(load: &GPULoadOp, clear: T) -> wgpu_com::LoadOp<T> {
match load {
GPULoadOp::Load => wgpu_com::LoadOp::Load,
GPULoadOp::Clear => wgpu_com::LoadOp::Clear(clear),
}
}

Expand Down
4 changes: 4 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f3b06a

Please sign in to comment.