diff --git a/CHANGELOG.md b/CHANGELOG.md index 082dba39d..b534e3687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,10 @@ Bottom level categories: ### Bug Fixes +#### General + - Fixed build error occurring when the `profiling` dependency is configured to have profiling active. By @kpreid in [#7916](https://github.com/gfx-rs/wgpu/pull/7916). +- Emit a validation error instead of panicking when a query set index is OOB. By @ErichDonGubler in [#7908](https://github.com/gfx-rs/wgpu/pull/7908). ## v26.0.0 (2025-07-09) diff --git a/cts_runner/test.lst b/cts_runner/test.lst index c509d87bb..5b1f604cd 100644 --- a/cts_runner/test.lst +++ b/cts_runner/test.lst @@ -47,6 +47,7 @@ webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_grou webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";* webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:buffer_binding,render_pipeline:* webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:* +webgpu:api,validation,encoding,queries,general:occlusion_query,query_index:* webgpu:api,validation,image_copy,layout_related:copy_end_overflows_u64:* webgpu:api,validation,image_copy,texture_related:format:dimension="1d";* webgpu:api,validation,queue,submit:command_buffer,device_mismatch:* diff --git a/wgpu-core/src/command/query.rs b/wgpu-core/src/command/query.rs index cd487e0db..fb59c8dd4 100644 --- a/wgpu-core/src/command/query.rs +++ b/wgpu-core/src/command/query.rs @@ -210,6 +210,14 @@ impl QuerySet { query_index: u32, reset_state: Option<&mut QueryResetMap>, ) -> Result<(), QueryUseError> { + // NOTE: Further code assumes the index is good, so do this first. + if query_index >= self.desc.count { + return Err(QueryUseError::OutOfBounds { + query_index, + query_set_size: self.desc.count, + }); + } + // We need to defer our resets because we are in a renderpass, // add the usage to the reset map. if let Some(reset) = reset_state { @@ -227,13 +235,6 @@ impl QuerySet { }); } - if query_index >= self.desc.count { - return Err(QueryUseError::OutOfBounds { - query_index, - query_set_size: self.desc.count, - }); - } - Ok(()) }