Skip to content

Commit 14b29d9

Browse files
committed
upgrade to imgui 1.92.6
1 parent 204ebdb commit 14b29d9

16 files changed

+4239
-3789
lines changed

source/views/command_palette.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void CommandPalette::drawInput() {
149149
}
150150

151151
void CommandPalette::drawList(float width) {
152-
ImGui::BeginChild("##command_matches", ImVec2(0, 0), ImGuiChildFlags_None, ImGuiWindowFlags_NavFlattened);
152+
ImGui::BeginChild("##command_matches", ImVec2(0, 0), ImGuiChildFlags_None, ImGuiChildFlags_NavFlattened);
153153
float maxWidth = 0;
154154
for (const auto& match : matches) {
155155
auto width = ImGui::CalcTextSize(match.label.c_str()).x;

third_party/imgui/include/imconfig.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#pragma once
1616

1717
//---- Define assertion handler. Defaults to calling assert().
18-
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
18+
// - If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
19+
// - Compiling with NDEBUG will usually strip out assert() to nothing, which is NOT recommended because we use asserts to notify of programmer mistakes.
1920
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
2021
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
2122

@@ -48,7 +49,7 @@
4849
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
4950
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
5051
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
51-
//#define IMGUI_DISABLE_DEFAULT_FONT // Disable default embedded font (ProggyClean.ttf), remove ~9.5 KB from output binary. AddFontDefault() will assert.
52+
//#define IMGUI_DISABLE_DEFAULT_FONT // Disable default embedded fonts (ProggyClean/ProggyForever), remove ~9 KB + ~14 KB from output binary. AddFontDefaultXXX() functions will assert.
5253
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
5354

5455
//---- Enable Test Engine / Automation features.
@@ -83,6 +84,7 @@
8384

8485
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
8586
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
87+
// Note that imgui_freetype.cpp may be used _without_ this define, if you manually call ImFontAtlas::SetFontLoader(). The define is simply a convenience.
8688
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
8789
#define IMGUI_ENABLE_FREETYPE
8890

third_party/imgui/include/imgui.h

Lines changed: 305 additions & 256 deletions
Large diffs are not rendered by default.

third_party/imgui/include/imgui_impl_glfw.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// dear imgui: Platform Backend for GLFW
22
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
33
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
4-
// (Requires: GLFW 3.1+. Prefer GLFW 3.3+ for full feature support.)
4+
// (Requires: GLFW 3.0+. Prefer GLFW 3.3+/3.4+ for full feature support.)
55

66
// Implemented features:
77
// [X] Platform: Clipboard support.
88
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
99
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values are obsolete since 1.87 and not supported since 1.91.5]
1010
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
11-
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
11+
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors) with GLFW 3.1+. Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
1212
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
1313
// [X] Multiple Dear ImGui contexts support.
1414
// Missing features or Issues:
15-
// [ ] Touch events are only correctly identified as Touch on Windows. This create issues with some interactions. GLFW doesn't provide a way to identify touch inputs from mouse inputs, we cannot call io.AddMouseSourceEvent() to identify the source. We provide a Windows-specific workaround.
16-
// [ ] Missing ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress cursors.
17-
// [ ] Multi-viewport: ParentViewportID not honored, and so io.ConfigViewportsNoDefaultParent has no effect (minor).
15+
// [ ] Platform: Touch events are only correctly identified as Touch on Windows. This create issues with some interactions. GLFW doesn't provide a way to identify touch inputs from mouse inputs, we cannot call io.AddMouseSourceEvent() to identify the source. We provide a Windows-specific workaround.
16+
// [ ] Platform: Missing ImGuiMouseCursor_Wait and ImGuiMouseCursor_Progress cursors.
17+
// [ ] Platform: Multi-viewport: Missing ImGuiBackendFlags_HasParentViewport support. The viewport->ParentViewportID field is ignored, and therefore io.ConfigViewportsNoDefaultParent has no effect either.
1818

1919
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
2020
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
@@ -50,7 +50,7 @@ IMGUI_IMPL_API void ImGui_ImplGlfw_InstallEmscriptenCallbacks(GLFWwindow* wi
5050
IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window);
5151
IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window);
5252

53-
// GFLW callbacks options:
53+
// GLFW callbacks options:
5454
// - Set 'chain_for_all_windows=true' to enable chaining callbacks for all windows (including secondary viewports created by backends or by user)
5555
IMGUI_IMPL_API void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows);
5656

third_party/imgui/include/imgui_impl_opengl3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
4141
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
4242
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
4343

44-
// (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = NULL to handle this manually.
44+
// (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = nullptr to handle this manually.
4545
IMGUI_IMPL_API void ImGui_ImplOpenGL3_UpdateTexture(ImTextureData* tex);
4646

4747
// Configuration flags to add in your imconfig file:

third_party/imgui/include/imgui_impl_opengl3_loader.h

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ typedef khronos_uint8_t GLubyte;
166166
#define GL_SCISSOR_BOX 0x0C10
167167
#define GL_SCISSOR_TEST 0x0C11
168168
#define GL_UNPACK_ROW_LENGTH 0x0CF2
169+
#define GL_UNPACK_ALIGNMENT 0x0CF5
169170
#define GL_PACK_ALIGNMENT 0x0D05
170171
#define GL_MAX_TEXTURE_SIZE 0x0D33
171172
#define GL_TEXTURE_2D 0x0DE1
@@ -179,6 +180,7 @@ typedef khronos_uint8_t GLubyte;
179180
#define GL_RENDERER 0x1F01
180181
#define GL_VERSION 0x1F02
181182
#define GL_EXTENSIONS 0x1F03
183+
#define GL_NEAREST 0x2600
182184
#define GL_LINEAR 0x2601
183185
#define GL_TEXTURE_MAG_FILTER 0x2800
184186
#define GL_TEXTURE_MIN_FILTER 0x2801
@@ -399,9 +401,15 @@ GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum
399401
#ifndef GL_VERSION_3_3
400402
#define GL_VERSION_3_3 1
401403
#define GL_SAMPLER_BINDING 0x8919
404+
typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
405+
typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
402406
typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
407+
typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
403408
#ifdef GL_GLEXT_PROTOTYPES
409+
GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
410+
GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
404411
GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
412+
GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
405413
#endif
406414
#endif /* GL_VERSION_3_3 */
407415
#ifndef GL_VERSION_4_1
@@ -476,12 +484,13 @@ typedef GL3WglProc (*GL3WGetProcAddressProc)(const char *proc);
476484
/* gl3w api */
477485
GL3W_API int imgl3wInit(void);
478486
GL3W_API int imgl3wInit2(GL3WGetProcAddressProc proc);
487+
GL3W_API void imgl3wShutdown(void);
479488
GL3W_API int imgl3wIsSupported(int major, int minor);
480489
GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc);
481490

482491
/* gl3w internal state */
483492
union ImGL3WProcs {
484-
GL3WglProc ptr[60];
493+
GL3WglProc ptr[63];
485494
struct {
486495
PFNGLACTIVETEXTUREPROC ActiveTexture;
487496
PFNGLATTACHSHADERPROC AttachShader;
@@ -501,6 +510,7 @@ union ImGL3WProcs {
501510
PFNGLCREATESHADERPROC CreateShader;
502511
PFNGLDELETEBUFFERSPROC DeleteBuffers;
503512
PFNGLDELETEPROGRAMPROC DeleteProgram;
513+
PFNGLDELETESAMPLERSPROC DeleteSamplers;
504514
PFNGLDELETESHADERPROC DeleteShader;
505515
PFNGLDELETETEXTURESPROC DeleteTextures;
506516
PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays;
@@ -513,6 +523,7 @@ union ImGL3WProcs {
513523
PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray;
514524
PFNGLFLUSHPROC Flush;
515525
PFNGLGENBUFFERSPROC GenBuffers;
526+
PFNGLGENSAMPLERSPROC GenSamplers;
516527
PFNGLGENTEXTURESPROC GenTextures;
517528
PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
518529
PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
@@ -533,6 +544,7 @@ union ImGL3WProcs {
533544
PFNGLPIXELSTOREIPROC PixelStorei;
534545
PFNGLPOLYGONMODEPROC PolygonMode;
535546
PFNGLREADPIXELSPROC ReadPixels;
547+
PFNGLSAMPLERPARAMETERIPROC SamplerParameteri;
536548
PFNGLSCISSORPROC Scissor;
537549
PFNGLSHADERSOURCEPROC ShaderSource;
538550
PFNGLTEXIMAGE2DPROC TexImage2D;
@@ -567,6 +579,7 @@ GL3W_API extern union ImGL3WProcs imgl3wProcs;
567579
#define glCreateShader imgl3wProcs.gl.CreateShader
568580
#define glDeleteBuffers imgl3wProcs.gl.DeleteBuffers
569581
#define glDeleteProgram imgl3wProcs.gl.DeleteProgram
582+
#define glDeleteSamplers imgl3wProcs.gl.DeleteSamplers
570583
#define glDeleteShader imgl3wProcs.gl.DeleteShader
571584
#define glDeleteTextures imgl3wProcs.gl.DeleteTextures
572585
#define glDeleteVertexArrays imgl3wProcs.gl.DeleteVertexArrays
@@ -579,6 +592,7 @@ GL3W_API extern union ImGL3WProcs imgl3wProcs;
579592
#define glEnableVertexAttribArray imgl3wProcs.gl.EnableVertexAttribArray
580593
#define glFlush imgl3wProcs.gl.Flush
581594
#define glGenBuffers imgl3wProcs.gl.GenBuffers
595+
#define glGenSamplers imgl3wProcs.gl.GenSamplers
582596
#define glGenTextures imgl3wProcs.gl.GenTextures
583597
#define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays
584598
#define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation
@@ -599,6 +613,7 @@ GL3W_API extern union ImGL3WProcs imgl3wProcs;
599613
#define glPixelStorei imgl3wProcs.gl.PixelStorei
600614
#define glPolygonMode imgl3wProcs.gl.PolygonMode
601615
#define glReadPixels imgl3wProcs.gl.ReadPixels
616+
#define glSamplerParameteri imgl3wProcs.gl.SamplerParameteri
602617
#define glScissor imgl3wProcs.gl.Scissor
603618
#define glShaderSource imgl3wProcs.gl.ShaderSource
604619
#define glTexImage2D imgl3wProcs.gl.TexImage2D
@@ -631,7 +646,7 @@ extern "C" {
631646
#endif
632647
#include <windows.h>
633648

634-
static HMODULE libgl;
649+
static HMODULE libgl = NULL;
635650
typedef PROC(__stdcall* GL3WglGetProcAddr)(LPCSTR);
636651
static GL3WglGetProcAddr wgl_get_proc_address;
637652

@@ -644,7 +659,7 @@ static int open_libgl(void)
644659
return GL3W_OK;
645660
}
646661

647-
static void close_libgl(void) { FreeLibrary(libgl); }
662+
static void close_libgl(void) { FreeLibrary(libgl); libgl = NULL; }
648663
static GL3WglProc get_proc(const char *proc)
649664
{
650665
GL3WglProc res;
@@ -656,7 +671,7 @@ static GL3WglProc get_proc(const char *proc)
656671
#elif defined(__APPLE__)
657672
#include <dlfcn.h>
658673

659-
static void *libgl;
674+
static void *libgl = NULL;
660675
static int open_libgl(void)
661676
{
662677
libgl = dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LAZY | RTLD_LOCAL);
@@ -665,7 +680,7 @@ static int open_libgl(void)
665680
return GL3W_OK;
666681
}
667682

668-
static void close_libgl(void) { dlclose(libgl); }
683+
static void close_libgl(void) { dlclose(libgl); libgl = NULL; }
669684

670685
static GL3WglProc get_proc(const char *proc)
671686
{
@@ -699,7 +714,11 @@ static void close_libgl(void)
699714

700715
static int is_library_loaded(const char* name, void** lib)
701716
{
717+
#if defined(__HAIKU__)
718+
*lib = NULL; // no support for RTLD_NOLOAD on Haiku.
719+
#else
702720
*lib = dlopen(name, RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
721+
#endif
703722
return *lib != NULL;
704723
}
705724

@@ -817,6 +836,7 @@ static int parse_version(void)
817836
}
818837

819838
static void load_procs(GL3WGetProcAddressProc proc);
839+
static void clear_procs();
820840

821841
int imgl3wInit(void)
822842
{
@@ -833,6 +853,12 @@ int imgl3wInit2(GL3WGetProcAddressProc proc)
833853
return parse_version();
834854
}
835855

856+
void imgl3wShutdown(void)
857+
{
858+
close_libgl();
859+
clear_procs();
860+
}
861+
836862
int imgl3wIsSupported(int major, int minor)
837863
{
838864
if (major < 2)
@@ -863,6 +889,7 @@ static const char *proc_names[] = {
863889
"glCreateShader",
864890
"glDeleteBuffers",
865891
"glDeleteProgram",
892+
"glDeleteSamplers",
866893
"glDeleteShader",
867894
"glDeleteTextures",
868895
"glDeleteVertexArrays",
@@ -875,6 +902,7 @@ static const char *proc_names[] = {
875902
"glEnableVertexAttribArray",
876903
"glFlush",
877904
"glGenBuffers",
905+
"glGenSamplers",
878906
"glGenTextures",
879907
"glGenVertexArrays",
880908
"glGetAttribLocation",
@@ -895,6 +923,7 @@ static const char *proc_names[] = {
895923
"glPixelStorei",
896924
"glPolygonMode",
897925
"glReadPixels",
926+
"glSamplerParameteri",
898927
"glScissor",
899928
"glShaderSource",
900929
"glTexImage2D",
@@ -916,6 +945,13 @@ static void load_procs(GL3WGetProcAddressProc proc)
916945
imgl3wProcs.ptr[i] = proc(proc_names[i]);
917946
}
918947

948+
static void clear_procs()
949+
{
950+
size_t i;
951+
for (i = 0; i < GL3W_ARRAY_SIZE(proc_names); i++)
952+
imgl3wProcs.ptr[i] = nullptr;
953+
}
954+
919955
#ifdef __cplusplus
920956
}
921957
#endif

0 commit comments

Comments
 (0)