summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wgpu-core/src/command/query.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/wgpu-core/src/command/query.rs')
-rw-r--r--third_party/rust/wgpu-core/src/command/query.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/third_party/rust/wgpu-core/src/command/query.rs b/third_party/rust/wgpu-core/src/command/query.rs
index 89cba6fbf3..fd3360cc00 100644
--- a/third_party/rust/wgpu-core/src/command/query.rs
+++ b/third_party/rust/wgpu-core/src/command/query.rs
@@ -9,7 +9,7 @@ use crate::{
hal_api::HalApi,
id::{self, Id},
init_tracker::MemoryInitKind,
- resource::QuerySet,
+ resource::{QuerySet, Resource},
storage::Storage,
Epoch, FastHashMap, Index,
};
@@ -429,11 +429,20 @@ impl Global {
.add_single(&*query_set_guard, query_set_id)
.ok_or(QueryError::InvalidQuerySet(query_set_id))?;
+ if query_set.device.as_info().id() != cmd_buf.device.as_info().id() {
+ return Err(DeviceError::WrongDevice.into());
+ }
+
let (dst_buffer, dst_pending) = {
let buffer_guard = hub.buffers.read();
let dst_buffer = buffer_guard
.get(destination)
.map_err(|_| QueryError::InvalidBuffer(destination))?;
+
+ if dst_buffer.device.as_info().id() != cmd_buf.device.as_info().id() {
+ return Err(DeviceError::WrongDevice.into());
+ }
+
tracker
.buffers
.set_single(dst_buffer, hal::BufferUses::COPY_DST)