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
|
else
|
||||||
core = false;
|
core = false;
|
||||||
|
|
||||||
|
if (version >= 31 || epoxy_has_gl_extension ("GL_ARB_sync"))
|
||||||
|
fences = true;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,11 +642,21 @@ void S9xOpenGLDisplayDriver::swap_buffers ()
|
||||||
context->swap_buffers ();
|
context->swap_buffers ();
|
||||||
|
|
||||||
if (config->sync_every_frame)
|
if (config->sync_every_frame)
|
||||||
|
{
|
||||||
|
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);
|
usleep (0);
|
||||||
glFinish ();
|
glFinish ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void S9xOpenGLDisplayDriver::deinit ()
|
void S9xOpenGLDisplayDriver::deinit ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,7 @@ class S9xOpenGLDisplayDriver : public S9xDisplayDriver
|
||||||
bool npot;
|
bool npot;
|
||||||
bool using_pbos;
|
bool using_pbos;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
bool fences;
|
||||||
|
|
||||||
bool using_glsl_shaders;
|
bool using_glsl_shaders;
|
||||||
GLSLShader *glsl_shader;
|
GLSLShader *glsl_shader;
|
||||||
|
|
|
@ -156,6 +156,8 @@ void GTKGLXContext::swap_interval (int frames)
|
||||||
glXSwapIntervalEXT (display, xid, frames);
|
glXSwapIntervalEXT (display, xid, frames);
|
||||||
else if (epoxy_has_glx_extension (display, screen, "GLX_SGI_swap_control"))
|
else if (epoxy_has_glx_extension (display, screen, "GLX_SGI_swap_control"))
|
||||||
glXSwapIntervalSGI (frames);
|
glXSwapIntervalSGI (frames);
|
||||||
|
else if (epoxy_has_glx_extension (display, screen, "GLX_MESA_swap_control"))
|
||||||
|
glXSwapIntervalMESA (frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue