From db44d5675f4e02a9f3178fe54ac6d5a9c216a573 Mon Sep 17 00:00:00 2001 From: Gary Hsu Date: Thu, 23 Jun 2022 22:13:38 -0700 Subject: [PATCH] Fixes when running in WinRT (#2827) * Use ResizeBuffers for WinRT * Set maximum frame latency for WinRT * Remove extra space --- src/dxgi.cpp | 27 ++++++++++++++++----------- src/renderer_d3d11.cpp | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/dxgi.cpp b/src/dxgi.cpp index 5708090ed..29b3dc50d 100644 --- a/src/dxgi.cpp +++ b/src/dxgi.cpp @@ -427,17 +427,6 @@ namespace bgfx , &scd , reinterpret_cast(_swapChain) ); - - if (SUCCEEDED(hr) ) - { - IDXGIDevice1* dxgiDevice1; - _device->QueryInterface(IID_IDXGIDevice1, (void**)&dxgiDevice1); - if (NULL != dxgiDevice1) - { - dxgiDevice1->SetMaximumFrameLatency(_scd.maxFrameLatency); - DX_RELEASE_I(dxgiDevice1); - } - } #else DXGI_SWAP_CHAIN_DESC1 scd; scd.Width = _scd.width; @@ -539,6 +528,22 @@ namespace bgfx } #endif // BX_PLATFORM_WINDOWS + if (SUCCEEDED(hr) ) + { + IDXGIDevice1* dxgiDevice1; + _device->QueryInterface(IID_IDXGIDevice1, (void**)&dxgiDevice1); + if (NULL != dxgiDevice1) + { + hr = dxgiDevice1->SetMaximumFrameLatency(_scd.maxFrameLatency); + if (FAILED(hr) ) + { + BX_TRACE("Failed to set maximum frame latency, hr 0x%08x", hr); + hr = S_OK; + } + DX_RELEASE_I(dxgiDevice1); + } + } + if (FAILED(hr) ) { BX_TRACE("Failed to create swap chain."); diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 0bbc1edc0..787996820 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2441,7 +2441,7 @@ namespace bgfx { namespace d3d11 uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); bool resize = true - && !BX_ENABLED(BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT) // can't use ResizeBuffers on Windows Phone + && !BX_ENABLED(BX_PLATFORM_XBOXONE) && (m_resolution.reset&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK) ;