diff options
author | Dave Parks <davep@lindenlab.com> | 2012-11-26 17:10:22 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2012-11-26 17:10:22 -0600 |
commit | 72cbe5b9429b095cc2b9d940fde78dc4d2e21978 (patch) | |
tree | 8f8ff2d564af774dfc9e552771601c195d3a007f /indra/newview/pipeline.cpp | |
parent | cb96ab1a6fed15da0407d2aba5e9de566417088f (diff) |
MAINT-1958 Fix for crash on OSX when resizing window with deferred rendering enabled.
Reviewed by VoidPointer
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 6f8ead0943..6dd448f091 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -764,7 +764,16 @@ void LLPipeline::resizeScreenTexture() GLuint resX = gViewerWindow->getWorldViewWidthRaw(); GLuint resY = gViewerWindow->getWorldViewHeightRaw(); - allocateScreenBuffer(resX,resY); + if (!allocateScreenBuffer(resX,resY)) + { //FAILSAFE: screen buffer allocation failed, disable deferred rendering if it's enabled + //NOTE: if the session closes successfully after this call, deferred rendering will be + // disabled on future sessions + if (LLPipeline::sRenderDeferred) + { + gSavedSettings.setBOOL("RenderDeferred", FALSE); + LLPipeline::refreshCachedSettings(); + } + } } } @@ -782,15 +791,38 @@ void LLPipeline::allocatePhysicsBuffer() bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { refreshCachedSettings(); - U32 samples = RenderFSAASamples; + + bool save_settings = sRenderDeferred; + if (save_settings) + { + // Set this flag in case we crash while resizing window or allocating space for deferred rendering targets + gSavedSettings.setBOOL("RenderInitError", TRUE); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); + } + + bool ret = doAllocateScreenBuffer(resX, resY); + + if (save_settings) + { + // don't disable shaders on next session + gSavedSettings.setBOOL("RenderInitError", FALSE); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); + } + + return ret; +} + +bool LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) +{ //try to allocate screen buffers at requested resolution and samples // - on failure, shrink number of samples and try again // - if not multisampled, shrink resolution and try again (favor X resolution over Y) // Make sure to call "releaseScreenBuffers" after each failure to cleanup the partially loaded state - bool ret = true; + U32 samples = RenderFSAASamples; + bool ret = true; if (!allocateScreenBuffer(resX, resY, samples)) { //failed to allocate at requested specification, return false @@ -834,7 +866,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) return ret; } - bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) { refreshCachedSettings(); @@ -861,10 +892,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (LLPipeline::sRenderDeferred) { - // Set this flag in case we crash while resizing window or allocating space for deferred rendering targets - gSavedSettings.setBOOL("RenderInitError", TRUE); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); - S32 shadow_detail = RenderShadowDetail; BOOL ssao = RenderDeferredSSAO; @@ -929,9 +956,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) } } - // don't disable shaders on next session - gSavedSettings.setBOOL("RenderInitError", FALSE); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); + //HACK make screenbuffer allocations start failing after 30 seconds + if (gSavedSettings.getBOOL("SimulateFBOFailure")) + { + return false; + } } else { |