Added FrameTime. (#3521)

This commit is contained in:
Branimir Karadžić
2025-12-23 20:03:52 -08:00
committed by GitHub
parent 9d63c39a44
commit 3ddf1ed032
47 changed files with 608 additions and 590 deletions

View File

@@ -327,6 +327,8 @@ public:
m_havePrevious = false;
imguiCreate();
m_frameTime.reset();
}
int32_t shutdown() override
@@ -375,6 +377,9 @@ public:
{
if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) )
{
m_frameTime.frame();
const float deltaTime = bx::toSeconds<float>(m_frameTime.getDeltaTime() );
// skip processing when minimized, otherwise crashing
if (0 == m_width
|| 0 == m_height)
@@ -382,13 +387,6 @@ public:
return true;
}
// Update frame timer
int64_t now = bx::getHPCounter();
static int64_t last = now;
const int64_t frameTime = now - last;
last = now;
const double freq = double(bx::getHPFrequency() );
const float deltaTime = float(frameTime / freq);
const bgfx::Caps* caps = bgfx::getCaps();
if (m_size[0] != (int32_t)m_width
@@ -1113,6 +1111,8 @@ public:
bool m_enableTxaa = false;
bool m_applyMitchellFilter = true;
bool m_useTxaaSlow = false;
FrameTime m_frameTime;
};
} // namespace