diff options
Diffstat (limited to 'components/script/dom/gputexture.rs')
-rw-r--r-- | components/script/dom/gputexture.rs | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/components/script/dom/gputexture.rs b/components/script/dom/gputexture.rs index 4f97024f774..062b2101d0a 100644 --- a/components/script/dom/gputexture.rs +++ b/components/script/dom/gputexture.rs @@ -7,7 +7,7 @@ use std::string::String; use dom_struct::dom_struct; use webgpu::wgc::resource; -use webgpu::{wgt, WebGPU, WebGPUOpResult, WebGPURequest, WebGPUTexture, WebGPUTextureView}; +use webgpu::{wgt, WebGPU, WebGPURequest, WebGPUTexture, WebGPUTextureView}; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{ @@ -114,7 +114,7 @@ impl Drop for GPUTexture { if let Err(e) = self .channel .0 - .send((None, WebGPURequest::DropTexture(self.texture.0))) + .send(WebGPURequest::DropTexture(self.texture.0)) { warn!( "Failed to send WebGPURequest::DropTexture({:?}) ({})", @@ -143,8 +143,6 @@ impl GPUTextureMethods for GPUTexture { /// <https://gpuweb.github.io/gpuweb/#dom-gputexture-createview> fn CreateView(&self, descriptor: &GPUTextureViewDescriptor) -> DomRoot<GPUTextureView> { - let scope_id = self.device.use_current_scope(); - let desc = if !matches!(descriptor.mipLevelCount, Some(0)) && !matches!(descriptor.arrayLayerCount, Some(0)) { @@ -165,12 +163,10 @@ impl GPUTextureMethods for GPUTexture { }, }) } else { - self.device.handle_server_msg( - scope_id, - WebGPUOpResult::ValidationError(String::from( + self.device + .dispatch_error(webgpu::Error::Validation(String::from( "arrayLayerCount and mipLevelCount cannot be 0", - )), - ); + ))); None }; @@ -182,15 +178,12 @@ impl GPUTextureMethods for GPUTexture { self.channel .0 - .send(( - scope_id, - WebGPURequest::CreateTextureView { - texture_id: self.texture.0, - texture_view_id, - device_id: self.device.id().0, - descriptor: desc, - }, - )) + .send(WebGPURequest::CreateTextureView { + texture_id: self.texture.0, + texture_view_id, + device_id: self.device.id().0, + descriptor: desc, + }) .expect("Failed to create WebGPU texture view"); let texture_view = WebGPUTextureView(texture_view_id); @@ -209,13 +202,10 @@ impl GPUTextureMethods for GPUTexture { if self.destroyed.get() { return; } - if let Err(e) = self.channel.0.send(( - None, - WebGPURequest::DestroyTexture { - device_id: self.device.id().0, - texture_id: self.texture.0, - }, - )) { + if let Err(e) = self.channel.0.send(WebGPURequest::DestroyTexture { + device_id: self.device.id().0, + texture_id: self.texture.0, + }) { warn!( "Failed to send WebGPURequest::DestroyTexture({:?}) ({})", self.texture.0, e |