mirror of https://github.com/snes9xgit/snes9x.git
GTK+: OpenGL: Add fences as glFinish alternative.
This commit is contained in:
parent
536c6708c3
commit
dc4de5b7c7
|
@ -584,6 +584,9 @@ int S9xOpenGLDisplayDriver::create_context ()
|
|||
else
|
||||
core = false;
|
||||
|
||||
if (version >= 31 || epoxy_has_gl_extension ("GL_ARB_sync"))
|
||||
fences = true;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -640,8 +643,18 @@ void S9xOpenGLDisplayDriver::swap_buffers ()
|
|||
|
||||
if (config->sync_every_frame)
|
||||
{
|
||||
usleep (0);
|
||||
glFinish ();
|
||||
if (fences)
|
||||
{
|
||||
GLsync fence = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
usleep (0);
|
||||
glClientWaitSync (fence, GL_SYNC_FLUSH_COMMANDS_BIT, 100000000);
|
||||
glDeleteSync (fence);
|
||||
}
|
||||
else
|
||||
{
|
||||
usleep (0);
|
||||
glFinish ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ class S9xOpenGLDisplayDriver : public S9xDisplayDriver
|
|||
bool npot;
|
||||
bool using_pbos;
|
||||
bool initialized;
|
||||
bool fences;
|
||||
|
||||
bool using_glsl_shaders;
|
||||
GLSLShader *glsl_shader;
|
||||
|
|
|
@ -156,6 +156,8 @@ void GTKGLXContext::swap_interval (int frames)
|
|||
glXSwapIntervalEXT (display, xid, frames);
|
||||
else if (epoxy_has_glx_extension (display, screen, "GLX_SGI_swap_control"))
|
||||
glXSwapIntervalSGI (frames);
|
||||
else if (epoxy_has_glx_extension (display, screen, "GLX_MESA_swap_control"))
|
||||
glXSwapIntervalMESA (frames);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue