aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gpurenderpipeline.rs
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2024-04-26 09:04:15 +0200
committerGitHub <noreply@github.com>2024-04-26 07:04:15 +0000
commit4af413cd04a962eb46e60005a1958622629e4a4f (patch)
treef2113d3bc7398bcc574ee8ad44e72a5aaf476836 /components/script/dom/gpurenderpipeline.rs
parent81c4f2ae7a0b605befae652c0feeea03caba6292 (diff)
downloadservo-4af413cd04a962eb46e60005a1958622629e4a4f.tar.gz
servo-4af413cd04a962eb46e60005a1958622629e4a4f.zip
webgpu: Update wgpu to 0.19 (#31995)
* Update wgpu to https://github.com/gfx-rs/wgpu/commit/32e70bc1635905c508d408eb1cf22b2aa062ffe1 (0.19) * Update expect only good * reexpect * remove dbg stuff * Remove all occurrences of dx11_hub
Diffstat (limited to 'components/script/dom/gpurenderpipeline.rs')
-rw-r--r--components/script/dom/gpurenderpipeline.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/components/script/dom/gpurenderpipeline.rs b/components/script/dom/gpurenderpipeline.rs
index 765737fa8b9..411c176c326 100644
--- a/components/script/dom/gpurenderpipeline.rs
+++ b/components/script/dom/gpurenderpipeline.rs
@@ -5,7 +5,7 @@
use std::string::String;
use dom_struct::dom_struct;
-use webgpu::{WebGPUBindGroupLayout, WebGPURenderPipeline};
+use webgpu::{WebGPU, WebGPUBindGroupLayout, WebGPURenderPipeline, WebGPURequest};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineMethods;
@@ -20,6 +20,9 @@ use crate::dom::gpudevice::GPUDevice;
#[dom_struct]
pub struct GPURenderPipeline {
reflector_: Reflector,
+ #[ignore_malloc_size_of = "channels are hard"]
+ #[no_trace]
+ channel: WebGPU,
label: DomRefCell<USVString>,
#[no_trace]
render_pipeline: WebGPURenderPipeline,
@@ -37,6 +40,7 @@ impl GPURenderPipeline {
) -> Self {
Self {
reflector_: Reflector::new(),
+ channel: device.channel(),
label: DomRefCell::new(label),
render_pipeline,
bind_group_layouts: bgls,
@@ -87,8 +91,23 @@ impl GPURenderPipelineMethods for GPURenderPipeline {
}
Ok(GPUBindGroupLayout::new(
&self.global(),
+ self.channel.clone(),
self.bind_group_layouts[index as usize],
USVString::default(),
))
}
}
+
+impl Drop for GPURenderPipeline {
+ fn drop(&mut self) {
+ if let Err(e) = self.channel.0.send((
+ None,
+ WebGPURequest::DropRenderPipeline(self.render_pipeline.0),
+ )) {
+ warn!(
+ "Failed to send WebGPURequest::DropRenderPipeline({:?}) ({})",
+ self.render_pipeline.0, e
+ );
+ };
+ }
+}