mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-04-06 12:24:23 -04:00
Sprinkled profiler macros.
This commit is contained in:
parent
55df818f06
commit
cbbba6e5f6
3 changed files with 14 additions and 4 deletions
|
@ -378,7 +378,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||
|
||||
rmtError err = rmt_CreateGlobalInstance(&s_rmt);
|
||||
BX_WARN(RMT_ERROR_NONE != err, "Remotery failed to create global instance.");
|
||||
if (RMT_ERROR_NONE != err)
|
||||
if (RMT_ERROR_NONE == err)
|
||||
{
|
||||
rmt_SetCurrentThreadName("Main");
|
||||
}
|
||||
else
|
||||
{
|
||||
s_rmt = NULL;
|
||||
}
|
||||
|
|
|
@ -1341,6 +1341,7 @@ namespace bgfx
|
|||
m_occlusionQuerySet.clear();
|
||||
}
|
||||
|
||||
BGFX_PROFILER_SCOPE(bgfx, main_thread_frame, 0xff2040ff);
|
||||
// wait for render thread to finish
|
||||
renderSemWait();
|
||||
frameNoRenderWait();
|
||||
|
@ -1416,7 +1417,7 @@ namespace bgfx
|
|||
|
||||
bool Context::renderFrame()
|
||||
{
|
||||
BGFX_PROFILER_SCOPE(bgfx, render_frame, 0xff2040ff)
|
||||
BGFX_PROFILER_SCOPE(bgfx, render_frame, 0xff2040ff);
|
||||
|
||||
if (m_rendererInitialized
|
||||
&& !m_flipAfterRender)
|
||||
|
@ -1429,6 +1430,7 @@ namespace bgfx
|
|||
rendererExecCommands(m_render->m_cmdPre);
|
||||
if (m_rendererInitialized)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE(bgfx, render_submit, 0xff2040ff);
|
||||
m_renderCtx->submit(m_render, m_clearQuad, m_textVideoMemBlitter);
|
||||
}
|
||||
rendererExecCommands(m_render->m_cmdPost);
|
||||
|
|
|
@ -53,12 +53,15 @@
|
|||
# if BGFX_CONFIG_PROFILER_MICROPROFILE
|
||||
# include <microprofile.h>
|
||||
# define BGFX_PROFILER_SCOPE(_group, _name, _color) MICROPROFILE_SCOPEI(#_group, #_name, _color)
|
||||
# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP()
|
||||
# elif BGFX_CONFIG_PROFILER_REMOTERY
|
||||
# define RMT_ENABLED BGFX_CONFIG_PROFILER_REMOTERY
|
||||
# include <remotery/lib/Remotery.h>
|
||||
# define BGFX_PROFILER_SCOPE(_group, _name, _color) rmt_ScopedCPUSample(_group##_##_name)
|
||||
# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) rmt_SetCurrentThreadName(_name)
|
||||
# else
|
||||
# define BGFX_PROFILER_SCOPE(_group, _name, _color) BX_NOOP()
|
||||
# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP()
|
||||
# endif // BGFX_CONFIG_PROFILER_*
|
||||
#endif // BGFX_PROFILER_SCOPE
|
||||
|
||||
|
@ -2028,6 +2031,7 @@ namespace bgfx
|
|||
static int32_t renderThread(void* /*_userData*/)
|
||||
{
|
||||
BX_TRACE("render thread start");
|
||||
BGFX_PROFILER_SET_CURRENT_THREAD_NAME("bgfx - Render Thread");
|
||||
while (RenderFrame::Exiting != bgfx::renderFrame() ) {};
|
||||
BX_TRACE("render thread exit");
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -3796,7 +3800,7 @@ namespace bgfx
|
|||
{
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE(bgfx, main_thread_wait, 0xff2040ff)
|
||||
BGFX_PROFILER_SCOPE(bgfx, main_thread_wait, 0xff2040ff);
|
||||
int64_t start = bx::getHPCounter();
|
||||
bool ok = m_gameSem.wait();
|
||||
BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
|
||||
|
@ -3816,7 +3820,7 @@ namespace bgfx
|
|||
{
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
BGFX_PROFILER_SCOPE(bgfx, render_thread_wait, 0xff2040ff)
|
||||
BGFX_PROFILER_SCOPE(bgfx, render_thread_wait, 0xff2040ff);
|
||||
int64_t start = bx::getHPCounter();
|
||||
bool ok = m_renderSem.wait();
|
||||
BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
|
||||
|
|
Loading…
Add table
Reference in a new issue