summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowsdl.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2023-09-11 22:07:32 +0800
committerErik Kundiman <erik@megapahit.org>2023-09-11 22:07:32 +0800
commitbff37ebbe4e6c09c8833f4724551c7ab76e9563b (patch)
tree7985dc206b6cc2cd2c5f967f85eb7ce2af621660 /indra/llwindow/llwindowsdl.cpp
parent33cea024db8b63b19e445126f8226e7af7ba61f7 (diff)
Fix macOS crash by explicitly ask SDL2 for GL 4.1
The reason it kept crashing was because it is now a requirement for the OpenGL version to be "detected" as equal or higher than 4.09. All this time (or maybe since macOS switching to SDL2), Megapahit has been given only OpenGL 2.1 by macOS (4.1 on SL viewer & Alchemy, though funny it's 2.1 too somehow on Kokua), and now is fixed by setting the profile to core 4.1 from SDL2. The commit is on this branch only cause somehow this fix didn't work on main branch (it crashed). So 6.6.x is stuck with 2.1 for macOS. We're moving forward with this branch anyway, which will be merged to main in the (hopefully near) future.
Diffstat (limited to 'indra/llwindow/llwindowsdl.cpp')
-rw-r--r--indra/llwindow/llwindowsdl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 10e8b03f4c..f7efbd93f2 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -503,6 +503,12 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
int sdlflags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;// | SDL_ANYFORMAT;
+#if LL_DARWIN
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
+#endif
+
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
if (mFSAASamples > 0)