// (minor and older changes stripped away, please see git history for details)
// 2021-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2021-05-19: DirectX11: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
// 2021-02-18: DirectX11: Change blending equation to preserve alpha in output buffer.
// 2019-08-01: DirectX11: Fixed code querying the Geometry Shader state (would generally error with Debug layer enabled).
// 2019-07-21: DirectX11: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData. Clearing Hull/Domain/Compute shaders without backup/restore.
// (minor and older changes stripped away, please see git history for details)
// 2021-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2021-05-19: OpenGL: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
// 2021-01-03: OpenGL: Backup, setup and restore GL_SHADE_MODEL state, disable GL_STENCIL_TEST and disable GL_NORMAL_ARRAY client state to increase compatibility with legacy OpenGL applications.
// 2020-01-23: OpenGL: Backup, setup and restore GL_TEXTURE_ENV to increase compatibility with legacy OpenGL applications.
// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
WGPUSamplerSampler;// Sampler for the font texture
WGPUBufferUniforms;// Shader uniforms
WGPUBindGroupCommonBindGroup;// Resources bind-group to bind the common resources to pipeline
WGPUBindGroupLayoutImageBindGroupLayout;// Bind group layout for image textures
ImGuiStorageImageBindGroups;// Resources bind-group to bind the font/image resources to pipeline (this is a key->value map)
WGPUBindGroupImageBindGroup;// Default font-resource of Dear ImGui
WGPUBindGroupLayoutImageBindGroupLayout;// Cache layout used for the image bind group. Avoids allocating unnecessary JS objects when working with WebASM
Once you understand this design you will understand that loading image files and turning them into displayable textures is not within the scope of Dear ImGui.
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
@ -238,6 +247,7 @@ typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11)
#endif
// 2D vector (often used to store positions or sizes)
IM_MSVC_RUNTIME_CHECKS_OFF
structImVec2
{
floatx,y;
@ -260,6 +270,7 @@ struct ImVec4
IM_VEC4_CLASS_EXTRA// Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec4.
// Do NOT use this class as a std::vector replacement in your own code! Many of the structures used by dear imgui can be safely initialized by a zero-memset.
boolWantSaveIniSettings;// When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving!
boolNavActive;// Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
boolNavVisible;// Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events).
floatFramerate;// Application framerate estimate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames.
floatFramerate;// Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames.
intMetricsRenderVertices;// Vertices output during last call to Render()
intMetricsRenderIndices;// Indices output during last call to Render() = number of triangles * 3
intMetricsRenderWindows;// Number of visible windows
@ -2331,6 +2344,9 @@ struct ImDrawCmd
void*UserCallbackData;// 4-8 // The draw callback code can access this.
ImDrawCmd(){memset(this,0,sizeof(*this));}// Also ensure our padding fields are zeroed
// Since 1.83: returns ImTextureID associated with this draw call. Warning: DO NOT assume this is always same as 'TextureId' (we will change this function for an upcoming feature)
#if defined __SSE__ || defined __x86_64__ || defined _M_X64
#define IMGUI_ENABLE_SSE
#include<immintrin.h>
#endif
// Visual Studio warnings
#ifdef _MSC_VER
#pragma warning (push)
@ -128,10 +134,11 @@ struct ImGuiTabBar; // Storage for a tab bar
structImGuiTabItem;// Storage for a tab item (within a tab bar)
structImGuiTable;// Storage for a table
structImGuiTableColumn;// Storage for one column of a table
structImGuiTableTempData;// Temporary storage for one table (one per table in the stack), shared between tables.
structImGuiTableSettings;// Storage for a table .ini settings
structImGuiTableColumnsSettings;// Storage for a column .ini settings
structImGuiWindow;// Storage for one window
structImGuiWindowTempData;// Temporary storage for one window (that's the data which in theory we could ditch at the end of the frame)
structImGuiWindowTempData;// Temporary storage for one window (that's the data which in theory we could ditch at the end of the frame, in practice we currently keep it for each window)
structImGuiWindowSettings;// Storage for a window .ini settings (we keep one of those even if the actual window wasn't instanced during this session)
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
@ -338,6 +345,7 @@ IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, cons
// We are keeping those disabled by default so they don't leak in user space, to allow user enabling implicit cast operators between ImVec2 and their own types (using IM_VEC2_CLASS_EXTRA etc.)
// We unfortunately don't have a unary- operator for ImVec2 because this would needs to be defined inside the class itself.
// FIXME-TABLE: transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData
// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData
structImGuiTable
{
ImGuiIDID;
ImGuiTableFlagsFlags;
void*RawData;// Single allocation to hold Columns[], DisplayOrderToIndex[] and RowCellData[]
ImGuiTableTempData*TempData;// Transient data while table is active. Point within g.CurrentTableStack[]
ImSpan<ImGuiTableColumn>Columns;// Point within RawData[]
ImSpan<ImGuiTableColumnIdx>DisplayOrderToIndex;// Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
ImSpan<ImGuiTableCellData>RowCellData;// Point within RawData[]. Store cells background requests for current row.
@ -2346,22 +2369,11 @@ struct ImGuiTable
ImRectBg0ClipRectForDrawCmd;// Actual ImDrawCmd clip rect for BG0/1 channel. This tends to be == OuterWindow->ClipRect at BeginTable() because output in BG0/BG1 is cpu-clipped
ImRectBg2ClipRectForDrawCmd;// Actual ImDrawCmd clip rect for BG2 channel. This tends to be a correct, tight-fit, because output to BG2 are done by widgets relying on regular ClipRect.
ImRectHostClipRect;// This is used to check if we can eventually merge our columns draw calls into the current draw call of the current window.
ImRectHostBackupWorkRect;// Backup of InnerWindow->WorkRect at the end of BeginTable()
ImRectHostBackupParentWorkRect;// Backup of InnerWindow->ParentWorkRect at the end of BeginTable()
ImRectHostBackupInnerClipRect;// Backup of InnerWindow->ClipRect during PushTableBackground()/PopTableBackground()
ImVec2HostBackupPrevLineSize;// Backup of InnerWindow->DC.PrevLineSize at the end of BeginTable()
ImVec2HostBackupCurrLineSize;// Backup of InnerWindow->DC.CurrLineSize at the end of BeginTable()
ImVec2HostBackupCursorMaxPos;// Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable()
ImVec2UserOuterSize;// outer_size.x passed to BeginTable()
ImVec1HostBackupColumnsOffset;// Backup of OuterWindow->DC.ColumnsOffset at the end of BeginTable()
floatHostBackupItemWidth;// Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()
intHostBackupItemWidthStackSize;// Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()
ImGuiWindow*OuterWindow;// Parent window for the table
ImGuiWindow*InnerWindow;// Window holding the table data (== OuterWindow or a child window)
ImDrawListSplitterDrawSplitter;// We carry our own ImDrawList splitter to allow recursion (FIXME: could be stored outside, worst case we need 1 splitter per recursing table)
ImGuiTableColumnSortSpecsSortSpecsSingle;
ImVector<ImGuiTableColumnSortSpecs>SortSpecsMulti;// FIXME-OPT: Using a small-vector pattern would work be good.
ImDrawListSplitter*DrawSplitter;// Shortcut to TempData->DrawSplitter while in table. Isolate draw commands per columns to avoid switching clip rect constantly
ImGuiTableSortSpecsSortSpecs;// Public facing sorts specs, this is what we return in TableGetSortSpecs()
ImGuiTableColumnIdxSortSpecsCount;
ImGuiTableColumnIdxColumnsEnabledCount;// Number of enabled columns (<= ColumnsCount)
@ -2408,6 +2420,32 @@ struct ImGuiTable
IMGUI_API~ImGuiTable(){IM_FREE(RawData);}
};
// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).
// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.
// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.
// FIXME-TABLE: more transient data could be stored here: DrawSplitter, incoming RowData?
structImGuiTableTempData
{
intTableIndex;// Index in g.Tables.Buf[] pool
floatLastTimeActive;// Last timestamp this structure was used
ImVec2UserOuterSize;// outer_size.x passed to BeginTable()
ImDrawListSplitterDrawSplitter;
ImGuiTableColumnSortSpecsSortSpecsSingle;
ImVector<ImGuiTableColumnSortSpecs>SortSpecsMulti;// FIXME-OPT: Using a small-vector pattern would be good.
ImRectHostBackupWorkRect;// Backup of InnerWindow->WorkRect at the end of BeginTable()
ImRectHostBackupParentWorkRect;// Backup of InnerWindow->ParentWorkRect at the end of BeginTable()
ImVec2HostBackupPrevLineSize;// Backup of InnerWindow->DC.PrevLineSize at the end of BeginTable()
ImVec2HostBackupCurrLineSize;// Backup of InnerWindow->DC.CurrLineSize at the end of BeginTable()
ImVec2HostBackupCursorMaxPos;// Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable()
ImVec1HostBackupColumnsOffset;// Backup of OuterWindow->DC.ColumnsOffset at the end of BeginTable()
floatHostBackupItemWidth;// Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()
intHostBackupItemWidthStackSize;//Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()