Skip noop dispatch in front-end

Workaround for Metal becuase system crashes on 0 dispatches.

Bug: dawn:640
Change-Id: I5bd33b22242ddc31816a16acb019ce2f552808bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39521
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/ComputePassEncoder.cpp b/src/dawn_native/ComputePassEncoder.cpp
index 3d52249..057ef3f 100644
--- a/src/dawn_native/ComputePassEncoder.cpp
+++ b/src/dawn_native/ComputePassEncoder.cpp
@@ -65,10 +65,14 @@
                 DAWN_TRY(mCommandBufferState.ValidateCanDispatch());
             }
 
-            DispatchCmd* dispatch = allocator->Allocate<DispatchCmd>(Command::Dispatch);
-            dispatch->x = x;
-            dispatch->y = y;
-            dispatch->z = z;
+            // Skip noop dispatch. It is a workaround for system crashes on 0 dispatches on some
+            // platforms.
+            if (x != 0 && y != 0 && z != 0) {
+                DispatchCmd* dispatch = allocator->Allocate<DispatchCmd>(Command::Dispatch);
+                dispatch->x = x;
+                dispatch->y = y;
+                dispatch->z = z;
+            }
 
             return {};
         });