iOS glGenerateMipmap是同步的,还是可能是异步的? [英] Is iOS glGenerateMipmap synchronous, or is it possibly asynchronous?

查看:248
本文介绍了iOS glGenerateMipmap是同步的,还是可能是异步的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款在OpenGL ES中使用大纹理的iPad应用。当场景第一次加载时,我会在天花板上得到一个大的黑色神器几帧,如下图所示。就好像还没有填写更高级别的mipmap。在后续帧中,天花板显示正确。

I'm developing an iPad app that uses large textures in OpenGL ES. When the scene first loads I get a large black artifact on the ceiling for a few frames, as seen in the picture below. It's as if higher levels of the mipmap have not yet been filled in. On subsequent frames, the ceiling displays correctly.

当我开始使用mipmapping时,这个问题才开始显现。一种可能的解释是glGenerateMipmap()调用异步工作,产生一些mipmap创建工作者(在一个单独的进程中,或者可能在GPU中)并返回。

This problem only began showing up when I started using mipmapping. One possible explanation is that the glGenerateMipmap() call does its work asynchronously, spawning some mipmap creation worker (in a separate process, or perhaps in the GPU) and returning.

这是可能的,还是我在错误的树上吠叫?

Is this possible, or am I barking up the wrong tree?

推荐答案

在单个上下文中,所有操作看起来都是严格按顺序执行的。但是,在您最近的回复中,您提到使用第二个线程。为此,您必须创建第二个共享上下文:重新输入OpenGL上下文始终是非法的。如果已经使用了共享上下文,则必须遵循一些同步规则,记录在 http://developer.apple.com/library/ios/ipad/#DOCUMENTATION/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/WorkingwithOpenGLESContexts/WorkingwithOpenGLESContexts.html

Within a single context, all operations will appear to execute strictly in order. However, in your most recent reply, you mentioned using a second thread. To do that, you must have created a second shared context: it is always illegal to re-enter an OpenGL context. If already using a shared context, there are still some synchronization rules you must follow, documented at http://developer.apple.com/library/ios/ipad/#DOCUMENTATION/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/WorkingwithOpenGLESContexts/WorkingwithOpenGLESContexts.html

这篇关于iOS glGenerateMipmap是同步的,还是可能是异步的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆