GLES: Only use GPU sync if necessary and available.

If there are complaints of reduced performance, or visual artefacts compared to 4.6.1, it may be worth increasing HW_MAX_PIPELINE_BUFFERS to 4 again.
This commit is contained in:
Emile Belanger 2021-09-21 17:32:15 +01:00 committed by Christoph Oelckers
parent 24aa497e4f
commit 4de6b769d3

View file

@ -235,18 +235,23 @@ void GLBuffer::Resize(size_t newsize)
void GLBuffer::GPUDropSync()
{
#if !(USE_GLES2) // Only applicable when running on desktop for now
if (gles.useMappedBuffers && glFenceSync && glClientWaitSync)
{
if (mGLSync != NULL)
{
glDeleteSync(mGLSync);
}
mGLSync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
}
#endif
}
void GLBuffer::GPUWaitSync()
{
#if !(USE_GLES2) // Only applicable when running on desktop for now
if (gles.useMappedBuffers && glFenceSync && glClientWaitSync)
{
GLenum status = glClientWaitSync(mGLSync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000 * 1000 * 50); // Wait for a max of 50ms...
if (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED)
@ -257,6 +262,7 @@ void GLBuffer::GPUWaitSync()
glDeleteSync(mGLSync);
mGLSync = NULL;
}
#endif
}