From 16c73cd71bd770994f5d582b1a72020fcbeacd1a Mon Sep 17 00:00:00 2001 From: Mikulas Florek Date: Sun, 15 May 2016 17:27:13 +0200 Subject: [PATCH] waitRender and waitSubmit in the stats --- examples/17-drawstress/drawstress.cpp | 4 +++- include/bgfx/bgfx.h | 3 +++ include/bgfx/c99/bgfx.h | 2 ++ src/bgfx_p.h | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/17-drawstress/drawstress.cpp b/examples/17-drawstress/drawstress.cpp index 2e933c1cb..ce0c8fd61 100644 --- a/examples/17-drawstress/drawstress.cpp +++ b/examples/17-drawstress/drawstress.cpp @@ -246,7 +246,9 @@ class ExampleDrawStress : public entry::AppI const bgfx::Stats* stats = bgfx::getStats(); imguiLabel("GPU %0.6f [ms]", double(stats->gpuTimeEnd - stats->gpuTimeBegin)*1000.0/stats->gpuTimerFreq); imguiLabel("CPU %0.6f [ms]", double(stats->cpuTimeEnd - stats->cpuTimeBegin)*1000.0/stats->cpuTimerFreq); - + imguiLabel("Waiting for render thread %0.6f [ms]", double(stats->waitRender) * toMs); + imguiLabel("Waiting for submit thread %0.6f [ms]", double(stats->waitSubmit) * toMs); + imguiEndScrollArea(); imguiEndFrame(); diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index 37d0538e3..a77a769ea 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -640,6 +640,9 @@ namespace bgfx uint64_t gpuTimeBegin; //!< GPU frame begin time. uint64_t gpuTimeEnd; //!< GPU frame end time. uint64_t gpuTimerFreq; //!< GPU timer frequency. + + int64_t waitRender; //!< Render wait time. + int64_t waitSubmit; //!< Submit wait time. }; /// Vertex declaration. diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index 9f6fde039..37b07c45f 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -307,6 +307,8 @@ typedef struct bgfx_stats uint64_t gpuTimeEnd; uint64_t gpuTimerFreq; + int64_t waitRender; + int64_t waitSubmit; } bgfx_stats_t; /**/ diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 243c23ca2..90005ca3e 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -3892,6 +3892,7 @@ namespace bgfx bool ok = m_gameSem.wait(); BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok); m_render->m_waitSubmit = bx::getHPCounter()-start; + m_submit->m_perfStats.waitSubmit = m_submit->m_waitSubmit; } } @@ -3912,6 +3913,7 @@ namespace bgfx bool ok = m_renderSem.wait(); BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok); m_submit->m_waitRender = bx::getHPCounter() - start; + m_submit->m_perfStats.waitRender = m_submit->m_waitRender; } }