webgpu: Update wgpu to 0.19 (#31995)

* Update wgpu to 32e70bc163 (0.19)

* Update expect only good

* reexpect

* remove dbg stuff

* Remove all occurrences of dx11_hub
This commit is contained in:
Samson 2024-04-26 09:04:15 +02:00 committed by GitHub
parent 81c4f2ae7a
commit 4af413cd04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 3422 additions and 9526 deletions

View file

@ -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
);
}
}
}