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 <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/src/dawn_native/CommandBufferStateTracker.cpp b/src/dawn_native/CommandBufferStateTracker.cpp
index d6ef68b..88197f3 100644
--- a/src/dawn_native/CommandBufferStateTracker.cpp
+++ b/src/dawn_native/CommandBufferStateTracker.cpp
@@ -69,16 +69,11 @@
 
         // 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 @@
         }
     }
 
-    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 50e5107..8c9c989 100644
--- a/src/dawn_native/CommandBufferStateTracker.h
+++ b/src/dawn_native/CommandBufferStateTracker.h
@@ -46,7 +46,7 @@
       private:
         MaybeError ValidateOperation(ValidationAspects requiredAspects);
         void RecomputeLazyAspects(ValidationAspects aspects);
-        MaybeError GenerateAspectError(ValidationAspects aspects);
+        MaybeError CheckMissingAspects(ValidationAspects aspects);
 
         void SetPipelineCommon(PipelineBase* pipeline);