1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Frame image transfer prototype.

This commit is contained in:
Bartosz Taudul
2019-06-06 21:39:54 +02:00
parent a37348c5c7
commit e5bb6011c5
8 changed files with 153 additions and 38 deletions
+20
View File
@@ -170,6 +170,25 @@ public:
GetProfiler().m_serialLock.unlock();
}
static tracy_force_inline void SendFrameImage( void* image, uint16_t w, uint16_t h )
{
#ifdef TRACY_ON_DEMAND
if( !GetProfiler().IsConnected() ) return;
#endif
const auto sz = size_t( w ) * size_t( h ) * 4;
Magic magic;
auto token = GetToken();
auto ptr = (char*)tracy_malloc( sz );
memcpy( ptr, image, sz );
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
MemWrite( &item->hdr.type, QueueType::FrameImage );
MemWrite( &item->frameImage.image, (uint64_t)ptr );
MemWrite( &item->frameImage.w, w );
MemWrite( &item->frameImage.h, h );
tail.store( magic + 1, std::memory_order_release );
}
static tracy_force_inline void PlotData( const char* name, int64_t val )
{
#ifdef TRACY_ON_DEMAND
@@ -422,6 +441,7 @@ private:
bool SendData( const char* data, size_t len );
void SendString( uint64_t ptr, const char* str, QueueType type );
void SendLongString( uint64_t ptr, const char* str, QueueType type );
void SendSourceLocation( uint64_t ptr );
void SendSourceLocationPayload( uint64_t ptr );
void SendCallstackPayload( uint64_t ptr );