Fixes when running in WinRT (#2827)

* Use ResizeBuffers for WinRT

* Set maximum frame latency for WinRT

* Remove extra space
This commit is contained in:
Gary Hsu 2022-06-23 22:13:38 -07:00 committed by GitHub
parent 296ed0a81e
commit db44d5675f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 12 deletions

View File

@ -427,17 +427,6 @@ namespace bgfx
, &scd
, reinterpret_cast<IDXGISwapChain**>(_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.");

View File

@ -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)
;