From da7d6b4011be6b512a859574594d4159fe6b004b Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 6 Aug 2026 11:39:44 +1000 Subject: [PATCH] [idd] capture: defer interop synchronization Signal the shared D3D11 source only after a retained candidate and its command slots have been acquired. Superseded source frames no longer queue a fence that no Direct3D 12 work will consume. --- idd/LGIdd/CSwapChainProcessor.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/idd/LGIdd/CSwapChainProcessor.cpp b/idd/LGIdd/CSwapChainProcessor.cpp index 6415337a..cab09002 100644 --- a/idd/LGIdd/CSwapChainProcessor.cpp +++ b/idd/LGIdd/CSwapChainProcessor.cpp @@ -1403,17 +1403,6 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr acquiredBuffer return false; } - /** - * Even though we have not performed any copy/draw operations we still need to - * use a fence. Because we share this texture with DirectX12 it is able to - * read from it before the desktop duplication API has finished updating it. - */ - if (!srcRes->Signal()) - { - SetFullPendingDamage(); - return false; - } - RECT dirtyRects[LG_MAX_DIRTY_RECTS] = {0}; bool noImageUpdate = false; if (moveRegionCount || dirtyRectCount > ARRAYSIZE(dirtyRects)) @@ -1688,7 +1677,25 @@ bool CSwapChainProcessor::SwapChainNewFrame(ComPtr acquiredBuffer SetFullPendingDamage(); return false; } + } + /** + * Even though we have not performed any copy/draw operations we still need + * to use a fence. Because we share this texture with DirectX12 it is able to + * read from it before IddCx has finished updating it. + */ + if (!srcRes->Signal()) + { + if (computeSlot) + computeSlot->Cancel(); + copySlot->Cancel(); + ReleaseCandidate(candidateIndex); + SetFullPendingDamage(); + return false; + } + + if (computeSlot) + { if (!srcRes->Sync(*computeSlot)) { computeSlot->Cancel();