Load custom mip chain for zigzags.

This commit is contained in:
Bartosz Taudul 2023-04-29 13:10:58 +02:00
parent 657bf7d44c
commit e1e4699a52
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
12 changed files with 91 additions and 29 deletions

View File

@ -344,7 +344,6 @@
<ClInclude Include="..\..\src\font\FontAwesomeSolid.hpp" />
<ClInclude Include="..\..\src\HttpRequest.hpp" />
<ClInclude Include="..\..\src\icon.hpp" />
<ClInclude Include="..\..\src\zigzag.hpp" />
<ClInclude Include="..\..\src\ImGuiContext.hpp" />
<ClInclude Include="..\..\src\imgui\imgui_impl_glfw.h" />
<ClInclude Include="..\..\src\imgui\imgui_impl_opengl3.h" />

View File

@ -464,9 +464,6 @@
<ClInclude Include="..\..\src\icon.hpp">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\src\zigzag.hpp">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\src\stb_image.h">
<Filter>src</Filter>
</ClInclude>

View File

@ -45,7 +45,12 @@
#include "../../server/IconsFontAwesome6.h"
#include "icon.hpp"
#include "zigzag.hpp"
#include "zigzag01.hpp"
#include "zigzag02.hpp"
#include "zigzag04.hpp"
#include "zigzag08.hpp"
#include "zigzag16.hpp"
#include "zigzag32.hpp"
#include "Backend.hpp"
#include "ConnectionHistory.hpp"
@ -96,8 +101,8 @@ static uint8_t* iconPx;
static int iconX, iconY;
static void* iconTex;
static int iconTexSz;
static uint8_t* zigzagPx;
static int zigzagX, zigzagY;
static uint8_t* zigzagPx[6];
static int zigzagX[6], zigzagY[6];
void* zigzagTex;
static Backend* bptr;
static bool s_customTitle = false;
@ -223,7 +228,12 @@ int main( int argc, char** argv )
auto iconThread = std::thread( [] {
iconPx = stbi_load_from_memory( (const stbi_uc*)Icon_data, Icon_size, &iconX, &iconY, nullptr, 4 );
zigzagPx = stbi_load_from_memory( (const stbi_uc*)ZigZag_data, ZigZag_size, &zigzagX, &zigzagY, nullptr, 4 );
zigzagPx[0] = stbi_load_from_memory( (const stbi_uc*)ZigZag32_data, ZigZag32_size, &zigzagX[0], &zigzagY[0], nullptr, 4 );
zigzagPx[1] = stbi_load_from_memory( (const stbi_uc*)ZigZag16_data, ZigZag16_size, &zigzagX[1], &zigzagY[1], nullptr, 4 );
zigzagPx[2] = stbi_load_from_memory( (const stbi_uc*)ZigZag08_data, ZigZag08_size, &zigzagX[2], &zigzagY[2], nullptr, 4 );
zigzagPx[3] = stbi_load_from_memory( (const stbi_uc*)ZigZag04_data, ZigZag04_size, &zigzagX[3], &zigzagY[3], nullptr, 4 );
zigzagPx[4] = stbi_load_from_memory( (const stbi_uc*)ZigZag02_data, ZigZag02_size, &zigzagX[4], &zigzagY[4], nullptr, 4 );
zigzagPx[5] = stbi_load_from_memory( (const stbi_uc*)ZigZag01_data, ZigZag01_size, &zigzagX[5], &zigzagY[5], nullptr, 4 );
} );
ImGuiTracyContext imguiContext;
@ -245,9 +255,8 @@ int main( int argc, char** argv )
SetupDPIScale( dpiScale, s_fixedWidth, s_bigFont, s_smallFont );
tracy::UpdateTextureRGBA( zigzagTex, zigzagPx, zigzagX, zigzagY );
tracy::MakeMipMaps( zigzagTex );
free( zigzagPx );
tracy::UpdateTextureRGBAMips( zigzagTex, (void**)zigzagPx, zigzagX, zigzagY, 6 );
for( auto& v : zigzagPx ) free( v );
if( initFileOpen )
{

View File

@ -1,13 +0,0 @@
// File: 'zigzag.png' (284 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int ZigZag_size = 284;
static const unsigned int ZigZag_data[284/4] =
{
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x20000000, 0x20000000, 0x00000304, 0x67548100, 0x000000c7, 0x58457419, 0x666f5374, 0x72617774,
0x77770065, 0x6e692e77, 0x6163736b, 0x6f2e6570, 0xee9b6772, 0x00001a3c, 0x48700900, 0x00007359, 0x0000c30e, 0xc701c30e, 0x0064a86f, 0x501b0000,
0x5045544c, 0xffff5050, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x289affff, 0x00004ebe, 0x52740800, 0x0100534e, 0x975d5c02,
0xd8b39e9d, 0x0000cae9, 0x44496e00, 0xda785441, 0x01b74fbd, 0x130020c3, 0xa732909c, 0xb90bcf67, 0x99899982, 0xa75f4023, 0xa3b2985a, 0x315406c5,
0x1a27d70d, 0xa88f9718, 0x2a2327b1, 0x9aa640d8, 0xf40a6772, 0x6bdfc10d, 0x68f99eca, 0xa3f2e55c, 0xdf8b14af, 0x772e2daf, 0xeff84a30, 0x01e8fd04,
0x990a4aa2, 0x1f8c7cc9, 0x86130e0b, 0x10a51591, 0xd8411144, 0x6f0b303e, 0x8229622a, 0xc3e60235, 0x00000000, 0x444e4549, 0x826042ae,
};

10
profiler/src/zigzag01.hpp Normal file
View File

@ -0,0 +1,10 @@
// File: 'zigzag01.png' (126 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int ZigZag01_size = 126;
static const unsigned int ZigZag01_data[128/4] =
{
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x01000000, 0x01000000, 0x00000408, 0x0c1cb500, 0x00000002, 0x58457419, 0x666f5374, 0x72617774,
0x77770065, 0x6e692e77, 0x6163736b, 0x6f2e6570, 0xee9b6772, 0x00001a3c, 0x48700900, 0x00007359, 0x00007600, 0x4e017600, 0x0008267b, 0x490b0000,
0x78544144, 0xbff963da, 0xb802001a, 0x77afaf01, 0x0000dbd6, 0x45490000, 0x42ae444e, 0x00008260,
};

10
profiler/src/zigzag02.hpp Normal file
View File

@ -0,0 +1,10 @@
// File: 'zigzag02.png' (133 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int ZigZag02_size = 133;
static const unsigned int ZigZag02_data[136/4] =
{
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x02000000, 0x02000000, 0x00000408, 0xc5bfd800, 0x000000af, 0x58457419, 0x666f5374, 0x72617774,
0x77770065, 0x6e692e77, 0x6163736b, 0x6f2e6570, 0xee9b6772, 0x00001a3c, 0x48700900, 0x00007359, 0x0000ec00, 0x7901ec00, 0x00bd7128, 0x49120000,
0x78544144, 0xfffc63da, 0xf19fa18c, 0x0143297f, 0x04651900, 0x4bae135b, 0x000000a6, 0x4e454900, 0x6042ae44, 0x00000082,
};

11
profiler/src/zigzag04.hpp Normal file
View File

@ -0,0 +1,11 @@
// File: 'zigzag04.png' (151 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int ZigZag04_size = 151;
static const unsigned int ZigZag04_data[152/4] =
{
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x04000000, 0x04000000, 0x00000408, 0x56f80300, 0x000000f5, 0x58457419, 0x666f5374, 0x72617774,
0x77770065, 0x6e692e77, 0x6163736b, 0x6f2e6570, 0xee9b6772, 0x00001a3c, 0x48700900, 0x00007359, 0x0000d801, 0xfa01d801, 0x0072a65c, 0x49240000,
0x78544144, 0x6ff863da, 0x8022dff1, 0xe1818021, 0x74202bff, 0x00c0eff8, 0x061c4022, 0xf37ff090, 0x5500e6ff, 0x70bb123d, 0x0058f936, 0x49000000,
0xae444e45, 0x00826042,
};

11
profiler/src/zigzag08.hpp Normal file
View File

@ -0,0 +1,11 @@
// File: 'zigzag08.png' (191 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int ZigZag08_size = 191;
static const unsigned int ZigZag08_data[192/4] =
{
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x08000000, 0x08000000, 0x00000304, 0xa3213600, 0x000000b8, 0x58457419, 0x666f5374, 0x72617774,
0x77770065, 0x6e692e77, 0x6163736b, 0x6f2e6570, 0xee9b6772, 0x00001a3c, 0x48700900, 0x00007359, 0x0000b003, 0x2701b003, 0x00ad0fc4, 0x500f0000,
0x5045544c, 0xffff5050, 0xffffffff, 0xffffffff, 0x5a2fffff, 0x0000b6c6, 0x52740500, 0x3700534e, 0x35ea4038, 0x00e23649, 0x49200000, 0x78544144,
0x030063da, 0x61200526, 0x9c240ce2, 0x19980c4d, 0x4d9d980c, 0x028c0260, 0x32001560, 0x4e760248, 0x00382c13, 0x49000000, 0xae444e45, 0x00826042,
};

12
profiler/src/zigzag16.hpp Normal file
View File

@ -0,0 +1,12 @@
// File: 'zigzag16.png' (234 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int ZigZag16_size = 234;
static const unsigned int ZigZag16_data[236/4] =
{
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x10000000, 0x10000000, 0x00000304, 0xe2dded00, 0x00000052, 0x58457419, 0x666f5374, 0x72617774,
0x77770065, 0x6e692e77, 0x6163736b, 0x6f2e6570, 0xee9b6772, 0x00001a3c, 0x48700900, 0x00007359, 0x00006107, 0x95016107, 0x00b6b8c3, 0x501b0000,
0x5045544c, 0xffff5050, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x289affff, 0x00004ebe, 0x52740900, 0x3700534e, 0x403d3c38,
0x6aeae942, 0x0041d380, 0x493b0000, 0x78544144, 0x07c063da, 0x8ca01498, 0xcd085688, 0x009e6652, 0x3027b866, 0xad198197, 0x0600c940, 0x10065606,
0x4580e201, 0x205813cd, 0xee65ccd2, 0x3046a809, 0xb3e00a30, 0x4f750012, 0x7fcbb408, 0x000025f6, 0x45490000, 0x42ae444e, 0x00008260,
};

13
profiler/src/zigzag32.hpp Normal file
View File

@ -0,0 +1,13 @@
// File: 'zigzag32.png' (263 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int ZigZag32_size = 263;
static const unsigned int ZigZag32_data[264/4] =
{
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x20000000, 0x20000000, 0x00000304, 0x67548100, 0x000000c7, 0x58457419, 0x666f5374, 0x72617774,
0x77770065, 0x6e692e77, 0x6163736b, 0x6f2e6570, 0xee9b6772, 0x00001a3c, 0x48700900, 0x00007359, 0x0000c30e, 0xc701c30e, 0x0064a86f, 0x50180000,
0x5045544c, 0xffff5050, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1dffffff, 0x002deec8, 0x74070000, 0x00534e52, 0x877e7d01, 0xbd7e8f88,
0x0000db4b, 0x44495d00, 0xda785441, 0xc0381863, 0x902680a4, 0x67ca865e, 0x404f4b2b, 0x604f0811, 0xe2401329, 0xb83502b3, 0x002b2227, 0x412887aa,
0x02514028, 0x610d9031, 0x50859811, 0x5600cac2, 0x1c253080, 0x928456bb, 0xcc30b070, 0x08959814, 0x08055025, 0x08057025, 0x060fe24f, 0x81836606,
0x3c00248b, 0x79101397, 0x00b45f6d, 0x49000000, 0xae444e45, 0x00826042,
};

View File

@ -174,11 +174,14 @@ void UpdateTextureRGBA( void* _tex, void* data, int w, int h )
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
}
void MakeMipMaps( void* _tex )
void UpdateTextureRGBAMips( void* _tex, void** data, int* w, int* h, size_t mips )
{
auto tex = (GLuint)(intptr_t)_tex;
glBindTexture( GL_TEXTURE_2D, tex );
glGenerateMipmap( GL_TEXTURE_2D );
for( size_t i=0; i<mips; i++ )
{
glTexImage2D( GL_TEXTURE_2D, i, GL_RGBA, w[i], h[i], 0, GL_RGBA, GL_UNSIGNED_BYTE, data[i] );
}
}
}

View File

@ -11,7 +11,7 @@ void* MakeTexture( bool zigzag = false );
void FreeTexture( void* tex, void(*runOnMainThread)(const std::function<void()>&, bool) );
void UpdateTexture( void* tex, const char* data, int w, int h );
void UpdateTextureRGBA( void* tex, void* data, int w, int h );
void MakeMipMaps( void* tex );
void UpdateTextureRGBAMips( void* tex, void** data, int* w, int* h, size_t mips );
}