mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-06-28 09:59:41 -06:00
OpenGL: disable vsync, atleast under Windows
This commit is contained in:
@ -620,6 +620,7 @@ _UI_EXTERN void *uiGLGetProcAddress(const char* proc);
|
|||||||
_UI_EXTERN int uiGLGetFramebuffer(uiGLContext* ctx);
|
_UI_EXTERN int uiGLGetFramebuffer(uiGLContext* ctx);
|
||||||
_UI_EXTERN float uiGLGetFramebufferScale(uiGLContext* ctx);
|
_UI_EXTERN float uiGLGetFramebufferScale(uiGLContext* ctx);
|
||||||
_UI_EXTERN void uiGLSwapBuffers(uiGLContext* ctx);
|
_UI_EXTERN void uiGLSwapBuffers(uiGLContext* ctx);
|
||||||
|
_UI_EXTERN void uiGLSetVSync(int sync);
|
||||||
|
|
||||||
|
|
||||||
_UI_ENUM(uiModifiers) {
|
_UI_ENUM(uiModifiers) {
|
||||||
|
@ -193,6 +193,11 @@ void uiGLSwapBuffers(uiGLContext* ctx)
|
|||||||
ctx->backbuffer = ctx->backbuffer ? 0 : 1;
|
ctx->backbuffer = ctx->backbuffer ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiGLSetVSync(int sync)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void uiGLMakeContextCurrent(uiGLContext* ctx)
|
void uiGLMakeContextCurrent(uiGLContext* ctx)
|
||||||
{
|
{
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "area.hpp"
|
#include "area.hpp"
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
#include <GL/glext.h>
|
||||||
#include <GL/wglext.h>
|
#include <GL/wglext.h>
|
||||||
|
|
||||||
struct uiGLContext
|
struct uiGLContext
|
||||||
@ -159,3 +160,37 @@ float uiGLGetFramebufferScale(uiGLContext* ctx)
|
|||||||
// TODO
|
// TODO
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiGLSetVSync(int sync)
|
||||||
|
{
|
||||||
|
static PFNWGLSWAPINTERVALEXTPROC _wglSwapIntervalEXT = NULL;
|
||||||
|
static bool symloaded = false;
|
||||||
|
|
||||||
|
if (!symloaded)
|
||||||
|
{
|
||||||
|
PFNGLGETSTRINGIPROC _glGetStringi = (PFNGLGETSTRINGIPROC)wglGetProcAddress("glGetStringi");
|
||||||
|
if (_glGetStringi == NULL) return;
|
||||||
|
|
||||||
|
GLint numext;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &numext);
|
||||||
|
|
||||||
|
bool hasswapctrl = false;
|
||||||
|
for (GLint i = 0; i < numext; i++)
|
||||||
|
{
|
||||||
|
const char* ext = (const char*)_glGetStringi(GL_EXTENSIONS, i);
|
||||||
|
if (!stricmp(ext, "WGL_EXT_swap_control"))
|
||||||
|
{
|
||||||
|
hasswapctrl = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasswapctrl)
|
||||||
|
_wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
|
||||||
|
|
||||||
|
symloaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_wglSwapIntervalEXT)
|
||||||
|
_wglSwapIntervalEXT(sync);
|
||||||
|
}
|
||||||
|
@ -2417,6 +2417,7 @@ void CreateMainWindow(bool opengl)
|
|||||||
if (opengl_good)
|
if (opengl_good)
|
||||||
{
|
{
|
||||||
uiGLMakeContextCurrent(GLContext);
|
uiGLMakeContextCurrent(GLContext);
|
||||||
|
uiGLSetVSync(0); // TODO: make configurable?
|
||||||
if (!GLScreen_Init()) opengl_good = false;
|
if (!GLScreen_Init()) opengl_good = false;
|
||||||
if (opengl_good)
|
if (opengl_good)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user