aboutsummaryrefslogtreecommitdiffstats
path: root/components/webgpu/lib.rs
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2020-08-24 16:04:34 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2020-08-25 11:07:25 +0530
commit851f83c61fc51d30c79e6ea5f9e521c81d3e5461 (patch)
tree43b4000f36f81419803566694e1f1f47dc061cfd /components/webgpu/lib.rs
parent84185eb1daf1420597f38a77e40ed3baedb5d521 (diff)
downloadservo-851f83c61fc51d30c79e6ea5f9e521c81d3e5461.tar.gz
servo-851f83c61fc51d30c79e6ea5f9e521c81d3e5461.zip
Prevent redundant texture and buffer destroy calls
Diffstat (limited to 'components/webgpu/lib.rs')
-rw-r--r--components/webgpu/lib.rs12
1 files changed, 5 insertions, 7 deletions
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));
}
}
}