mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[dxgi] Move GetOutputFromMonitor to swap chain class
Not a great solution, but we only need it for the swap chain anyway.
This commit is contained in:
parent
9e9e17348f
commit
57e814717e
@ -321,28 +321,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT DxgiAdapter::GetOutputFromMonitor(
|
|
||||||
HMONITOR Monitor,
|
|
||||||
IDXGIOutput** ppOutput) {
|
|
||||||
if (ppOutput == nullptr)
|
|
||||||
return DXGI_ERROR_INVALID_CALL;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; SUCCEEDED(EnumOutputs(i, ppOutput)); i++) {
|
|
||||||
DXGI_OUTPUT_DESC outputDesc;
|
|
||||||
(*ppOutput)->GetDesc(&outputDesc);
|
|
||||||
|
|
||||||
if (outputDesc.Monitor == Monitor)
|
|
||||||
return S_OK;
|
|
||||||
|
|
||||||
(*ppOutput)->Release();
|
|
||||||
(*ppOutput) = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No such output found
|
|
||||||
return DXGI_ERROR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT DxgiAdapter::GetOutputData(
|
HRESULT DxgiAdapter::GetOutputData(
|
||||||
HMONITOR Monitor,
|
HMONITOR Monitor,
|
||||||
DXGI_VK_OUTPUT_DATA* pOutputData) {
|
DXGI_VK_OUTPUT_DATA* pOutputData) {
|
||||||
|
@ -76,10 +76,6 @@ namespace dxvk {
|
|||||||
DXGI_FORMAT Format,
|
DXGI_FORMAT Format,
|
||||||
DXGI_VK_FORMAT_MODE Mode);
|
DXGI_VK_FORMAT_MODE Mode);
|
||||||
|
|
||||||
HRESULT GetOutputFromMonitor(
|
|
||||||
HMONITOR Monitor,
|
|
||||||
IDXGIOutput** ppOutput);
|
|
||||||
|
|
||||||
HRESULT GetOutputData(
|
HRESULT GetOutputData(
|
||||||
HMONITOR Monitor,
|
HMONITOR Monitor,
|
||||||
DXGI_VK_OUTPUT_DATA* pOutputData);
|
DXGI_VK_OUTPUT_DATA* pOutputData);
|
||||||
|
@ -45,7 +45,7 @@ namespace dxvk {
|
|||||||
DxgiSwapChain::~DxgiSwapChain() {
|
DxgiSwapChain::~DxgiSwapChain() {
|
||||||
Com<IDXGIOutput> output;
|
Com<IDXGIOutput> output;
|
||||||
|
|
||||||
if (SUCCEEDED(m_adapter->GetOutputFromMonitor(m_monitor, &output)))
|
if (SUCCEEDED(GetOutputFromMonitor(m_monitor, &output)))
|
||||||
RestoreDisplayMode(output.ptr());
|
RestoreDisplayMode(output.ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ namespace dxvk {
|
|||||||
(windowRect.top + windowRect.bottom) / 2 },
|
(windowRect.top + windowRect.bottom) / 2 },
|
||||||
MONITOR_DEFAULTTOPRIMARY);
|
MONITOR_DEFAULTTOPRIMARY);
|
||||||
|
|
||||||
return m_adapter->GetOutputFromMonitor(monitor, ppOutput);
|
return GetOutputFromMonitor(monitor, ppOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ namespace dxvk {
|
|||||||
*ppTarget = nullptr;
|
*ppTarget = nullptr;
|
||||||
|
|
||||||
if (!m_descFs.Windowed)
|
if (!m_descFs.Windowed)
|
||||||
hr = m_adapter->GetOutputFromMonitor(m_monitor, ppTarget);
|
hr = GetOutputFromMonitor(m_monitor, ppTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
@ -358,7 +358,7 @@ namespace dxvk {
|
|||||||
} else {
|
} else {
|
||||||
Com<IDXGIOutput> output;
|
Com<IDXGIOutput> output;
|
||||||
|
|
||||||
if (FAILED(m_adapter->GetOutputFromMonitor(m_monitor, &output))) {
|
if (FAILED(GetOutputFromMonitor(m_monitor, &output))) {
|
||||||
Logger::err("DXGI: ResizeTarget: Failed to query containing output");
|
Logger::err("DXGI: ResizeTarget: Failed to query containing output");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
@ -570,7 +570,7 @@ namespace dxvk {
|
|||||||
if (!IsWindow(m_window))
|
if (!IsWindow(m_window))
|
||||||
return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
|
return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
|
||||||
|
|
||||||
if (FAILED(m_adapter->GetOutputFromMonitor(m_monitor, &output))
|
if (FAILED(GetOutputFromMonitor(m_monitor, &output))
|
||||||
|| FAILED(RestoreDisplayMode(output.ptr())))
|
|| FAILED(RestoreDisplayMode(output.ptr())))
|
||||||
Logger::warn("DXGI: LeaveFullscreenMode: Failed to restore display mode");
|
Logger::warn("DXGI: LeaveFullscreenMode: Failed to restore display mode");
|
||||||
|
|
||||||
@ -677,4 +677,25 @@ namespace dxvk {
|
|||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT DxgiSwapChain::GetOutputFromMonitor(
|
||||||
|
HMONITOR Monitor,
|
||||||
|
IDXGIOutput** ppOutput) {
|
||||||
|
if (!ppOutput)
|
||||||
|
return DXGI_ERROR_INVALID_CALL;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; SUCCEEDED(m_adapter->EnumOutputs(i, ppOutput)); i++) {
|
||||||
|
DXGI_OUTPUT_DESC outputDesc;
|
||||||
|
(*ppOutput)->GetDesc(&outputDesc);
|
||||||
|
|
||||||
|
if (outputDesc.Monitor == Monitor)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
(*ppOutput)->Release();
|
||||||
|
(*ppOutput) = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DXGI_ERROR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -201,6 +201,10 @@ namespace dxvk {
|
|||||||
IUnknown* pDevice,
|
IUnknown* pDevice,
|
||||||
IDXGIVkSwapChain** ppSwapChain);
|
IDXGIVkSwapChain** ppSwapChain);
|
||||||
|
|
||||||
|
HRESULT GetOutputFromMonitor(
|
||||||
|
HMONITOR Monitor,
|
||||||
|
IDXGIOutput** ppOutput);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user