1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[dxgi] Query window size before creating presenter

Otherwise we may pass a size of zero to the presenter.
This commit is contained in:
Philip Rebohle 2018-11-16 15:03:09 +01:00
parent 66bcc4b3d8
commit e4d3357e55
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -23,13 +23,6 @@ namespace dxvk {
m_stats.SyncQPCTime.QuadPart = 0;
m_stats.SyncGPUTime.QuadPart = 0;
// Create presenter, which also serves as an interface to the device
if (FAILED(CreatePresenter(pDevice, &m_presenter)))
throw DxvkError("DXGI: Failed to create presenter");
if (FAILED(m_presenter->GetAdapter(__uuidof(IDXGIAdapter), reinterpret_cast<void**>(&m_adapter))))
throw DxvkError("DXGI: Failed to get adapter for present device");
// Adjust initial back buffer size. If zero, these
// shall be set to the current window size.
const VkExtent2D windowSize = GetWindowSize();
@ -37,6 +30,13 @@ namespace dxvk {
if (m_desc.Width == 0) m_desc.Width = windowSize.width;
if (m_desc.Height == 0) m_desc.Height = windowSize.height;
// Create presenter, which also serves as an interface to the device
if (FAILED(CreatePresenter(pDevice, &m_presenter)))
throw DxvkError("DXGI: Failed to create presenter");
if (FAILED(m_presenter->GetAdapter(__uuidof(IDXGIAdapter), reinterpret_cast<void**>(&m_adapter))))
throw DxvkError("DXGI: Failed to get adapter for present device");
// Set initial window mode and fullscreen state
if (!m_descFs.Windowed && FAILED(EnterFullscreenMode(nullptr)))
throw DxvkError("DXGI: Failed to set initial fullscreen state");