ES逻辑缓冲区加载

ES逻辑缓冲区加载

本文介绍了iOS OpenGL ES逻辑缓冲区加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在分析仪器给出的OpenGL API使用性能警告列表中,我发现我们正在每帧生成多个逻辑缓冲区加载-在这些地方我们没有清除缓冲区,因为draw调用完全覆盖了它.

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.

反常地,在这些情况下引入glClear()调用只是将警告的位置移动到glClear()调用. Apple工具GL_EXT_discard_framebuffer,但是单独使用它也不足以停止警告. glDiscardFramebufferEXT()后跟glClear()确实可以停止警告,并显着提高性能,但是glClear()调用本身需要一些时间来清除缓冲区,在我们的用例中,这是多余的操作.

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.

其他人是否还发现他们需要调用两个函数来避免重新加载费用,还是我错过了一些东西?有没有便宜的方法可以向OpenGL暗示帧缓冲区的内容将被完全覆盖,因此不需要重新加载到图块内存中?

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?

推荐答案

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

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.

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

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.

这篇关于iOS OpenGL ES逻辑缓冲区加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 13:11