aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gpushadermodule.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/gpushadermodule.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/gpushadermodule.rs')
-rw-r--r--components/script/dom/gpushadermodule.rs30
1 files changed, 27 insertions, 3 deletions
diff --git a/components/script/dom/gpushadermodule.rs b/components/script/dom/gpushadermodule.rs
index 745daefaac3..56e37808031 100644
--- a/components/script/dom/gpushadermodule.rs
+++ b/components/script/dom/gpushadermodule.rs
@@ -5,7 +5,7 @@
use std::rc::Rc;
use dom_struct::dom_struct;
-use webgpu::WebGPUShaderModule;
+use webgpu::{WebGPU, WebGPURequest, WebGPUShaderModule};
use super::bindings::error::Fallible;
use super::promise::Promise;
@@ -19,15 +19,19 @@ use crate::dom::globalscope::GlobalScope;
#[dom_struct]
pub struct GPUShaderModule {
reflector_: Reflector,
+ #[ignore_malloc_size_of = "defined in webgpu"]
+ #[no_trace]
+ channel: WebGPU,
label: DomRefCell<USVString>,
#[no_trace]
shader_module: WebGPUShaderModule,
}
impl GPUShaderModule {
- fn new_inherited(shader_module: WebGPUShaderModule, label: USVString) -> Self {
+ fn new_inherited(channel: WebGPU, shader_module: WebGPUShaderModule, label: USVString) -> Self {
Self {
reflector_: Reflector::new(),
+ channel,
label: DomRefCell::new(label),
shader_module,
}
@@ -35,11 +39,16 @@ impl GPUShaderModule {
pub fn new(
global: &GlobalScope,
+ channel: WebGPU,
shader_module: WebGPUShaderModule,
label: USVString,
) -> DomRoot<Self> {
reflect_dom_object(
- Box::new(GPUShaderModule::new_inherited(shader_module, label)),
+ Box::new(GPUShaderModule::new_inherited(
+ channel,
+ shader_module,
+ label,
+ )),
global,
)
}
@@ -67,3 +76,18 @@ impl GPUShaderModuleMethods for GPUShaderModule {
todo!("Missing in wgpu: https://github.com/gfx-rs/wgpu/issues/2170")
}
}
+
+impl Drop for GPUShaderModule {
+ fn drop(&mut self) {
+ if let Err(e) = self
+ .channel
+ .0
+ .send((None, WebGPURequest::DropShaderModule(self.shader_module.0)))
+ {
+ warn!(
+ "Failed to send DropShaderModule ({:?}) ({})",
+ self.shader_module.0, e
+ );
+ }
+ }
+}