[idd] cancel stale swap chain assignments

Invalidate in-progress swap chain setup when IddCx unassigns the
monitor, and serialize replacement assignments so workers are
never started on abandoned handles.

Also initialize all worker dependencies before starting the processing
thread and treat teardown during SetDevice as normal cancellation.
This commit is contained in:
Geoffrey McRae
2026-07-19 00:28:56 +10:00
parent e0d3794c1d
commit 84e0a1b956
4 changed files with 83 additions and 16 deletions

View File

@@ -36,9 +36,13 @@ using namespace Microsoft::WRL;
#define STAGING_TEXTURES 3
class CIndirectMonitorContext;
class CSwapChainProcessor
{
private:
CIndirectMonitorContext * m_monitorContext;
UINT64 m_assignmentGeneration;
IDDCX_MONITOR m_monitor;
CIndirectDeviceContext * m_devContext;
IDDCX_SWAPCHAIN m_hSwapChain;
@@ -74,7 +78,8 @@ private:
DXGI_COLOR_SPACE_TYPE colorSpace, UINT sdrWhiteLevel);
public:
CSwapChainProcessor(IDDCX_MONITOR monitor, CIndirectDeviceContext * devContext, IDDCX_SWAPCHAIN hSwapChain,
CSwapChainProcessor(CIndirectMonitorContext * monitorContext, UINT64 assignmentGeneration,
IDDCX_MONITOR monitor, CIndirectDeviceContext * devContext, IDDCX_SWAPCHAIN hSwapChain,
std::shared_ptr<CD3D11Device> dx11Device, std::shared_ptr<CD3D12Device> dx12Device, HANDLE newFrameEvent);
~CSwapChainProcessor();