[DEBUG] Stack Tool: update queries. Called by NewFrame()
| 14327 | |
| 14328 | // [DEBUG] Stack Tool: update queries. Called by NewFrame() |
| 14329 | void ImGui::UpdateDebugToolStackQueries() |
| 14330 | { |
| 14331 | ImGuiContext& g = *GImGui; |
| 14332 | ImGuiStackTool* tool = &g.DebugStackTool; |
| 14333 | |
| 14334 | // Clear hook when stack tool is not visible |
| 14335 | g.DebugHookIdInfo = 0; |
| 14336 | if (g.FrameCount != tool->LastActiveFrame + 1) |
| 14337 | return; |
| 14338 | |
| 14339 | // Update queries. The steps are: -1: query Stack, >= 0: query each stack item |
| 14340 | // We can only perform 1 ID Info query every frame. This is designed so the GetID() tests are cheap and constant-time |
| 14341 | const ImGuiID query_id = g.HoveredIdPreviousFrame ? g.HoveredIdPreviousFrame : g.ActiveId; |
| 14342 | if (tool->QueryId != query_id) |
| 14343 | { |
| 14344 | tool->QueryId = query_id; |
| 14345 | tool->StackLevel = -1; |
| 14346 | tool->Results.resize(0); |
| 14347 | } |
| 14348 | if (query_id == 0) |
| 14349 | return; |
| 14350 | |
| 14351 | // Advance to next stack level when we got our result, or after 2 frames (in case we never get a result) |
| 14352 | int stack_level = tool->StackLevel; |
| 14353 | if (stack_level >= 0 && stack_level < tool->Results.Size) |
| 14354 | if (tool->Results[stack_level].QuerySuccess || tool->Results[stack_level].QueryFrameCount > 2) |
| 14355 | tool->StackLevel++; |
| 14356 | |
| 14357 | // Update hook |
| 14358 | stack_level = tool->StackLevel; |
| 14359 | if (stack_level == -1) |
| 14360 | g.DebugHookIdInfo = query_id; |
| 14361 | if (stack_level >= 0 && stack_level < tool->Results.Size) |
| 14362 | { |
| 14363 | g.DebugHookIdInfo = tool->Results[stack_level].ID; |
| 14364 | tool->Results[stack_level].QueryFrameCount++; |
| 14365 | } |
| 14366 | } |
| 14367 | |
| 14368 | // [DEBUG] Stack tool: hooks called by GetID() family functions |
| 14369 | void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* data_id, const void* data_id_end) |
nothing calls this directly
no outgoing calls
no test coverage detected