mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxgi] Make output code use new wsi interface
This commit is contained in:
parent
71a630801e
commit
e13a9f9cf6
@ -125,16 +125,10 @@ namespace dxvk {
|
|||||||
DEVMODEW devMode;
|
DEVMODEW devMode;
|
||||||
devMode.dmSize = sizeof(devMode);
|
devMode.dmSize = sizeof(devMode);
|
||||||
|
|
||||||
if (!GetMonitorDisplayMode(m_monitor, ENUM_CURRENT_SETTINGS, &devMode))
|
wsi::WsiMode activeWsiMode = { };
|
||||||
return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
|
wsi::getCurrentDisplayMode(m_monitor, &activeWsiMode);
|
||||||
|
|
||||||
DXGI_MODE_DESC activeMode = { };
|
DXGI_MODE_DESC1 activeMode = ConvertDisplayMode(activeWsiMode);
|
||||||
activeMode.Width = devMode.dmPelsWidth;
|
|
||||||
activeMode.Height = devMode.dmPelsHeight;
|
|
||||||
activeMode.RefreshRate = { devMode.dmDisplayFrequency, 1 };
|
|
||||||
activeMode.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; // FIXME
|
|
||||||
activeMode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE;
|
|
||||||
activeMode.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
|
||||||
|
|
||||||
DXGI_MODE_DESC1 defaultMode;
|
DXGI_MODE_DESC1 defaultMode;
|
||||||
defaultMode.Width = 0;
|
defaultMode.Width = 0;
|
||||||
@ -222,17 +216,16 @@ namespace dxvk {
|
|||||||
if (pDesc == nullptr)
|
if (pDesc == nullptr)
|
||||||
return DXGI_ERROR_INVALID_CALL;
|
return DXGI_ERROR_INVALID_CALL;
|
||||||
|
|
||||||
::MONITORINFOEXW monInfo;
|
if (!wsi::getDesktopCoordinates(m_monitor, &pDesc->DesktopCoordinates)) {
|
||||||
monInfo.cbSize = sizeof(monInfo);
|
Logger::err("DXGI: Failed to query monitor coords");
|
||||||
|
|
||||||
if (!::GetMonitorInfoW(m_monitor, reinterpret_cast<MONITORINFO*>(&monInfo))) {
|
|
||||||
Logger::err("DXGI: Failed to query monitor info");
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memcpy(pDesc->DeviceName, monInfo.szDevice, std::size(pDesc->DeviceName));
|
if (!wsi::getDisplayName(m_monitor, pDesc->DeviceName)) {
|
||||||
|
Logger::err("DXGI: Failed to query monitor name");
|
||||||
pDesc->DesktopCoordinates = monInfo.rcMonitor;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
pDesc->AttachedToDesktop = 1;
|
pDesc->AttachedToDesktop = 1;
|
||||||
pDesc->Rotation = DXGI_MODE_ROTATION_UNSPECIFIED;
|
pDesc->Rotation = DXGI_MODE_ROTATION_UNSPECIFIED;
|
||||||
pDesc->Monitor = m_monitor;
|
pDesc->Monitor = m_monitor;
|
||||||
@ -300,32 +293,27 @@ namespace dxvk {
|
|||||||
|
|
||||||
// Walk over all modes that the display supports and
|
// Walk over all modes that the display supports and
|
||||||
// return those that match the requested format etc.
|
// return those that match the requested format etc.
|
||||||
DEVMODEW devMode = { };
|
wsi::WsiMode devMode = { };
|
||||||
devMode.dmSize = sizeof(DEVMODEW);
|
|
||||||
|
|
||||||
uint32_t srcModeId = 0;
|
uint32_t srcModeId = 0;
|
||||||
uint32_t dstModeId = 0;
|
uint32_t dstModeId = 0;
|
||||||
|
|
||||||
std::vector<DXGI_MODE_DESC1> modeList;
|
std::vector<DXGI_MODE_DESC1> modeList;
|
||||||
|
|
||||||
while (GetMonitorDisplayMode(m_monitor, srcModeId++, &devMode)) {
|
while (wsi::getDisplayMode(m_monitor, srcModeId++, &devMode)) {
|
||||||
// Skip interlaced modes altogether
|
// Skip interlaced modes altogether
|
||||||
if (devMode.dmDisplayFlags & DM_INTERLACED)
|
if (devMode.interlaced)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Skip modes with incompatible formats
|
// Skip modes with incompatible formats
|
||||||
if (devMode.dmBitsPerPel != GetMonitorFormatBpp(EnumFormat))
|
if (devMode.bitsPerPixel != GetMonitorFormatBpp(EnumFormat))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pDesc != nullptr) {
|
if (pDesc != nullptr) {
|
||||||
DXGI_MODE_DESC1 mode;
|
DXGI_MODE_DESC1 mode = ConvertDisplayMode(devMode);
|
||||||
mode.Width = devMode.dmPelsWidth;
|
// Fix up the DXGI_FORMAT to match what we were enumerating.
|
||||||
mode.Height = devMode.dmPelsHeight;
|
mode.Format = EnumFormat;
|
||||||
mode.RefreshRate = { devMode.dmDisplayFrequency * 1000, 1000 };
|
|
||||||
mode.Format = EnumFormat;
|
|
||||||
mode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE;
|
|
||||||
mode.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
|
||||||
mode.Stereo = FALSE;
|
|
||||||
modeList.push_back(mode);
|
modeList.push_back(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user