summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wgpu-core/src/command/clear.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/wgpu-core/src/command/clear.rs')
-rw-r--r--third_party/rust/wgpu-core/src/command/clear.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/third_party/rust/wgpu-core/src/command/clear.rs b/third_party/rust/wgpu-core/src/command/clear.rs
index 72c923f82e..faff177928 100644
--- a/third_party/rust/wgpu-core/src/command/clear.rs
+++ b/third_party/rust/wgpu-core/src/command/clear.rs
@@ -104,6 +104,11 @@ impl Global {
let dst_buffer = buffer_guard
.get(dst)
.map_err(|_| ClearError::InvalidBuffer(dst))?;
+
+ if dst_buffer.device.as_info().id() != cmd_buf.device.as_info().id() {
+ return Err(DeviceError::WrongDevice.into());
+ }
+
cmd_buf_data
.trackers
.buffers
@@ -200,6 +205,10 @@ impl Global {
.get(dst)
.map_err(|_| ClearError::InvalidTexture(dst))?;
+ if dst_texture.device.as_info().id() != cmd_buf.device.as_info().id() {
+ return Err(DeviceError::WrongDevice.into());
+ }
+
// Check if subresource aspects are valid.
let clear_aspects =
hal::FormatAspects::new(dst_texture.desc.format, subresource_range.aspect);