Linux; Do ot call SDL_GL_CreateContext if the environment variable FS_NO_SDL_CREATE_CONTEXT is set to 1.

NVidia does not seem to like he SDL_GL_CreateContext while AMD needs it. The documentation on the other hand agrees the call is a must. Needs some more investigation.
meow-7.2.2
Nicky 2019-12-26 19:33:57 +01:00
parent 0bb5632dd9
commit 759c43cbb3
2 changed files with 16 additions and 7 deletions

View File

@ -203,6 +203,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
// Ignore use_gl for now, only used for drones on PC
mWindow = NULL;
mContext = {};
mNeedsResize = FALSE;
mOverrideAspectRatio = 0.f;
mGrabbyKeyFlags = 0;
@ -598,15 +599,20 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
bmpsurface = NULL;
}
SDL_GLContext glContext = SDL_GL_CreateContext( mWindow );
if( glContext == 0 )
char const *pEnv = getenv("FS_NO_SDL_CREATE_CONTEXT" );
if( pEnv == nullptr || std::string( pEnv ) == "1" )
{
LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL;
return FALSE;
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;

View File

@ -190,8 +190,12 @@ protected:
//
U32 mGrabbyKeyFlags;
int mReallyCapturedCount;
SDL_Window* mWindow;
SDL_Surface* mSurface;
SDL_GLContext mContext;
SDL_Cursor* mSDLCursors[UI_CURSOR_COUNT];
std::string mWindowTitle;
double mOriginalAspectRatio;
BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize.
@ -202,7 +206,6 @@ protected:
int mSDLFlags;
SDL_Cursor* mSDLCursors[UI_CURSOR_COUNT];
int mHaveInputFocus; /* 0=no, 1=yes, else unknown */
int mIsMinimized; /* 0=no, 1=yes, else unknown */