diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 493d48b8c7..13a1158e82 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -244,9 +244,9 @@ D3DFORMAT RageDisplay::FindBackBufferType(bool bWindowed, int iBPP) // Desc: //----------------------------------------------------------------------------- bool RageDisplay::SwitchDisplayMode( - const bool bWindowed, const int iWidth, const int iHeight, const int iBPP, const int iFullScreenHz ) + bool bWindowed, int iWidth, int iHeight, int iBPP, int iFullScreenHz, bool bVsync ) { - LOG->Trace( "RageDisplay::SwitchDisplayModes( %d, %d, %d, %d, %d )", bWindowed, iWidth, iHeight, iBPP, iFullScreenHz ); + LOG->Trace( "RageDisplay::SwitchDisplayModes( %d, %d, %d, %d, %d, %d )", bWindowed, iWidth, iHeight, iBPP, iFullScreenHz, bVsync ); if( !bWindowed ) SetCursor( NULL ); @@ -281,7 +281,11 @@ bool RageDisplay::SwitchDisplayMode( iFullScreenHz == REFRESH_MAX? MaxRefresh(iWidth, iHeight, fmtBackBuffer): iFullScreenHz == REFRESH_DEFAULT? D3DPRESENT_RATE_DEFAULT: iFullScreenHz; - m_d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; + + /* Windowed must always use D3DPRESENT_INTERVAL_DEFAULT. */ + m_d3dpp.FullScreen_PresentationInterval = + bWindowed || bVsync? D3DPRESENT_INTERVAL_DEFAULT: + D3DPRESENT_INTERVAL_IMMEDIATE; LOG->Trace( "Present Parameters: %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d", m_d3dpp.BackBufferWidth, m_d3dpp.BackBufferHeight, m_d3dpp.BackBufferFormat, diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index eaa136dcf3..5ba4675fb9 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -51,7 +51,7 @@ public: ~RageDisplay(); enum { REFRESH_DEFAULT=0, REFRESH_MAX=1 }; bool SwitchDisplayMode( - const bool bWindowed, const int iWidth, const int iHeight, const int iBPP, const int iFullScreenHz ); + bool bWindowed, int iWidth, int iHeight, int iBPP, int iFullScreenHz, bool bVsync ); // LPDIRECT3D8 GetD3D() { return m_pd3d; }; // inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; }; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index fbe3ff4e7c..a2bcfe0572 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -966,34 +966,34 @@ void ApplyGraphicOptions() // // If the requested resolution doesn't work, keep switching until we find one that does. // - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) + if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) goto success; // We failed. Using default refresh rate. iRefreshRate = RageDisplay::REFRESH_DEFAULT; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) + if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) goto success; // We failed. Try full screen with same params. bWindowed = false; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) + if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) goto success; // Failed again. Try 16 BPP iDisplayBPP = 16; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) + if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) goto success; // Failed again. Try 640x480 iDisplayWidth = 640; iDisplayHeight = 480; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) + if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) goto success; // Failed again. Try 320x240 iDisplayWidth = 320; iDisplayHeight = 240; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) + if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) goto success; throw RageException( "Tried every possible display mode, and couldn't find one that works." );