From ea7526eecf9d9c1d4d4e122a22829660ebbeda43 Mon Sep 17 00:00:00 2001 From: Nicky Date: Thu, 26 Dec 2019 20:15:00 +0100 Subject: [PATCH] Linux; Move SDL_GL_CreateContext right after SDL_CreateImage. Putting it before SDL_GetWindowSurface seems to fix the problems with the NVidia driver. --- indra/llwindow/llwindowsdl.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 549bb74604..f1ae8c1f4c 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -546,8 +546,20 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B mWindow = SDL_CreateWindow( mWindowTitle.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, mSDLFlags ); if( mWindow ) + { + mContext = SDL_GL_CreateContext( mWindow ); + + if( mContext == 0 ) + { + LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL; + setupFailure("GL Context creation error creation error", "Error", OSMB_OK); + return FALSE; + } + // SDL_GL_SetSwapInterval(1); mSurface = SDL_GetWindowSurface( mWindow ); - + } + + if( mFullscreen ) { if (mSurface) @@ -599,20 +611,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B bmpsurface = NULL; } - char const *pEnv = getenv("FS_NO_SDL_CREATE_CONTEXT" ); - if( pEnv == nullptr || std::string( pEnv ) == "1" ) - { - mContext = SDL_GL_CreateContext( mWindow ); - - if( mContext == 0 ) - { - LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL; - raise(SIGTRAP); - return FALSE; - } - // SDL_GL_SetSwapInterval(1); - } - // Detect video memory size. # if LL_X11 gGLManager.mVRAM = x11_detect_VRAM_kb() / 1024;