Fix build with SDL prior to 1.3.0
This commit is contained in:
@@ -373,7 +373,7 @@ static int x11_detect_VRAM_kb()
|
||||
}
|
||||
#endif // LL_X11
|
||||
|
||||
BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, const S32 vsync_mode, S32 vsync_mode)
|
||||
BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, const S32 vsync_mode)
|
||||
{
|
||||
//bool glneedsinit = false;
|
||||
|
||||
@@ -721,6 +721,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, c
|
||||
}
|
||||
#endif // LL_X11
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
// Disable vertical sync for swap
|
||||
if (vsync_mode == 0)
|
||||
{
|
||||
@@ -741,6 +742,29 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, c
|
||||
LL_DEBUGS("Window") << "Enabling vertical sync" << LL_ENDL;
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
}
|
||||
#else // SDL_VERSION_ATLEAST(1,3,0)
|
||||
#ifdef SDL_GL_SWAP_CONTROL
|
||||
if (vsync_mode == 0)
|
||||
{
|
||||
LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
|
||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);
|
||||
}
|
||||
else if(vsync_mode == -1)
|
||||
{
|
||||
LL_DEBUGS("Window") << "Enabling adaptive vertical sync" << LL_ENDL;
|
||||
if(SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, -1) == -1)
|
||||
{
|
||||
LL_DEBUGS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL;
|
||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_DEBUGS("Window") << "Enabling vertical sync" << LL_ENDL;
|
||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
|
||||
}
|
||||
#endif // SDL_GL_SWAP_CONTROL
|
||||
#endif // SDL_VERSION_ATLEAST(1,3,0)
|
||||
|
||||
//make sure multisampling is disabled by default
|
||||
glDisable(GL_MULTISAMPLE_ARB);
|
||||
@@ -1014,7 +1038,7 @@ S32 LLWindowSDL::getVsyncMode()
|
||||
|
||||
void LLWindowSDL::setVsyncMode(const S32 vsync_mode)
|
||||
{
|
||||
mVsyncMode = vsync_mode
|
||||
mVsyncMode = vsync_mode;
|
||||
}
|
||||
|
||||
F32 LLWindowSDL::getGamma()
|
||||
|
||||
Reference in New Issue
Block a user