diff --git a/cmake/gl3w-extra-symbols.patch b/cmake/gl3w-extra-symbols.patch index 7fc7c44a..6d394dd1 100644 --- a/cmake/gl3w-extra-symbols.patch +++ b/cmake/gl3w-extra-symbols.patch @@ -1,14 +1,12 @@ diff --git a/extra_symbols.txt b/extra_symbols.txt -index 447818e..d086538 100644 +index b95bb58..6b8f616 100644 --- a/extra_symbols.txt +++ b/extra_symbols.txt -@@ -1,3 +1,9 @@ +@@ -1,3 +1,7 @@ +glCompressedTexImage2D +GL_LINEAR_MIPMAP_LINEAR +GL_TEXTURE_WRAP_S +GL_TEXTURE_WRAP_T -+GL_REPEAT -+GL_CLAMP_TO_EDGE glReadPixels glClearColor glClear diff --git a/cmake/imgui-loader.patch b/cmake/imgui-loader.patch index f6e1e30f..a00f479c 100644 --- a/cmake/imgui-loader.patch +++ b/cmake/imgui-loader.patch @@ -1,36 +1,16 @@ -diff '--color=auto' -ruN e4f53010203bd9cf867b892a5cf6b192609bdb26/backends/imgui_impl_opengl3_loader.h new/backends/imgui_impl_opengl3_loader.h ---- e4f53010203bd9cf867b892a5cf6b192609bdb26/backends/imgui_impl_opengl3_loader.h 2024-09-27 15:28:48.719522293 +0200 -+++ new/backends/imgui_impl_opengl3_loader.h 2024-09-27 15:49:51.695380147 +0200 -@@ -10,7 +10,7 @@ - // THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE. - // - // IF YOU GET BUILD ERRORS IN THIS FILE (commonly macro redefinitions or function redefinitions): --// IT LIKELY MEANS THAT YOU ARE BUILDING 'imgui_impl_opengl3.cpp' OR INCLUDING 'imgui_impl_opengl3_loader.h' -+// IT LIKELY MEANS THAT YOU ARE BUILDING 'imgui_impl_opengl3.cpp' OR INCUDING 'imgui_impl_opengl3_loader.h' - // IN THE SAME COMPILATION UNIT AS ONE OF YOUR FILE WHICH IS USING A THIRD-PARTY OPENGL LOADER. - // (e.g. COULD HAPPEN IF YOU ARE DOING A UNITY/JUMBO BUILD, OR INCLUDING .CPP FILES FROM OTHERS) - // YOU SHOULD NOT BUILD BOTH IN THE SAME COMPILATION UNIT. -@@ -179,8 +179,12 @@ +diff --git a/backends/imgui_impl_opengl3_loader.h b/backends/imgui_impl_opengl3_loader.h +index d6ffa5a2d..e48372c64 100644 +--- a/backends/imgui_impl_opengl3_loader.h ++++ b/backends/imgui_impl_opengl3_loader.h +@@ -179,6 +179,7 @@ typedef khronos_uint8_t GLubyte; #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 #define GL_LINEAR 0x2601 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 -+#define GL_TEXTURE_WRAP_S 0x2802 -+#define GL_TEXTURE_WRAP_T 0x2803 -+#define GL_REPEAT 0x2901 - typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode); - typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); - typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); -@@ -231,12 +235,17 @@ - GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); - #endif - #endif /* GL_VERSION_1_1 */ -+#ifndef GL_VERSION_1_2 -+#define GL_CLAMP_TO_EDGE 0x812F -+#endif /* GL_VERSION_1_2 */ - #ifndef GL_VERSION_1_3 + #define GL_TEXTURE_WRAP_S 0x2802 +@@ -241,8 +242,10 @@ GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); #define GL_TEXTURE0 0x84C0 #define GL_ACTIVE_TEXTURE 0x84E0 typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); @@ -41,7 +21,7 @@ diff '--color=auto' -ruN e4f53010203bd9cf867b892a5cf6b192609bdb26/backends/imgui #endif #endif /* GL_VERSION_1_3 */ #ifndef GL_VERSION_1_4 -@@ -472,7 +481,7 @@ +@@ -478,7 +481,7 @@ GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc); /* gl3w internal state */ union ImGL3WProcs { @@ -50,7 +30,7 @@ diff '--color=auto' -ruN e4f53010203bd9cf867b892a5cf6b192609bdb26/backends/imgui struct { PFNGLACTIVETEXTUREPROC ActiveTexture; PFNGLATTACHSHADERPROC AttachShader; -@@ -488,6 +497,7 @@ +@@ -494,6 +497,7 @@ union ImGL3WProcs { PFNGLCLEARPROC Clear; PFNGLCLEARCOLORPROC ClearColor; PFNGLCOMPILESHADERPROC CompileShader; @@ -58,7 +38,7 @@ diff '--color=auto' -ruN e4f53010203bd9cf867b892a5cf6b192609bdb26/backends/imgui PFNGLCREATEPROGRAMPROC CreateProgram; PFNGLCREATESHADERPROC CreateShader; PFNGLDELETEBUFFERSPROC DeleteBuffers; -@@ -553,6 +563,7 @@ +@@ -559,6 +563,7 @@ GL3W_API extern union ImGL3WProcs imgl3wProcs; #define glClear imgl3wProcs.gl.Clear #define glClearColor imgl3wProcs.gl.ClearColor #define glCompileShader imgl3wProcs.gl.CompileShader @@ -66,7 +46,7 @@ diff '--color=auto' -ruN e4f53010203bd9cf867b892a5cf6b192609bdb26/backends/imgui #define glCreateProgram imgl3wProcs.gl.CreateProgram #define glCreateShader imgl3wProcs.gl.CreateShader #define glDeleteBuffers imgl3wProcs.gl.DeleteBuffers -@@ -848,6 +859,7 @@ +@@ -854,6 +859,7 @@ static const char *proc_names[] = { "glClear", "glClearColor", "glCompileShader", diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake index a8ae2696..a2a9dedf 100644 --- a/cmake/vendor.cmake +++ b/cmake/vendor.cmake @@ -168,7 +168,7 @@ target_include_directories(TracyGetOpt PUBLIC ${GETOPT_DIR}) CPMAddPackage( NAME ImGui GITHUB_REPOSITORY ocornut/imgui - GIT_TAG v1.91.3-docking + GIT_TAG v1.91.4-docking DOWNLOAD_ONLY TRUE PATCHES "${CMAKE_CURRENT_LIST_DIR}/imgui-emscripten.patch" diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 5d9ae1f5..438c0833 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -112,11 +112,11 @@ static bool showReleaseNotes = false; static std::string releaseNotes; static uint8_t* iconPx; static int iconX, iconY; -static void* iconTex; +static ImTextureID iconTex; static int iconTexSz; static uint8_t* zigzagPx[6]; static int zigzagX[6], zigzagY[6]; -void* zigzagTex; +ImTextureID zigzagTex; static Backend* bptr; static bool s_customTitle = false; static bool s_isElevated = false; diff --git a/profiler/src/profiler/TracyImGui.cpp b/profiler/src/profiler/TracyImGui.cpp index 7714951c..dce67d55 100644 --- a/profiler/src/profiler/TracyImGui.cpp +++ b/profiler/src/profiler/TracyImGui.cpp @@ -4,7 +4,7 @@ #include "TracyPrint.hpp" #include "TracyImGui.hpp" -extern void* zigzagTex; +extern ImTextureID zigzagTex; namespace tracy { diff --git a/profiler/src/profiler/TracyTexture.cpp b/profiler/src/profiler/TracyTexture.cpp index 2102e0ac..de8efce9 100644 --- a/profiler/src/profiler/TracyTexture.cpp +++ b/profiler/src/profiler/TracyTexture.cpp @@ -39,7 +39,7 @@ void InitTexture() #endif } -void* MakeTexture( bool zigzag ) +ImTextureID MakeTexture( bool zigzag ) { GLuint tex; glGenTextures( 1, &tex ); @@ -48,12 +48,12 @@ void* MakeTexture( bool zigzag ) glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, zigzag ? GL_REPEAT : GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); - return (void*)(intptr_t)tex; + return tex; } -void FreeTexture( void* _tex, void(*runOnMainThread)(const std::function&, bool) ) +void FreeTexture( ImTextureID _tex, void(*runOnMainThread)(const std::function&, bool) ) { - auto tex = (GLuint)(intptr_t)_tex; + auto tex = (GLuint)_tex; runOnMainThread( [tex] { glDeleteTextures( 1, &tex ); }, false ); } @@ -139,9 +139,9 @@ static tracy_force_inline void DecodeDxt1Part( uint64_t d, uint32_t* dst, uint32 memcpy( dst+3, dict + (idx & 0x3), 4 ); } -void UpdateTexture( void* _tex, const char* data, int w, int h ) +void UpdateTexture( ImTextureID _tex, const char* data, int w, int h ) { - auto tex = (GLuint)(intptr_t)_tex; + auto tex = (GLuint)_tex; glBindTexture( GL_TEXTURE_2D, tex ); if( s_hardwareS3tc ) { @@ -167,16 +167,16 @@ void UpdateTexture( void* _tex, const char* data, int w, int h ) } } -void UpdateTextureRGBA( void* _tex, void* data, int w, int h ) +void UpdateTextureRGBA( ImTextureID _tex, void* data, int w, int h ) { - auto tex = (GLuint)(intptr_t)_tex; + auto tex = (GLuint)_tex; glBindTexture( GL_TEXTURE_2D, tex ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data ); } -void UpdateTextureRGBAMips( void* _tex, void** data, int* w, int* h, size_t mips ) +void UpdateTextureRGBAMips( ImTextureID _tex, void** data, int* w, int* h, size_t mips ) { - auto tex = (GLuint)(intptr_t)_tex; + auto tex = (GLuint)_tex; glBindTexture( GL_TEXTURE_2D, tex ); for( size_t i=0; i +#include namespace tracy { void InitTexture(); -void* MakeTexture( bool zigzag = false ); -void FreeTexture( void* tex, void(*runOnMainThread)(const std::function&, bool) ); -void UpdateTexture( void* tex, const char* data, int w, int h ); -void UpdateTextureRGBA( void* tex, void* data, int w, int h ); -void UpdateTextureRGBAMips( void* tex, void** data, int* w, int* h, size_t mips ); +ImTextureID MakeTexture( bool zigzag = false ); +void FreeTexture( ImTextureID tex, void(*runOnMainThread)(const std::function&, bool) ); +void UpdateTexture( ImTextureID tex, const char* data, int w, int h ); +void UpdateTextureRGBA( ImTextureID tex, void* data, int w, int h ); +void UpdateTextureRGBAMips( ImTextureID tex, void** data, int* w, int* h, size_t mips ); } diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index b976e894..b8f99a32 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -597,10 +597,10 @@ private: std::atomic m_srcFileBytes { 0 }; std::atomic m_dstFileBytes { 0 }; - void* m_frameTexture = nullptr; + ImTextureID m_frameTexture = 0; const void* m_frameTexturePtr = nullptr; - void* m_frameTextureConn = nullptr; + ImTextureID m_frameTextureConn = 0; const void* m_frameTextureConnPtr = nullptr; std::vector> m_annotations; @@ -859,7 +859,7 @@ private: } m_cache; struct { - void* texture = nullptr; + ImTextureID texture = 0; float timeLeft = 0; float speed = 1; uint32_t frame = 0;