summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-11-02 10:47:15 -0500
committerDave Parks <davep@lindenlab.com>2023-11-02 10:47:15 -0500
commit65fb4e67cb55f048c3ac8d0e46fc585f737c48ad (patch)
tree825d4818773ae96d0543daecc9a3aa0ad155dffd
parentf72309a17eab1be1979c58a135e061ebffc37e21 (diff)
SL-19979 Fix for frame stalls on mac with shadows enabled. Also fix multihreaded GL not working on mac (thanks, Rye!)
-rw-r--r--indra/llwindow/llwindowmacosx.cpp54
-rw-r--r--indra/newview/featuretable_mac.txt6
-rw-r--r--indra/newview/llviewershadermgr.cpp4
3 files changed, 57 insertions, 7 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)
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index 77a9a0d1cf..40aaccc8cb 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -1,4 +1,4 @@
-version 55
+version 56
// The version number above should be incremented IF AND ONLY IF some
// change has been made that is sufficiently important to justify
// resetting the graphics preferences of all users to the recommended
@@ -61,7 +61,7 @@ RenderShaderLightingMaxLevel 1 3
RenderDeferred 1 1
RenderDeferredSSAO 1 1
RenderUseAdvancedAtmospherics 1 0
-RenderShadowDetail 1 0
+RenderShadowDetail 1 2
RenderUseStreamVBO 1 1
RenderFSAASamples 1 16
RenderMaxTextureIndex 1 16
@@ -71,7 +71,7 @@ RenderGLMultiThreadedMedia 1 0
RenderReflectionsEnabled 1 1
RenderReflectionProbeDetail 1 2
RenderScreenSpaceReflections 1 1
-RenderReflectionProbeLevel 1 0
+RenderReflectionProbeLevel 1 3
//
// Low Graphics Settings
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 61ccc1d43f..cdf5e2875f 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -392,8 +392,8 @@ void LLViewerShaderMgr::setShaders()
static LLCachedControl<U32> max_texture_index(gSavedSettings, "RenderMaxTextureIndex", 16);
- // when using indexed texture rendering, leave 8 texture units available for shadow and reflection maps
- LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits-8, (S32) max_texture_index), 1);
+ // when using indexed texture rendering, leave some texture units available for shadow and reflection maps
+ LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits-12, (S32) max_texture_index), 1);
reentrance = true;