fix(core): validate TIMESTAMP_QUERY feature before other query set validation in pass creation

This commit is contained in:
Erich Gubler
2024-11-21 09:16:40 -05:00
parent 5ca92bf984
commit b17c30338d
3 changed files with 14 additions and 9 deletions

View File

@@ -131,6 +131,8 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
- 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).
- 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/).
- Replace potentially unsound usage of `PreHashedMap` with `FastHashMap`. By @jamienicol in [#6541](https://github.com/gfx-rs/wgpu/pull/6541).
- Add missing validation for timestamp writes in compute and render passes. By @ErichDonGubler in [#6578](https://github.com/gfx-rs/wgpu/pull/6578).
- Check the status of the `TIMESTAMP_QUERY` feature before other validation.
#### Naga

View File

@@ -309,14 +309,6 @@ 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)
@@ -325,6 +317,16 @@ 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),
};
match query_set.same_device(&cmd_buf.device) {
Ok(()) => (),
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

@@ -1393,10 +1393,11 @@ 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)?;
query_set.same_device(device)?;
Some(ArcPassTimestampWrites {
query_set,
beginning_of_pass_write_index: tw.beginning_of_pass_write_index,