SL-19979 Fix for frame stalls on mac with shadows enabled. Also fix multihreaded GL not working on mac (thanks, Rye!)
parent
f72309a17e
commit
65fb4e67cb
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue