mirror of
https://github.com/wolfpld/tracy.git
synced 2024-09-20 05:42:18 +00:00
Fix lua zone state init.
This commit is contained in:
parent
26f2cb336e
commit
c3ba0ef4eb
37
TracyLua.hpp
37
TracyLua.hpp
@ -118,8 +118,9 @@ static inline void LuaRemove( char* script )
|
|||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
extern thread_local uint32_t s_luaZoneCounter;
|
#ifdef TRACY_ON_DEMAND
|
||||||
extern thread_local bool s_luaZoneActive;
|
extern thread_local LuaZoneState s_luaZoneState;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@ -127,10 +128,10 @@ namespace detail
|
|||||||
static inline int LuaZoneBegin( lua_State* L )
|
static inline int LuaZoneBegin( lua_State* L )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
const auto zoneCnt = s_luaZoneCounter++;
|
const auto zoneCnt = s_luaZoneState.counter++;
|
||||||
if( zoneCnt != 0 && !s_luaZoneActive ) return 0;
|
if( zoneCnt != 0 && !s_luaZoneState.active ) return 0;
|
||||||
s_luaZoneActive = s_profiler.IsConnected();
|
s_luaZoneState.active = s_profiler.IsConnected();
|
||||||
if( !s_luaZoneActive ) return 0;
|
if( !s_luaZoneState.active ) return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint32_t color = Color::DeepSkyBlue3;
|
const uint32_t color = Color::DeepSkyBlue3;
|
||||||
@ -181,10 +182,10 @@ static inline int LuaZoneBegin( lua_State* L )
|
|||||||
static inline int LuaZoneBeginN( lua_State* L )
|
static inline int LuaZoneBeginN( lua_State* L )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
const auto zoneCnt = s_luaZoneCounter++;
|
const auto zoneCnt = s_luaZoneState.counter++;
|
||||||
if( zoneCnt != 0 && !s_luaZoneActive ) return 0;
|
if( zoneCnt != 0 && !s_luaZoneState.active ) return 0;
|
||||||
s_luaZoneActive = s_profiler.IsConnected();
|
s_luaZoneState.active = s_profiler.IsConnected();
|
||||||
if( !s_luaZoneActive ) return 0;
|
if( !s_luaZoneState.active ) return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint32_t color = Color::DeepSkyBlue3;
|
const uint32_t color = Color::DeepSkyBlue3;
|
||||||
@ -239,12 +240,12 @@ static inline int LuaZoneBeginN( lua_State* L )
|
|||||||
static inline int LuaZoneEnd( lua_State* L )
|
static inline int LuaZoneEnd( lua_State* L )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
assert( s_luaZoneCounter != 0 );
|
assert( s_luaZoneState.counter != 0 );
|
||||||
s_luaZoneCounter--;
|
s_luaZoneState.counter--;
|
||||||
if( !s_luaZoneActive ) return 0;
|
if( !s_luaZoneState.active ) return 0;
|
||||||
if( !s_profiler.IsConnected() )
|
if( !s_profiler.IsConnected() )
|
||||||
{
|
{
|
||||||
s_luaZoneActive = false;
|
s_luaZoneState.active = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -269,10 +270,10 @@ static inline int LuaZoneEnd( lua_State* L )
|
|||||||
static inline int LuaZoneText( lua_State* L )
|
static inline int LuaZoneText( lua_State* L )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !s_luaZoneActive ) return 0;
|
if( !s_luaZoneState.active ) return 0;
|
||||||
if( !s_profiler.IsConnected() )
|
if( !s_profiler.IsConnected() )
|
||||||
{
|
{
|
||||||
s_luaZoneActive = false;
|
s_luaZoneState.active = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -297,10 +298,10 @@ static inline int LuaZoneText( lua_State* L )
|
|||||||
static inline int LuaZoneName( lua_State* L )
|
static inline int LuaZoneName( lua_State* L )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !s_luaZoneActive ) return 0;
|
if( !s_luaZoneState.active ) return 0;
|
||||||
if( !s_profiler.IsConnected() )
|
if( !s_profiler.IsConnected() )
|
||||||
{
|
{
|
||||||
s_luaZoneActive = false;
|
s_luaZoneState.active = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -180,8 +180,7 @@ std::atomic<ThreadNameData*> init_order(104) s_threadNameData( nullptr );
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
thread_local uint32_t init_order(104) s_luaZoneCounter( 0 );
|
thread_local LuaZoneState init_order(104) s_luaZoneState { 0, false };
|
||||||
thread_local bool init_order(104) s_luaZoneActive( false );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Profiler init_order(105) s_profiler;
|
Profiler init_order(105) s_profiler;
|
||||||
|
@ -62,6 +62,14 @@ struct VkCtxWrapper
|
|||||||
VkCtx* ptr;
|
VkCtx* ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef TRACY_ON_DEMAND
|
||||||
|
struct LuaZoneState
|
||||||
|
{
|
||||||
|
uint32_t counter;
|
||||||
|
bool active;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
using Magic = tracy::moodycamel::ConcurrentQueueDefaultTraits::index_t;
|
using Magic = tracy::moodycamel::ConcurrentQueueDefaultTraits::index_t;
|
||||||
|
|
||||||
#if __ARM_ARCH >= 6
|
#if __ARM_ARCH >= 6
|
||||||
|
Loading…
Reference in New Issue
Block a user