使用 GPU 在画布上绘图时性能受到影响

发布于 2024-11-24 00:25:20 字数 708 浏览 1 评论 0原文

使用 Chrome 12,我的游戏绘制流畅。但 Chrome 14 似乎使用 GPU 进行绘图,这对我的游戏性能产生了巨大的负面影响。

我制作了一个 jsFiddle 来查看它何时发生,这个简单的代码已经遇到了问题:http://jsfiddle。网/eGjak/48/

  • 在 Chrome 12 上,FPS 为 62,甚至超过了我的屏幕频率。
  • 在 Chrome 14 上,FPS 约为 25。

25 FPS 是完全可以接受的,但在我的游戏中,我画得更多,并且它运行到了 ~8 FPS,这绝对是可接受的。我从未遇到过任何性能问题,但画布的 GPU 更新对我来说是一个瓶颈。

  • 为什么使用 GPU 在画布上进行一些简单绘图的速度会慢很多?
  • 我可以通过 JavaScript 禁用 Chrome 使用 GPU 吗? (或者还有其他解决方案吗?)

编辑:http://code.google.com/p/chromium/issues/detail?id=89540

Using Chrome 12 my game is drawing smoothly. But Chrome 14, which appears to use the GPU for drawing, has an enormous negative impact on the performance of my game.

I made a jsFiddle to see when exactly it happens and this simple code is already running into problems: http://jsfiddle.net/eGjak/48/.

  • On Chrome 12, the FPS is 62, which is even more than my screen frequency.
  • On Chrome 14, the FPS is ~25.

25 FPS is quite acceptable, but in my game I'm drawing even more and it is running down to ~8 FPS there, which definitely is not acceptable. I've never had any performance problems but the GPU update for canvas is a bottleneck for me.

  • Why is some simple drawing on canvas so much slower using the GPU?
  • Can I disable Chrome from using the GPU through JavaScript? (Or is there another solution for this?)

Edit: Filed a bug at http://code.google.com/p/chromium/issues/detail?id=89540

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

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

发布评论

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

评论(2

以酷 2024-12-01 00:25:21

我在 Chrome 14 中的帧速率为 60fps,效果很好。

我几乎可以保证这是由于 Chrome 14 中默认启用了硬件加速,而不是 12 中。特别是等待垂直同步,这在以前没有发生过。

在 Chrome 14 及更高版本中,GPU Accel(Canvas)不再是您可以打开和关闭的标志 - 它是默认设置。对不起。

不过,如果您转到 chrome://flags/,您仍然可以在 Chrome 14 中禁用 GPU Vsync。这几乎肯定会给你更多的帧。

然而,这不是你可以让用户做的事情。

I'm getting 60fps in Chrome 14 just fine.

I can almost guarantee this is due to hardware acceleration being on by default in Chrome 14 and not in 12. Specifically the waiting for vertical sync, which didn't happen before.

In Chrome 14 and beyond GPU accel (of Canvas) is no longer a flag you can turn on and off - it is a default. Sorry.

You can however still disable GPU Vsync in Chrome 14 if you go to chrome://flags/. This will almost certainly give you more frames.

However it is not something you can make your users do.

我一向站在原地 2024-12-01 00:25:21

我刚刚安装了 Chromium 14.0.831.0 build 93677(而不是 14.0.917.0 build 91952),一切又恢复正常了。现在,它的帧速率低于 60 FPS,而不是~62,但是哦,好吧...

我想主要的一点是,夜间构建的事情来得快去得也快。我的游戏再次运行良好(从今天起,最新的夜间构建使用了新的 WebSocket 协议,这也很棒)。

我希望我不会对此太激动,因为下周它可能会再次放缓,但我会看看。

I just installed Chromium 14.0.831.0 build 93677 (as opposed to 14.0.917.0 build 91952) and things were fine again. It's now just under 60 FPS instead of ~62, but oh well...

I guess the main point is that things come and go too fast with nightly builds. My game is running fine again (and since today the latest nightly build uses the new WebSocket protocol which is a great as well).

I hope I'm not getting too fired up of this as it might just slow down next week again, but I'll see.

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