Add safety Signal/Wait when disposing SwapChainManager

このコミットが含まれているのは:
Sergio Pedri committed 2022-07-31 23:26:13 +02:00
1 親 d5b746402e
コミット 9dd707a835
1ファイル変更
+8
+8
ファイルの表示
@@ -530,6 +530,14 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
@this.UnsafeStopRenderLoopAndWait();
ulong updatedFenceValue = @this.nextD3D12FenceValue + 1;
@this.d3D12CommandQueue.Get()->Signal(@this.d3D12Fence.Get(), updatedFenceValue).Assert();
// Just like in the resize logic, signal and wait to make sure no operations are pending. This
// is needed to avoid a crash when disposing resources when disposing after stopping rendering.
@this.d3D12Fence.Get()->SetEventOnCompletion(updatedFenceValue, default).Assert();
_ = Win32.CloseHandle(@this.frameLatencyWaitableObject);
@this.d3D12Device.Dispose();