1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[dxgi] Support multiple outputs per adapter

This commit is contained in:
Philip Rebohle 2018-07-16 17:00:23 +02:00
parent d87200c4d9
commit fe5e215dfc
2 changed files with 37 additions and 7 deletions

View File

@ -143,14 +143,18 @@ namespace dxvk {
if (ppOutput == nullptr) if (ppOutput == nullptr)
return E_INVALIDARG; return E_INVALIDARG;
if (Output > 0) { MonitorEnumInfo info;
*ppOutput = nullptr; info.iMonitorId = Output;
return DXGI_ERROR_NOT_FOUND; info.oMonitor = nullptr;
}
// TODO support multiple monitors ::EnumDisplayMonitors(
HMONITOR monitor = ::MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY); nullptr, nullptr, &MonitorEnumProc,
*ppOutput = ref(new DxgiOutput(m_factory, this, monitor)); reinterpret_cast<LPARAM>(&info));
if (info.oMonitor == nullptr)
return DXGI_ERROR_NOT_FOUND;
*ppOutput = ref(new DxgiOutput(m_factory, this, info.oMonitor));
return S_OK; return S_OK;
} }
@ -458,4 +462,19 @@ namespace dxvk {
} }
} }
BOOL CALLBACK DxgiAdapter::MonitorEnumProc(
HMONITOR hmon,
HDC hdc,
LPRECT rect,
LPARAM lp) {
auto data = reinterpret_cast<MonitorEnumInfo*>(lp);
if (data->iMonitorId--)
return TRUE; /* continue */
data->oMonitor = hmon;
return FALSE; /* stop */
}
} }

View File

@ -124,6 +124,17 @@ namespace dxvk {
void runEventThread(); void runEventThread();
struct MonitorEnumInfo {
UINT iMonitorId;
HMONITOR oMonitor;
};
static BOOL CALLBACK MonitorEnumProc(
HMONITOR hmon,
HDC hdc,
LPRECT rect,
LPARAM lp);
}; };
} }