aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock4
-rw-r--r--components/script/dom/gpubuffer.rs1
-rw-r--r--components/script/dom/gputexture.rs7
-rw-r--r--components/webgpu/lib.rs12
4 files changed, 15 insertions, 9 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b4bc8fe7f39..bebc8f83d36 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7028,7 +7028,7 @@ dependencies = [
[[package]]
name = "wgpu-core"
version = "0.6.0"
-source = "git+https://github.com/gfx-rs/wgpu#1d0e0ce37ede5ec53000ab252c27b8cf856865b2"
+source = "git+https://github.com/gfx-rs/wgpu#59f0996eabd43e882d4bfc73ee5b4ed912617abf"
dependencies = [
"arrayvec 0.5.1",
"bitflags",
@@ -7055,7 +7055,7 @@ dependencies = [
[[package]]
name = "wgpu-types"
version = "0.6.0"
-source = "git+https://github.com/gfx-rs/wgpu#1d0e0ce37ede5ec53000ab252c27b8cf856865b2"
+source = "git+https://github.com/gfx-rs/wgpu#59f0996eabd43e882d4bfc73ee5b4ed912617abf"
dependencies = [
"bitflags",
"serde",
diff --git a/components/script/dom/gpubuffer.rs b/components/script/dom/gpubuffer.rs
index 2d721465e68..60a6075cb7f 100644
--- a/components/script/dom/gpubuffer.rs
+++ b/components/script/dom/gpubuffer.rs
@@ -184,6 +184,7 @@ impl GPUBufferMethods for GPUBuffer {
GPUBufferState::Mapped | GPUBufferState::MappedAtCreation => {
self.Unmap();
},
+ GPUBufferState::Destroyed => return,
_ => {},
};
if let Err(e) = self
diff --git a/components/script/dom/gputexture.rs b/components/script/dom/gputexture.rs
index 175ec7c90cc..b473e52eaae 100644
--- a/components/script/dom/gputexture.rs
+++ b/components/script/dom/gputexture.rs
@@ -18,6 +18,7 @@ use crate::dom::gpudevice::{
};
use crate::dom::gputextureview::GPUTextureView;
use dom_struct::dom_struct;
+use std::cell::Cell;
use std::num::NonZeroU32;
use std::string::String;
use webgpu::{
@@ -40,6 +41,7 @@ pub struct GPUTexture {
dimension: GPUTextureDimension,
format: GPUTextureFormat,
texture_usage: u32,
+ destroyed: Cell<bool>,
}
impl GPUTexture {
@@ -67,6 +69,7 @@ impl GPUTexture {
dimension,
format,
texture_usage,
+ destroyed: Cell::new(false),
}
}
@@ -197,6 +200,9 @@ impl GPUTextureMethods for GPUTexture {
/// https://gpuweb.github.io/gpuweb/#dom-gputexture-destroy
fn Destroy(&self) {
+ if self.destroyed.get() {
+ return;
+ }
if let Err(e) = self
.channel
.0
@@ -207,5 +213,6 @@ impl GPUTextureMethods for GPUTexture {
self.texture.0, e
);
};
+ self.destroyed.set(true);
}
}
diff --git a/components/webgpu/lib.rs b/components/webgpu/lib.rs
index 7d4dbd3e808..21935e06305 100644
--- a/components/webgpu/lib.rs
+++ b/components/webgpu/lib.rs
@@ -21,7 +21,6 @@ use servo_config::pref;
use smallvec::SmallVec;
use std::borrow::Cow;
use std::cell::RefCell;
-use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::num::NonZeroU64;
use std::rc::Rc;
@@ -475,9 +474,7 @@ impl<'a> WGPU<'a> {
))
.map_err(|e| format!("{:?}", e))
};
- if result.is_err() {
- self.encoder_record_error(command_encoder_id, result.clone());
- }
+ self.encoder_record_error(command_encoder_id, result.clone());
self.send_result(device_id, scope_id, result);
},
WebGPURequest::CopyBufferToBuffer {
@@ -1282,9 +1279,10 @@ impl<'a> WGPU<'a> {
result: Result<U, T>,
) {
if let Err(e) = result {
- if let Entry::Vacant(v) = self.error_command_encoders.borrow_mut().entry(encoder_id) {
- v.insert(format!("{:?}", e));
- }
+ self.error_command_encoders
+ .borrow_mut()
+ .entry(encoder_id)
+ .or_insert_with(|| format!("{:?}", e));
}
}
}