DrawData: added FrameCount field to facilitate debugging multi-threading issues. (#8597, #9136)

This commit is contained in:
ocornut
2026-07-20 16:57:17 +02:00
parent 548389359c
commit 6f41d13c7a
2 changed files with 5 additions and 3 deletions

View File

@@ -5954,7 +5954,7 @@ static void FlattenDrawDataIntoSingleLayer(ImDrawDataBuilder* builder)
static void InitViewportDrawData(ImGuiViewportP* viewport)
{
ImGuiIO& io = ImGui::GetIO();
ImGuiContext& g = *GImGui;
ImDrawData* draw_data = &viewport->DrawDataP;
viewport->DrawDataBuilder.Layers[0] = &draw_data->CmdLists;
@@ -5963,12 +5963,13 @@ static void InitViewportDrawData(ImGuiViewportP* viewport)
viewport->DrawDataBuilder.Layers[1]->resize(0);
draw_data->Valid = true;
draw_data->FrameCount = g.FrameCount;
draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0;
draw_data->DisplayPos = viewport->Pos;
draw_data->DisplaySize = viewport->Size;
draw_data->FramebufferScale = io.DisplayFramebufferScale;
draw_data->FramebufferScale = g.IO.DisplayFramebufferScale;
draw_data->OwnerViewport = viewport;
draw_data->Textures = &ImGui::GetPlatformIO().Textures;
draw_data->Textures = &g.PlatformIO.Textures;
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
draw_data->CmdListsCount = 0;
#endif

View File

@@ -3493,6 +3493,7 @@ struct ImDrawList
struct ImDrawData
{
bool Valid; // Only valid after Render() is called and before the next NewFrame() is called.
int FrameCount; // Frame counter of the emitter context. For debugging purpose.
int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size
int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size
ImVector<ImDrawList*> CmdLists; // Array of ImDrawList* to render. The ImDrawLists are owned by ImGuiContext and only pointed to from here.