d3d12: Keep wait fences alive until GPU completion

In D3D12, objects need to be kept alive until they're done being used on
the GPU. This is particularly important for wait fences imported into
Dawn otherwise the waits don't happen sometimes.

Bug: dawn:576
Change-Id: Id2d8af59f1530a1e507471cf2e4653ac5cfbae06
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104425
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Sunny Sachanandani 2022-10-04 00:08:52 +00:00 committed by Dawn LUCI CQ
parent 4ff00cc470
commit 025880595d
1 changed files with 2 additions and 0 deletions

View File

@ -739,6 +739,8 @@ MaybeError Texture::SynchronizeImportedTextureBeforeUse() {
DAWN_TRY(CheckHRESULT(device->GetCommandQueue()->Wait(fence->GetD3D12Fence(),
fence->GetFenceValue()),
"D3D12 fence wait"););
// Keep D3D12 fence alive since we'll clear the waitFences list below.
device->ReferenceUntilUnused(fence->GetD3D12Fence());
}
mWaitFences.clear();
return {};