2023-04-09 02:16:33 +00:00
|
|
|
#include "CIndirectMonitorContext.h"
|
|
|
|
#include "Direct3DDevice.h"
|
|
|
|
|
2023-04-11 06:55:58 +00:00
|
|
|
CIndirectMonitorContext::CIndirectMonitorContext(_In_ IDDCX_MONITOR monitor, CIndirectDeviceContext * device) :
|
|
|
|
m_monitor(monitor),
|
|
|
|
m_devContext(device)
|
2023-04-09 02:16:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CIndirectMonitorContext::~CIndirectMonitorContext()
|
|
|
|
{
|
|
|
|
m_thread.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CIndirectMonitorContext::AssignSwapChain(IDDCX_SWAPCHAIN swapChain, LUID renderAdapter, HANDLE newFrameEvent)
|
|
|
|
{
|
|
|
|
m_thread.reset();
|
|
|
|
auto device = std::make_shared<Direct3DDevice>(renderAdapter);
|
|
|
|
if (FAILED(device->Init()))
|
|
|
|
{
|
|
|
|
WdfObjectDelete(swapChain);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-04-11 06:55:58 +00:00
|
|
|
m_thread.reset(new CSwapChainProcessor(m_devContext, swapChain, device, newFrameEvent));
|
2023-04-09 02:16:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CIndirectMonitorContext::UnassignSwapChain()
|
|
|
|
{
|
|
|
|
m_thread.reset();
|
|
|
|
}
|