Skip to content

Commit e524930

Browse files
fix(core): validate TIMESTAMP_QUERY feature before other query set validation in pass creation
1 parent 5ca92bf commit e524930

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

wgpu-core/src/command/compute.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,21 +309,23 @@ impl Global {
309309
};
310310

311311
arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
312+
match cmd_buf
313+
.device
314+
.require_features(wgt::Features::TIMESTAMP_QUERY)
315+
{
316+
Ok(()) => (),
317+
Err(e) => return make_err(e.into(), arc_desc),
318+
}
319+
312320
let query_set = match hub.query_sets.get(tw.query_set).get() {
313321
Ok(query_set) => query_set,
314322
Err(e) => return make_err(e.into(), arc_desc),
315323
};
324+
316325
match query_set.same_device(&cmd_buf.device) {
317326
Ok(()) => (),
318327
Err(e) => return make_err(e.into(), arc_desc),
319328
}
320-
match cmd_buf
321-
.device
322-
.require_features(wgt::Features::TIMESTAMP_QUERY)
323-
{
324-
Ok(()) => (),
325-
Err(e) => return make_err(e.into(), arc_desc),
326-
}
327329

328330
Some(ArcPassTimestampWrites {
329331
query_set,

wgpu-core/src/command/render.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,10 +1393,11 @@ impl Global {
13931393

13941394
arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
13951395
let query_set = query_sets.get(tw.query_set).get()?;
1396-
query_set.same_device(device)?;
13971396

13981397
device.require_features(wgt::Features::TIMESTAMP_QUERY)?;
13991398

1399+
query_set.same_device(device)?;
1400+
14001401
Some(ArcPassTimestampWrites {
14011402
query_set,
14021403
beginning_of_pass_write_index: tw.beginning_of_pass_write_index,

0 commit comments

Comments
 (0)