与围栏同步
Synchronization with fencing
我对 glClientWaitSync 函数的使用有误解。
承认我正在使用类似的东西:
glDraw(...);
sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
glDraw(...);
glClientWaitSync(sync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
glDeleteSync(sync);
如果我很了解OpenGL Wiki,我们有两种情况
第一种情况:OpenGL 4.5:在这种情况下,在 glClientWaitSync 之后,我们确定只执行第一次绘制,因为它写在 wiki 上:
In OpenGL 4.5, this flush is made special. If it's the first time that you are waiting on that particular sync object, and the wait is in the same context that created the sync object, the flush will behave as if you had issued it immediately after the sync object. So if you had issued other OpenGL commands after the sync object was created, they will not be flushed.
第二种情况:OpenGL 4.4 或更低版本:我们确定执行了两次绘制,因为此函数具有 "globally" 与 glFlush 函数相同的行为?
那样的话,如果刷新所有命令缓冲区,如何真正使用 OpenGL 4.4 循环方式使用持久映射?
"Flush" 并不代表 "has finished"。它仅仅意味着 "will eventually be executed by the GPU, without further OpenGL calls."
4.4 的行为将刷新 glClientWaitSync
命令之前的所有内容。 4.5 行为只会刷新 glFenceSync
调用之前的所有内容。
但在这两种情况下,如果 glClientWaitSync
returns 没有超时或错误,唯一 你知道的 GPU 状态是glFenceSync
调用之前的所有命令都已完成。
Going that way, how really use persistent mapping using round robin fashion with OpenGL 4.4 if all the command buffer is flushed ?
如果您只想刷新栅栏同步,那么这就是您在 4.4 中必须做的。也就是说,glFlush
在创建栅栏后立即,但在使用 glClientWaitSync
时不刷新。这将为您提供 4.5 行为的效果。
我对 glClientWaitSync 函数的使用有误解。
承认我正在使用类似的东西:
glDraw(...);
sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
glDraw(...);
glClientWaitSync(sync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
glDeleteSync(sync);
如果我很了解OpenGL Wiki,我们有两种情况
第一种情况:OpenGL 4.5:在这种情况下,在 glClientWaitSync 之后,我们确定只执行第一次绘制,因为它写在 wiki 上:
In OpenGL 4.5, this flush is made special. If it's the first time that you are waiting on that particular sync object, and the wait is in the same context that created the sync object, the flush will behave as if you had issued it immediately after the sync object. So if you had issued other OpenGL commands after the sync object was created, they will not be flushed.
第二种情况:OpenGL 4.4 或更低版本:我们确定执行了两次绘制,因为此函数具有 "globally" 与 glFlush 函数相同的行为? 那样的话,如果刷新所有命令缓冲区,如何真正使用 OpenGL 4.4 循环方式使用持久映射?
"Flush" 并不代表 "has finished"。它仅仅意味着 "will eventually be executed by the GPU, without further OpenGL calls."
4.4 的行为将刷新 glClientWaitSync
命令之前的所有内容。 4.5 行为只会刷新 glFenceSync
调用之前的所有内容。
但在这两种情况下,如果 glClientWaitSync
returns 没有超时或错误,唯一 你知道的 GPU 状态是glFenceSync
调用之前的所有命令都已完成。
Going that way, how really use persistent mapping using round robin fashion with OpenGL 4.4 if all the command buffer is flushed ?
如果您只想刷新栅栏同步,那么这就是您在 4.4 中必须做的。也就是说,glFlush
在创建栅栏后立即,但在使用 glClientWaitSync
时不刷新。这将为您提供 4.5 行为的效果。