mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Explicitly store GPU context type.
This commit is contained in:
parent
4f3934ae6a
commit
54a029356d
@ -111,6 +111,7 @@ public:
|
|||||||
MemWrite( &item->gpuNewContext.period, period );
|
MemWrite( &item->gpuNewContext.period, period );
|
||||||
MemWrite( &item->gpuNewContext.context, m_context );
|
MemWrite( &item->gpuNewContext.context, m_context );
|
||||||
MemWrite( &item->gpuNewContext.accuracyBits, (uint8_t)bits );
|
MemWrite( &item->gpuNewContext.accuracyBits, (uint8_t)bits );
|
||||||
|
MemWrite( &item->gpuNewContext.type, GpuContextType::OpenGl );
|
||||||
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
|
@ -105,6 +105,8 @@ public:
|
|||||||
MemWrite( &item->gpuNewContext.period, period );
|
MemWrite( &item->gpuNewContext.period, period );
|
||||||
MemWrite( &item->gpuNewContext.context, m_context );
|
MemWrite( &item->gpuNewContext.context, m_context );
|
||||||
MemWrite( &item->gpuNewContext.accuracyBits, uint8_t( 0 ) );
|
MemWrite( &item->gpuNewContext.accuracyBits, uint8_t( 0 ) );
|
||||||
|
MemWrite( &item->gpuNewContext.type, GpuContextType::Vulkan );
|
||||||
|
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,7 +9,7 @@ namespace tracy
|
|||||||
|
|
||||||
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
||||||
|
|
||||||
enum : uint32_t { ProtocolVersion = 32 };
|
enum : uint32_t { ProtocolVersion = 33 };
|
||||||
enum : uint32_t { BroadcastVersion = 1 };
|
enum : uint32_t { BroadcastVersion = 1 };
|
||||||
|
|
||||||
using lz4sz_t = uint32_t;
|
using lz4sz_t = uint32_t;
|
||||||
|
@ -258,6 +258,14 @@ struct QueueMessageColor : public QueueMessage
|
|||||||
uint8_t b;
|
uint8_t b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Don't change order, only add new entries at the end, this is also used on trace dumps!
|
||||||
|
enum class GpuContextType : uint8_t
|
||||||
|
{
|
||||||
|
Invalid,
|
||||||
|
OpenGl,
|
||||||
|
Vulkan
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueGpuNewContext
|
struct QueueGpuNewContext
|
||||||
{
|
{
|
||||||
int64_t cpuTime;
|
int64_t cpuTime;
|
||||||
@ -266,6 +274,7 @@ struct QueueGpuNewContext
|
|||||||
float period;
|
float period;
|
||||||
uint8_t context;
|
uint8_t context;
|
||||||
uint8_t accuracyBits;
|
uint8_t accuracyBits;
|
||||||
|
GpuContextType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QueueGpuZoneBegin
|
struct QueueGpuZoneBegin
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "TracyVector.hpp"
|
#include "TracyVector.hpp"
|
||||||
#include "tracy_robin_hood.h"
|
#include "tracy_robin_hood.h"
|
||||||
#include "../common/TracyForceInline.hpp"
|
#include "../common/TracyForceInline.hpp"
|
||||||
|
#include "../common/TracyQueue.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
@ -571,6 +572,7 @@ struct GpuCtxData
|
|||||||
float period;
|
float period;
|
||||||
unordered_flat_map<uint64_t, GpuCtxThreadData> threadData;
|
unordered_flat_map<uint64_t, GpuCtxThreadData> threadData;
|
||||||
short_ptr<GpuEvent> query[64*1024];
|
short_ptr<GpuEvent> query[64*1024];
|
||||||
|
GpuContextType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { GpuCtxDataSize = sizeof( GpuCtxData ) };
|
enum { GpuCtxDataSize = sizeof( GpuCtxData ) };
|
||||||
|
@ -7,7 +7,7 @@ namespace Version
|
|||||||
{
|
{
|
||||||
enum { Major = 0 };
|
enum { Major = 0 };
|
||||||
enum { Minor = 6 };
|
enum { Minor = 6 };
|
||||||
enum { Patch = 13 };
|
enum { Patch = 14 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace tracy
|
|||||||
|
|
||||||
static double s_time = 0;
|
static double s_time = 0;
|
||||||
|
|
||||||
static const char* s_tracyStackFrames[] = {
|
constexpr const char* s_tracyStackFrames[] = {
|
||||||
"tracy::Callstack",
|
"tracy::Callstack",
|
||||||
"tracy::Callstack(int)",
|
"tracy::Callstack(int)",
|
||||||
"tracy::GpuCtxScope::{ctor}",
|
"tracy::GpuCtxScope::{ctor}",
|
||||||
@ -72,6 +72,12 @@ static const char* s_tracyStackFrames[] = {
|
|||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr const char* GpuContextNames[] = {
|
||||||
|
"Invalid",
|
||||||
|
"OpenGL",
|
||||||
|
"Vulkan"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline uint64_t GetThreadBit( uint8_t thread )
|
static inline uint64_t GetThreadBit( uint8_t thread )
|
||||||
{
|
{
|
||||||
@ -2464,16 +2470,10 @@ void View::DrawZones()
|
|||||||
{
|
{
|
||||||
draw->AddTriangle( wpos + ImVec2( to/2, oldOffset + to/2 ), wpos + ImVec2( to/2, oldOffset + ty - to/2 ), wpos + ImVec2( to/2 + th, oldOffset + ty * 0.5 ), 0xFF886666, 2.0f );
|
draw->AddTriangle( wpos + ImVec2( to/2, oldOffset + to/2 ), wpos + ImVec2( to/2, oldOffset + ty - to/2 ), wpos + ImVec2( to/2 + th, oldOffset + ty * 0.5 ), 0xFF886666, 2.0f );
|
||||||
}
|
}
|
||||||
const bool isVulkan = v->thread == 0;
|
|
||||||
|
const bool isMultithreaded = v->type == GpuContextType::Vulkan;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
if( isVulkan )
|
sprintf( buf, "%s context %zu", GpuContextNames[(int)v->type], i );
|
||||||
{
|
|
||||||
sprintf( buf, "Vulkan context %zu", i );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf( buf, "OpenGL context %zu", i );
|
|
||||||
}
|
|
||||||
DrawTextContrast( draw, wpos + ImVec2( ty, oldOffset ), showFull ? 0xFFFFAAAA : 0xFF886666, buf );
|
DrawTextContrast( draw, wpos + ImVec2( ty, oldOffset ), showFull ? 0xFFFFAAAA : 0xFF886666, buf );
|
||||||
|
|
||||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( ty + ImGui::CalcTextSize( buf ).x, oldOffset + ty ) ) )
|
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( ty + ImGui::CalcTextSize( buf ).x, oldOffset + ty ) ) )
|
||||||
@ -2513,7 +2513,7 @@ void View::DrawZones()
|
|||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::TextUnformatted( buf );
|
ImGui::TextUnformatted( buf );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if( !isVulkan )
|
if( !isMultithreaded )
|
||||||
{
|
{
|
||||||
SmallColorBox( GetThreadColor( v->thread, 0 ) );
|
SmallColorBox( GetThreadColor( v->thread, 0 ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -2590,7 +2590,7 @@ void View::DrawZones()
|
|||||||
}
|
}
|
||||||
TextFocused( "Zone count:", RealToString( v->count ) );
|
TextFocused( "Zone count:", RealToString( v->count ) );
|
||||||
//TextFocused( "Top-level zones:", RealToString( v->timeline.size() ) );
|
//TextFocused( "Top-level zones:", RealToString( v->timeline.size() ) );
|
||||||
if( isVulkan )
|
if( isMultithreaded )
|
||||||
{
|
{
|
||||||
TextFocused( "Timestamp accuracy:", TimeToString( v->period ) );
|
TextFocused( "Timestamp accuracy:", TimeToString( v->period ) );
|
||||||
}
|
}
|
||||||
@ -7878,16 +7878,8 @@ void View::DrawOptions()
|
|||||||
for( size_t i=0; i<gpuData.size(); i++ )
|
for( size_t i=0; i<gpuData.size(); i++ )
|
||||||
{
|
{
|
||||||
const auto& timeline = gpuData[i]->threadData.begin()->second.timeline;
|
const auto& timeline = gpuData[i]->threadData.begin()->second.timeline;
|
||||||
const bool isVulkan = gpuData[i]->thread == 0;
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
if( isVulkan )
|
sprintf( buf, "%s context %zu", GpuContextNames[(int)gpuData[i]->type], i );
|
||||||
{
|
|
||||||
sprintf( buf, "Vulkan context %zu", i );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf( buf, "OpenGL context %zu", i );
|
|
||||||
}
|
|
||||||
SmallCheckbox( buf, &Vis( gpuData[i] ).visible );
|
SmallCheckbox( buf, &Vis( gpuData[i] ).visible );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if( gpuData[i]->threadData.size() == 1 )
|
if( gpuData[i]->threadData.size() == 1 )
|
||||||
|
@ -1082,7 +1082,15 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
for( uint64_t i=0; i<sz; i++ )
|
for( uint64_t i=0; i<sz; i++ )
|
||||||
{
|
{
|
||||||
auto ctx = m_slab.AllocInit<GpuCtxData>();
|
auto ctx = m_slab.AllocInit<GpuCtxData>();
|
||||||
f.Read4( ctx->thread, ctx->accuracyBits, ctx->count, ctx->period );
|
if( fileVer >= FileVersion( 0, 6, 14 ) )
|
||||||
|
{
|
||||||
|
f.Read5( ctx->thread, ctx->accuracyBits, ctx->count, ctx->period, ctx->type );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f.Read4( ctx->thread, ctx->accuracyBits, ctx->count, ctx->period );
|
||||||
|
ctx->type = ctx->thread == 0 ? GpuContextType::Vulkan : GpuContextType::OpenGl;
|
||||||
|
}
|
||||||
m_data.gpuCnt += ctx->count;
|
m_data.gpuCnt += ctx->count;
|
||||||
if( fileVer >= FileVersion( 0, 5, 10 ) )
|
if( fileVer >= FileVersion( 0, 5, 10 ) )
|
||||||
{
|
{
|
||||||
@ -5163,6 +5171,7 @@ void Worker::ProcessMessageAppInfo( const QueueMessage& ev )
|
|||||||
void Worker::ProcessGpuNewContext( const QueueGpuNewContext& ev )
|
void Worker::ProcessGpuNewContext( const QueueGpuNewContext& ev )
|
||||||
{
|
{
|
||||||
assert( !m_gpuCtxMap[ev.context] );
|
assert( !m_gpuCtxMap[ev.context] );
|
||||||
|
assert( ev.type != GpuContextType::Invalid );
|
||||||
|
|
||||||
int64_t gpuTime;
|
int64_t gpuTime;
|
||||||
if( ev.period == 1.f )
|
if( ev.period == 1.f )
|
||||||
@ -5181,6 +5190,7 @@ void Worker::ProcessGpuNewContext( const QueueGpuNewContext& ev )
|
|||||||
gpu->accuracyBits = ev.accuracyBits;
|
gpu->accuracyBits = ev.accuracyBits;
|
||||||
gpu->period = ev.period;
|
gpu->period = ev.period;
|
||||||
gpu->count = 0;
|
gpu->count = 0;
|
||||||
|
gpu->type = ev.type;
|
||||||
m_data.gpuData.push_back( gpu );
|
m_data.gpuData.push_back( gpu );
|
||||||
m_gpuCtxMap[ev.context] = gpu;
|
m_gpuCtxMap[ev.context] = gpu;
|
||||||
}
|
}
|
||||||
@ -7081,6 +7091,7 @@ void Worker::Write( FileWrite& f )
|
|||||||
f.Write( &ctx->accuracyBits, sizeof( ctx->accuracyBits ) );
|
f.Write( &ctx->accuracyBits, sizeof( ctx->accuracyBits ) );
|
||||||
f.Write( &ctx->count, sizeof( ctx->count ) );
|
f.Write( &ctx->count, sizeof( ctx->count ) );
|
||||||
f.Write( &ctx->period, sizeof( ctx->period ) );
|
f.Write( &ctx->period, sizeof( ctx->period ) );
|
||||||
|
f.Write( &ctx->type, sizeof( ctx->type ) );
|
||||||
sz = ctx->threadData.size();
|
sz = ctx->threadData.size();
|
||||||
f.Write( &sz, sizeof( sz ) );
|
f.Write( &sz, sizeof( sz ) );
|
||||||
for( auto& td : ctx->threadData )
|
for( auto& td : ctx->threadData )
|
||||||
|
Loading…
Reference in New Issue
Block a user