mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add VSync option in Windows. Turns itself off when unthrottled.
This commit is contained in:
parent
c35b206398
commit
e782b6f20e
10 changed files with 29 additions and 19 deletions
|
@ -123,6 +123,7 @@ void Config::Load(const char *iniFileName)
|
|||
graphics->Get("TexScalingLevel", &iTexScalingLevel, 1);
|
||||
graphics->Get("TexScalingType", &iTexScalingType, 0);
|
||||
graphics->Get("TexDeposterize", &bTexDeposterize, false);
|
||||
graphics->Get("VSyncInterval", &iVSyncInterval, 0);
|
||||
|
||||
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
||||
sound->Get("Enable", &bEnableSound, true);
|
||||
|
@ -221,6 +222,7 @@ void Config::Save()
|
|||
graphics->Set("TexScalingLevel", iTexScalingLevel);
|
||||
graphics->Set("TexScalingType", iTexScalingType);
|
||||
graphics->Set("TexDeposterize", bTexDeposterize);
|
||||
graphics->Set("VSyncInterval", iVSyncInterval);
|
||||
|
||||
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
||||
sound->Set("Enable", bEnableSound);
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
bool bPartialStretch;
|
||||
#endif
|
||||
bool bStretchToDisplay;
|
||||
int iVSyncInterval;
|
||||
int iFrameSkip;
|
||||
|
||||
int iWindowX;
|
||||
|
|
|
@ -172,8 +172,10 @@ static const u8 flushBeforeCommandList[] = {
|
|||
};
|
||||
|
||||
GLES_GPU::GLES_GPU()
|
||||
: resized_(false)
|
||||
{
|
||||
: resized_(false) {
|
||||
lastVsync_ = g_Config.iVSyncInterval;
|
||||
glstate.SetVSyncInterval(g_Config.iVSyncInterval);
|
||||
|
||||
shaderManager_ = new ShaderManager();
|
||||
transformDraw_.SetShaderManager(shaderManager_);
|
||||
transformDraw_.SetTextureCache(&textureCache_);
|
||||
|
@ -251,6 +253,15 @@ void GLES_GPU::DumpNextFrame() {
|
|||
}
|
||||
|
||||
void GLES_GPU::BeginFrame() {
|
||||
// Turn off vsync when unthrottled
|
||||
int desiredVSyncInterval = g_Config.iVSyncInterval;
|
||||
if (PSP_CoreParameter().unthrottle)
|
||||
desiredVSyncInterval = 0;
|
||||
if (desiredVSyncInterval != lastVsync_) {
|
||||
glstate.SetVSyncInterval(desiredVSyncInterval);
|
||||
lastVsync_ = desiredVSyncInterval;
|
||||
}
|
||||
|
||||
textureCache_.StartFrame();
|
||||
transformDraw_.DecimateTrackedVertexArrays();
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ private:
|
|||
|
||||
u8 *flushBeforeCommand_;
|
||||
bool resized_;
|
||||
int lastVsync_;
|
||||
|
||||
std::string reportingPrimaryInfo_;
|
||||
std::string reportingFullInfo_;
|
||||
|
|
|
@ -8,29 +8,21 @@
|
|||
|
||||
#include "OpenGLBase.h"
|
||||
|
||||
static HDC hDC=NULL; // Private GDI Device Context
|
||||
static HGLRC hRC=NULL; // Permanent Rendering Context
|
||||
static HWND hWnd=NULL; // Holds Our Window Handle
|
||||
static HINSTANCE hInstance; // Holds The Instance Of The Application
|
||||
static HDC hDC; // Private GDI Device Context
|
||||
static HGLRC hRC; // Permanent Rendering Context
|
||||
static HWND hWnd; // Holds Our Window Handle
|
||||
|
||||
static int xres, yres;
|
||||
|
||||
// TODO: Make config?
|
||||
static bool enableGLDebug = false;
|
||||
|
||||
|
||||
//typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int );
|
||||
//static PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;
|
||||
|
||||
void setVSync(int interval=1)
|
||||
void GL_SetVSyncInterval(int interval=1)
|
||||
{
|
||||
const char *extensions = (const char *)glGetString( GL_EXTENSIONS );
|
||||
|
||||
if( wglSwapIntervalEXT )
|
||||
wglSwapIntervalEXT(interval);
|
||||
}
|
||||
|
||||
// Resize And Initialize The GL Window
|
||||
void GL_Resized() {
|
||||
if (!hWnd)
|
||||
return;
|
||||
|
@ -39,8 +31,6 @@ void GL_Resized() {
|
|||
xres = rc.right - rc.left; //account for border :P
|
||||
yres = rc.bottom - rc.top;
|
||||
|
||||
//swidth=width; // Set Scissor Width To Window Width
|
||||
//sheight=height; // Set Scissor Height To Window Height
|
||||
if (yres == 0)
|
||||
yres = 1;
|
||||
glstate.viewport.set(0, 0, xres, yres);
|
||||
|
@ -105,7 +95,6 @@ bool GL_Init(HWND window, std::string *error_message) {
|
|||
hWnd = window;
|
||||
GLuint PixelFormat;
|
||||
|
||||
hInstance = GetModuleHandle(NULL);
|
||||
static const PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
||||
1, // Version Number
|
||||
|
@ -205,7 +194,7 @@ bool GL_Init(HWND window, std::string *error_message) {
|
|||
glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
|
||||
|
||||
glstate.Initialize();
|
||||
setVSync(0);
|
||||
GL_SetVSyncInterval(0);
|
||||
if (enableGLDebug && glewIsSupported("GL_ARB_debug_output")) {
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)&DebugCallbackARB, 0); // print debug output to stderr
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <windows.h>
|
||||
|
||||
bool GL_Init(HWND window, std::string *error_message);
|
||||
|
||||
void GL_Shutdown();
|
||||
void GL_Resized();
|
||||
void GL_SwapBuffers();
|
||||
|
|
|
@ -586,6 +586,10 @@ namespace MainWindow
|
|||
g_Config.bMipMap = !g_Config.bMipMap;
|
||||
break;
|
||||
|
||||
case ID_OPTIONS_VSYNC:
|
||||
g_Config.iVSyncInterval = !g_Config.iVSyncInterval;
|
||||
break;
|
||||
|
||||
case ID_TEXTURESCALING_OFF:
|
||||
setTexScalingLevel(1);
|
||||
break;
|
||||
|
@ -897,6 +901,7 @@ namespace MainWindow
|
|||
CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.bShowFPSCounter);
|
||||
CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != 0);
|
||||
CHECKITEM(ID_OPTIONS_MIPMAP, g_Config.bMipMap);
|
||||
CHECKITEM(ID_OPTIONS_VSYNC, g_Config.iVSyncInterval != 0);
|
||||
CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost);
|
||||
CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound);
|
||||
CHECKITEM(ID_TEXTURESCALING_DEPOSTERIZE, g_Config.bTexDeposterize);
|
||||
|
|
Binary file not shown.
Binary file not shown.
2
native
2
native
|
@ -1 +1 @@
|
|||
Subproject commit bebb3ae397212883cf3c51a93ef803b72aca1860
|
||||
Subproject commit 4c2f26ff35b9833752d956a97265261f1e149e58
|
Loading…
Add table
Reference in a new issue