summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp56
1 files changed, 33 insertions, 23 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 32f4421ce2..551d4fc5d9 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -305,6 +305,7 @@ extern bool gDebugGL;
#if LL_DARWIN
extern bool gHiDPISupport;
+extern bool gHDRDisplaySupport;
#endif
////////////////////////////////////////////////////////////
@@ -596,6 +597,7 @@ static void settings_to_globals()
LLWindowMacOSX::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL");
#endif // LL_SDL
gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI");
+ gHDRDisplaySupport = gSavedSettings.getBOOL("MPHDRDisplay");
#endif
}
@@ -607,6 +609,8 @@ static void settings_modify()
LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor");
LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4]
gDebugGL = gDebugGLSession || gDebugSession;
+ bool noGLDebug = gSavedSettings.getBOOL("MPNoGLDebug");
+ if(noGLDebug) gDebugGL = false;
gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline");
}
@@ -1310,11 +1314,15 @@ void LLAppViewer::initMaxHeapSize()
//------------------------------------------------------------------------------------------
//currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB.
- #ifndef LL_X86_64
+/*
+#ifndef LL_X86_64
F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ;
#else
+*/
F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize64");
+/*
#endif
+*/
LLMemory::initMaxHeapSizeGB(max_heap_size_gb);
}
@@ -1366,12 +1374,11 @@ bool LLAppViewer::frame()
bool LLAppViewer::doFrame()
{
U32 fpsLimitMaxFps = (U32)gSavedSettings.getU32("MaxFPS");
- if(fpsLimitMaxFps>120) fpsLimitMaxFps=0;
+ if(fpsLimitMaxFps > 120) fpsLimitMaxFps = 0;
using TimePoint = std::chrono::steady_clock::time_point;
-
- U64 fpsLimitSleepFor = 0;
- TimePoint fpsLimitFrameStartTime = std::chrono::steady_clock::now();
+ U64 additionalSleepTime = 0;
+ TimePoint frameStartTime = std::chrono::steady_clock::now();
#ifdef LL_DISCORD
{
@@ -1550,18 +1557,6 @@ bool LLAppViewer::doFrame()
}
}
- if(fpsLimitMaxFps > 0)
- {
- auto elapsed = std::chrono::steady_clock::now() - fpsLimitFrameStartTime;
-
- long long fpsLimitFrameTime = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
- U64 desired_time_us = (U32)(1000000.f / fpsLimitMaxFps);
- if((fpsLimitFrameTime+1000) < desired_time_us)
- {
- fpsLimitSleepFor = (desired_time_us - fpsLimitFrameTime - 1000) * 1.0;
- }
- }
-
{
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df pauseMainloopTimeout");
pingMainloopTimeout("Main:Sleep");
@@ -1574,13 +1569,25 @@ bool LLAppViewer::doFrame()
//LL_RECORD_BLOCK_TIME(SLEEP2);
LL_PROFILE_ZONE_WARN("Sleep2");
- if(fpsLimitSleepFor)
+ auto elapsed = std::chrono::steady_clock::now() - frameStartTime;
+ long long frameTime = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
+
+ if(fpsLimitMaxFps > 0)
{
-#if LL_WINDOWS
- std::this_thread::sleep_for(std::chrono::microseconds(fpsLimitSleepFor));
-#else
- usleep(fpsLimitSleepFor);
-#endif
+ U64 desired_time_us = (U32)(1000000.f / fpsLimitMaxFps);
+ if((frameTime+1000) < desired_time_us)
+ {
+ additionalSleepTime = 0.92 * (F64)(desired_time_us - frameTime);
+ if(additionalSleepTime < 200)
+ {
+ additionalSleepTime = 0;
+ }
+ }
+ }
+
+ if(additionalSleepTime > 0)
+ {
+ std::this_thread::sleep_for(std::chrono::microseconds(additionalSleepTime));
}
// yield some time to the os based on command line option
@@ -1676,6 +1683,9 @@ bool LLAppViewer::doFrame()
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df resumeMainloopTimeout");
resumeMainloopTimeout();
}
+
+ //swap();
+
pingMainloopTimeout("Main:End");
}
}