Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化叠加层渲染性能 #790

Merged
merged 11 commits into from
Dec 29, 2023
Merged

优化叠加层渲染性能 #790

merged 11 commits into from
Dec 29, 2023

Conversation

Blinue
Copy link
Owner

@Blinue Blinue commented Dec 27, 2023

  1. 将渲染 ImGui 使用的着色器从运行时编译改为预先编译。
  2. 叠加层支持在一帧里渲染多次,因为我们只在必要时才渲染新帧,参见 Re-render only on user interaction ocornut/imgui#2268 。对于某些输入(我们的情况是鼠标操作)ImGui 不会立刻更新,所以不得不重复渲染几次。具体而言,在 WM_LBUTTONUP,WM_RBUTTONUP 两个消息中渲染两次,在显示第一帧前渲染三次,我暂时没有在其他地方遇到这个问题。(还有一个方案是比较 ImDrawData 的哈希,这更好维护,但性能相对较低,因为它要求每帧至少渲染两次。)

@Blinue
Copy link
Owner Author

Blinue commented Dec 29, 2023

叠加层有个问题是缩放窗口没有完全遮盖源窗口会导致叠加层无法交互,因为缩放窗口收不到鼠标消息。以前使用鼠标钩子监视鼠标状态,我现在希望避免使用钩子。

@Blinue Blinue merged commit 40a5e1e into render-system Dec 29, 2023
2 checks passed
@Blinue Blinue deleted the imgui branch December 29, 2023 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant