mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Added flip after submit reset flag.
This commit is contained in:
parent
87a5652b46
commit
7bfe51d0d8
5 changed files with 29 additions and 7 deletions
|
@ -123,7 +123,9 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
|| setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
|
|| setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
|
||||||
|| setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
|
|| setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
|
||||||
|| setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv)
|
|| setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv)
|
||||||
|| setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv) )
|
|| setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv)
|
||||||
|
|| setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_SUBMIT, 1, _argc, _argv)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -176,6 +178,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
{ entry::Key::F4, entry::Modifier::LeftCtrl, 1, cmd, "graphics hmddbg" },
|
{ entry::Key::F4, entry::Modifier::LeftCtrl, 1, cmd, "graphics hmddbg" },
|
||||||
{ entry::Key::F7, entry::Modifier::None, 1, cmd, "graphics vsync" },
|
{ entry::Key::F7, entry::Modifier::None, 1, cmd, "graphics vsync" },
|
||||||
{ entry::Key::F8, entry::Modifier::None, 1, cmd, "graphics msaa" },
|
{ entry::Key::F8, entry::Modifier::None, 1, cmd, "graphics msaa" },
|
||||||
|
{ entry::Key::F9, entry::Modifier::None, 1, cmd, "graphics flip" },
|
||||||
{ entry::Key::Print, entry::Modifier::None, 1, cmd, "graphics screenshot" },
|
{ entry::Key::Print, entry::Modifier::None, 1, cmd, "graphics screenshot" },
|
||||||
|
|
||||||
INPUT_BINDING_END
|
INPUT_BINDING_END
|
||||||
|
|
|
@ -571,7 +571,12 @@ namespace bgfx
|
||||||
/// - `BGFX_RESET_FULLSCREEN` - Not supported yet.
|
/// - `BGFX_RESET_FULLSCREEN` - Not supported yet.
|
||||||
/// - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
|
/// - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA.
|
||||||
/// - `BGFX_RESET_VSYNC` - Enable V-Sync.
|
/// - `BGFX_RESET_VSYNC` - Enable V-Sync.
|
||||||
|
/// - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
|
||||||
/// - `BGFX_RESET_CAPTURE` - Begin screen capture.
|
/// - `BGFX_RESET_CAPTURE` - Begin screen capture.
|
||||||
|
/// - `BGFX_RESET_HMD` - HMD stereo rendering.
|
||||||
|
/// - `BGFX_RESET_HMD_DEBUG` - HMD stereo rendering debug mode.
|
||||||
|
/// - `BGFX_RESET_HMD_RECENTER` - HMD calibration.
|
||||||
|
/// - `BGFX_RESET_FLIP_AFTER_SUBMIT` - Flip back buffer after submit.
|
||||||
///
|
///
|
||||||
/// @attention This call doesn't actually change window size, it just
|
/// @attention This call doesn't actually change window size, it just
|
||||||
/// resizes back-buffer. Windowing code has to change window size.
|
/// resizes back-buffer. Windowing code has to change window size.
|
||||||
|
|
|
@ -303,6 +303,7 @@
|
||||||
#define BGFX_RESET_HMD UINT32_C(0x00000400)
|
#define BGFX_RESET_HMD UINT32_C(0x00000400)
|
||||||
#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800)
|
#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800)
|
||||||
#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000)
|
#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000)
|
||||||
|
#define BGFX_RESET_FLIP_AFTER_SUBMIT UINT32_C(0x00002000)
|
||||||
|
|
||||||
///
|
///
|
||||||
#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001)
|
#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001)
|
||||||
|
|
11
src/bgfx.cpp
11
src/bgfx.cpp
|
@ -1190,6 +1190,8 @@ namespace bgfx
|
||||||
m_render = m_submit;
|
m_render = m_submit;
|
||||||
m_submit = temp;
|
m_submit = temp;
|
||||||
|
|
||||||
|
memcpy(&m_submit->m_hmd, &m_render->m_hmd, sizeof(HMD) );
|
||||||
|
|
||||||
m_frames++;
|
m_frames++;
|
||||||
m_submit->start();
|
m_submit->start();
|
||||||
|
|
||||||
|
@ -1205,7 +1207,8 @@ namespace bgfx
|
||||||
|
|
||||||
bool Context::renderFrame()
|
bool Context::renderFrame()
|
||||||
{
|
{
|
||||||
if (m_rendererInitialized)
|
if (m_rendererInitialized
|
||||||
|
&& !m_flipAfterSubmit)
|
||||||
{
|
{
|
||||||
m_renderCtx->flip();
|
m_renderCtx->flip();
|
||||||
}
|
}
|
||||||
|
@ -1221,6 +1224,12 @@ namespace bgfx
|
||||||
|
|
||||||
renderSemPost();
|
renderSemPost();
|
||||||
|
|
||||||
|
if (m_rendererInitialized
|
||||||
|
&& m_flipAfterSubmit)
|
||||||
|
{
|
||||||
|
m_renderCtx->flip();
|
||||||
|
}
|
||||||
|
|
||||||
return m_exit;
|
return m_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1893,6 +1893,7 @@ namespace bgfx
|
||||||
, m_renderCtx(NULL)
|
, m_renderCtx(NULL)
|
||||||
, m_rendererInitialized(false)
|
, m_rendererInitialized(false)
|
||||||
, m_exit(false)
|
, m_exit(false)
|
||||||
|
, m_flipAfterSubmit(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1927,6 +1928,8 @@ namespace bgfx
|
||||||
m_resolution.m_height = bx::uint32_max(1, _height);
|
m_resolution.m_height = bx::uint32_max(1, _height);
|
||||||
m_resolution.m_flags = _flags;
|
m_resolution.m_flags = _flags;
|
||||||
|
|
||||||
|
m_flipAfterSubmit = !!(_flags & BGFX_RESET_FLIP_AFTER_SUBMIT);
|
||||||
|
|
||||||
memset(m_fb, 0xff, sizeof(m_fb) );
|
memset(m_fb, 0xff, sizeof(m_fb) );
|
||||||
|
|
||||||
for (uint16_t ii = 0, num = m_textureHandle.getNumHandles(); ii < num; ++ii)
|
for (uint16_t ii = 0, num = m_textureHandle.getNumHandles(); ii < num; ++ii)
|
||||||
|
@ -3527,6 +3530,7 @@ namespace bgfx
|
||||||
|
|
||||||
bool m_rendererInitialized;
|
bool m_rendererInitialized;
|
||||||
bool m_exit;
|
bool m_exit;
|
||||||
|
bool m_flipAfterSubmit;
|
||||||
|
|
||||||
typedef UpdateBatchT<256> TextureUpdateBatch;
|
typedef UpdateBatchT<256> TextureUpdateBatch;
|
||||||
BX_ALIGN_DECL_CACHE_LINE(TextureUpdateBatch m_textureUpdateBatch);
|
BX_ALIGN_DECL_CACHE_LINE(TextureUpdateBatch m_textureUpdateBatch);
|
||||||
|
|
Loading…
Reference in a new issue