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

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use dom_struct::dom_struct;
use webgpu::WebGPUTextureView;
use webgpu::{WebGPU, WebGPURequest, WebGPUTextureView};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewMethods;
@ -16,6 +16,9 @@ use crate::dom::gputexture::GPUTexture;
#[dom_struct]
pub struct GPUTextureView {
reflector_: Reflector,
#[ignore_malloc_size_of = "defined in webgpu"]
#[no_trace]
channel: WebGPU,
label: DomRefCell<USVString>,
#[no_trace]
texture_view: WebGPUTextureView,
@ -24,12 +27,14 @@ pub struct GPUTextureView {
impl GPUTextureView {
fn new_inherited(
channel: WebGPU,
texture_view: WebGPUTextureView,
texture: &GPUTexture,
label: USVString,
) -> GPUTextureView {
Self {
reflector_: Reflector::new(),
channel,
texture: Dom::from_ref(texture),
label: DomRefCell::new(label),
texture_view,
@ -38,12 +43,18 @@ impl GPUTextureView {
pub fn new(
global: &GlobalScope,
channel: WebGPU,
texture_view: WebGPUTextureView,
texture: &GPUTexture,
label: USVString,
) -> DomRoot<GPUTextureView> {
reflect_dom_object(
Box::new(GPUTextureView::new_inherited(texture_view, texture, label)),
Box::new(GPUTextureView::new_inherited(
channel,
texture_view,
texture,
label,
)),
global,
)
}
@ -66,3 +77,18 @@ impl GPUTextureViewMethods for GPUTextureView {
*self.label.borrow_mut() = value;
}
}
impl Drop for GPUTextureView {
fn drop(&mut self) {
if let Err(e) = self
.channel
.0
.send((None, WebGPURequest::DropTextureView(self.texture_view.0)))
{
warn!(
"Failed to send DropTextureView ({:?}) ({})",
self.texture_view.0, e
);
}
}
}