From 08173c6510d5552e6737ffd592262711e32b3354 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sat, 14 Jan 2006 23:22:18 +0000 Subject: [PATCH] Handle swap interval in LLW_Cocoa itself. --- stepmania/src/RageDisplay_OGL_Extensions.cpp | 3 -- .../LowLevelWindow/LowLevelWindow_Cocoa.mm | 15 +++++++-- stepmania/src/archutils/Darwin/Vsync.cpp | 33 ------------------- stepmania/src/archutils/Darwin/Vsync.h | 31 ----------------- 4 files changed, 12 insertions(+), 70 deletions(-) delete mode 100644 stepmania/src/archutils/Darwin/Vsync.cpp delete mode 100644 stepmania/src/archutils/Darwin/Vsync.h diff --git a/stepmania/src/RageDisplay_OGL_Extensions.cpp b/stepmania/src/RageDisplay_OGL_Extensions.cpp index 41e4d5fe16..d453058885 100644 --- a/stepmania/src/RageDisplay_OGL_Extensions.cpp +++ b/stepmania/src/RageDisplay_OGL_Extensions.cpp @@ -14,7 +14,6 @@ #else # include # include -# include "VSync.h" #endif #undef __glext_h_ @@ -89,8 +88,6 @@ void GLExt_t::Load( LowLevelWindow *pWind ) #if defined(WIN32) if( HasExtension("WGL_EXT_swap_control") ) wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) pWind->GetProcAddress("wglSwapIntervalEXT"); -#elif defined(MACOSX) - wglSwapIntervalEXT = OSXSwapIntervalEXT; #endif if( HasExtension("GL_EXT_paletted_texture") ) diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm index 48d96ce2f4..e450545f85 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Cocoa.mm @@ -118,8 +118,15 @@ static void SetOGLParameters( NSOpenGLContext *context ) CString LowLevelWindow_Cocoa::TryVideoMode( const VideoModeParams& p, bool& newDeviceOut ) { + // Always set these params. + mCurrentParams.bSmoothLines = p.bSmoothLines; + mCurrentParams.bTrilinearFiltering = p.bTrilinearFiltering; + mCurrentParams.bAnisotropicFiltering = p.bAnisotropicFiltering; + mCurrentParams.interlaced = p.interlaced; + mCurrentParams.PAL = p.PAL; + #define X(x) p.x == mCurrentParams.x - if( X(windowed) && X(bpp) && X(width) && X(height) && X(rate) ) + if( X(windowed) && X(bpp) && X(width) && X(height) && X(rate) && X(vsync) ) return 0; #undef X @@ -231,11 +238,13 @@ CString LowLevelWindow_Cocoa::TryVideoMode( const VideoModeParams& p, bool& newD } SetOGLParameters( mFullScreenContext ); } + long swap = p.vsync ? 1 : 0; + + [mFullScreenContext setValues:&swap forParameter:NSOpenGLCPSwapInterval]; [mFullScreenContext setFullScreen]; [mFullScreenContext update]; [mFullScreenContext makeCurrentContext]; - // Copy the rest of the state - mCurrentParams = p; + mCurrentParams.vsync = p.vsync; newDeviceOut = newDeviceOut || !mSharingContexts; return CString(); diff --git a/stepmania/src/archutils/Darwin/Vsync.cpp b/stepmania/src/archutils/Darwin/Vsync.cpp deleted file mode 100644 index 773fbc5a94..0000000000 --- a/stepmania/src/archutils/Darwin/Vsync.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "Vsync.h" -#include - - -bool OSXSwapIntervalEXT( int swapInterval ) -{ - return !CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval, (long*)(&swapInterval) ); -} - -/* - * (c) 2003-2004 Steve Checkoway - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/stepmania/src/archutils/Darwin/Vsync.h b/stepmania/src/archutils/Darwin/Vsync.h deleted file mode 100644 index fbb10eb04d..0000000000 --- a/stepmania/src/archutils/Darwin/Vsync.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef VSYNC_H -#define VSYNC_H - -bool OSXSwapIntervalEXT( int swapInterval ); - -#endif - -/* - * (c) 2003-2004 Steve Checkoway - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */