diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 33 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 42 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 5 |
6 files changed, 93 insertions, 10 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5e50bd6e01..dde423f86c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8705,6 +8705,28 @@ <key>Value</key> <integer>1</integer> </map> + <key>DisableAllRenderTypes</key> + <map> + <key>Comment</key> + <string>Disables all rendering types.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>DisableAllRenderFeatures</key> + <map> + <key>Comment</key> + <string>Disables all rendering features.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderHUDInSnapshot</key> <map> <key>Comment</key> @@ -13010,6 +13032,17 @@ <key>Value</key> <integer>-1</integer> </map> + <key>MaxFPS</key> + <map> + <key>Comment</key> + <string>Yield some time to the local host if we reach a threshold framerate.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <integer>-1.0</integer> + </map> <key>ZoomDirect</key> <map> <key>Comment</key> 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() ) diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index ae3c795d1e..f55954234f 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -254,6 +254,7 @@ private: bool mQuitRequested; // User wants to quit, may have modified documents open. bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. S32 mYieldTime; + F32 mMinFrameTime; struct SettingsFiles* mSettingsLocationList; LLWatchdogTimeout* mMainloopTimeout; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 4571d08050..e4451c3c93 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1042,7 +1042,7 @@ void render_hud_attachments() gPipeline.pushRenderTypeMask(); // turn off everything - gPipeline.andRenderTypeMask(LLPipeline::END_RENDER_TYPES); + gPipeline.clearAllRenderTypes(); // turn on HUD gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD); // turn on HUD particles diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index de72d79043..cd4c7289a7 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -471,19 +471,29 @@ void LLPipeline::init() LLViewerStats::getInstance()->mTrianglesDrawnStat.reset(); resetFrameStats(); - for (U32 i = 0; i < NUM_RENDER_TYPES; ++i) + if (gSavedSettings.getBOOL("DisableAllRenderFeatures")) { - mRenderTypeEnabled[i] = TRUE; //all rendering types start enabled + mRenderDebugFeatureMask = 0x0; + } + else + { + mRenderDebugFeatureMask = 0xffffffff; // By default, all debugging features on } - - mRenderDebugFeatureMask = 0xffffffff; // All debugging features on mRenderDebugMask = 0; // All debug starts off - // Don't turn on ground when this is set - // Mac Books with intel 950s need this - if(!gSavedSettings.getBOOL("RenderGround")) + if (gSavedSettings.getBOOL("DisableAllRenderTypes")) { - toggleRenderType(RENDER_TYPE_GROUND); + clearAllRenderTypes(); + } + else + { + setAllRenderTypes(); // By default, all rendering types start enabled + // Don't turn on ground when this is set + // Mac Books with intel 950s need this + if(!gSavedSettings.getBOOL("RenderGround")) + { + toggleRenderType(RENDER_TYPE_GROUND); + } } // make sure RenderPerformanceTest persists (hackity hack hack) @@ -9945,6 +9955,22 @@ void LLPipeline::clearRenderTypeMask(U32 type, ...) } } +void LLPipeline::setAllRenderTypes() +{ + for (U32 i = 0; i < NUM_RENDER_TYPES; ++i) + { + mRenderTypeEnabled[i] = TRUE; + } +} + +void LLPipeline::clearAllRenderTypes() +{ + for (U32 i = 0; i < NUM_RENDER_TYPES; ++i) + { + mRenderTypeEnabled[i] = FALSE; + } +} + void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color) { DebugBlip blip(position, color); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 6ae482fa06..3536746eb1 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -311,9 +311,12 @@ public: BOOL hasAnyRenderType(const U32 type, ...) const; void setRenderTypeMask(U32 type, ...); - void orRenderTypeMask(U32 type, ...); + // This is equivalent to 'setRenderTypeMask' + //void orRenderTypeMask(U32 type, ...); void andRenderTypeMask(U32 type, ...); void clearRenderTypeMask(U32 type, ...); + void setAllRenderTypes(); + void clearAllRenderTypes(); void pushRenderTypeMask(); void popRenderTypeMask(); |