This article describes the discovery by rendering the dirty areas to improve rendering performance.
Dirty District Dirty Region
In computer graphics rendering may draw all of the picture of each frame, but this computer's performance requirements are very high.
The introduction of the dirty areas (Dirty Region) in order to reduce the rendering is required on computer performance. When drawing each frame, only part of the draw change in software rendering can save a lot of resources. While rendering each frame, to change the need to redraw part is dirty areas.
The following is a WPF my program Walterlv.CloudKeyboard as dirty regions interact constantly needs to be repainted.
You can see, the dirty areas involving almost the entire interface, and refresh very frequently. This is clearly in terms of rendering performance is unfavorable.
* Of course, this program is very small, even if all has been re-rendering performance is acceptable. * But there is more complex when part of the program, as a lot of Geometry
as well as 3D graphics when re-render this part will bring serious performance problems.
WPF Performance Suite
WPF Performance Suite to download:
Dirty surveillance zone
Start WPF Performance Suite, select Tools Perforator, and then start the process of a WPF to be analyzed in the Action menu. Although the tool has not been updated for a long time, but still supports .NET Core 3 version of the WPF program.
When the program is running, various properties can be seen that the WPF application data table.
Now the Show dirty-region update overlay
option to check to see the beginning of this article show the dirty areas of the overlay.
And dirty area related options are three:
- Show dirty-region update overlay
- Overlay display area dirty, dirty each time zone will appear superimposed on a new layer of translucent color when the need to re-render.
- Disable dirty region support
- 禁用脏区支持。这时,每次渲染都将重绘整个窗口。
- Clear back-buffer before rendering
- 每次重绘之前都将清除之前所有的绘制,使用此选项,你可以迅速找到界面中频繁刷新的部分,而重绘频率不高的部分多数时候都是纯黑。
优化脏区重绘
一开始的程序中,因为我使用了模拟 UWP 的高光效果,导致大量的控件在重绘高光部分,这是导致每一帧都在重新渲染的罪魁祸首。
于是我将高光渲染关闭,脏区的重新渲染将仅仅几种在控件样式改变的时候(例如焦点改变):
光照效果可以参见我的另一篇博客:
参考资料
我的博客会首发于 https://blog.walterlv.com/,而 CSDN 会从其中精选发布,但是一旦发布了就很少更新。
如果在博客看到有任何不懂的内容,欢迎交流。我搭建了 dotnet 职业技术学院 欢迎大家加入。
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。欢迎转载、使用、重新发布,但务必保留文章署名吕毅(包含链接:https://walterlv.blog.csdn.net/),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请与我联系。