Dxgi tearing support (#2601)
* present tearing support * use existing syncInterval variable
This commit is contained in:
parent
f1ddf67114
commit
bbc2b76948
@ -122,6 +122,7 @@ namespace bgfx
|
||||
, m_factory(NULL)
|
||||
, m_adapter(NULL)
|
||||
, m_output(NULL)
|
||||
, m_tearingSupported(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -389,6 +390,8 @@ namespace bgfx
|
||||
: 0
|
||||
;
|
||||
|
||||
m_tearingSupported = allowTearing;
|
||||
|
||||
DX_RELEASE_I(factory5);
|
||||
}
|
||||
|
||||
@ -785,6 +788,11 @@ namespace bgfx
|
||||
#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
|
||||
}
|
||||
|
||||
bool Dxgi::tearingSupported()
|
||||
{
|
||||
return m_tearingSupported;
|
||||
}
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
#endif // BGFX_CONFIG_RENDERER_DIRECT3D11 || BGFX_CONFIG_RENDERER_DIRECT3D12
|
||||
|
@ -99,6 +99,9 @@ namespace bgfx
|
||||
///
|
||||
void trim();
|
||||
|
||||
///
|
||||
bool tearingSupported();
|
||||
|
||||
///
|
||||
void* m_dxgiDll;
|
||||
void* m_dxgiDebugDll;
|
||||
@ -108,6 +111,7 @@ namespace bgfx
|
||||
FactoryI* m_factory;
|
||||
AdapterI* m_adapter;
|
||||
OutputI* m_output;
|
||||
bool m_tearingSupported;
|
||||
};
|
||||
|
||||
} // namespace bgfx
|
||||
|
@ -2287,7 +2287,12 @@ namespace bgfx { namespace d3d11
|
||||
if (NULL != m_swapChain
|
||||
&& m_needPresent)
|
||||
{
|
||||
hr = m_swapChain->Present(syncInterval, 0);
|
||||
uint32_t presentFlags = 0;
|
||||
if (!syncInterval && (m_dxgi.tearingSupported()))
|
||||
{
|
||||
presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
|
||||
}
|
||||
hr = m_swapChain->Present(syncInterval, presentFlags);
|
||||
|
||||
m_needPresent = false;
|
||||
}
|
||||
|
@ -1508,7 +1508,19 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
uint32_t syncInterval = !!(m_resolution.reset & BGFX_RESET_VSYNC);
|
||||
uint32_t flags = 0 == syncInterval ? DXGI_PRESENT_RESTART : 0;
|
||||
uint32_t flags = 0;
|
||||
if (syncInterval)
|
||||
{
|
||||
flags |= DXGI_PRESENT_RESTART;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_dxgi.tearingSupported())
|
||||
{
|
||||
flags |= DXGI_PRESENT_ALLOW_TEARING;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t ii = 1, num = m_numWindows; ii < num && SUCCEEDED(hr); ++ii)
|
||||
{
|
||||
FrameBufferD3D12& frameBuffer = m_frameBuffers[m_windows[ii].idx];
|
||||
|
Loading…
x
Reference in New Issue
Block a user