mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-19 07:08:18 +00:00
Changed default ImTextureID_Invalid value to -1 instead of 0 +added comments. (#9293, #8745, #8465, #7090)
This commit is contained in:
@@ -41,6 +41,12 @@ HOW TO UPDATE?
|
||||
|
||||
Breaking Changes:
|
||||
|
||||
- Changed default ImTextureID_Invalid value to -1 instead of 0 if not #define-d.
|
||||
(#9293, #8745, #8465, #7090)
|
||||
- It seems like a better default since it will work with backends storing
|
||||
indices or memory offsets inside ImTextureID, where 0 might be a valid value.
|
||||
- If this is causing problem with e.g your custom ImTextureID definition, you can
|
||||
add '#define ImTextureID_Invalid 0' to your imconfig.h + PLEASE report this to GitHub.
|
||||
- Separator(): fixed a legacy quirk where Separator() was submitting a zero-height
|
||||
item for layout purpose, even though it draws a 1-pixel separator.
|
||||
The fix could affect code e.g. computing height from multiple widgets in order to
|
||||
|
||||
@@ -394,6 +394,9 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2026/03/12 (1.92.7) - Changed default ImTextureID_Invalid to -1 instead of 0 if not #define-d. (#9293, #8745, #8465, #7090)
|
||||
It seems like a better default since it will work with backends storing indices or memory offsets inside ImTextureID, where 0 might be a valid value.
|
||||
If this is causing problem with e.g. your custom ImTextureID definition, you can add '#define ImTextureID_Invalid 0' to your imconfig.h + PLEASE report this to GitHub.
|
||||
- 2026/02/26 (1.92.7) - Separator: fixed a legacy quirk where Separator() was submitting a zero-height item for layout purpose, even though it draws a 1-pixel separator.
|
||||
The fix could affect code e.g. computing height from multiple widgets in order to allocate vertical space for a footer or multi-line status bar. (#2657, #9263)
|
||||
The "Console" example had such a bug:
|
||||
@@ -402,8 +405,7 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
Should be:
|
||||
float footer_height = style.ItemSpacing.y + style.SeparatorSize + ImGui::GetFrameHeightWithSpacing();
|
||||
BeginChild("ScrollingRegion", { 0, -footer_height });
|
||||
When such idiom was used and assuming zero-height Separator, it is likely that
|
||||
in 1.92.7 the resulting window will have unexpected 1 pixel scrolling range.
|
||||
When such idiom was used and assuming zero-height Separator, it is likely that in 1.92.7 the resulting window will have unexpected 1 pixel scrolling range.
|
||||
- 2026/02/23 (1.92.7) - Commented out legacy signature for Combo(), ListBox(), signatures which were obsoleted in 1.90 (Nov 2023), when the getter callback type was changed.
|
||||
- Old getter type: bool (*getter)(void* user_data, int idx, const char** out_text) // Set label + return bool. False replaced label with placeholder.
|
||||
- New getter type: const char* (*getter)(void* user_data, int idx) // Return label or NULL/empty label if missing
|
||||
|
||||
14
imgui.h
14
imgui.h
@@ -30,7 +30,7 @@
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.92.7 WIP"
|
||||
#define IMGUI_VERSION_NUM 19264
|
||||
#define IMGUI_VERSION_NUM 19265
|
||||
#define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000
|
||||
#define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198
|
||||
|
||||
@@ -340,9 +340,11 @@ IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||
typedef ImU64 ImTextureID; // Default: store up to 64-bits (any pointer or integer). A majority of backends are ok with that.
|
||||
#endif
|
||||
|
||||
// Define this if you need 0 to be a valid ImTextureID for your backend.
|
||||
// Define this if you need to change the invalid value for your backend.
|
||||
// - in v1.92.7 (2025/03/12): we changed default value from 0 to -1 as it is a better default, which supports storing offsets/indices.
|
||||
// - If this is causing problem with your custom ImTextureID definition, you can add '#define ImTextureID_Invalid' to your imconfig + please report this to GitHub.
|
||||
#ifndef ImTextureID_Invalid
|
||||
#define ImTextureID_Invalid ((ImTextureID)0)
|
||||
#define ImTextureID_Invalid ((ImTextureID)-1)
|
||||
#endif
|
||||
|
||||
// ImTextureRef = higher-level identifier for a texture. Store a ImTextureID _or_ a ImTextureData*.
|
||||
@@ -3906,8 +3908,10 @@ inline ImTextureID ImTextureRef::GetTexID() const
|
||||
// Using an indirection to avoid patching ImDrawCmd after a SetTexID() call (but this could be an alternative solution too)
|
||||
inline ImTextureID ImDrawCmd::GetTexID() const
|
||||
{
|
||||
// If you are getting this assert: A renderer backend with support for ImGuiBackendFlags_RendererHasTextures (1.92)
|
||||
// must iterate and handle ImTextureData requests stored in ImDrawData::Textures[].
|
||||
// If you are getting this assert with ImTextureID_Invalid == 0 and your ImTextureID is used to store an index:
|
||||
// - You can add '#define ImTextureID_Invalid ((ImTextureID)-1)' in your imconfig file.
|
||||
// If you are getting this assert with a renderer backend with support for ImGuiBackendFlags_RendererHasTextures (1.92+):
|
||||
// - You must correctly iterate and handle ImTextureData requests stored in ImDrawData::Textures[]. See docs/BACKENDS.md.
|
||||
ImTextureID tex_id = TexRef._TexData ? TexRef._TexData->TexID : TexRef._TexID; // == TexRef.GetTexID() above.
|
||||
if (TexRef._TexData != NULL)
|
||||
IM_ASSERT(tex_id != ImTextureID_Invalid && "ImDrawCmd is referring to ImTextureData that wasn't uploaded to graphics system. Backend must call ImTextureData::SetTexID() after handling ImTextureStatus_WantCreate request!");
|
||||
|
||||
Reference in New Issue
Block a user