summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowmacosx.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-12-15 12:34:37 +0800
committerErik Kundiman <erik@megapahit.org>2024-12-15 12:34:37 +0800
commit3316ffb3b571b8730d26d6e8b2ee00fc9cbdf7c0 (patch)
tree200cd8497a4fdd782ac4dbfd2ad5fb1632e03275 /indra/llwindow/llwindowmacosx.cpp
parentd4e433b37af94ee11880deeede74a87a728f4775 (diff)
parent5b77436cf0ad749d36e8f0c60077eeb24698d644 (diff)
Merge remote-tracking branch 'secondlife/release/2024.09-ExtraFPS' into 2024.09-ExtraFPS
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp52
1 files changed, 36 insertions, 16 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 3cfc9d7c84..a6ca26236c 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -69,6 +69,41 @@ namespace
bool LLWindowMacOSX::sUseMultGL = false;
+//static
+void LLWindowMacOSX::setUseMultGL(bool use_mult_gl)
+{
+ bool was_enabled = sUseMultGL;
+
+ sUseMultGL = use_mult_gl;
+
+ if (gGLManager.mInited)
+ {
+ CGLContextObj ctx = CGLGetCurrentContext();
+ //enable multi-threaded OpenGL (whether or not sUseMultGL actually changed)
+ if (sUseMultGL)
+ {
+ CGLError cgl_err;
+
+ cgl_err = CGLEnable( ctx, kCGLCEMPEngine);
+
+ if (cgl_err != kCGLNoError )
+ {
+ LL_INFOS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
+ sUseMultGL = false;
+ }
+ else
+ {
+ LL_INFOS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
+ }
+ }
+ else if (was_enabled)
+ {
+ CGLDisable( ctx, kCGLCEMPEngine);
+ LL_INFOS("GLInit") << "Multi-threaded OpenGL disabled." << LL_ENDL;
+ }
+ }
+}
+
// Cross-platform bits:
bool check_for_card(const char* RENDERER, const char* bad_card)
@@ -705,23 +740,8 @@ bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
// Disable vertical sync for swap
toggleVSync(enable_vsync);
- //enable multi-threaded OpenGL
- if (sUseMultGL)
- {
- CGLError cgl_err;
- CGLContextObj ctx = CGLGetCurrentContext();
-
- cgl_err = CGLEnable( ctx, kCGLCEMPEngine);
+ setUseMultGL(sUseMultGL);
- if (cgl_err != kCGLNoError )
- {
- LL_INFOS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
- }
- else
- {
- LL_INFOS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
- }
- }
makeFirstResponder(mWindow, mGLView);
return true;