Switch to DXT1 textures in profiler utility.

This commit is contained in:
Bartosz Taudul 2019-06-27 17:16:23 +02:00
parent 1939c31165
commit 10bcc8c770
6 changed files with 17 additions and 7 deletions

View File

@ -2,6 +2,10 @@
#include "TracyTexture.hpp" #include "TracyTexture.hpp"
#ifndef COMPRESSED_RGB_S3TC_DXT1_EXT
# define COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#endif
namespace tracy namespace tracy
{ {
@ -21,11 +25,11 @@ void FreeTexture( void* _tex )
glDeleteTextures( 1, &tex ); glDeleteTextures( 1, &tex );
} }
void UpdateTexture( void* _tex, const char* data, int w, int h ) void UpdateTexture( void* _tex, const char* data, int w, int h, bool etc )
{ {
auto tex = (GLuint)(intptr_t)_tex; auto tex = (GLuint)(intptr_t)_tex;
glBindTexture( GL_TEXTURE_2D, tex ); glBindTexture( GL_TEXTURE_2D, tex );
glCompressedTexImage2D( GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, w, h, 0, w * h / 2, data ); glCompressedTexImage2D( GL_TEXTURE_2D, 0, etc ? GL_COMPRESSED_RGB8_ETC2 : COMPRESSED_RGB_S3TC_DXT1_EXT, w, h, 0, w * h / 2, data );
} }
} }

View File

@ -6,7 +6,7 @@ namespace tracy
void* MakeTexture(); void* MakeTexture();
void FreeTexture( void* tex ); void FreeTexture( void* tex );
void UpdateTexture( void* tex, const char* data, int w, int h ); void UpdateTexture( void* tex, const char* data, int w, int h, bool etc );
} }

View File

@ -7,7 +7,7 @@ namespace Version
{ {
enum { Major = 0 }; enum { Major = 0 };
enum { Minor = 4 }; enum { Minor = 4 };
enum { Patch = 9 }; enum { Patch = 10 };
} }
} }

View File

@ -1001,7 +1001,7 @@ void View::DrawFrames()
if( fi != m_frameTexturePtr ) if( fi != m_frameTexturePtr )
{ {
if( !m_frameTexture ) m_frameTexture = MakeTexture(); if( !m_frameTexture ) m_frameTexture = MakeTexture();
UpdateTexture( m_frameTexture, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h ); UpdateTexture( m_frameTexture, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h, m_worker.HasEtc1FrameImages() );
m_frameTexturePtr = fi; m_frameTexturePtr = fi;
} }
ImGui::Separator(); ImGui::Separator();
@ -1409,7 +1409,7 @@ bool View::DrawZoneFrames( const FrameData& frames )
if( fi != m_frameTexturePtr ) if( fi != m_frameTexturePtr )
{ {
if( !m_frameTexture ) m_frameTexture = MakeTexture(); if( !m_frameTexture ) m_frameTexture = MakeTexture();
UpdateTexture( m_frameTexture, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h ); UpdateTexture( m_frameTexture, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h, m_worker.HasEtc1FrameImages() );
m_frameTexturePtr = fi; m_frameTexturePtr = fi;
} }
ImGui::Separator(); ImGui::Separator();
@ -9122,7 +9122,7 @@ void View::DrawPlayback()
if( m_playback.currFrame != m_playback.frame ) if( m_playback.currFrame != m_playback.frame )
{ {
m_playback.currFrame = m_playback.frame; m_playback.currFrame = m_playback.frame;
UpdateTexture( m_playback.texture, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h ); UpdateTexture( m_playback.texture, m_worker.UnpackFrameImage( *fi ), fi->w, fi->h, m_worker.HasEtc1FrameImages() );
if( m_playback.sync ) if( m_playback.sync )
{ {

View File

@ -4534,4 +4534,9 @@ const char* Worker::UnpackFrameImage( const FrameImage& image )
return m_frameImageBuffer; return m_frameImageBuffer;
} }
bool Worker::HasEtc1FrameImages() const
{
return m_traceVersion <= FileVersion( 0, 4, 9 );
}
} }

View File

@ -350,6 +350,7 @@ public:
const char* PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz ); const char* PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz );
const char* UnpackFrameImage( const FrameImage& image ); const char* UnpackFrameImage( const FrameImage& image );
bool HasEtc1FrameImages() const;
private: private:
void Exec(); void Exec();