Skip to content

Commit 2a4644b

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

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
131131
- Lower `QUERY_SET_MAX_QUERIES` (and enforced limits) from 8192 to 4096 to match WebGPU spec. By @ErichDonGubler in [#6525](https://github.com/gfx-rs/wgpu/pull/6525).
132132
- Allow non-filterable float on texture bindings never used with samplers when using a derived bind group layout. By @ErichDonGubler in [#6531](https://github.com/gfx-rs/wgpu/pull/6531/).
133133
- Replace potentially unsound usage of `PreHashedMap` with `FastHashMap`. By @jamienicol in [#6541](https://github.com/gfx-rs/wgpu/pull/6541).
134+
- Add missing validation for timestamp writes in compute and render passes (by @ErichDonGubler in [#6578](https://github.com/gfx-rs/wgpu/pull/6578)):
135+
- Check the status of the `TIMESTAMP_QUERY` feature before other validation.
134136

135137
#### Naga
136138

wgpu-core/src/command/compute.rs

+9-7
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

+2-1
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)