summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2012-07-10 00:42:10 +0000
committerDon Kjer <don@lindenlab.com>2012-07-10 00:42:10 +0000
commitcb2b59b48b6cf8aeb17f5b0f9f4063e8340ce144 (patch)
tree00277a9a3a1f29c43f27bde7dd1f837253d973f2 /indra/newview/llappviewer.cpp
parent29385890a412ba7cfbd4ca89b7a2e32c05aab97d (diff)
Added new settings: DisableAllRenderTypes, DisableAllRenderFeatures, and MaxFPS.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index efa24796e5..f01f62c798 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -632,6 +632,7 @@ LLAppViewer::LLAppViewer() :
mQuitRequested(false),
mLogoutRequestSent(false),
mYieldTime(-1),
+ mMinFrameTime(-1.0),
mMainloopTimeout(NULL),
mAgentRegionLastAlive(false),
mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", FALSE)),
@@ -1465,6 +1466,19 @@ bool LLAppViewer::mainLoop()
{
gFrameStalls++;
}
+
+ // Limit FPS
+ if (mMinFrameTime > F_APPROXIMATELY_ZERO)
+ {
+ // Sleep a while to limit frame rate.
+ S32 milliseconds_to_sleep = llclamp((S32)((mMinFrameTime - frameTimer.getElapsedTimeF64()) * 1000.f), 0, 1000);
+ if (milliseconds_to_sleep > 0)
+ {
+ LLFastTimer t(FTM_YIELD);
+ ms_sleep(milliseconds_to_sleep);
+ }
+ }
+
frameTimer.reset();
resumeMainloopTimeout();
@@ -2577,6 +2591,12 @@ bool LLAppViewer::initConfiguration()
}
mYieldTime = gSavedSettings.getS32("YieldTime");
+ mMinFrameTime = -1.0f;
+ F32 max_fps = gSavedSettings.getF32("MaxFPS");
+ if (max_fps > F_APPROXIMATELY_ZERO)
+ {
+ mMinFrameTime = 1.0f / max_fps;
+ }
// Read skin/branding settings if specified.
//if (! gDirUtilp->getSkinDir().empty() )