Browse Source

Fixes when running in WinRT (#2827)

* Use ResizeBuffers for WinRT

* Set maximum frame latency for WinRT

* Remove extra space
Gary Hsu 3 years ago
parent
commit
db44d5675f
2 changed files with 17 additions and 12 deletions
  1. 16 11
      src/dxgi.cpp
  2. 1 1
      src/renderer_d3d11.cpp

+ 16 - 11
src/dxgi.cpp

@@ -427,17 +427,6 @@ namespace bgfx
 			, &scd
 			, &scd
 			, reinterpret_cast<IDXGISwapChain**>(_swapChain)
 			, 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
 #else
 		DXGI_SWAP_CHAIN_DESC1 scd;
 		DXGI_SWAP_CHAIN_DESC1 scd;
 		scd.Width  = _scd.width;
 		scd.Width  = _scd.width;
@@ -539,6 +528,22 @@ namespace bgfx
 		}
 		}
 #endif // BX_PLATFORM_WINDOWS
 #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) )
 		if (FAILED(hr) )
 		{
 		{
 			BX_TRACE("Failed to create swap chain.");
 			BX_TRACE("Failed to create swap chain.");

+ 1 - 1
src/renderer_d3d11.cpp

@@ -2441,7 +2441,7 @@ namespace bgfx { namespace d3d11
 				uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE);
 				uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE);
 
 
 				bool resize = true
 				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)
 					&& (m_resolution.reset&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK)
 					;
 					;