Adding some improvements and stuff that apparently got lost during merge to LL V3.1

Ansariel 2011-10-30 19:09:57 +01:00
parent f88181b4af
commit df68ed61a9
4 changed files with 62 additions and 13 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -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);
}

View File

@ -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();
}
}