gl: Implement swap control on linux

This commit is contained in:
kd-11 2018-01-22 13:07:52 +03:00
parent d37aa466ff
commit c05d164eee
2 changed files with 19 additions and 1 deletions

View File

@ -34,6 +34,9 @@ void gl::init()
#ifdef __unix__
glewExperimental = true;
glewInit();
#ifndef __APPLE__
glxewInit();
#endif
#endif
}
@ -41,5 +44,19 @@ void gl::set_swapinterval(int interval)
{
#ifdef _WIN32
wglSwapIntervalEXT(interval);
#elif !defined(__APPLE__)
if (glXSwapIntervalEXT)
{
if (auto window = glXGetCurrentDrawable())
{
glXSwapIntervalEXT(glXGetCurrentDisplay(), window, interval);
return;
}
}
//No existing drawable or missing swap extension, EGL?
LOG_ERROR(RSX, "Failed to set swap interval");
#else
LOG_UNIMPLEMENTED(RSX, "Swap control not implemented for this platform. Vsync options not available.");
#endif
}

View File

@ -22,6 +22,7 @@ typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval);
#include <OpenGL/glu.h>
#else
#include <GL/glxew.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glxext.h>