WPF 高性能绘图 - 我应该按画笔颜色分组吗?

发布于 2024-09-06 21:08:35 字数 224 浏览 3 评论 0原文

在 Direct2D 中,他们建议将相似的事物绘制在一起,以避免不必要的 GPU 状态更改。为此,他们还在幕后进行了一些绘图操作重新排序。

我必须绘制很多可以具有两种颜色之一的矩形。我正在考虑分两次绘制,一次用于第一种颜色的矩形,另一次用于具有另一种颜色的矩形。

您知道这是否会提高渲染速度吗?我现在的速度还没有那么快。我绘制到从 DrawingVisual 获得的 DrawingContext 中。

In Direct2D they recommend drawing similar things together, to avoid unnecessary GPU state changes. They also do some drawing operation reordering behind the scene just for that.

I have to draw a lot of rectangles which can have one of two colors. I'm thinking of doing the drawing in two passes, one for the rectangles with the first color and another for the ones with the other color.

Do you have any idea if this will improve the rendering speed? The speed I have right now is not that great. I draw into a DrawingContext obtained from a DrawingVisual.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦太阳 2024-09-13 21:08:35

我真的不知道按画笔分组会产生什么效果,但是您应该首先检查一些事情:

  • 确保所有画笔、钢笔和其他可冻结对象都被冻结。
  • 简化你的视觉树,尝试减少元素数量。
  • 尝试减少每次更新绘图时更改的元素数量。

阅读:http://msdn.microsoft.com/en-us/magazine/ dd483292.aspx

I really don't know what effect grouping by brush will have, but there are some things you should check first:

  • Make sure all brushes, pens and other freezables are frozen.
  • Simplify your visual tree, try to reduce element count.
  • Try to reduce the number of elements that change every time you update your drawing.

Read: http://msdn.microsoft.com/en-us/magazine/dd483292.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文