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>
This commit is contained in:
Hao Li 2021-02-04 03:10:03 +00:00 committed by Commit Bot service account
parent 8aa7919735
commit 5ab1ed7e1e
1 changed files with 8 additions and 4 deletions

View File

@ -65,10 +65,14 @@ namespace dawn_native {
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 {};
});