将 2 个纹理绑定到一个或两个 FBO 更快吗?
我想一个接一个地运行多个着色器(主要是图像处理),其中一个着色器的输出是以下着色器的输入。我想知道仅使用一个绑定到所有所需纹理的 FBO 是否会带来性能提升,或者为每个纹理创建一个 FBO 是否相同?
如果重要的话,目标平台是 iPhone,因此使用 OpenGL ES 2.0。
谢谢
I want to to run several shaders one after the other (mostly image processing), the output of one being the input of the following. I wonder if there's a performance gain to use only one FBO bound to all the needed textures, or if it's the same to create one FBO for each texture?
In case it matters, the aimed platform is the iPhone, therefore with OpenGL ES 2.0.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉 OpenGL ES,但在 PC 平台上通常最好只使用一个 FBO,而且我不明白为什么这在 ES 上应该有所不同(但是,我可能是错的)。但重要的是,为了 FBO 完整性,所有绑定的纹理都具有相同的大小(例如视口大小),否则它将无法工作。
通常,您最初将所有纹理附加到一个 FBO,然后在每一帧中只需更改每个通道中的渲染目标通道。这可以节省大量由 fbo 绑定引起的状态更改。
请注意,可以绑定的最大纹理数量受到 GL_MAX_COLOR_ATTACHMENTS_EXT 的限制。
您可能还会发现这很有帮助:http://www.songho.ca/opengl/gl_fbo.html< /a>
干杯,
莱因霍尔德
I am not familiar with OpenGL ES, but on PC platform it is normally better to use only one FBO, and i don't see why this should be different on ES (however, I might be wrong). It is important though that all textures bound have the same size (e.g. viewport size) for FBO completeness, otherwise it won't work.
Normally, you attach all textures to one FBO initially and then in each frame just change the rendertarget channel in each pass. This saves you a lot of state changes caused by fbo binding.
Note that the maximum number of textures that can be bound is limited by GL_MAX_COLOR_ATTACHMENTS_EXT.
You might also find this helpful: http://www.songho.ca/opengl/gl_fbo.html
Cheers,
Reinhold