Compare commits

..

15 Commits

Author SHA1 Message Date
ocornut
a959617d2e Backends: Vulkan: rewrite pColorAttachmentFormats deep-copy to avoid issues when calling multiple times. (#8282, #8110) 2025-09-04 18:14:59 +02:00
Ronan Cailleau
f937a32742 Backends: Vulkan: added ImGui_ImplVulkan_CreateMainPipeline() - amend for docking branch. (8110, 8111, 8053) 2025-09-04 18:06:46 +02:00
ocornut
fdcd351488 Merge branch 'master' into docking
# Conflicts:
#	backends/imgui_impl_vulkan.cpp
2025-09-04 18:06:35 +02:00
ocornut
026d47cd35 Backends: Vulkan: store pColorAttachmentFormats deep-copy into an ImVector. (#8282, #8110) 2025-09-04 18:05:58 +02:00
ocornut
c63714822f Backends: Vulkan: reorder InitInfo fields. 2025-09-04 18:05:15 +02:00
ocornut
26aa81a8b1 Backends: Vulkan: misc amends (makes ImGui_ImplVulkan_MainPipelineCreateInfo::PipelineRenderingCreateInfo consistent with InitInfo). (#8110, #8111, #8053) 2025-09-04 18:05:15 +02:00
ocornut
1ecc34a0b1 Backends: Vulkan: misc amends (e.g. changelog, coding style). (8110, 8111, 8053)
# Conflicts:
#	backends/imgui_impl_vulkan.cpp
2025-09-04 18:04:20 +02:00
ocornut
ee03cef14f Backends: Vulkan: revert using a struct for ImGui_ImplVulkan_CreatePipeline() for now. (#8110, #8111, #8053) 2025-09-04 18:00:05 +02:00
Ronan Cailleau
e51d93e2f5 Backends: Vulkan: added ImGui_ImplVulkan_CreateMainPipeline(). (#8110, #8111, #8053)
- Added ImGui_ImplVulkan_CreateMainPipeline(...) to explicitly re-create the main window pipeline (when some of its properties are changed).
- Does not implicitly use ImGui_ImplVulkan_InitInfo::PipelineRenderingCreateInfo, but a function parameter.
- The main window pipeline is created only if possible during ImGui_ImplVulkan_Init(...) (if a render pass or rendering info are given), else it should be created with ImGui_ImplVulkan_ReCreateMainPipeline(...)
- ImGui_ImplVulkan_CreatePipeline now takes a struct rather than (too) many parameters (and returns the created pipeline).
2025-09-04 18:00:05 +02:00
ocornut
7d33524042 InputText: fixed an issue where using Escape with ImGuiInputTextFlags_EscapeClearsAll. (#8915, #8273)
Regression test: "widgets_inputtext_temp_buffer_2"
2025-09-04 13:16:05 +02:00
ocornut
605a751571 InputText, InputInt, InputFloat: fixed an issue where using Escape to revert would not write back the reverted value. (#8915, #8273)
Revealed by 00f12b9a0
Regression test: "widgets_inputtext_temp_buffer_2"
2025-09-04 13:16:04 +02:00
ocornut
b7cb3d93a4 Comments about using MSVC SAL for printf annotation. (#8871) 2025-09-03 19:39:55 +02:00
ocornut
20160ff1d5 Fonts: fixed merging a font and specifying a font target in DstFont that's not the last added font (regression in 1.92). (#8912) 2025-09-03 19:36:02 +02:00
ocornut
3766d40394 Nav: fixed Ctrl+Tab window appearing as empty when the sole active and focused window has the ImGuiWindowFlags_NoNavFocus flag. (#8914) 2025-09-03 17:50:10 +02:00
Ян Ли
0dd3c845eb Docs: add missing anchor in FAQ.md (#8913) 2025-09-03 09:17:23 +02:00
7 changed files with 39 additions and 26 deletions

View File

@@ -280,6 +280,7 @@ struct ImGui_ImplVulkan_Data
VkShaderModule ShaderModuleVert; VkShaderModule ShaderModuleVert;
VkShaderModule ShaderModuleFrag; VkShaderModule ShaderModuleFrag;
VkDescriptorPool DescriptorPool; VkDescriptorPool DescriptorPool;
ImVector<VkFormat> PipelineRenderingCreateInfoColorAttachmentFormats; // Deep copy of format array
// Texture management // Texture management
VkSampler TexSampler; VkSampler TexSampler;
@@ -936,7 +937,7 @@ static void ImGui_ImplVulkan_CreateShaderModules(VkDevice device, const VkAlloca
} }
} }
#ifndef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING #if !defined(IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING) && !(defined(VK_VERSION_1_3) || defined(VK_KHR_dynamic_rendering))
typedef void VkPipelineRenderingCreateInfoKHR; typedef void VkPipelineRenderingCreateInfoKHR;
#endif #endif
@@ -1183,11 +1184,24 @@ void ImGui_ImplVulkan_CreateMainPipeline(const ImGui_ImplVulkan_MainPipelineCrea
v->MSAASamples = info.MSAASamples; v->MSAASamples = info.MSAASamples;
v->Subpass = info.Subpass; v->Subpass = info.Subpass;
const VkPipelineRenderingCreateInfoKHR* pipeline_rendering_create_info = nullptr;
#ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING #ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
if (v->UseDynamicRendering) if (v->UseDynamicRendering)
{
v->PipelineRenderingCreateInfo = info.PipelineRenderingCreateInfo; v->PipelineRenderingCreateInfo = info.PipelineRenderingCreateInfo;
pipeline_rendering_create_info = &v->PipelineRenderingCreateInfo;
if (v->PipelineRenderingCreateInfo.pColorAttachmentFormats != NULL)
{
// Deep copy buffer to reduce error-rate for end user (#8282)
ImVector<VkFormat> formats;
formats.resize((int)v->PipelineRenderingCreateInfo.colorAttachmentCount);
memcpy(formats.Data, v->PipelineRenderingCreateInfo.pColorAttachmentFormats, (size_t)formats.size_in_bytes());
formats.swap(bd->PipelineRenderingCreateInfoColorAttachmentFormats);
v->PipelineRenderingCreateInfo.pColorAttachmentFormats = bd->PipelineRenderingCreateInfoColorAttachmentFormats.Data;
}
}
#endif #endif
bd->Pipeline = ImGui_ImplVulkan_CreatePipeline(v->Device, v->Allocator, v->PipelineCache, v->RenderPass, v->MSAASamples, v->Subpass, v->UseDynamicRendering ? &info.PipelineRenderingCreateInfo : nullptr); bd->Pipeline = ImGui_ImplVulkan_CreatePipeline(v->Device, v->Allocator, v->PipelineCache, v->RenderPass, v->MSAASamples, v->Subpass, pipeline_rendering_create_info);
} }
void ImGui_ImplVulkan_DestroyDeviceObjects() void ImGui_ImplVulkan_DestroyDeviceObjects()
@@ -1321,17 +1335,6 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info)
vkGetPhysicalDeviceProperties(info->PhysicalDevice, &properties); vkGetPhysicalDeviceProperties(info->PhysicalDevice, &properties);
bd->NonCoherentAtomSize = properties.limits.nonCoherentAtomSize; bd->NonCoherentAtomSize = properties.limits.nonCoherentAtomSize;
#ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
ImGui_ImplVulkan_InitInfo* v = &bd->VulkanInitInfo;
if (v->PipelineRenderingCreateInfo.pColorAttachmentFormats != NULL)
{
// Deep copy buffer to reduce error-rate for end user (#8282)
VkFormat* formats_copy = (VkFormat*)IM_ALLOC(sizeof(VkFormat) * v->PipelineRenderingCreateInfo.colorAttachmentCount);
memcpy(formats_copy, v->PipelineRenderingCreateInfo.pColorAttachmentFormats, sizeof(VkFormat) * v->PipelineRenderingCreateInfo.colorAttachmentCount);
v->PipelineRenderingCreateInfo.pColorAttachmentFormats = formats_copy;
}
#endif
if (!ImGui_ImplVulkan_CreateDeviceObjects()) if (!ImGui_ImplVulkan_CreateDeviceObjects())
IM_ASSERT(0 && "ImGui_ImplVulkan_CreateDeviceObjects() failed!"); // <- Can't be hit yet. IM_ASSERT(0 && "ImGui_ImplVulkan_CreateDeviceObjects() failed!"); // <- Can't be hit yet.
@@ -1352,9 +1355,6 @@ void ImGui_ImplVulkan_Shutdown()
// First destroy objects in all viewports // First destroy objects in all viewports
ImGui_ImplVulkan_DestroyDeviceObjects(); ImGui_ImplVulkan_DestroyDeviceObjects();
#ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
IM_FREE((void*)const_cast<VkFormat*>(bd->VulkanInitInfo.PipelineRenderingCreateInfo.pColorAttachmentFormats));
#endif
// Manually delete main viewport render data in-case we haven't initialized for viewports // Manually delete main viewport render data in-case we haven't initialized for viewports
ImGuiViewport* main_viewport = ImGui::GetMainViewport(); ImGuiViewport* main_viewport = ImGui::GetMainViewport();

View File

@@ -47,10 +47,21 @@ Other Changes:
ImGuiStyleVar_ScrollbarPadding enum, instead of hardcoded computed default. (#8895) ImGuiStyleVar_ScrollbarPadding enum, instead of hardcoded computed default. (#8895)
- Fonts: fixed an assertion failure when a rectangle entry has been reused - Fonts: fixed an assertion failure when a rectangle entry has been reused
1024 times (e.g. due to constant change of font types). (#8906) [@cfillion] 1024 times (e.g. due to constant change of font types). (#8906) [@cfillion]
- Fonts: fixed merging a font and specifying a font target in DstFont
that's not the last added font (regression in 1.92). (#8912)
- Clipper, Tables: added ImGuiListClipperFlags_NoSetTableRowCounters as a way to - Clipper, Tables: added ImGuiListClipperFlags_NoSetTableRowCounters as a way to
disable the assumption that 1 clipper item == 1 table row, which breaks when disable the assumption that 1 clipper item == 1 table row, which breaks when
e.g. using clipper with ItemsHeight=1 in order to clip in pixel units. (#8886) e.g. using clipper with ItemsHeight=1 in order to clip in pixel units. (#8886)
- Fixed Bullet() fixed tesselation amount which looked out of place in very large sizes. - Nav: fixed Ctrl+Tab window appearing as empty when the sole active and focused
window has the ImGuiWindowFlags_NoNavFocus flag. (#8914)
- Bullet: fixed tesselation amount which looked out of place in very large sizes.
- InputText, InputInt, InputFloat: fixed an issue where using Escape to revert
would not write back the reverted value during the IsItemDeactivatedAfterEdit()
frame if the provided input buffer doesn't store temporary edits.
(regression in 1.91.7) (#8915, #8273)
- InputText: fixed an issue where using Escape with ImGuiInputTextFlags_EscapeClearsAll
would not write back the cleared value during the IsItemDeactivatedAfterEdit()
frame if the provided input buffer doesn't store temporary edits. (#8915, #8273)
- InputText: allow passing an empty string with buf_size==0. (#8907) - InputText: allow passing an empty string with buf_size==0. (#8907)
In theory the buffer size should always account for a zero-terminator, but idioms In theory the buffer size should always account for a zero-terminator, but idioms
such as using InputTextMultiline() with ImGuiInputTextFlags_ReadOnly to display such as using InputTextMultiline() with ImGuiInputTextFlags_ReadOnly to display

View File

@@ -19,7 +19,7 @@ or view this file with any Markdown viewer.
| **[How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?](#q-how-can-i-tell-whether-to-dispatch-mousekeyboard-to-dear-imgui-or-my-application)** | | **[How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?](#q-how-can-i-tell-whether-to-dispatch-mousekeyboard-to-dear-imgui-or-my-application)** |
| [How can I enable keyboard or gamepad controls?](#q-how-can-i-enable-keyboard-or-gamepad-controls) | | [How can I enable keyboard or gamepad controls?](#q-how-can-i-enable-keyboard-or-gamepad-controls) |
| [How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)](#q-how-can-i-use-this-on-a-machine-without-mouse-keyboard-or-screen-input-share-remote-display) | | [How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)](#q-how-can-i-use-this-on-a-machine-without-mouse-keyboard-or-screen-input-share-remote-display) |
| [How can I create my own backend?](q-how-can-i-create-my-own-backend) | [How can I create my own backend?](#q-how-can-i-create-my-own-backend)
| [I integrated Dear ImGui in my engine and little squares are showing instead of text...](#q-i-integrated-dear-imgui-in-my-engine-and-little-squares-are-showing-instead-of-text) | | [I integrated Dear ImGui in my engine and little squares are showing instead of text...](#q-i-integrated-dear-imgui-in-my-engine-and-little-squares-are-showing-instead-of-text) |
| [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) | | [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) |
| [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) | | [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) |

View File

@@ -14966,7 +14966,7 @@ static void ImGui::NavUpdateWindowing()
g.NavWindowingInputSource = g.NavInputSource = ImGuiInputSource_Gamepad; g.NavWindowingInputSource = g.NavInputSource = ImGuiInputSource_Gamepad;
} }
if (start_windowing_with_gamepad || start_windowing_with_keyboard) if (start_windowing_with_gamepad || start_windowing_with_keyboard)
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1)) if (ImGuiWindow* window = (g.NavWindow && IsWindowNavFocusable(g.NavWindow)) ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
{ {
if (start_windowing_with_keyboard || g.ConfigNavWindowingWithGamepad) if (start_windowing_with_keyboard || g.ConfigNavWindowingWithGamepad)
g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow; // Current location g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow; // Current location

View File

@@ -29,7 +29,7 @@
// Library Version // Library Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
#define IMGUI_VERSION "1.92.3 WIP" #define IMGUI_VERSION "1.92.3 WIP"
#define IMGUI_VERSION_NUM 19224 #define IMGUI_VERSION_NUM 19225
#define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000
#define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198
#define IMGUI_HAS_VIEWPORT // In 'docking' WIP branch. #define IMGUI_HAS_VIEWPORT // In 'docking' WIP branch.
@@ -102,8 +102,10 @@ Index of this file:
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions. // Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
// (MSVC provides an equivalent mechanism via SAL Annotations but it would require the macros in a different // (MSVC provides an equivalent mechanism via SAL Annotations but it requires the macros in a different
// location. e.g. #include <sal.h> + void myprintf(_Printf_format_string_ const char* format, ...)) // location. e.g. #include <sal.h> + void myprintf(_Printf_format_string_ const char* format, ...),
// and only works when using Code Analysis, rather than just normal compiling).
// (see https://github.com/ocornut/imgui/issues/8871 for a patch to enable this for MSVC's Code Analysis)
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__) #if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1))) #define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0))) #define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))

View File

@@ -3032,7 +3032,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg_in)
else else
{ {
IM_ASSERT(Fonts.Size > 0 && "Cannot use MergeMode for the first font"); // When using MergeMode make sure that a font has already been added before. You can use ImGui::GetIO().Fonts->AddFontDefault() to add the default imgui font. IM_ASSERT(Fonts.Size > 0 && "Cannot use MergeMode for the first font"); // When using MergeMode make sure that a font has already been added before. You can use ImGui::GetIO().Fonts->AddFontDefault() to add the default imgui font.
font = Fonts.back(); font = font_cfg_in->DstFont ? font_cfg_in->DstFont : Fonts.back();
} }
// Add to list // Add to list

View File

@@ -4972,7 +4972,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
{ {
if (flags & ImGuiInputTextFlags_EscapeClearsAll) if (flags & ImGuiInputTextFlags_EscapeClearsAll)
{ {
if (buf[0] != 0) if (state->TextA.Data[0] != 0)
{ {
revert_edit = true; revert_edit = true;
} }
@@ -5064,14 +5064,14 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
if (flags & ImGuiInputTextFlags_EscapeClearsAll) if (flags & ImGuiInputTextFlags_EscapeClearsAll)
{ {
// Clear input // Clear input
IM_ASSERT(buf[0] != 0); IM_ASSERT(state->TextA.Data[0] != 0);
apply_new_text = ""; apply_new_text = "";
apply_new_text_length = 0; apply_new_text_length = 0;
value_changed = true; value_changed = true;
IMSTB_TEXTEDIT_CHARTYPE empty_string; IMSTB_TEXTEDIT_CHARTYPE empty_string;
stb_textedit_replace(state, state->Stb, &empty_string, 0); stb_textedit_replace(state, state->Stb, &empty_string, 0);
} }
else if (strcmp(buf, state->TextToRevertTo.Data) != 0) else if (strcmp(state->TextA.Data, state->TextToRevertTo.Data) != 0)
{ {
apply_new_text = state->TextToRevertTo.Data; apply_new_text = state->TextToRevertTo.Data;
apply_new_text_length = state->TextToRevertTo.Size - 1; apply_new_text_length = state->TextToRevertTo.Size - 1;