diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 7c233c725..b7550d26e 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -1319,6 +1319,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); goto error; } + m_swapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + bx::memSet(&m_scd, 0, sizeof(m_scd) ); m_scd.BufferDesc.Width = _init.resolution.m_width; m_scd.BufferDesc.Height = _init.resolution.m_height; @@ -1328,8 +1330,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_scd.SampleDesc.Count = 1; m_scd.SampleDesc.Quality = 0; m_scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - m_scd.BufferCount = 2; - m_scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + m_scd.BufferCount = 1; + m_scd.SwapEffect = m_swapEffect; m_scd.OutputWindow = (HWND)g_platformData.nwh; m_scd.Windowed = true; @@ -1341,7 +1343,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { // DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL is not available on win7 // Try again with DXGI_SWAP_EFFECT_DISCARD - m_scd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + m_swapEffect = DXGI_SWAP_EFFECT_DISCARD; + m_scd.BufferCount = 1; + m_scd.SwapEffect = m_swapEffect; hr = m_factory->CreateSwapChain(m_device , &m_scd , &m_swapChain @@ -2706,6 +2710,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(m_swapChain, 0); + m_scd.SwapEffect = m_scd.SampleDesc.Count != 1 + ? DXGI_SWAP_EFFECT_DISCARD + : m_swapEffect + ; + SwapChainDesc* scd = &m_scd; SwapChainDesc swapChainScd; if (0 != (m_resolution.m_flags & BGFX_RESET_HMD) @@ -3870,6 +3879,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #endif // BX_PLATFORM_WINDOWS SwapChainDesc m_scd; + DXGI_SWAP_EFFECT m_swapEffect; uint32_t m_maxAnisotropy; bool m_depthClamp; bool m_wireframe; @@ -6906,6 +6916,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); PIX_ENDEVENT(); } + + m_deviceCtx->OMSetRenderTargets(0, NULL, NULL); } } /* namespace d3d11 */ } // namespace bgfx