Skip to content

Commit 942b64a

Browse files
committed
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_dx12.cpp # backends/imgui_impl_sdl2.cpp # backends/imgui_impl_sdl3.cpp
2 parents 943e26b + ccb6646 commit 942b64a

27 files changed

+984
-20
lines changed

backends/imgui_impl_allegro5.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ static void ImGui_ImplAllegro5_SetClipboardText(ImGuiContext*, const char* text)
312312
#endif
313313

314314
// Not static to allow third-party code to use that if they want to (but undocumented)
315+
ImGuiKey ImGui_ImplAllegro5_KeyCodeToImGuiKey(int key_code);
315316
ImGuiKey ImGui_ImplAllegro5_KeyCodeToImGuiKey(int key_code)
316317
{
317318
switch (key_code)

backends/imgui_impl_dx12.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// CHANGELOG
2020
// (minor and older changes stripped away, please see git history for details)
2121
// 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
22+
// 2024-10-23: DirectX12: Unmap() call specify written range. The range is informational and may be used by debug tools.
2223
// 2024-10-07: DirectX12: Changed default texture sampler to Clamp instead of Repeat/Wrap.
2324
// 2024-10-07: DirectX12: Expose selected render state in ImGui_ImplDX12_RenderState, which you can access in 'void* platform_io.Renderer_RenderState' during draw callbacks.
2425
// 2024-10-07: DirectX12: Compiling with '#define ImTextureID=ImU64' is unnecessary now that dear imgui defaults ImTextureID to u64 instead of void*.
@@ -293,9 +294,9 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
293294
}
294295

295296
// Upload vertex/index data into a single contiguous GPU buffer
297+
// During Map() we specify a null read range (as per DX12 API, this is informational and for tooling only)
296298
void* vtx_resource, *idx_resource;
297-
D3D12_RANGE range;
298-
memset(&range, 0, sizeof(D3D12_RANGE));
299+
D3D12_RANGE range = { 0, 0 };
299300
if (fr->VertexBuffer->Map(0, &range, &vtx_resource) != S_OK)
300301
return;
301302
if (fr->IndexBuffer->Map(0, &range, &idx_resource) != S_OK)
@@ -310,7 +311,13 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
310311
vtx_dst += draw_list->VtxBuffer.Size;
311312
idx_dst += draw_list->IdxBuffer.Size;
312313
}
314+
315+
// During Unmap() we specify the written range (as per DX12 API, this is informational and for tooling only)
316+
range.End = (SIZE_T)((intptr_t)vtx_dst - (intptr_t)vtx_resource);
317+
IM_ASSERT(range.End == draw_data->TotalVtxCount * sizeof(ImDrawVert));
313318
fr->VertexBuffer->Unmap(0, &range);
319+
range.End = (SIZE_T)((intptr_t)idx_dst - (intptr_t)idx_resource);
320+
IM_ASSERT(range.End == draw_data->TotalIdxCount * sizeof(ImDrawIdx));
314321
fr->IndexBuffer->Unmap(0, &range);
315322

316323
// Setup desired DX state

backends/imgui_impl_glfw.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ static void ImGui_ImplGlfw_ShutdownMultiViewportSupport();
217217
// Functions
218218

219219
// Not static to allow third-party code to use that if they want to (but undocumented)
220+
ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode);
220221
ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int keycode, int scancode)
221222
{
222223
IM_UNUSED(scancode);

backends/imgui_impl_osx.mm

+1
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ - (void)displaysDidChange:(NSNotification*)aNotification
291291
// Functions
292292

293293
// Not static to allow third-party code to use that if they want to (but undocumented)
294+
ImGuiKey ImGui_ImplOSX_KeyCodeToImGuiKey(int key_code);
294295
ImGuiKey ImGui_ImplOSX_KeyCodeToImGuiKey(int key_code)
295296
{
296297
switch (key_code)

backends/imgui_impl_sdl2.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
// CHANGELOG
2727
// (minor and older changes stripped away, please see git history for details)
2828
// 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
29+
// 2024-10-24: Emscripten: from SDL 2.30.9, SDL_EVENT_MOUSE_WHEEL event doesn't require dividing by 100.0f.
2930
// 2024-09-09: use SDL_Vulkan_GetDrawableSize() when available. (#7967, #3190)
3031
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
3132
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
@@ -126,8 +127,8 @@
126127
#define SDL_HAS_DISPLAY_EVENT SDL_VERSION_ATLEAST(2,0,9)
127128
#define SDL_HAS_SHOW_WINDOW_ACTIVATION_HINT SDL_VERSION_ATLEAST(2,0,18)
128129
#if SDL_HAS_VULKAN
129-
extern "C" { extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window* window, int* w, int* h); }
130-
#elif
130+
#include <SDL_vulkan.h>
131+
#else
131132
static const Uint32 SDL_WINDOW_VULKAN = 0x10000000;
132133
#endif
133134

@@ -203,6 +204,7 @@ static void ImGui_ImplSDL2_PlatformSetImeData(ImGuiContext*, ImGuiViewport* view
203204
}
204205

205206
// Not static to allow third-party code to use that if they want to (but undocumented)
207+
ImGuiKey ImGui_ImplSDL2_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode scancode);
206208
ImGuiKey ImGui_ImplSDL2_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode scancode)
207209
{
208210
IM_UNUSED(scancode);
@@ -386,7 +388,7 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
386388
float wheel_x = -(float)event->wheel.x;
387389
float wheel_y = (float)event->wheel.y;
388390
#endif
389-
#ifdef __EMSCRIPTEN__
391+
#if defined(__EMSCRIPTEN__) && !SDL_VERSION_ATLEAST(2,31,0)
390392
wheel_x /= 100.0f;
391393
#endif
392394
io.AddMouseSourceEvent(event->wheel.which == SDL_TOUCH_MOUSEID ? ImGuiMouseSource_TouchScreen : ImGuiMouseSource_Mouse);

backends/imgui_impl_sdl3.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
// (minor and older changes stripped away, please see git history for details)
2727
// 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
2828
// 2024-09-11: (Docking) Added support for viewport->ParentViewportId field to support parenting at OS level. (#7973)
29+
// 2024-10-24: Emscripten: SDL_EVENT_MOUSE_WHEEL event doesn't require dividing by 100.0f on Emscripten.
2930
// 2024-09-03: Update for SDL3 api changes: SDL_GetGamepads() memory ownership revert. (#7918, #7898, #7807)
3031
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
3132
// - io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn
@@ -173,6 +174,7 @@ static void ImGui_ImplSDL3_PlatformSetImeData(ImGuiContext*, ImGuiViewport* view
173174
}
174175

175176
// Not static to allow third-party code to use that if they want to (but undocumented)
177+
ImGuiKey ImGui_ImplSDL3_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode scancode);
176178
ImGuiKey ImGui_ImplSDL3_KeyEventToImGuiKey(SDL_Keycode keycode, SDL_Scancode scancode)
177179
{
178180
// Keypad doesn't have individual key values in SDL3
@@ -355,9 +357,6 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event)
355357
//IMGUI_DEBUG_LOG("wheel %.2f %.2f, precise %.2f %.2f\n", (float)event->wheel.x, (float)event->wheel.y, event->wheel.preciseX, event->wheel.preciseY);
356358
float wheel_x = -event->wheel.x;
357359
float wheel_y = event->wheel.y;
358-
#ifdef __EMSCRIPTEN__
359-
wheel_x /= 100.0f;
360-
#endif
361360
io.AddMouseSourceEvent(event->wheel.which == SDL_TOUCH_MOUSEID ? ImGuiMouseSource_TouchScreen : ImGuiMouseSource_Mouse);
362361
io.AddMouseWheelEvent(wheel_x, wheel_y);
363362
return true;

backends/imgui_impl_wgpu.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
// CHANGELOG
2121
// (minor and older changes stripped away, please see git history for details)
22+
// 2024-10-14: Update Dawn support for change of string usages. (#8082, #8083)
2223
// 2024-10-07: Expose selected render state in ImGui_ImplWGPU_RenderState, which you can access in 'void* platform_io.Renderer_RenderState' during draw callbacks.
2324
// 2024-10-07: Changed default texture sampler to Clamp instead of Repeat/Wrap.
2425
// 2024-09-16: Added support for optional IMGUI_IMPL_WEBGPU_BACKEND_DAWN / IMGUI_IMPL_WEBGPU_BACKEND_WGPU define to handle ever-changing native implementations. (#7977)
@@ -277,7 +278,11 @@ static WGPUProgrammableStageDescriptor ImGui_ImplWGPU_CreateShaderModule(const c
277278

278279
WGPUProgrammableStageDescriptor stage_desc = {};
279280
stage_desc.module = wgpuDeviceCreateShaderModule(bd->wgpuDevice, &desc);
281+
#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN
282+
stage_desc.entryPoint = { "main", WGPU_STRLEN };
283+
#else
280284
stage_desc.entryPoint = "main";
285+
#endif
281286
return stage_desc;
282287
}
283288

@@ -390,6 +395,9 @@ void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder
390395
{
391396
nullptr,
392397
"Dear ImGui Vertex buffer",
398+
#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN
399+
WGPU_STRLEN,
400+
#endif
393401
WGPUBufferUsage_CopyDst | WGPUBufferUsage_Vertex,
394402
MEMALIGN(fr->VertexBufferSize * sizeof(ImDrawVert), 4),
395403
false
@@ -414,6 +422,9 @@ void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder
414422
{
415423
nullptr,
416424
"Dear ImGui Index buffer",
425+
#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN
426+
WGPU_STRLEN,
427+
#endif
417428
WGPUBufferUsage_CopyDst | WGPUBufferUsage_Index,
418429
MEMALIGN(fr->IndexBufferSize * sizeof(ImDrawIdx), 4),
419430
false
@@ -524,7 +535,11 @@ static void ImGui_ImplWGPU_CreateFontsTexture()
524535
// Upload texture to graphics system
525536
{
526537
WGPUTextureDescriptor tex_desc = {};
538+
#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN
539+
tex_desc.label = { "Dear ImGui Font Texture", WGPU_STRLEN };
540+
#else
527541
tex_desc.label = "Dear ImGui Font Texture";
542+
#endif
528543
tex_desc.dimension = WGPUTextureDimension_2D;
529544
tex_desc.size.width = width;
530545
tex_desc.size.height = height;
@@ -587,6 +602,9 @@ static void ImGui_ImplWGPU_CreateUniformBuffer()
587602
{
588603
nullptr,
589604
"Dear ImGui Uniform buffer",
605+
#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN
606+
WGPU_STRLEN,
607+
#endif
590608
WGPUBufferUsage_CopyDst | WGPUBufferUsage_Uniform,
591609
MEMALIGN(sizeof(Uniforms), 16),
592610
false

backends/imgui_impl_win32.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ void ImGui_ImplWin32_NewFrame()
496496

497497
// Map VK_xxx to ImGuiKey_xxx.
498498
// Not static to allow third-party code to use that if they want to (but undocumented)
499+
ImGuiKey ImGui_ImplWin32_KeyEventToImGuiKey(WPARAM wParam, LPARAM lParam);
499500
ImGuiKey ImGui_ImplWin32_KeyEventToImGuiKey(WPARAM wParam, LPARAM lParam)
500501
{
501502
// There is no distinct VK_xxx for keypad enter, instead it is VK_RETURN + KF_EXTENDED.

docs/CHANGELOG.txt

+16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ HOW TO UPDATE?
3535
and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users.
3636
- Please report any issue!
3737

38+
-----------------------------------------------------------------------
39+
VERSION 1.91.5 WIP (In Progress)
40+
-----------------------------------------------------------------------
41+
42+
Breaking changes:
43+
44+
Other changes:
45+
46+
- Backends: DX12: Unmap() call specify written range. The range is informational and
47+
may be used by debug tools.
48+
- Backends: SDL2: Replace SDL_Vulkan_GetDrawableSize() forward declaration with the
49+
actual include. (#8095, #7967, #3190) [@sev-]
50+
- Backends: SDL2, SDL3: SDL_EVENT_MOUSE_WHEEL event doesn't require dividing
51+
by 100.0f on Emscripten target. (#4019, #6096, #1463)
52+
- Examples: Added SDL3+Vulkan example. (#8084, #8085)
53+
3854
-----------------------------------------------------------------------
3955
VERSION 1.91.4 (Released 2024-10-18)
4056
-----------------------------------------------------------------------

examples/example_glfw_vulkan/build_win64.bat

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
@REM Build for Visual Studio compiler. Run your copy of amd64/vcvars32.bat to setup 64-bit command-line compiler.
1+
@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup 64-bit command-line compiler.
22

3+
@set OUT_EXE=example_glfw_vulkan
34
@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include
45
@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp
56
@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib

examples/example_sdl2_vulkan/build_win32.bat

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
@set OUT_DIR=Debug
99
mkdir %OUT_DIR%
1010
cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
11+
12+
@set OUT_DIR=Release
13+
@REM mkdir %OUT_DIR%
14+
@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler.
2+
3+
@set OUT_EXE=example_sdl2_vulkan
4+
@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include
5+
@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
6+
@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib
7+
8+
@set OUT_DIR=Debug
9+
mkdir %OUT_DIR%
10+
cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
11+
12+
@set OUT_DIR=Release
13+
@REM mkdir %OUT_DIR%
14+
@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
2-
@set OUT_DIR=Debug
2+
33
@set OUT_EXE=example_sdl3_opengl3
44
@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
55
@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
66
@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib opengl32.lib shell32.lib
7+
8+
@set OUT_DIR=Debug
79
mkdir %OUT_DIR%
810
cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
11+
12+
@set OUT_DIR=Release
13+
@REM mkdir %OUT_DIR%
14+
@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler.
2+
3+
@set OUT_EXE=example_sdl3_opengl3
4+
@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
5+
@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
6+
@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 SDL3.lib opengl32.lib shell32.lib
7+
8+
@set OUT_DIR=Debug
9+
mkdir %OUT_DIR%
10+
cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
11+
12+
@set OUT_DIR=Release
13+
@REM mkdir %OUT_DIR%
14+
@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
2+
3+
@set OUT_EXE=example_sdl3_vulkan
4+
@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include
5+
@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
6+
@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 SDL3.lib shell32.lib vulkan-1.lib
7+
8+
@set OUT_DIR=Debug
9+
mkdir %OUT_DIR%
10+
cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
11+
12+
@set OUT_DIR=Release
13+
@REM mkdir %OUT_DIR%
14+
@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler.
2+
3+
@set OUT_EXE=example_sdl3_vulkan
4+
@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include
5+
@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
6+
@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib SDL3.lib shell32.lib vulkan-1.lib
7+
8+
@set OUT_DIR=Debug
9+
mkdir %OUT_DIR%
10+
cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
11+
12+
@set OUT_DIR=Release
13+
@REM mkdir %OUT_DIR%
14+
@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console

0 commit comments

Comments
 (0)