[wgpu-core] validate occlusion and pipeline statistics queries end (#8684)

This commit is contained in:
Teodor Tanasoaia 2025-12-08 18:42:26 +01:00 committed by GitHub
parent 51490ea45a
commit d41e43bc60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View File

@ -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,*

View File

@ -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,
}
}
}

View File

@ -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