Skip noop dispatches on D3D12 backend

Execution warning is produced from D3D12 validation layers for noop
dispatches, which leads to device lost. The skip noop dispatch handling
was added to the front-end before, and moved to Metal backend due
to it gets in the way of a validation change in the follow-up CL. We
also need to add it to D3D12 backend now.

Bug: dawn:1028
Change-Id: I364f6f1e0ac79679a43c064cb402874f1e959537
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Li Hao 2021-07-28 05:00:26 +00:00 committed by Dawn LUCI CQ
parent ce5b9a6c4b
commit 366c9d8c43
1 changed files with 6 additions and 0 deletions

View File

@ -995,6 +995,12 @@ namespace dawn_native { namespace d3d12 {
case Command::Dispatch: {
DispatchCmd* dispatch = mCommands.NextCommand<DispatchCmd>();
// Skip noop dispatches, it can cause D3D12 warning from validation layers and
// leads to device lost.
if (dispatch->x == 0 || dispatch->y == 0 || dispatch->z == 0) {
break;
}
TransitionAndClearForSyncScope(commandContext,
resourceUsages.dispatchUsages[currentDispatch]);
DAWN_TRY(bindingTracker->Apply(commandContext));