diff --git a/CHANGELOG.md b/CHANGELOG.md index 45b2871c3f..de11b30459 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,13 @@ Bottom level categories: - Change the `DropCallback` API to use `FnOnce` instead of `FnMut`. By @jerzywilczek in [#6482](https://github.com/gfx-rs/wgpu/pull/6482) +### Bug Fixes + +#### General + +- Ensure that `Features::TIMESTAMP_QUERY` is set when using timestamp writes in render and compute passes. By @ErichDonGubler in [#6497](https://github.com/gfx-rs/wgpu/pull/6497). +- Check for device mismatches when beginning render and compute passes. By @ErichDonGubler in [#6497](https://github.com/gfx-rs/wgpu/pull/6497). + ## 23.0.0 (2024-10-25) ### Themes of this release diff --git a/wgpu-core/src/command/compute.rs b/wgpu-core/src/command/compute.rs index 07dcc2475a..93654c9235 100644 --- a/wgpu-core/src/command/compute.rs +++ b/wgpu-core/src/command/compute.rs @@ -312,6 +312,17 @@ impl Global { Ok(query_set) => query_set, Err(e) => return make_err(e.into(), arc_desc), }; + match query_set.same_device(&cmd_buf.device) { + Ok(()) => (), + Err(e) => return make_err(e.into(), arc_desc), + } + match cmd_buf + .device + .require_features(wgt::Features::TIMESTAMP_QUERY) + { + Ok(()) => (), + Err(e) => return make_err(e.into(), arc_desc), + } Some(ArcPassTimestampWrites { query_set, diff --git a/wgpu-core/src/command/mod.rs b/wgpu-core/src/command/mod.rs index 42c80d3ca5..540ff9d2e5 100644 --- a/wgpu-core/src/command/mod.rs +++ b/wgpu-core/src/command/mod.rs @@ -26,7 +26,7 @@ pub use timestamp_writes::PassTimestampWrites; use self::memory_init::CommandBufferTextureMemoryActions; -use crate::device::{Device, DeviceError}; +use crate::device::{Device, DeviceError, MissingFeatures}; use crate::lock::{rank, Mutex}; use crate::snatch::SnatchGuard; @@ -642,6 +642,8 @@ pub enum CommandEncoderError { InvalidColorAttachment(#[from] ColorAttachmentError), #[error(transparent)] InvalidResource(#[from] InvalidResourceError), + #[error(transparent)] + MissingFeatures(#[from] MissingFeatures), } impl Global { diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index d22eb5f0d6..6102d0d492 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -1358,9 +1358,11 @@ impl Global { }) = color_attachment { let view = texture_views.get(*view_id).get()?; + view.same_device(device)?; let resolve_target = if let Some(resolve_target_id) = resolve_target { let rt_arc = texture_views.get(*resolve_target_id).get()?; + rt_arc.same_device(device)?; Some(rt_arc) } else { @@ -1382,6 +1384,7 @@ impl Global { arc_desc.depth_stencil_attachment = if let Some(depth_stencil_attachment) = desc.depth_stencil_attachment { let view = texture_views.get(depth_stencil_attachment.view).get()?; + view.same_device(device)?; Some(ArcRenderPassDepthStencilAttachment { view, @@ -1394,6 +1397,9 @@ impl Global { arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes { let query_set = query_sets.get(tw.query_set).get()?; + query_set.same_device(device)?; + + device.require_features(wgt::Features::TIMESTAMP_QUERY)?; Some(ArcPassTimestampWrites { query_set, @@ -1407,6 +1413,7 @@ impl Global { arc_desc.occlusion_query_set = if let Some(occlusion_query_set) = desc.occlusion_query_set { let query_set = query_sets.get(occlusion_query_set).get()?; + query_set.same_device(device)?; Some(query_set) } else {