mirror of
https://github.com/wolfpld/tracy.git
synced 2026-11-08 00:45:27 +00:00
Add trigger parameter.
This commit is contained in:
@@ -203,15 +203,18 @@ bool View::DrawConnection()
|
||||
ImGui::TextUnformatted( m_worker.GetString( p.name ) );
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID( idx );
|
||||
if( p.isBool )
|
||||
switch( p.type )
|
||||
{
|
||||
case ParameterType::Boolean:
|
||||
{
|
||||
bool val = p.val;
|
||||
if( ImGui::Checkbox( "", &val ) )
|
||||
{
|
||||
m_worker.SetParameter( idx, int32_t( val ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
case ParameterType::Integer:
|
||||
{
|
||||
auto val = int( p.val );
|
||||
ImGui::SetNextItemWidth( 100 * GetScale() );
|
||||
@@ -219,6 +222,14 @@ bool View::DrawConnection()
|
||||
{
|
||||
m_worker.SetParameter( idx, int32_t( val ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParameterType::Trigger:
|
||||
if( ImGui::Button( ICON_FA_CIRCLE_DOT ) )
|
||||
{
|
||||
m_worker.SetParameter( idx, p.val );
|
||||
}
|
||||
break;
|
||||
}
|
||||
ImGui::PopID();
|
||||
idx++;
|
||||
|
||||
@@ -748,12 +748,13 @@ public:
|
||||
profiler.m_paramCallbackData = data;
|
||||
}
|
||||
|
||||
static tracy_force_inline void ParameterSetup( uint32_t idx, const char* name, bool isBool, int32_t val )
|
||||
static tracy_force_inline void ParameterSetup( uint32_t idx, const char* name, uint8_t type, int32_t val )
|
||||
{
|
||||
assert( type >= 0 && type <= 2 );
|
||||
TracyLfqPrepare( QueueType::ParamSetup );
|
||||
tracy::MemWrite( &item->paramSetup.idx, idx );
|
||||
tracy::MemWrite( &item->paramSetup.name, (uint64_t)name );
|
||||
tracy::MemWrite( &item->paramSetup.isBool, (uint8_t)isBool );
|
||||
tracy::MemWrite( &item->paramSetup.type, type );
|
||||
tracy::MemWrite( &item->paramSetup.val, val );
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
|
||||
@@ -795,7 +795,7 @@ struct QueueParamSetup
|
||||
{
|
||||
uint32_t idx;
|
||||
uint64_t name; // ptr
|
||||
uint8_t isBool;
|
||||
uint8_t type;
|
||||
int32_t val;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
# define TracyLine TracyConcat(__LINE__,U) // MSVC Edit and continue __LINE__ is non-constant. See https://developercommunity.visualstudio.com/t/-line-cannot-be-used-as-an-argument-for-constexpr/195665
|
||||
#endif
|
||||
|
||||
|
||||
#define TracyParamTypeInt 0
|
||||
#define TracyParamTypeBool 1
|
||||
#define TracyParamTypeTrigger 2
|
||||
|
||||
|
||||
#ifndef TRACY_ENABLE
|
||||
|
||||
#define TracyNoop
|
||||
@@ -248,7 +254,7 @@
|
||||
|
||||
#define TracySourceCallbackRegister( cb, data ) tracy::Profiler::SourceCallbackRegister( cb, data )
|
||||
#define TracyParameterRegister( cb, data ) tracy::Profiler::ParameterRegister( cb, data )
|
||||
#define TracyParameterSetup( idx, name, isBool, val ) tracy::Profiler::ParameterSetup( idx, name, isBool, val )
|
||||
#define TracyParameterSetup( idx, name, type, val ) tracy::Profiler::ParameterSetup( idx, name, type, val )
|
||||
#define TracyIsConnected tracy::GetProfiler().IsConnected()
|
||||
#define TracySetProgramName( name ) tracy::GetProfiler().SetProgramName( name );
|
||||
|
||||
|
||||
@@ -849,11 +849,18 @@ struct CpuThreadData
|
||||
};
|
||||
|
||||
|
||||
enum class ParameterType
|
||||
{
|
||||
Integer,
|
||||
Boolean,
|
||||
Trigger
|
||||
};
|
||||
|
||||
struct Parameter
|
||||
{
|
||||
uint32_t idx;
|
||||
StringRef name;
|
||||
bool isBool;
|
||||
ParameterType type;
|
||||
int32_t val;
|
||||
};
|
||||
|
||||
|
||||
@@ -7261,7 +7261,7 @@ void Worker::ProcessHwSampleBranchMiss( const QueueHwSample& ev )
|
||||
void Worker::ProcessParamSetup( const QueueParamSetup& ev )
|
||||
{
|
||||
CheckString( ev.name );
|
||||
m_params.push_back( Parameter { ev.idx, StringRef( StringRef::Ptr, ev.name ), bool( ev.isBool ), ev.val } );
|
||||
m_params.push_back( Parameter { ev.idx, StringRef( StringRef::Ptr, ev.name ), ParameterType( ev.type ), ev.val } );
|
||||
}
|
||||
|
||||
void Worker::ProcessSourceCodeNotAvailable( const QueueSourceCodeNotAvailable& ev )
|
||||
|
||||
Reference in New Issue
Block a user