linux - 如何知道 opengl 函数是否会阻塞?

标签 linux opengl opengl-es opengl-es-2.0 wayland

我将 wayland 与 IVI extension 一起使用.我有一个程序,在 sufrace 中显示相机图像,它是使用 dbus 控制的。

我发现如果表面是隐藏的,那么 opengl 函数会阻塞程序(它是 glClear( GL_COLOR_BUFFER_BIT ); 阻塞)。我找到了 this discussion ,这说明此行为符合预期。

有什么方法可以检查表面是否不可见,这样我就可以防止程序被阻止? opengl 中是否有任何东西可以查看函数是否会阻塞?


我的layer是1号,surface是5242880,最初,当程序启动时,我的场景是这样的:

root@pdm3:~# LayerManagerControl get scene
screen 0 (0x0)
---------------------------------------
- connector name:       Unknown-1
- resolution:           x=1280, y=480
- layer render order:   1(0x1),

    layer 1 (0x1)
    ---------------------------------------
    - destination region:   x=0, y=0, w=1280, h=480
    - source region:        x=0, y=0, w=1280, h=480
    - opacity:              1
    - visibility:           1
    - surface render order:
    - on screen:            0(0x0)

要显示图像,只有这样进程才会被解锁,我才能用 dbus 访问它,我需要做接下来的事情:

 LayerManagerControl set layer 1 render order 5242880
 LayerManagerControl set surface 5242880 source region 0 0 200 200
 LayerManagerControl set surface 5242880 destination region 0 0 200 200
 LayerManagerControl set surface 5242880 visibility 1

最佳答案

Is there anything in opengl to see if a function is going to block?

没有。阻塞的内容和时间完全由实现定义,并且在不同供应商之间可能完全不同,甚至可能取决于动态运行时条件,因此即使 API 序列相同,一个框架中的哪些 block 可能不会在另一个框架中阻塞。

关于linux - 如何知道 opengl 函数是否会阻塞?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55953754/

相关文章:

android - OpenGL ES 3.0 遮挡查询始终结果为 false

linux - 在运行时读取加载的共享对象的 ELF header

linux - 在 linux 机器上执行 C# win 表单应用程序

c++ - QMatrix4x4 模型 View 投影 OpenGL 无法获取要渲染的场景

opengl - 这个简单的FxAA如何工作?

opengl - 获取支持的 GLSL 版本

c++ - 在 Linux 中为 USB 大容量存储设备禁用读取缓冲

linux - 适用于 Linux 的非 GPL 库的存储库?

opengl - gl_NormalMatrix

c++ - OpenGL 让物体粘在相机上