mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 01:15:39 +00:00
Report error immediately if pass ends twice
The previous code reports error till command encoder finish. This change also updates webgpu-cts expectations.txt accordingly. Bug: dawn:1578 Change-Id: I1fe758a02d9cfdb1440e3cabf10aea0bd60b9c59 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116842 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
@@ -150,6 +150,13 @@ ObjectType ComputePassEncoder::GetType() const {
|
||||
}
|
||||
|
||||
void ComputePassEncoder::APIEnd() {
|
||||
if (mEnded && IsValidationEnabled()) {
|
||||
GetDevice()->ConsumedError(DAWN_VALIDATION_ERROR("%s was already ended.", this));
|
||||
return;
|
||||
}
|
||||
|
||||
mEnded = true;
|
||||
|
||||
if (mEncodingContext->TryEncode(
|
||||
this,
|
||||
[&](CommandAllocator* allocator) -> MaybeError {
|
||||
|
||||
@@ -86,11 +86,11 @@ class EncodingContext {
|
||||
if (DAWN_UNLIKELY(encoder != mCurrentEncoder)) {
|
||||
if (mCurrentEncoder != mTopLevelEncoder) {
|
||||
// The top level encoder was used when a pass encoder was current.
|
||||
HandleError(DAWN_VALIDATION_ERROR("Command cannot be recorded while %s is active.",
|
||||
mCurrentEncoder));
|
||||
HandleError(DAWN_VALIDATION_ERROR(
|
||||
"Command cannot be recorded while %s is locked and %s is currently open.",
|
||||
mTopLevelEncoder, mCurrentEncoder));
|
||||
} else {
|
||||
HandleError(
|
||||
DAWN_VALIDATION_ERROR("Recording in an error or already ended %s.", encoder));
|
||||
HandleError(DAWN_VALIDATION_ERROR("Recording in an error %s.", encoder));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ class ProgrammableEncoder : public ApiObjectBase {
|
||||
|
||||
uint64_t mDebugGroupStackSize = 0;
|
||||
|
||||
bool mEnded = false;
|
||||
|
||||
private:
|
||||
const bool mValidationEnabled;
|
||||
};
|
||||
|
||||
@@ -136,6 +136,13 @@ void RenderPassEncoder::TrackQueryAvailability(QuerySetBase* querySet, uint32_t
|
||||
}
|
||||
|
||||
void RenderPassEncoder::APIEnd() {
|
||||
if (mEnded && IsValidationEnabled()) {
|
||||
GetDevice()->ConsumedError(DAWN_VALIDATION_ERROR("%s was already ended.", this));
|
||||
return;
|
||||
}
|
||||
|
||||
mEnded = true;
|
||||
|
||||
mEncodingContext->TryEncode(
|
||||
this,
|
||||
[&](CommandAllocator* allocator) -> MaybeError {
|
||||
|
||||
Reference in New Issue
Block a user