mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
[dxgi] Support multiple outputs per adapter
This commit is contained in:
parent
d87200c4d9
commit
fe5e215dfc
@ -143,14 +143,18 @@ namespace dxvk {
|
||||
if (ppOutput == nullptr)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (Output > 0) {
|
||||
*ppOutput = nullptr;
|
||||
return DXGI_ERROR_NOT_FOUND;
|
||||
}
|
||||
MonitorEnumInfo info;
|
||||
info.iMonitorId = Output;
|
||||
info.oMonitor = nullptr;
|
||||
|
||||
// TODO support multiple monitors
|
||||
HMONITOR monitor = ::MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);
|
||||
*ppOutput = ref(new DxgiOutput(m_factory, this, monitor));
|
||||
::EnumDisplayMonitors(
|
||||
nullptr, nullptr, &MonitorEnumProc,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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 */
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -124,6 +124,17 @@ namespace dxvk {
|
||||
|
||||
void runEventThread();
|
||||
|
||||
struct MonitorEnumInfo {
|
||||
UINT iMonitorId;
|
||||
HMONITOR oMonitor;
|
||||
};
|
||||
|
||||
static BOOL CALLBACK MonitorEnumProc(
|
||||
HMONITOR hmon,
|
||||
HDC hdc,
|
||||
LPRECT rect,
|
||||
LPARAM lp);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user