fix: check for device mismatch in create_{render,compute}_pass

This commit is contained in:
Erich Gubler 2024-11-05 16:09:21 -05:00
parent 2e46a6c9c9
commit 5936fe58f4
3 changed files with 16 additions and 7 deletions

View File

@ -63,6 +63,7 @@ Bottom level categories:
#### 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)

View File

@ -308,6 +308,14 @@ impl Global {
};
arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
let query_set = match hub.query_sets.get(tw.query_set).get() {
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)
@ -316,11 +324,6 @@ impl Global {
Err(e) => return make_err(e.into(), arc_desc),
}
let query_set = match hub.query_sets.get(tw.query_set).get() {
Ok(query_set) => query_set,
Err(e) => return make_err(e.into(), arc_desc),
};
Some(ArcPassTimestampWrites {
query_set,
beginning_of_pass_write_index: tw.beginning_of_pass_write_index,

View File

@ -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,
@ -1393,9 +1396,10 @@ impl Global {
};
arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
device.require_features(wgt::Features::TIMESTAMP_QUERY)?;
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,
@ -1409,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 {