diff --git a/cts_runner/test.lst b/cts_runner/test.lst index b45529e38..e885d1e2f 100644 --- a/cts_runner/test.lst +++ b/cts_runner/test.lst @@ -180,3 +180,4 @@ webgpu:shader,validation,statement,statement_behavior:invalid_statements:body="l webgpu:shader,validation,statement,statement_behavior:invalid_statements:body="switch1" //FAIL: 9 invalid_statements subtests due to https://github.com/gfx-rs/wgpu/issues/7733 webgpu:api,validation,render_pipeline,vertex_state:many_attributes_overlapping:* +webgpu:api,validation,encoding,queries,begin_end:occlusion_query,* diff --git a/wgpu-core/src/command/query.rs b/wgpu-core/src/command/query.rs index 79d3bf9dd..a20e9f1ce 100644 --- a/wgpu-core/src/command/query.rs +++ b/wgpu-core/src/command/query.rs @@ -150,6 +150,8 @@ pub enum QueryUseError { set_type: SimplifiedQueryType, query_type: SimplifiedQueryType, }, + #[error("A query of type {query_type:?} was not ended before the encoder was finished")] + MissingEnd { query_type: SimplifiedQueryType }, } impl WebGpuError for QueryUseError { @@ -160,7 +162,8 @@ impl WebGpuError for QueryUseError { | Self::UsedTwiceInsideRenderpass { .. } | Self::AlreadyStarted { .. } | Self::AlreadyStopped - | Self::IncompatibleType { .. } => ErrorType::Validation, + | Self::IncompatibleType { .. } + | Self::MissingEnd { .. } => ErrorType::Validation, } } } diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 31628228b..63bb0b4b2 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -2241,6 +2241,18 @@ pub(super) fn encode_render_pass( .map_pass_err(pass_scope), )?; } + if state.active_occlusion_query.is_some() { + Err(RenderPassErrorInner::QueryUse(QueryUseError::MissingEnd { + query_type: super::SimplifiedQueryType::Occlusion, + }) + .map_pass_err(pass_scope))?; + } + if state.active_pipeline_statistics_query.is_some() { + Err(RenderPassErrorInner::QueryUse(QueryUseError::MissingEnd { + query_type: super::SimplifiedQueryType::PipelineStatistics, + }) + .map_pass_err(pass_scope))?; + } state .info