1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

gl: Fix vsync; always use adaptive vsync instead of double-buffered

This commit is contained in:
kd-11 2017-08-13 20:41:55 +03:00
parent c04aa05398
commit b86745ee4e
4 changed files with 23 additions and 52 deletions

View File

@ -566,6 +566,9 @@ void GLGSRender::on_init_thread()
gl::init();
//Enable adaptive vsync if vsync is requested
gl::set_swapinterval(g_cfg.video.vsync ? -1 : 0);
if (g_cfg.video.debug_output)
gl::enable_debugging();

View File

@ -219,6 +219,8 @@ OPENGL_PROC(PFNGLTEXTUREBARRIERPROC, TextureBarrier);
OPENGL_PROC(PFNGLTEXTUREBARRIERNVPROC, TextureBarrierNV);
//...
WGL_PROC(PFNWGLSWAPINTERVALEXTPROC, SwapIntervalEXT);
#if !defined(__GNUG__) || defined(__MINGW32__)
OPENGL_PROC(PFNGLBLENDCOLORPROC, BlendColor);
OPENGL_PROC(PFNGLBLENDEQUATIONPROC, BlendEquation);

View File

@ -1,21 +1,6 @@
#include "stdafx.h"
#include "OpenGL.h"
void gl::init()
{
#ifdef _WIN32
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n)
#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(gl##n = (p)wglGetProcAddress(#tn))) LOG_ERROR(RSX, "OpenGL: initialization of " #tn " failed.")
#include "GLProcTable.h"
#undef OPENGL_PROC
#undef OPENGL_PROC2
#endif
#ifdef __unix__
glewExperimental = true;
glewInit();
#endif
}
#ifdef _WIN32
extern "C"
@ -27,41 +12,34 @@ extern "C"
}
#define OPENGL_PROC(p, n) p gl##n = nullptr
#define WGL_PROC(p, n) p wgl##n = nullptr
#define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n)
#include "GLProcTable.h"
#undef OPENGL_PROC
#undef OPENGL_PROC2
#undef WGL_PROC
#endif
OpenGL::OpenGL()
{
Close();
Init();
}
OpenGL::~OpenGL()
{
Close();
}
void OpenGL::Init()
void gl::init()
{
#ifdef _WIN32
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n)
#define OPENGL_PROC2(p, n, tn) if(!(n = (p)wglGetProcAddress(#tn))) LOG_ERROR(RSX, "OpenGL: initialization of " #tn " failed.")
#include "GLProcTable.h"
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, gl##n, gl##n)
#define WGL_PROC(p, n) OPENGL_PROC2(p, wgl##n, wgl##n)
#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(n = (p)wglGetProcAddress(#tn))) LOG_ERROR(RSX, "OpenGL: initialization of " #tn " failed.")
#include "GLProcTable.h"
#undef OPENGL_PROC
#undef WGL_PROC
#undef OPENGL_PROC2
#endif
#ifdef __unix__
glewExperimental = true;
glewInit();
#endif
}
void OpenGL::Close()
void gl::set_swapinterval(int interval)
{
#ifdef _WIN32
#define OPENGL_PROC(p, n) n = nullptr
#define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n)
#include "GLProcTable.h"
#undef OPENGL_PROC
#undef OPENGL_PROC2
wglSwapIntervalEXT(interval);
#endif
}
}

View File

@ -10,9 +10,11 @@
typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval);
#define OPENGL_PROC(p, n) extern p gl##n
#define WGL_PROC(p, n) extern p wgl##n
#define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n)
#include "GLProcTable.h"
#undef OPENGL_PROC
#undef WGL_PROC
#undef OPENGL_PROC2
#elif defined(__APPLE__)
@ -34,19 +36,5 @@ typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval);
namespace gl
{
void init();
void set_swapinterval(int interval);
}
struct OpenGL
{
#define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n)
#define OPENGL_PROC(p, n) p n
#include "GLProcTable.h"
#undef OPENGL_PROC
#undef OPENGL_PROC2
OpenGL();
~OpenGL();
void Init();
void Close();
};