Added --with-profiler option.
This commit is contained in:
parent
150f52ae74
commit
8c33afdd09
10
3rdparty/remotery/lib/Remotery.c
vendored
10
3rdparty/remotery/lib/Remotery.c
vendored
@ -488,15 +488,7 @@ static void AtomicSub(rmtS32 volatile* value, rmtS32 sub)
|
||||
}
|
||||
|
||||
|
||||
// Compiler read/write fences (windows implementation)
|
||||
static void ReadFence()
|
||||
{
|
||||
#if defined(RMT_PLATFORM_WINDOWS)
|
||||
_ReadBarrier();
|
||||
#else
|
||||
asm volatile ("" : : : "memory");
|
||||
#endif
|
||||
}
|
||||
// Compiler write fences (windows implementation)
|
||||
static void WriteFence()
|
||||
{
|
||||
#if defined(RMT_PLATFORM_WINDOWS) && !defined(__MINGW32__)
|
||||
|
@ -39,6 +39,21 @@ namespace entry
|
||||
extern bx::AllocatorI* getDefaultAllocator();
|
||||
static bx::AllocatorI* s_allocator = getDefaultAllocator();
|
||||
|
||||
void* rmtMalloc(void* /*_context*/, rmtU32 _size)
|
||||
{
|
||||
return BX_ALLOC(s_allocator, _size);
|
||||
}
|
||||
|
||||
void* rmtRealloc(void* /*_context*/, void* _ptr, rmtU32 _size)
|
||||
{
|
||||
return BX_REALLOC(s_allocator, _ptr, _size);
|
||||
}
|
||||
|
||||
void rmtFree(void* /*_context*/, void* _ptr)
|
||||
{
|
||||
BX_FREE(s_allocator, _ptr);
|
||||
}
|
||||
|
||||
#if ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
|
||||
bx::AllocatorI* getDefaultAllocator()
|
||||
{
|
||||
@ -349,10 +364,20 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
if (BX_ENABLED(ENTRY_CONFIG_PROFILER) )
|
||||
{
|
||||
// rmtSettings* settings = rmt_Settings();
|
||||
if (RMT_ERROR_NONE != rmt_CreateGlobalInstance(&s_rmt) )
|
||||
rmtSettings* settings = rmt_Settings();
|
||||
BX_WARN(NULL != settings, "Remotery is not enabled.");
|
||||
if (NULL != settings)
|
||||
{
|
||||
s_rmt = NULL;
|
||||
settings->malloc = rmtMalloc;
|
||||
settings->realloc = rmtRealloc;
|
||||
settings->free = rmtFree;
|
||||
|
||||
rmtError err = rmt_CreateGlobalInstance(&s_rmt);
|
||||
BX_WARN(RMT_ERROR_NONE != err, "Remotery failed to create global instance.");
|
||||
if (RMT_ERROR_NONE != err)
|
||||
{
|
||||
s_rmt = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,11 @@ newoption {
|
||||
description = "Enable GLFW entry.",
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "with-profiler",
|
||||
description = "Enable build with intrusive profiler.",
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "with-scintilla",
|
||||
description = "Enable building with Scintilla editor.",
|
||||
@ -85,6 +90,13 @@ if _OPTIONS["with-sdl"] then
|
||||
end
|
||||
end
|
||||
|
||||
if _OPTIONS["with-profiler"] then
|
||||
defines {
|
||||
"ENTRY_CONFIG_PROFILER=1",
|
||||
"BGFX_CONFIG_PROFILER_REMOTERY=1",
|
||||
}
|
||||
end
|
||||
|
||||
function exampleProject(_name)
|
||||
|
||||
project ("example-" .. _name)
|
||||
|
Loading…
Reference in New Issue
Block a user