1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-15 07:29:17 +01:00

[dxgi] Support multiple outputs per adapter

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

View File

@ -81,14 +81,18 @@ namespace dxvk {
if (ppOutput == nullptr) if (ppOutput == nullptr)
return DXGI_ERROR_INVALID_CALL; return DXGI_ERROR_INVALID_CALL;
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(this, monitor)); reinterpret_cast<LPARAM>(&info));
if (info.oMonitor == nullptr)
return DXGI_ERROR_NOT_FOUND;
*ppOutput = ref(new DxgiOutput(this, info.oMonitor));
return S_OK; return S_OK;
} }
@ -284,4 +288,19 @@ namespace dxvk {
return S_OK; return S_OK;
} }
BOOL 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

@ -85,6 +85,17 @@ namespace dxvk {
std::mutex m_outputMutex; std::mutex m_outputMutex;
OutputMap m_outputData; OutputMap m_outputData;
struct MonitorEnumInfo {
UINT iMonitorId;
HMONITOR oMonitor;
};
static BOOL MonitorEnumProc(
HMONITOR hmon,
HDC hdc,
LPRECT rect,
LPARAM lp);
}; };
} }