mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-17 20:31:57 -05:00
Added BGFX_PROFILER_SCOPE.
This commit is contained in:
parent
384b45bec1
commit
5cd89ff624
3 changed files with 25 additions and 1 deletions
|
@ -1416,8 +1416,10 @@ namespace bgfx
|
|||
|
||||
bool Context::renderFrame()
|
||||
{
|
||||
BGFX_PROFILER_SCOPE("bgfx", "renderFrame", 0xff2040ff)
|
||||
|
||||
if (m_rendererInitialized
|
||||
&& !m_flipAfterRender)
|
||||
&& !m_flipAfterRender)
|
||||
{
|
||||
m_renderCtx->flip(m_render->m_hmd);
|
||||
}
|
||||
|
|
14
src/bgfx_p.h
14
src/bgfx_p.h
|
@ -49,6 +49,18 @@
|
|||
, _handleAlloc.getMaxHandles() \
|
||||
)
|
||||
|
||||
#ifndef BGFX_PROFILER_SCOPE
|
||||
# if BGFX_CONFIG_PROFILER_MICROPROFILE
|
||||
# include <microprofile.h>
|
||||
# define BGFX_PROFILER_SCOPE(_group, _name, _color) MICROPROFILE_SCOPEI(_group, _name, _color)
|
||||
# elif BGFX_CONFIG_PROFILER_REMOTERY
|
||||
# include <remotery.h>
|
||||
# define BGFX_PROFILER_SCOPE(_group, _name, _color) rmt_ScopedCPUSample(_name)
|
||||
# else
|
||||
# define BGFX_PROFILER_SCOPE(_group, _name, _color) BX_NOOP()
|
||||
# endif // BGFX_CONFIG_PROFILER_*
|
||||
#endif // BGFX_PROFILER_SCOPE
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
#if BX_COMPILER_CLANG_ANALYZER
|
||||
|
@ -3783,6 +3795,7 @@ namespace bgfx
|
|||
{
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
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);
|
||||
|
@ -3802,6 +3815,7 @@ namespace bgfx
|
|||
{
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
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);
|
||||
|
|
|
@ -300,4 +300,12 @@
|
|||
|
||||
#define BGFX_CONFIG_DRAW_INDIRECT_STRIDE 32
|
||||
|
||||
#ifndef BGFX_CONFIG_PROFILER_MICROPROFILE
|
||||
# define BGFX_CONFIG_PROFILER_MICROPROFILE 0
|
||||
#endif // BGFX_CONFIG_PROFILER_MICROPROFILE
|
||||
|
||||
#ifndef BGFX_CONFIG_PROFILER_REMOTERY
|
||||
# define BGFX_CONFIG_PROFILER_REMOTERY 0
|
||||
#endif // BGFX_CONFIG_PROFILER_REMOTERY
|
||||
|
||||
#endif // BGFX_CONFIG_H_HEADER_GUARD
|
||||
|
|
Loading…
Reference in a new issue