Tweak error behavior for unbalanced passes, and update CTS (#8543)

This commit is contained in:
Andy Leiserson 2025-11-18 08:18:17 -08:00 committed by GitHub
parent 836c97056f
commit 6043b059c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 31 deletions

View File

@ -1 +1 @@
cf8d39399889ae8324f77b6017071b3e1bfe3467
ca488e91d0bace04c9c393bd733053da0b84ce11

View File

@ -491,22 +491,21 @@ impl Global {
let base = pass.base.take();
if matches!(
base,
Err(ComputePassError {
inner: ComputePassErrorInner::EncoderState(EncoderStateError::Ended),
scope: _,
})
) {
// If the encoder was already finished at time of pass creation,
// then it was not put in the locked state, so we need to
// generate a validation error here and now due to the encoder not
// being locked. The encoder already holds an error from when the
// pass was opened, or earlier.
if let Err(ComputePassError {
inner:
ComputePassErrorInner::EncoderState(
err @ (EncoderStateError::Locked | EncoderStateError::Ended),
),
scope: _,
}) = base
{
// Most encoding errors are detected and raised within `finish()`.
//
// All other errors are propagated to the encoder within `push_with`,
// and will be reported later.
return Err(EncoderStateError::Ended);
// However, we raise a validation error here if the pass was opened
// within another pass, or on a finished encoder. The latter is
// particularly important, because in that case reporting errors via
// `CommandEncoder::finish` is not possible.
return Err(err.clone());
}
cmd_buf_data.push_with(|| -> Result<_, ComputePassError> {

View File

@ -1823,22 +1823,21 @@ impl Global {
let base = pass.base.take();
if matches!(
base,
Err(RenderPassError {
inner: RenderPassErrorInner::EncoderState(EncoderStateError::Ended),
scope: _,
})
) {
// If the encoder was already finished at time of pass creation,
// then it was not put in the locked state, so we need to
// generate a validation error here and now due to the encoder not
// being locked. The encoder already holds an error from when the
// pass was opened, or earlier.
if let Err(RenderPassError {
inner:
RenderPassErrorInner::EncoderState(
err @ (EncoderStateError::Locked | EncoderStateError::Ended),
),
scope: _,
}) = base
{
// Most encoding errors are detected and raised within `finish()`.
//
// All other errors are propagated to the encoder within `push_with`,
// and will be reported later.
return Err(EncoderStateError::Ended);
// However, we raise a validation error here if the pass was opened
// within another pass, or on a finished encoder. The latter is
// particularly important, because in that case reporting errors via
// `CommandEncoder::finish` is not possible.
return Err(err.clone());
}
cmd_buf_data.push_with(|| -> Result<_, RenderPassError> {