c++ - OpenGL 命令 - 顺序或并行

标签 c++ opengl

我正在阅读 this document 我对这句话有疑问:

While OpenGL explicitly requires that commands are completed in order, that does not mean that two (or more) commands cannot be concurrently executing. As such, it is possible for shader invocations from one command to be exeucting in tandem with shader invocations from other commands.

这是否意味着,例如,当我发出两个连续的 glDrawArrays 调用时,第二个调用可能会在第一个调用完成之前立即处理?

我的第一个想法是,OpenGL 调用仅映射到 gpu 的内部命令,并且 OpenGL 调用会在这些命令未完成的情况下立即返回,从而使第二个 OpenGL 调用能够发出自己的内部命令。然后可以并行化由 OpenGL 调用创建的内部命令。

最佳答案

也就是说,执行命令的确切顺序和任何并发性都留给实现的判断,唯一的限制是最终结果必须看起来就像所有命令都已执行一样按照客户端程序调用它们的顺序依次进行。

编辑:某些 OpenGL 调用会导致隐式或显式同步。例如读回像素或等待同步事件。

关于c++ - OpenGL 命令 - 顺序或并行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37213103/

相关文章:

c++ - 使用 continue 无限循环

c++ - Armadillo - 从列 vector 中的值填充矩阵

qt - 如何在 QOpenGLWidget 中使用 QPainter 进行叠加

opengl - 将颜色应用于opengl中四边形中的单个顶点

opengl - 着色器分割与算法分割

c++ - 如何在 Mac 上设置并开始使用谷歌测试框架?

c++ - SystemC 传输级模型套接字 : Two Way Communication

c++ - "Expected ' } ' at end of input"。为什么我不断收到此错误?

python - Python OpenGL、PyQt 和 Legacy OpenGL 兼容性出了什么问题?

opengl - Shader的功能参数表现