Fixed issue #1302.

This commit is contained in:
Branimir Karadžić 2017-12-30 15:26:30 -08:00
parent 25476fc8a2
commit 14ccddb088

View File

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