我正在阅读 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/