MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / CompressWorker

Method CompressWorker

Dependencies/tracy/client/TracyProfiler.cpp:2134–2202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2132
2133#ifndef TRACY_NO_FRAME_IMAGE
2134void Profiler::CompressWorker()
2135{
2136 ThreadExitHandler threadExitHandler;
2137 SetThreadName( "Tracy DXT1" );
2138 while( m_timeBegin.load( std::memory_order_relaxed ) == 0 ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
2139
2140#ifdef TRACY_USE_RPMALLOC
2141 rpmalloc_thread_initialize();
2142#endif
2143
2144 for(;;)
2145 {
2146 const auto shouldExit = ShouldExit();
2147
2148 {
2149 bool lockHeld = true;
2150 while( !m_fiLock.try_lock() )
2151 {
2152 if( m_shutdownManual.load( std::memory_order_relaxed ) )
2153 {
2154 lockHeld = false;
2155 break;
2156 }
2157 }
2158 if( !m_fiQueue.empty() ) m_fiQueue.swap( m_fiDequeue );
2159 if( lockHeld )
2160 {
2161 m_fiLock.unlock();
2162 }
2163 }
2164
2165 const auto sz = m_fiDequeue.size();
2166 if( sz > 0 )
2167 {
2168 auto fi = m_fiDequeue.data();
2169 auto end = fi + sz;
2170 while( fi != end )
2171 {
2172 const auto w = fi->w;
2173 const auto h = fi->h;
2174 const auto csz = size_t( w * h / 2 );
2175 auto etc1buf = (char*)tracy_malloc( csz );
2176 CompressImageDxt1( (const char*)fi->image, etc1buf, w, h );
2177 tracy_free( fi->image );
2178
2179 TracyLfqPrepare( QueueType::FrameImage );
2180 MemWrite( &item->frameImageFat.image, (uint64_t)etc1buf );
2181 MemWrite( &item->frameImageFat.frame, fi->frame );
2182 MemWrite( &item->frameImageFat.w, w );
2183 MemWrite( &item->frameImageFat.h, h );
2184 uint8_t flip = fi->flip;
2185 MemWrite( &item->frameImageFat.flip, flip );
2186 TracyLfqCommit;
2187
2188 fi++;
2189 }
2190 m_fiDequeue.clear();
2191 }

Callers 1

LaunchCompressWorkerMethod · 0.80

Calls 14

SetThreadNameFunction · 0.85
tracy_mallocFunction · 0.85
CompressImageDxt1Function · 0.85
tracy_freeFunction · 0.85
MemWriteFunction · 0.85
loadMethod · 0.45
try_lockMethod · 0.45
emptyMethod · 0.45
swapMethod · 0.45
unlockMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected