diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-07-01 13:31:14 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-07-01 13:31:14 +0800 |
commit | 29d68ecb229ecb19e6d0da4cf5fbd8e3bbdde2cf (patch) | |
tree | e60f85379679aa2b07c8a17a1fcd4954572149c2 /indra/newview/llappviewer.cpp | |
parent | a38b53cc5f456593e8ca21c5d5e20542c1723525 (diff) | |
parent | 1478ec8e9c50eba8b3a64fb9c2fc54a3a328510b (diff) |
Merge branch 'main' into maint-b
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index b60efb1330..768d131073 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -138,7 +138,11 @@ #include "vlc/libvlc_version.h" #if LL_DARWIN +#if LL_SDL #include "llwindowsdl.h" +#else +#include "llwindowmacosx.h" +#endif // LL_SDL #endif // Third party library includes @@ -385,7 +389,6 @@ static std::string gLaunchFileOnQuit; // Used on Win32 for other apps to identify our window (eg, win_setup) const char* const VIEWER_WINDOW_CLASSNAME = "Second Life"; -U64 fpsLimitSleepUntil = 0; // fps limiter : time until to render the frame again //---------------------------------------------------------------------------- @@ -563,7 +566,11 @@ static void settings_to_globals() LLWorldMapView::setScaleSetting(gSavedSettings.getF32("MapScale")); #if LL_DARWIN +#if LL_SDL LLWindowSDL::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL"); +#else + LLWindowMacOSX::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL"); +#endif // LL_SDL gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI"); #endif } @@ -1129,7 +1136,7 @@ bool LLAppViewer::init() gGLActive = FALSE; -#if LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX +#if 0 // LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX // Skip updater if this is a non-interactive instance if (!gSavedSettings.getBOOL("CmdLineSkipUpdater") && !gNonInteractive) { @@ -1361,21 +1368,11 @@ bool LLAppViewer::frame() bool LLAppViewer::doFrame() { + static LLCachedControl<U32> fpsLimitMaxFps(gSavedSettings, "MaxFPS", 0); - // FPS Limit - - U64 fpsLimitNow = LLTrace::BlockTimer::getCPUClockCount64(); - U64 fpsLimitFrameStartTime = fpsLimitNow; - if(fpsLimitSleepUntil > 0) - { - if(fpsLimitSleepUntil > fpsLimitNow) return 0; - } - else - { - fpsLimitSleepUntil = 0; - } - - + U64 fpsLimitSleepFor = 0; + U64 fpsLimitFrameStartTime = 0; + if(fpsLimitMaxFps > 0) fpsLimitFrameStartTime = LLTrace::BlockTimer::getCPUClockCount64(); LL_RECORD_BLOCK_TIME(FTM_FRAME); { @@ -1547,24 +1544,17 @@ bool LLAppViewer::doFrame() } } - // fps limiter - - fpsLimitNow = LLTrace::BlockTimer::getCPUClockCount64(); - U64 fpsLimitFrameTime = fpsLimitNow - fpsLimitFrameStartTime; - static LLCachedControl<U32> fpsLimitMaxFps(gSavedSettings, "MaxFPS", 0); - if(fpsLimitMaxFps > 0) { + U64 fpsLimitFrameTime = LLTrace::BlockTimer::getCPUClockCount64() - fpsLimitFrameStartTime; U64 desired_time_ns = (U32)(1000000.f / fpsLimitMaxFps); - if(fpsLimitFrameTime < desired_time_ns) + if((fpsLimitFrameTime+1000) < desired_time_ns) { - U64 fpsLimitSleepUntil_for = desired_time_ns - fpsLimitFrameTime; - fpsLimitSleepUntil = LLTrace::BlockTimer::getCPUClockCount64() + fpsLimitSleepUntil_for; + fpsLimitSleepFor = (desired_time_ns - fpsLimitFrameTime - 1000) * 1.0; } } - { LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df pauseMainloopTimeout" ) pingMainloopTimeout("Main:Sleep"); @@ -1577,6 +1567,11 @@ bool LLAppViewer::doFrame() //LL_RECORD_BLOCK_TIME(SLEEP2); LL_PROFILE_ZONE_WARN( "Sleep2" ) + if(fpsLimitSleepFor) + { + usleep(fpsLimitSleepFor); + } + // yield some time to the os based on command line option static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1); if(yield_time >= 0) |