iOS OpenGL ES 逻辑缓冲区加载

发布于 2024-10-28 01:57:33 字数 467 浏览 1 评论 0原文

通过分析工具给出的 OpenGL API 使用性能警告列表,我发现我们每帧生成几个逻辑缓冲区负载 - 在这些地方我们没有清除缓冲区,因为绘制调用完全覆盖了它。

与直觉相反,在这些情况下引入 glClear() 调用只是将警告的位置移动到 glClear() 调用。 Apple 实现了 GL_EXT_discard_framebuffer,但是单独使用它也不足以阻止警告。 glDiscardFramebufferEXT() 后跟 glClear() 确实会停止警告,并显着提高性能,但 glClear() 调用本身需要时间清除缓冲区,在我们的用例中这是一个冗余操作。

其他人是否也发现他们需要调用这两个函数以避免重新加载成本,或者我是否遗漏了一些东西?是否有一种廉价的方式向 OpenGL 暗示帧缓冲区的内容即将被完全覆盖,因此不需要重新加载到图块内存中?

Slogging through the list of OpenGL API usage performance warnings given by the Analyze instrument, I am finding that we are generating several logical buffer loads per frame - places where we are not clearing a buffer because a draw call completely overwrites it.

Counterintuitively, introducing glClear() calls for these cases simply moves the location of the warning to the glClear() calls. Apple implement GL_EXT_discard_framebuffer, however using this on its own is also not sufficient to stop the warning. A glDiscardFramebufferEXT() followed by a glClear() does stop the warning, and improves performance significantly, but the glClear() call itself takes time to clear the buffer, which in our use case is a redundant operation.

Do others also find they need to call both functions to avoid the reload cost or am I missing something? Is there a cheap way of hinting to OpenGL that the contents of the framebuffer is about to be completely overwritten and so does not need to be reloaded into tile memory?

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

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

发布评论

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

评论(1

风筝在阴天搁浅。 2024-11-04 01:57:33

该文档暗示全屏 glClear() 设置了一些神奇的标志,这与我在调试同一问题时所看到的一致。我不担心做多余的 glClear(),因为据我所知,这是预期的使用模式。

更新:您可能也遇到了与我相同的错误,我正在清除颜色和深度缓冲区,但在调用 glClear() 之前忘记设置 glDepthMask(GL_TRUE)。这导致了逻辑缓冲区负载警告。

The documentation implies that a fullscreen glClear() sets some magical flag, which is consistent with what I've seen while debugging the same issue. I wouldn't worry about doing a redundant glClear(), as this is the intended usage pattern from what I can tell.

Update: You may also be experiencing the same bug I had, where I was clearing the colour and depth buffers, but forgot to set glDepthMask(GL_TRUE) before calling glClear(). This resulted in a Logical Buffer Load warning.

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