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::{WebGPUDevice, WebGPUSampler};
use webgpu::{WebGPU, WebGPUDevice, WebGPURequest, WebGPUSampler};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSamplerMethods;
@ -15,6 +15,9 @@ use crate::dom::globalscope::GlobalScope;
#[dom_struct]
pub struct GPUSampler {
reflector_: Reflector,
#[ignore_malloc_size_of = "defined in webgpu"]
#[no_trace]
channel: WebGPU,
label: DomRefCell<USVString>,
#[no_trace]
device: WebGPUDevice,
@ -25,6 +28,7 @@ pub struct GPUSampler {
impl GPUSampler {
fn new_inherited(
channel: WebGPU,
device: WebGPUDevice,
compare_enable: bool,
sampler: WebGPUSampler,
@ -32,6 +36,7 @@ impl GPUSampler {
) -> Self {
Self {
reflector_: Reflector::new(),
channel,
label: DomRefCell::new(label),
device,
sampler,
@ -41,6 +46,7 @@ impl GPUSampler {
pub fn new(
global: &GlobalScope,
channel: WebGPU,
device: WebGPUDevice,
compare_enable: bool,
sampler: WebGPUSampler,
@ -48,6 +54,7 @@ impl GPUSampler {
) -> DomRoot<Self> {
reflect_dom_object(
Box::new(GPUSampler::new_inherited(
channel,
device,
compare_enable,
sampler,
@ -75,3 +82,15 @@ impl GPUSamplerMethods for GPUSampler {
*self.label.borrow_mut() = value;
}
}
impl Drop for GPUSampler {
fn drop(&mut self) {
if let Err(e) = self
.channel
.0
.send((None, WebGPURequest::DropSampler(self.sampler.0)))
{
warn!("Failed to send DropSampler ({:?}) ({})", self.sampler.0, e);
}
}
}