Skip to content

Commit 71c392a

Browse files
fix(core): validate that at least one pass timestamp write index is specified
1 parent 6365e2d commit 71c392a

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ 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).
134+
- Add missing validation for timestamp writes in compute and render passes. By @ErichDonGubler in [#6578](https://github.com/gfx-rs/wgpu/pull/6578), #????.
135135
- Check the status of the `TIMESTAMP_QUERY` feature before other validation.
136136
- Check that indices are in-bounds for the query set.
137137
- Check that begin and end indices are not equal.
138+
- Check that at least one index is specified.
138139
- Reject destroyed buffers in query set resolution. By @ErichDonGubler in [#6579](https://github.com/gfx-rs/wgpu/pull/6579).
139140

140141
#### Naga

wgpu-core/src/command/compute.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ impl Global {
354354
}
355355
}
356356

357+
if beginning_of_pass_write_index
358+
.or(end_of_pass_write_index)
359+
.is_none()
360+
{
361+
return make_err(CommandEncoderError::TimestampWriteIndicesMissing, arc_desc);
362+
}
363+
357364
Some(ArcPassTimestampWrites {
358365
query_set,
359366
beginning_of_pass_write_index,

wgpu-core/src/command/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,8 @@ pub enum CommandEncoderError {
660660
TimestampWriteIndicesEqual { idx: u32 },
661661
#[error(transparent)]
662662
TimestampWritesInvalid(#[from] QueryUseError),
663+
#[error("no begin or end indices were specified for pass timestamp writes, expected at least one to be set")]
664+
TimestampWriteIndicesMissing,
663665
}
664666

665667
impl Global {

wgpu-core/src/command/render.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,13 @@ impl Global {
14201420
}
14211421
}
14221422

1423+
if beginning_of_pass_write_index
1424+
.or(end_of_pass_write_index)
1425+
.is_none()
1426+
{
1427+
return Err(CommandEncoderError::TimestampWriteIndicesMissing);
1428+
}
1429+
14231430
Some(ArcPassTimestampWrites {
14241431
query_set,
14251432
beginning_of_pass_write_index,

0 commit comments

Comments
 (0)