diff --git a/cts_runner/revision.txt b/cts_runner/revision.txt index 44c121be4..ca7f27521 100644 --- a/cts_runner/revision.txt +++ b/cts_runner/revision.txt @@ -1 +1 @@ -cf8d39399889ae8324f77b6017071b3e1bfe3467 +ca488e91d0bace04c9c393bd733053da0b84ce11 diff --git a/wgpu-core/src/command/compute.rs b/wgpu-core/src/command/compute.rs index 5c5947d34..8f824d64a 100644 --- a/wgpu-core/src/command/compute.rs +++ b/wgpu-core/src/command/compute.rs @@ -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> { diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 6020071c3..b31ea59a4 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -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> {