diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9eadf18ae0..01ae0a6cfb 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1225,12 +1225,9 @@ void LLAppViewer::checkMemory() { const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second //const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds - //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; - - if(!gGLManager.mDebugGPU) - { - return ; - } + const static U32 MAX_SIZE_CHECKED_MEMORY_BLOCK = 64 * 1024 * 1024 ; //64 MB + //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; + static void* last_reserved_address = NULL ; if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32()) { @@ -1238,12 +1235,53 @@ void LLAppViewer::checkMemory() } mMemCheckTimer.reset() ; - //update the availability of memory - LLMemory::updateMemoryInfo() ; + if(gGLManager.mDebugGPU) + { + //update the availability of memory + LLMemory::updateMemoryInfo() ; + } - bool is_low = LLMemory::isMemoryPoolLow() ; + //check the virtual address space fragmentation + if(!last_reserved_address) + { + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + } + else + { + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + if(!last_reserved_address) //failed, try once more + { + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + } + } - LLPipeline::throttleNewMemoryAllocation(is_low) ; + S32 is_low = !last_reserved_address || LLMemory::isMemoryPoolLow() ; + + //if(is_low < 0) //to force quit + //{ + // if(force_quit_timer > MAX_QUIT_WAIT_TIME) //just hit the limit for the first time + // { + // //send out the notification to tell the viewer is about to quit in 30 seconds. + // LLNotification::Params params("ForceQuitDueToLowMemory"); + // LLNotifications::instance().add(params); + + // force_quit_timer = MAX_QUIT_WAIT_TIME - MEMORY_CHECK_INTERVAL ; + // } + // else + // { + // force_quit_timer -= MEMORY_CHECK_INTERVAL ; + // if(force_quit_timer < 0.f) + // { + // forceQuit() ; //quit + // } + // } + //} + //else + //{ + // force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; + //} + + LLPipeline::throttleNewMemoryAllocation(!is_low ? FALSE : TRUE) ; if(is_low) { diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 465fa2c8b5..080974dbca 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -422,8 +422,8 @@ void LLViewerShaderMgr::setShaders() } else { - LLPipeline::sRenderGlow = - LLPipeline::sWaterReflections = FALSE; + LLPipeline::sRenderGlow = FALSE; + LLPipeline::sWaterReflections = FALSE; } //hack to reset buffers that change behavior with shaders diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7d9f0bd95b..1a9c7bbdbc 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4271,7 +4271,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei // Note: Scaling of the UI is currently *not* supported so we limit the output size if UI is requested if (show_ui) { - + // If the user wants the UI, limit the output size to the available screen size + image_width = llmin(image_width, window_width); image_height = llmin(image_height, window_height); } diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index fa3959ad75..9908b98b3f 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -800,7 +800,17 @@ F32 LLWorld::getLandFarClip() const void LLWorld::setLandFarClip(const F32 far_clip) { + static S32 const rwidth = (S32)REGION_WIDTH_U32; + S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth; + S32 const n2 = (llceil(far_clip) - 1) / rwidth; + bool need_water_objects_update = n1 != n2; + mLandFarClip = far_clip; + + if (need_water_objects_update) + { + updateWaterObjects(); + } }