Commit d1678031 authored by NiranV's avatar NiranV
Browse files

Fixed: Undo fix that fixed the FPS limiter working for anything but Intel GPU's.

parent ea5b867d
......@@ -715,7 +715,9 @@ LLAppViewer::LLAppViewer()
mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)),
mFastTimerLogThread(NULL),
mSettingsLocationList(NULL),
mIsFirstRun(false)
mIsFirstRun(false),
//BD - FPS Limiter
mMinMicroSecPerFrame(0.f)
{
if(NULL != sInstance)
{
......@@ -1281,6 +1283,11 @@ bool LLAppViewer::init()
//BD
gJoystick->setNeedsReset(true);
/*----------------------------------------------------------------------*/
//BD - FPS Limiter
gSavedSettings.getControl("FramePerSecondLimit")->getSignal()->connect(boost::bind(&LLAppViewer::onChangeFrameLimit, this, _2));
onChangeFrameLimit(gSavedSettings.getLLSD("FramePerSecondLimit"));
return true;
}
......@@ -1530,6 +1537,22 @@ bool LLAppViewer::doFrame()
display();
//BD - FPS Limiter
static U64 last_call = 0;
if (!gTeleportDisplay) // SL-10625...throttle early, throttle often with Intel
{
// Frame/draw throttling
U64 elapsed_time = LLTimer::getTotalTime() - last_call;
if (elapsed_time < mMinMicroSecPerFrame)
{
LL_RECORD_BLOCK_TIME(FTM_SLEEP);
// llclamp for when time function gets funky
U64 sleep_time = llclamp(mMinMicroSecPerFrame - elapsed_time, (U64)1, (U64)1e6);
micro_sleep(sleep_time, 0);
}
}
last_call = LLTimer::getTotalTime();
pingMainloopTimeout("Main:Snapshot");
LLFloaterSnapshot::update(); // take snapshots
LLFloaterOutfitSnapshot::update();
......@@ -5568,6 +5591,20 @@ void LLAppViewer::disconnectViewer()
LLUrlEntryParcel::setDisconnected(gDisconnected);
}
//BD - FPS Limiter
bool LLAppViewer::onChangeFrameLimit(LLSD const & evt)
{
if (evt.asInteger() > 0)
{
mMinMicroSecPerFrame = (U64)(1000000.0f / F32(evt.asInteger()));
}
else
{
mMinMicroSecPerFrame = 0;
}
return false;
}
void LLAppViewer::forceErrorLLError()
{
LL_ERRS() << "This is a deliberate llerror" << LL_ENDL;
......
......@@ -260,6 +260,9 @@ class LLAppViewer : public LLApp
void sendLogoutRequest();
void disconnectViewer();
//BD - FPS Limiter
bool onChangeFrameLimit(LLSD const & evt);
// *FIX: the app viewer class should be some sort of singleton, no?
// Perhaps its child class is the singleton and this should be an abstract base.
static LLAppViewer* sInstance;
......@@ -322,6 +325,8 @@ class LLAppViewer : public LLApp
LLAppCoreHttp mAppCoreHttp;
bool mIsFirstRun;
//BD - FPS Limiter
U64 mMinMicroSecPerFrame; // frame throttling
};
// consts from viewer.h
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment