mirror of https://github.com/PCSX2/pcsx2.git
gsdx: store vsync state into an integer
allow to support late vsync (Adaptive vsync).
This commit is contained in:
parent
36fd2b6854
commit
392816fae3
|
@ -63,7 +63,7 @@ extern bool RunLinuxDialog();
|
|||
static GSRenderer* s_gs = NULL;
|
||||
static void (*s_irq)() = NULL;
|
||||
static uint8* s_basemem = NULL;
|
||||
static bool s_vsync = false;
|
||||
static int s_vsync = 0;
|
||||
static bool s_exclusive = true;
|
||||
static const char *s_renderer_name = "";
|
||||
static const char *s_renderer_type = "";
|
||||
|
@ -543,7 +543,7 @@ EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt)
|
|||
|
||||
// Legacy GUI expects to acquire vsync from the configuration files.
|
||||
|
||||
s_vsync = !!theApp.GetConfigI("vsync");
|
||||
s_vsync = theApp.GetConfigI("vsync");
|
||||
|
||||
if(mt == 2)
|
||||
{
|
||||
|
@ -965,9 +965,9 @@ EXPORT_C GSsetFrameSkip(int frameskip)
|
|||
s_gs->SetFrameSkip(frameskip);
|
||||
}
|
||||
|
||||
EXPORT_C GSsetVsync(int enabled)
|
||||
EXPORT_C GSsetVsync(int vsync)
|
||||
{
|
||||
s_vsync = !!enabled;
|
||||
s_vsync = vsync;
|
||||
|
||||
if(s_gs)
|
||||
{
|
||||
|
@ -1089,7 +1089,7 @@ EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
|
|||
std::array<uint8, 0x2000> regs;
|
||||
GSsetBaseMem(regs.data());
|
||||
|
||||
s_vsync = theApp.GetConfigB("vsync");
|
||||
s_vsync = theApp.GetConfigI("vsync");
|
||||
|
||||
HWND hWnd = nullptr;
|
||||
|
||||
|
@ -1435,7 +1435,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
|
|||
|
||||
GSsetBaseMem(regs);
|
||||
|
||||
s_vsync = theApp.GetConfigB("vsync");
|
||||
s_vsync = theApp.GetConfigI("vsync");
|
||||
int finished = theApp.GetConfigI("linux_replay");
|
||||
bool repack_dump = (finished < 0);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class GSDevice : public GSAlignedClass<32>
|
|||
|
||||
protected:
|
||||
std::shared_ptr<GSWnd> m_wnd;
|
||||
bool m_vsync;
|
||||
int m_vsync;
|
||||
bool m_rbswapped;
|
||||
GSTexture* m_backbuffer;
|
||||
GSTexture* m_merge;
|
||||
|
@ -149,7 +149,7 @@ public:
|
|||
virtual void Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader = 0);
|
||||
virtual void Flip() {}
|
||||
|
||||
virtual void SetVSync(bool enable) {m_vsync = enable;}
|
||||
virtual void SetVSync(int vsync) {m_vsync = vsync;}
|
||||
|
||||
virtual void BeginScene() {}
|
||||
virtual void DrawPrimitive() {};
|
||||
|
|
|
@ -571,11 +571,11 @@ void GSDevice9::Flip()
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice9::SetVSync(bool enable)
|
||||
void GSDevice9::SetVSync(int vsync)
|
||||
{
|
||||
if(m_vsync == enable) return;
|
||||
if(m_vsync == vsync) return;
|
||||
|
||||
__super::SetVSync(enable);
|
||||
__super::SetVSync(vsync);
|
||||
|
||||
// Clever trick: Delete the backbuffer, so that the next Present will fail and
|
||||
// cause a DXDevice9::Reset call, which re-creates the backbuffer with current
|
||||
|
|
|
@ -190,7 +190,7 @@ public:
|
|||
bool IsLost(bool update);
|
||||
void Flip();
|
||||
|
||||
void SetVSync(bool enable);
|
||||
void SetVSync(int vsync);
|
||||
|
||||
void BeginScene();
|
||||
void DrawPrimitive();
|
||||
|
|
|
@ -620,9 +620,9 @@ bool GSDeviceOGL::Reset(int w, int h)
|
|||
return true;
|
||||
}
|
||||
|
||||
void GSDeviceOGL::SetVSync(bool enable)
|
||||
void GSDeviceOGL::SetVSync(int vsync)
|
||||
{
|
||||
m_wnd->SetVSync(enable);
|
||||
m_wnd->SetVSync(vsync);
|
||||
}
|
||||
|
||||
void GSDeviceOGL::Flip()
|
||||
|
|
|
@ -523,7 +523,7 @@ public:
|
|||
bool Create(const std::shared_ptr<GSWnd> &wnd);
|
||||
bool Reset(int w, int h);
|
||||
void Flip();
|
||||
void SetVSync(bool enable);
|
||||
void SetVSync(int vsync);
|
||||
|
||||
void DrawPrimitive() final;
|
||||
void DrawPrimitive(int offset, int count);
|
||||
|
|
|
@ -44,7 +44,7 @@ GSRenderer::GSRenderer()
|
|||
m_interlace = theApp.GetConfigI("interlace") % s_interlace_nb;
|
||||
m_aspectratio = theApp.GetConfigI("AspectRatio") % s_aspect_ratio_nb;
|
||||
m_shader = theApp.GetConfigI("TVShader") % s_post_shader_nb;
|
||||
m_vsync = theApp.GetConfigB("vsync");
|
||||
m_vsync = theApp.GetConfigI("vsync");
|
||||
m_aa1 = theApp.GetConfigB("aa1");
|
||||
m_fxaa = theApp.GetConfigB("fxaa");
|
||||
m_shaderfx = theApp.GetConfigB("shaderfx");
|
||||
|
@ -304,9 +304,9 @@ GSVector2i GSRenderer::GetInternalResolution()
|
|||
return m_real_size;
|
||||
}
|
||||
|
||||
void GSRenderer::SetVSync(bool enabled)
|
||||
void GSRenderer::SetVSync(int vsync)
|
||||
{
|
||||
m_vsync = enabled;
|
||||
m_vsync = vsync;
|
||||
|
||||
if(m_dev) m_dev->SetVSync(m_vsync);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class GSRenderer : public GSState
|
|||
protected:
|
||||
int m_interlace;
|
||||
int m_aspectratio;
|
||||
bool m_vsync;
|
||||
int m_vsync;
|
||||
bool m_aa1;
|
||||
bool m_shaderfx;
|
||||
bool m_fxaa;
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
virtual GSVector2i GetCustomResolution() {return GSVector2i(0,0);}
|
||||
GSVector2i GetInternalResolution();
|
||||
void SetAspectRatio(int aspect) {m_aspectratio = aspect;}
|
||||
void SetVSync(bool enabled);
|
||||
void SetVSync(int vsync);
|
||||
virtual void SetExclusive(bool isExcl) {}
|
||||
|
||||
virtual bool BeginCapture();
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
virtual void HideFrame() = 0;
|
||||
|
||||
virtual void Flip() {};
|
||||
virtual void SetVSync(bool enable) {};
|
||||
virtual void SetVSync(int vsync) {};
|
||||
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
virtual void Hide() = 0;
|
||||
virtual void HideFrame() = 0;
|
||||
virtual void Flip() = 0;
|
||||
virtual void SetVSync(bool enable) = 0;
|
||||
virtual void SetVSync(int vsync) = 0;
|
||||
|
||||
void PopulateGlFunction();
|
||||
};
|
||||
|
|
|
@ -239,11 +239,11 @@ GSVector4i GSWndEGL::GetClientRect()
|
|||
return GSVector4i(0, 0, w, h);
|
||||
}
|
||||
|
||||
void GSWndEGL::SetVSync(bool enable)
|
||||
void GSWndEGL::SetVSync(int vsync)
|
||||
{
|
||||
// 0 -> disable vsync
|
||||
// n -> wait n frame
|
||||
eglSwapInterval(m_eglDisplay, enable);
|
||||
eglSwapInterval(m_eglDisplay, vsync);
|
||||
}
|
||||
|
||||
void GSWndEGL::Flip()
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
void* GetProcAddress(const char* name, bool opt = false) final;
|
||||
|
||||
void Flip() final;
|
||||
void SetVSync(bool enable) final;
|
||||
void SetVSync(int vsync) final;
|
||||
|
||||
// Deprecated API
|
||||
void Show() final {};
|
||||
|
|
|
@ -243,13 +243,13 @@ bool GSWndOGL::SetWindowText(const char* title)
|
|||
return true;
|
||||
}
|
||||
|
||||
void GSWndOGL::SetVSync(bool enable)
|
||||
void GSWndOGL::SetVSync(int vsync)
|
||||
{
|
||||
// m_swapinterval uses an integer as parameter
|
||||
// 0 -> disable vsync
|
||||
// n -> wait n frame
|
||||
if (m_swapinterval_ext) m_swapinterval_ext(m_NativeDisplay, m_NativeWindow, (int)enable);
|
||||
else if (m_swapinterval_mesa) m_swapinterval_mesa((int)enable);
|
||||
if (m_swapinterval_ext) m_swapinterval_ext(m_NativeDisplay, m_NativeWindow, vsync);
|
||||
else if (m_swapinterval_mesa) m_swapinterval_mesa(vsync);
|
||||
else fprintf(stderr, "Failed to set VSync\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
void Hide();
|
||||
void HideFrame();
|
||||
void Flip();
|
||||
void SetVSync(bool enable);
|
||||
void SetVSync(int vsync);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -323,12 +323,12 @@ void* GSWndWGL::GetProcAddress(const char* name, bool opt)
|
|||
|
||||
//TODO: check extensions supported or not
|
||||
//FIXME : extension allocation
|
||||
void GSWndWGL::SetVSync(bool enable)
|
||||
void GSWndWGL::SetVSync(int vsync)
|
||||
{
|
||||
// m_swapinterval uses an integer as parameter
|
||||
// 0 -> disable vsync
|
||||
// n -> wait n frame
|
||||
if (m_swapinterval) m_swapinterval((int)enable);
|
||||
if (m_swapinterval) m_swapinterval(vsync);
|
||||
}
|
||||
|
||||
void GSWndWGL::Flip()
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
void Hide();
|
||||
void HideFrame();
|
||||
void Flip();
|
||||
void SetVSync(bool enable);
|
||||
void SetVSync(int vsync);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,7 @@ GPURenderer::GPURenderer(GSDevice* dev)
|
|||
m_filter = theApp.GetConfigI("filter");
|
||||
m_dither = theApp.GetConfigI("dithering");
|
||||
m_aspectratio = theApp.GetConfigI("AspectRatio");
|
||||
m_vsync = theApp.GetConfigB("vsync");
|
||||
m_vsync = theApp.GetConfigI("vsync");
|
||||
m_fxaa = theApp.GetConfigB("fxaa");
|
||||
m_shaderfx = theApp.GetConfigB("shaderfx");
|
||||
m_scale = m_mem.GetScale();
|
||||
|
|
|
@ -37,7 +37,7 @@ protected:
|
|||
int m_filter;
|
||||
int m_dither;
|
||||
int m_aspectratio;
|
||||
bool m_vsync;
|
||||
int m_vsync;
|
||||
bool m_shaderfx;
|
||||
bool m_fxaa;
|
||||
bool m_shadeboost;
|
||||
|
|
Loading…
Reference in New Issue