From e0b4931a54f5be79d7b688e180c5fa6f4f8f718e Mon Sep 17 00:00:00 2001 From: paxcut <53811119+paxcut@users.noreply.github.com> Date: Sun, 15 Sep 2024 06:23:58 -0700 Subject: [PATCH] fix: 3D visualizer running very slowly with energy saving enabled (#1866) ### Problem description The bug described in #1663 was caused by an optimization of the display rendering that uses drawlists to detect changes. The changes in the 3-d visualizer don't contain drawlists when axes are turned off. ### Implementation description The fix is to identify the 3d visualizer among the command lists of the main window and, if found, avoid skipping frames regardless of the result of the comparison of drawlists. Closes #1663 --- main/gui/source/window/window.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index de4282f6b..634ee9581 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -692,8 +692,9 @@ namespace hex { auto drawData = viewPort->DrawData; for (int n = 0; n < drawData->CmdListsCount; n++) { const ImDrawList *cmdList = drawData->CmdLists[n]; + std::string ownerName = cmdList->_OwnerName; - if (vtxDataSize == previousVtxDataSize) { + if (vtxDataSize == previousVtxDataSize && (!ownerName.contains("##Popup") || !ownerName.contains("##image"))) { shouldRender = shouldRender || std::memcmp(previousVtxData.data() + offset, cmdList->VtxBuffer.Data, cmdList->VtxBuffer.size() * sizeof(ImDrawVert)) != 0; } else { shouldRender = true;