diff options
author | Erik Kundiman <erik@megapahit.org> | 2023-11-06 12:58:57 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2023-11-06 12:58:57 +0800 |
commit | 5394ee7b457ea85145309f0f17695b1a7a74ca69 (patch) | |
tree | 874c7c01c552f9cc0b4951819d852d13693ecdf6 /indra/llwindow | |
parent | 741f824d3cab438a60a46710f147d0cab00a0177 (diff) | |
parent | 439d26ccdc2864794036a8f6432664755f2b8234 (diff) |
Merge commit '439d26ccdc2864794036a8f6432664755f2b8234' into test
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 8bfaeca614..b99af1ae4c 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -186,7 +186,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, return; } - //start with arrow cursor + //start with arrow cursor initCursors(); setCursor( UI_CURSOR_ARROW ); @@ -637,6 +637,34 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits mGLView = createOpenGLView(mWindow, mFSAASamples, enable_vsync); mContext = getCGLContextObj(mGLView); gGLManager.mVRAM = getVramSize(mGLView); + + if(!mPixelFormat) + { + CGLPixelFormatAttribute attribs[] = + { + kCGLPFANoRecovery, + kCGLPFADoubleBuffer, + kCGLPFAClosestPolicy, + kCGLPFAAccelerated, + kCGLPFAMultisample, + kCGLPFASampleBuffers, static_cast<CGLPixelFormatAttribute>((mFSAASamples > 0 ? 1 : 0)), + kCGLPFASamples, static_cast<CGLPixelFormatAttribute>(mFSAASamples), + kCGLPFAStencilSize, static_cast<CGLPixelFormatAttribute>(8), + kCGLPFADepthSize, static_cast<CGLPixelFormatAttribute>(24), + kCGLPFAAlphaSize, static_cast<CGLPixelFormatAttribute>(8), + kCGLPFAColorSize, static_cast<CGLPixelFormatAttribute>(24), + kCGLPFAOpenGLProfile, static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_GL4_Core), + static_cast<CGLPixelFormatAttribute>(0) + }; + + GLint numPixelFormats; + CGLChoosePixelFormat (attribs, &mPixelFormat, &numPixelFormats); + + if(mPixelFormat == NULL) { + CGLChoosePixelFormat (attribs, &mPixelFormat, &numPixelFormats); + } + } + } // This sets up our view to recieve text from our non-inline text input window. @@ -1934,7 +1962,10 @@ public: void* LLWindowMacOSX::createSharedContext() { sharedContext* sc = new sharedContext(); - CGLCreateContext(mPixelFormat, mContext, &(sc->mContext)); + CGLError err = CGLCreateContext(mPixelFormat, mContext, &(sc->mContext)); + llassert(err == kCGLNoError); + + CGLEnable(mContext, kCGLCEMPEngine); return (void *)sc; } @@ -1942,6 +1973,25 @@ void* LLWindowMacOSX::createSharedContext() void LLWindowMacOSX::makeContextCurrent(void* context) { CGLSetCurrentContext(((sharedContext*)context)->mContext); + + //enable multi-threaded OpenGL + if (sUseMultGL) + { + CGLError cgl_err; + CGLContextObj ctx = CGLGetCurrentContext(); + + cgl_err = CGLEnable( ctx, kCGLCEMPEngine); + + if (cgl_err != kCGLNoError ) + { + LL_INFOS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL; + } + else + { + LL_INFOS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL; + } + } + } void LLWindowMacOSX::destroySharedContext(void* context) |