Move noop dispatch handling to the Metal backend

This workaround was only necessary in the Metal backend but it was easy
to put it in the frontend so it was put there. However, this simplification
gets in the way of a validation change in the follow-up CL. So we move
the nooping to the Metal backend.

Bug: dawn:632
Change-Id: I0a9957a1bc9bdd7867eb8c60fcab710832c13af2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/49886
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-05-06 11:30:34 +00:00 committed by Commit Bot service account
parent 063ea17f68
commit 9dad30d926
2 changed files with 9 additions and 8 deletions

View File

@ -64,14 +64,10 @@ namespace dawn_native {
DAWN_TRY(mCommandBufferState.ValidateCanDispatch());
}
// 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 {};
});

View File

@ -858,6 +858,11 @@ namespace dawn_native { namespace metal {
case Command::Dispatch: {
DispatchCmd* dispatch = mCommands.NextCommand<DispatchCmd>();
// Skip noop dispatches, it can causes issues on some systems.
if (dispatch->x == 0 || dispatch->y == 0 || dispatch->z == 0) {
break;
}
bindGroups.Apply(encoder);
storageBufferLengths.Apply(encoder, lastPipeline);