mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Move swap control to the host specific GLInterface files.
This commit is contained in:
parent
2db0c4270e
commit
73eb98ed8e
@ -26,6 +26,12 @@ void cInterfaceEGL::UpdateFPSDisplay(const char *text)
|
|||||||
{
|
{
|
||||||
XStoreName(GLWin.dpy, GLWin.win, text);
|
XStoreName(GLWin.dpy, GLWin.win, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cInterfaceEGL::SwapInterval(int Interval)
|
||||||
|
{
|
||||||
|
eglSwapInterval(GLWin.egl_dpy, Interval);
|
||||||
|
}
|
||||||
|
|
||||||
void cInterfaceEGL::Swap()
|
void cInterfaceEGL::Swap()
|
||||||
{
|
{
|
||||||
eglSwapBuffers(GLWin.egl_dpy, GLWin.egl_surf);
|
eglSwapBuffers(GLWin.egl_dpy, GLWin.egl_surf);
|
||||||
|
@ -34,6 +34,7 @@ private:
|
|||||||
cX11Window XWindow;
|
cX11Window XWindow;
|
||||||
public:
|
public:
|
||||||
friend class cX11Window;
|
friend class cX11Window;
|
||||||
|
void SwapInterval(int Interval);
|
||||||
void Swap();
|
void Swap();
|
||||||
void UpdateFPSDisplay(const char *Text);
|
void UpdateFPSDisplay(const char *Text);
|
||||||
bool Create(void *&window_handle);
|
bool Create(void *&window_handle);
|
||||||
|
@ -27,6 +27,15 @@ void cInterfaceGLX::UpdateFPSDisplay(const char *text)
|
|||||||
{
|
{
|
||||||
XStoreName(GLWin.dpy, GLWin.win, text);
|
XStoreName(GLWin.dpy, GLWin.win, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cInterfaceGLX::SwapInterval(int Interval)
|
||||||
|
{
|
||||||
|
if (glXSwapIntervalSGI)
|
||||||
|
glXSwapIntervalSGI(Interval);
|
||||||
|
else
|
||||||
|
ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
||||||
|
}
|
||||||
|
|
||||||
void cInterfaceGLX::Swap()
|
void cInterfaceGLX::Swap()
|
||||||
{
|
{
|
||||||
glXSwapBuffers(GLWin.dpy, GLWin.win);
|
glXSwapBuffers(GLWin.dpy, GLWin.win);
|
||||||
|
@ -31,6 +31,7 @@ private:
|
|||||||
cX11Window XWindow;
|
cX11Window XWindow;
|
||||||
public:
|
public:
|
||||||
friend class cX11Window;
|
friend class cX11Window;
|
||||||
|
void SwapInterval(int Interval);
|
||||||
void Swap();
|
void Swap();
|
||||||
void UpdateFPSDisplay(const char *Text);
|
void UpdateFPSDisplay(const char *Text);
|
||||||
bool Create(void *&window_handle);
|
bool Create(void *&window_handle);
|
||||||
|
@ -29,6 +29,7 @@ public:
|
|||||||
virtual bool MakeCurrent() = 0;
|
virtual bool MakeCurrent() = 0;
|
||||||
virtual void Shutdown() = 0;
|
virtual void Shutdown() = 0;
|
||||||
|
|
||||||
|
virtual void SwapInterval(int Interval) { }
|
||||||
virtual u32 GetBackBufferWidth() { return s_backbuffer_width; }
|
virtual u32 GetBackBufferWidth() { return s_backbuffer_width; }
|
||||||
virtual u32 GetBackBufferHeight() { return s_backbuffer_height; }
|
virtual u32 GetBackBufferHeight() { return s_backbuffer_height; }
|
||||||
virtual void SetBackBufferDimensions(u32 W, u32 H) {s_backbuffer_width = W; s_backbuffer_height = H; }
|
virtual void SetBackBufferDimensions(u32 W, u32 H) {s_backbuffer_width = W; s_backbuffer_height = H; }
|
||||||
|
@ -27,6 +27,13 @@
|
|||||||
static HDC hDC = NULL; // Private GDI Device Context
|
static HDC hDC = NULL; // Private GDI Device Context
|
||||||
static HGLRC hRC = NULL; // Permanent Rendering Context
|
static HGLRC hRC = NULL; // Permanent Rendering Context
|
||||||
|
|
||||||
|
void cInterfaceWGL::SwapInterval(int Interval)
|
||||||
|
{
|
||||||
|
if (WGLEW_EXT_swap_control)
|
||||||
|
wglSwapIntervalEXT(Interval);
|
||||||
|
else
|
||||||
|
ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
||||||
|
}
|
||||||
void cInterfaceWGL::Swap()
|
void cInterfaceWGL::Swap()
|
||||||
{
|
{
|
||||||
SwapBuffers(hDC);
|
SwapBuffers(hDC);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
class cInterfaceWGL : public cInterfaceBase
|
class cInterfaceWGL : public cInterfaceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
void SwapInterval(int Interval);
|
||||||
void Swap();
|
void Swap();
|
||||||
void UpdateFPSDisplay(const char *Text);
|
void UpdateFPSDisplay(const char *Text);
|
||||||
bool Create(void *&window_handle);
|
bool Create(void *&window_handle);
|
||||||
|
@ -23,6 +23,19 @@
|
|||||||
#include "../GLInterface.h"
|
#include "../GLInterface.h"
|
||||||
#include "WX.h"
|
#include "WX.h"
|
||||||
|
|
||||||
|
void cInterfaceWX::SwapInterval(int Interval)
|
||||||
|
{
|
||||||
|
// WX interface only used on Apple
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#if defined USE_WX && USE_WX
|
||||||
|
NSOpenGLContext *ctx = GLWin.glCtxt->GetWXGLContext();
|
||||||
|
#else
|
||||||
|
NSOpenGLContext *ctx = GLWin.cocoaCtx;
|
||||||
|
#endif
|
||||||
|
[ctx setValues: &Interval forParameter: NSOpenGLCPSwapInterval];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void cInterfaceWX::Swap()
|
void cInterfaceWX::Swap()
|
||||||
{
|
{
|
||||||
GLWin.glCanvas->SwapBuffers();
|
GLWin.glCanvas->SwapBuffers();
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
class cInterfaceWX : public cInterfaceBase
|
class cInterfaceWX : public cInterfaceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
void SwapInterval(int Interval);
|
||||||
void Swap();
|
void Swap();
|
||||||
void UpdateFPSDisplay(const char *Text);
|
void UpdateFPSDisplay(const char *Text);
|
||||||
bool Create(void *&window_handle);
|
bool Create(void *&window_handle);
|
||||||
|
@ -327,25 +327,8 @@ Renderer::Renderer()
|
|||||||
s_backbuffer_height = (int)GLInterface->GetBackBufferHeight();
|
s_backbuffer_height = (int)GLInterface->GetBackBufferHeight();
|
||||||
|
|
||||||
// Handle VSync on/off
|
// Handle VSync on/off
|
||||||
#ifdef __APPLE__
|
|
||||||
int swapInterval = g_ActiveConfig.bVSync ? 1 : 0;
|
int swapInterval = g_ActiveConfig.bVSync ? 1 : 0;
|
||||||
#if defined USE_WX && USE_WX
|
GLInterface->SwapInterval(swapInterval);
|
||||||
NSOpenGLContext *ctx = GLWin.glCtxt->GetWXGLContext();
|
|
||||||
#else
|
|
||||||
NSOpenGLContext *ctx = GLWin.cocoaCtx;
|
|
||||||
#endif
|
|
||||||
[ctx setValues: &swapInterval forParameter: NSOpenGLCPSwapInterval];
|
|
||||||
#elif defined _WIN32
|
|
||||||
if (WGLEW_EXT_swap_control)
|
|
||||||
wglSwapIntervalEXT(g_ActiveConfig.bVSync ? 1 : 0);
|
|
||||||
else
|
|
||||||
ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
|
||||||
if (glXSwapIntervalSGI)
|
|
||||||
glXSwapIntervalSGI(g_ActiveConfig.bVSync ? 1 : 0);
|
|
||||||
else
|
|
||||||
ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// check the max texture width and height
|
// check the max texture width and height
|
||||||
GLint max_texture_size;
|
GLint max_texture_size;
|
||||||
|
@ -142,27 +142,15 @@ void VideoSoftware::Video_Prepare()
|
|||||||
{
|
{
|
||||||
GLInterface->MakeCurrent();
|
GLInterface->MakeCurrent();
|
||||||
// Init extension support.
|
// Init extension support.
|
||||||
{
|
// Required for WGL SwapInterval
|
||||||
#ifndef USE_GLES
|
#ifndef USE_GLES
|
||||||
if (glewInit() != GLEW_OK) {
|
if (glewInit() != GLEW_OK) {
|
||||||
ERROR_LOG(VIDEO, "glewInit() failed!Does your video card support OpenGL 2.x?");
|
ERROR_LOG(VIDEO, "glewInit() failed!Does your video card support OpenGL 2.x?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Handle VSync on/off
|
// Handle VSync on/off
|
||||||
#ifdef _WIN32
|
GLInterface->SwapInterval(VSYNC_ENABLED);
|
||||||
if (WGLEW_EXT_swap_control)
|
|
||||||
wglSwapIntervalEXT(VSYNC_ENABLED);
|
|
||||||
else
|
|
||||||
ERROR_LOG(VIDEO, "no support for SwapInterval (framerate clamped to monitor refresh rate)Does your video card support OpenGL 2.x?");
|
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
|
||||||
if (glXSwapIntervalSGI)
|
|
||||||
glXSwapIntervalSGI(VSYNC_ENABLED);
|
|
||||||
else
|
|
||||||
ERROR_LOG(VIDEO, "no support for SwapInterval (framerate clamped to monitor refresh rate)");
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
HwRasterizer::Prepare();
|
HwRasterizer::Prepare();
|
||||||
SWRenderer::Prepare();
|
SWRenderer::Prepare();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user