cut the GPU load of moving the mouse over the 3D viewport (#15674)

Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
This commit is contained in:
Kris Austin
2026-09-18 20:19:37 -03:00
committed by GitHub
co-authored by Rodrigo Faselli
parent e0410db22e
commit 213c6569ab
30 changed files with 876 additions and 269 deletions
+30 -2
View File
@@ -590,11 +590,39 @@ void ImGuiWrapper::new_frame()
// BBL: end copy & paste
}
void ImGuiWrapper::render()
ImDrawData* ImGuiWrapper::end_frame()
{
ImGui::Render();
render_draw_data(ImGui::GetDrawData());
m_new_frame_open = false;
return ImGui::GetDrawData();
}
void ImGuiWrapper::render(ImDrawData* draw_data)
{
render_draw_data(draw_data);
}
ImGuiID ImGuiWrapper::draw_data_signature(const ImDrawData* draw_data)
{
ImGuiID hash = 0;
if (draw_data == nullptr)
return hash;
for (int i = 0; i < draw_data->CmdListsCount; ++i) {
const ImDrawList* list = draw_data->CmdLists[i];
hash = ImHashData(list->VtxBuffer.Data, list->VtxBuffer.Size * sizeof(ImDrawVert), hash);
hash = ImHashData(list->IdxBuffer.Data, list->IdxBuffer.Size * sizeof(ImDrawIdx), hash);
// ImDrawCmd has padding, and a hovered ImageButton3() differs only in TextureId.
for (const ImDrawCmd& cmd : list->CmdBuffer) {
hash = ImHashData(&cmd.ClipRect, sizeof(cmd.ClipRect), hash);
hash = ImHashData(&cmd.TextureId, sizeof(cmd.TextureId), hash);
hash = ImHashData(&cmd.VtxOffset, sizeof(cmd.VtxOffset), hash);
hash = ImHashData(&cmd.IdxOffset, sizeof(cmd.IdxOffset), hash);
hash = ImHashData(&cmd.ElemCount, sizeof(cmd.ElemCount), hash);
hash = ImHashData(&cmd.UserCallback, sizeof(cmd.UserCallback), hash);
}
}
return hash;
}
ImVec2 ImGuiWrapper::calc_text_size(std::string_view text,