Skip to content

Commit cd36acc

Browse files
committed
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_opengl3.cpp # backends/imgui_impl_osx.h # backends/imgui_impl_osx.mm # imgui.cpp
2 parents 747f7fd + 389982e commit cd36acc

File tree

17 files changed

+397
-165
lines changed

17 files changed

+397
-165
lines changed

.github/workflows/build.yml

+3-38
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ jobs:
3737
- name: Fix Projects
3838
shell: powershell
3939
run: |
40-
# WARNING: This will need updating if toolset/sdk change in project files!
40+
# CI workers do not supporter older Visual Studio versions. Fix projects to target newer available version.
4141
gci -recurse -filter "*.vcxproj" | ForEach-Object {
42-
# Fix SDK and toolset for most samples.
43-
(Get-Content $_.FullName) -Replace "<PlatformToolset>v110</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
44-
(Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
45-
# Fix SDK and toolset for samples that require newer SDK/toolset. At the moment it is only dx12.
46-
(Get-Content $_.FullName) -Replace "<PlatformToolset>v140</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
47-
(Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
42+
(Get-Content $_.FullName) -Replace "<PlatformToolset>v\d{3}</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
43+
(Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>[\d\.]+</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
4844
}
4945
5046
# Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long.
@@ -497,34 +493,3 @@ jobs:
497493
run: |
498494
cd examples/example_android_opengl3/android
499495
gradle assembleDebug
500-
501-
Discord-CI:
502-
runs-on: ubuntu-18.04
503-
if: always()
504-
needs: [Windows, Linux, MacOS, iOS, Emscripten, Android]
505-
steps:
506-
- uses: dearimgui/github_discord_notifier@latest
507-
with:
508-
discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }}
509-
github-token: ${{ github.token }}
510-
action-task: discord-jobs
511-
discord-filter: "'{{ github.branch }}'.match(/master|docking/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'"
512-
discord-username: GitHub Actions
513-
discord-job-new-failure-message: ''
514-
discord-job-fixed-failure-message: ''
515-
discord-job-new-failure-embed: |
516-
{
517-
"title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!",
518-
"description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke [{{ job.name }}]({{ job.url }}) build job.\nFailing steps: {{ failing_steps }}",
519-
"url": "{{ job.url }}",
520-
"color": "0xFF0000",
521-
"timestamp": "{{ run.updated_at }}"
522-
}
523-
discord-job-fixed-failure-embed: |
524-
{
525-
"title": "`{{ github.branch }}` branch is no longer failing!",
526-
"description": "Build failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.",
527-
"color": "0x00FF00",
528-
"url": "{{ github.context.payload.head_commit.url }}",
529-
"timestamp": "{{ run.completed_at }}"
530-
}

backends/imgui_impl_opengl3.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// CHANGELOG
1717
// (minor and older changes stripped away, please see git history for details)
1818
// 2021-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
19+
// 2021-12-15: OpenGL: Using buffer orphaning + glBufferSubData(), seems to fix leaks with multi-viewports with some Intel HD drivers.
1920
// 2021-08-23: OpenGL: Fixed ES 3.0 shader ("#version 300 es") use normal precision floats to avoid wobbly rendering at HD resolutions.
2021
// 2021-08-19: OpenGL: Embed and use our own minimal GL loader (imgui_impl_opengl3_loader.h), removing requirement and support for third-party loader.
2122
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
@@ -176,6 +177,8 @@ struct ImGui_ImplOpenGL3_Data
176177
GLuint AttribLocationVtxUV;
177178
GLuint AttribLocationVtxColor;
178179
unsigned int VboHandle, ElementsHandle;
180+
GLsizeiptr VertexBufferSize;
181+
GLsizeiptr IndexBufferSize;
179182
bool HasClipOrigin;
180183

181184
ImGui_ImplOpenGL3_Data() { memset(this, 0, sizeof(*this)); }
@@ -436,8 +439,20 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
436439
const ImDrawList* cmd_list = draw_data->CmdLists[n];
437440

438441
// Upload vertex/index buffers
439-
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
440-
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
442+
GLsizeiptr vtx_buffer_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert);
443+
GLsizeiptr idx_buffer_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx);
444+
if (bd->VertexBufferSize < vtx_buffer_size)
445+
{
446+
bd->VertexBufferSize = vtx_buffer_size;
447+
glBufferData(GL_ARRAY_BUFFER, bd->VertexBufferSize, NULL, GL_STREAM_DRAW);
448+
}
449+
if (bd->IndexBufferSize < idx_buffer_size)
450+
{
451+
bd->IndexBufferSize = idx_buffer_size;
452+
glBufferData(GL_ELEMENT_ARRAY_BUFFER, bd->IndexBufferSize, NULL, GL_STREAM_DRAW);
453+
}
454+
glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data);
455+
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data);
441456

442457
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
443458
{

backends/imgui_impl_opengl3_loader.h

+5
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,13 @@ typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
249249
typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
250250
typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
251251
typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
252+
typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
252253
#ifdef GL_GLEXT_PROTOTYPES
253254
GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
254255
GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
255256
GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
256257
GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
258+
GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
257259
#endif
258260
#endif /* GL_VERSION_1_5 */
259261
#ifndef GL_VERSION_2_0
@@ -447,6 +449,7 @@ union GL3WProcs {
447449
PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate;
448450
PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
449451
PFNGLBUFFERDATAPROC BufferData;
452+
PFNGLBUFFERSUBDATAPROC BufferSubData;
450453
PFNGLCLEARPROC Clear;
451454
PFNGLCLEARCOLORPROC ClearColor;
452455
PFNGLCOMPILESHADERPROC CompileShader;
@@ -506,6 +509,7 @@ GL3W_API extern union GL3WProcs imgl3wProcs;
506509
#define glBlendEquationSeparate imgl3wProcs.gl.BlendEquationSeparate
507510
#define glBlendFuncSeparate imgl3wProcs.gl.BlendFuncSeparate
508511
#define glBufferData imgl3wProcs.gl.BufferData
512+
#define glBufferSubData imgl3wProcs.gl.BufferSubData
509513
#define glClear imgl3wProcs.gl.Clear
510514
#define glClearColor imgl3wProcs.gl.ClearColor
511515
#define glCompileShader imgl3wProcs.gl.CompileShader
@@ -692,6 +696,7 @@ static const char *proc_names[] = {
692696
"glBlendEquationSeparate",
693697
"glBlendFuncSeparate",
694698
"glBufferData",
699+
"glBufferSubData",
695700
"glClear",
696701
"glClearColor",
697702
"glCompileShader",

backends/imgui_impl_osx.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
// Implemented features:
66
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
77
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend).
8+
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
9+
// [X] Platform: Keyboard arrays indexed using kVK_* codes, e.g. ImGui::IsKeyPressed(kVK_Space).
810
// Issues:
9-
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
1011
// [ ] Platform: Multi-viewport / platform windows.
1112

12-
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
13+
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
1314
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
1415
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
1516
// Read online: https://github.com/ocornut/imgui/tree/master/docs
@@ -19,7 +20,7 @@
1920
@class NSEvent;
2021
@class NSView;
2122

22-
IMGUI_IMPL_API bool ImGui_ImplOSX_Init();
23+
IMGUI_IMPL_API bool ImGui_ImplOSX_Init(NSView* _Nonnull view);
2324
IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
2425
IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view);
2526
IMGUI_IMPL_API bool ImGui_ImplOSX_HandleEvent(NSEvent* _Nonnull event, NSView* _Nullable view);

0 commit comments

Comments
 (0)