From 798cefb78d130a356ad6e57c4c6e465407446e0d Mon Sep 17 00:00:00 2001 From: Yunchao He Date: Mon, 4 May 2020 06:05:47 +0000 Subject: [PATCH] Fix incorrect validation error in CommandBufferStateTracker If we are missing pipeline in render or compute pass, it always reports that we are missing vertex buffers or bind groups for render and compute pass respectively. Bug: dawn:359 Change-Id: I5550e55fcc9f29c0f2fb71462def836061038add Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20784 Commit-Queue: Yunchao He Reviewed-by: Kai Ninomiya --- src/dawn_native/CommandBufferStateTracker.cpp | 15 ++++++--------- src/dawn_native/CommandBufferStateTracker.h | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/dawn_native/CommandBufferStateTracker.cpp b/src/dawn_native/CommandBufferStateTracker.cpp index d6ef68ba60..88197f3c6e 100644 --- a/src/dawn_native/CommandBufferStateTracker.cpp +++ b/src/dawn_native/CommandBufferStateTracker.cpp @@ -69,16 +69,11 @@ namespace dawn_native { // Generate an error immediately if a non-lazy aspect is missing as computing lazy aspects // requires the pipeline to be set. - if ((missingAspects & ~kLazyAspects).any()) { - return GenerateAspectError(missingAspects); - } + DAWN_TRY(CheckMissingAspects(missingAspects & ~kLazyAspects)); RecomputeLazyAspects(missingAspects); - missingAspects = requiredAspects & ~mAspects; - if (missingAspects.any()) { - return GenerateAspectError(missingAspects); - } + DAWN_TRY(CheckMissingAspects(requiredAspects & ~mAspects)); return {}; } @@ -114,8 +109,10 @@ namespace dawn_native { } } - MaybeError CommandBufferStateTracker::GenerateAspectError(ValidationAspects aspects) { - ASSERT(aspects.any()); + MaybeError CommandBufferStateTracker::CheckMissingAspects(ValidationAspects aspects) { + if (!aspects.any()) { + return {}; + } if (aspects[VALIDATION_ASPECT_INDEX_BUFFER]) { return DAWN_VALIDATION_ERROR("Missing index buffer"); diff --git a/src/dawn_native/CommandBufferStateTracker.h b/src/dawn_native/CommandBufferStateTracker.h index 50e5107c97..8c9c989a95 100644 --- a/src/dawn_native/CommandBufferStateTracker.h +++ b/src/dawn_native/CommandBufferStateTracker.h @@ -46,7 +46,7 @@ namespace dawn_native { private: MaybeError ValidateOperation(ValidationAspects requiredAspects); void RecomputeLazyAspects(ValidationAspects aspects); - MaybeError GenerateAspectError(ValidationAspects aspects); + MaybeError CheckMissingAspects(ValidationAspects aspects); void SetPipelineCommon(PipelineBase* pipeline);