Skip to content

Commit

Permalink
Update ImGui to 1.91.4-docking.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfpld committed Oct 18, 2024
1 parent d0a7ee1 commit 3dc68bc
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 57 deletions.
6 changes: 2 additions & 4 deletions cmake/gl3w-extra-symbols.patch
Original file line number Diff line number Diff line change
@@ -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
42 changes: 11 additions & 31 deletions cmake/imgui-loader.patch
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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 {
Expand All @@ -50,23 +30,23 @@ 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;
+ PFNGLCOMPRESSEDTEXIMAGE2DPROC CompressedTexImage2D;
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
+#define glCompressedTexImage2D imgl3wProcs.gl.CompressedTexImage2D
#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",
Expand Down
2 changes: 1 addition & 1 deletion cmake/vendor.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions profiler/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion profiler/src/profiler/TracyImGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "TracyPrint.hpp"
#include "TracyImGui.hpp"

extern void* zigzagTex;
extern ImTextureID zigzagTex;

namespace tracy
{
Expand Down
20 changes: 10 additions & 10 deletions profiler/src/profiler/TracyTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void InitTexture()
#endif
}

void* MakeTexture( bool zigzag )
ImTextureID MakeTexture( bool zigzag )
{
GLuint tex;
glGenTextures( 1, &tex );
Expand All @@ -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<void()>&, bool) )
void FreeTexture( ImTextureID _tex, void(*runOnMainThread)(const std::function<void()>&, bool) )
{
auto tex = (GLuint)(intptr_t)_tex;
auto tex = (GLuint)_tex;
runOnMainThread( [tex] { glDeleteTextures( 1, &tex ); }, false );
}

Expand Down Expand Up @@ -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 )
{
Expand All @@ -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<mips; i++ )
{
Expand Down
11 changes: 6 additions & 5 deletions profiler/src/profiler/TracyTexture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
#define __TRACYTEXTURE_HPP__

#include <functional>
#include <imgui.h>

namespace tracy
{

void InitTexture();
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 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<void()>&, 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 );

}

Expand Down
6 changes: 3 additions & 3 deletions profiler/src/profiler/TracyView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,10 @@ class View
std::atomic<size_t> m_srcFileBytes { 0 };
std::atomic<size_t> 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<std::unique_ptr<Annotation>> m_annotations;
Expand Down Expand Up @@ -859,7 +859,7 @@ class View
} m_cache;

struct {
void* texture = nullptr;
ImTextureID texture = 0;
float timeLeft = 0;
float speed = 1;
uint32_t frame = 0;
Expand Down

0 comments on commit 3dc68bc

Please sign in to comment.