diff --git a/capture/build/win32/capture.vcxproj b/capture/build/win32/capture.vcxproj index 23b6d78d..daf60a5c 100644 --- a/capture/build/win32/capture.vcxproj +++ b/capture/build/win32/capture.vcxproj @@ -132,6 +132,7 @@ + @@ -148,6 +149,7 @@ + diff --git a/capture/build/win32/capture.vcxproj.filters b/capture/build/win32/capture.vcxproj.filters index 01444809..cc3623ff 100644 --- a/capture/build/win32/capture.vcxproj.filters +++ b/capture/build/win32/capture.vcxproj.filters @@ -33,6 +33,9 @@ src + + common + @@ -98,5 +101,8 @@ common + + common + \ No newline at end of file diff --git a/profiler/build/win32/Tracy.vcxproj b/profiler/build/win32/Tracy.vcxproj index c8b1153e..9438ca89 100644 --- a/profiler/build/win32/Tracy.vcxproj +++ b/profiler/build/win32/Tracy.vcxproj @@ -96,6 +96,7 @@ + @@ -126,6 +127,7 @@ + diff --git a/profiler/build/win32/Tracy.vcxproj.filters b/profiler/build/win32/Tracy.vcxproj.filters index 918e550e..848251a3 100644 --- a/profiler/build/win32/Tracy.vcxproj.filters +++ b/profiler/build/win32/Tracy.vcxproj.filters @@ -81,6 +81,9 @@ src + + common + @@ -230,6 +233,9 @@ server + + common + diff --git a/server/TracyFileWrite.hpp b/server/TracyFileWrite.hpp index ef924fce..4b22ba05 100644 --- a/server/TracyFileWrite.hpp +++ b/server/TracyFileWrite.hpp @@ -7,6 +7,7 @@ #include "TracyFileHeader.hpp" #include "../common/tracy_lz4.hpp" +#include "../common/tracy_lz4hc.hpp" #include "../common/TracyForceInline.hpp" namespace tracy @@ -15,10 +16,10 @@ namespace tracy class FileWrite { public: - static FileWrite* Open( const char* fn ) + static FileWrite* Open( const char* fn, bool hc = false ) { auto f = fopen( fn, "wb" ); - return f ? new FileWrite( f ) : nullptr; + return f ? new FileWrite( f, hc ) : nullptr; } ~FileWrite() @@ -28,7 +29,9 @@ public: WriteLz4Block(); } fclose( m_file ); - LZ4_freeStream( m_stream ); + + if( m_stream ) LZ4_freeStream( m_stream ); + if( m_streamHC ) LZ4_freeStreamHC( m_streamHC ); } tracy_force_inline void Write( const void* ptr, size_t size ) @@ -44,13 +47,23 @@ public: } private: - FileWrite( FILE* f ) - : m_stream( LZ4_createStream() ) + FileWrite( FILE* f, bool hc ) + : m_stream( nullptr ) + , m_streamHC( nullptr ) , m_file( f ) , m_buf( m_bufData[0] ) , m_second( m_bufData[1] ) , m_offset( 0 ) { + if( hc ) + { + m_streamHC = LZ4_createStreamHC(); + } + else + { + m_stream = LZ4_createStream(); + } + fwrite( Lz4Header, 1, sizeof( Lz4Header ), m_file ); } @@ -81,7 +94,15 @@ private: void WriteLz4Block() { char lz4[LZ4Size]; - const uint32_t sz = LZ4_compress_fast_continue( m_stream, m_buf, lz4, m_offset, LZ4Size, 1 ); + uint32_t sz; + if( m_stream ) + { + sz = LZ4_compress_fast_continue( m_stream, m_buf, lz4, m_offset, LZ4Size, 1 ); + } + else + { + sz = LZ4_compress_HC_continue( m_streamHC, m_buf, lz4, m_offset, LZ4Size ); + } fwrite( &sz, 1, sizeof( sz ), m_file ); fwrite( lz4, 1, sz, m_file ); m_offset = 0; @@ -92,6 +113,7 @@ private: enum { LZ4Size = LZ4_COMPRESSBOUND( BufSize ) }; LZ4_stream_t* m_stream; + LZ4_streamHC_t* m_streamHC; FILE* m_file; char m_bufData[2][BufSize]; char* m_buf; diff --git a/update/build/win32/update.vcxproj b/update/build/win32/update.vcxproj index d75c9838..9818e440 100644 --- a/update/build/win32/update.vcxproj +++ b/update/build/win32/update.vcxproj @@ -132,6 +132,7 @@ + @@ -147,6 +148,7 @@ + diff --git a/update/build/win32/update.vcxproj.filters b/update/build/win32/update.vcxproj.filters index 025d58a1..fa1b604e 100644 --- a/update/build/win32/update.vcxproj.filters +++ b/update/build/win32/update.vcxproj.filters @@ -30,6 +30,9 @@ src + + common + @@ -92,5 +95,8 @@ common + + common + \ No newline at end of file