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.cpp92
1 files changed, 78 insertions, 14 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index ac9464d86e..98a1fd740b 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -131,13 +131,17 @@
#include "stringize.h"
#include "llcoros.h"
#include "llexception.h"
-#if !LL_LINUX
+#if !_M_ARM64 // !LL_LINUX
#include "cef/dullahan_version.h"
#include "vlc/libvlc_version.h"
#endif // LL_LINUX
#if LL_DARWIN
+#if LL_SDL
+#include "llwindowsdl.h"
+#else
#include "llwindowmacosx.h"
+#endif // LL_SDL
#endif
// Third party library includes
@@ -250,6 +254,11 @@ using namespace LL;
#include "llcoproceduremanager.h"
#include "llviewereventrecorder.h"
+#include <chrono>
+#include "rlvactions.h"
+#include "rlvcommon.h"
+#include "rlvhandler.h"
+
// *FIX: These extern globals should be cleaned up.
// The globals either represent state/config/resource-storage of either
// this app, or another 'component' of the viewer. App globals should be
@@ -264,9 +273,10 @@ using namespace LL;
// define a self-registering event API object
#include "llappviewerlistener.h"
-#if LL_LINUX && LL_GTK
-#include "glib.h"
-#endif // (LL_LINUX) && LL_GTK
+#if LL_MSVC
+// disable boost::lexical_cast warning
+#pragma warning (disable:4702)
+#endif
#ifdef LL_DISCORD
#define DISCORDPP_IMPLEMENTATION
@@ -295,6 +305,7 @@ extern bool gDebugGL;
#if LL_DARWIN
extern bool gHiDPISupport;
+extern bool gHDRDisplaySupport;
#endif
////////////////////////////////////////////////////////////
@@ -316,6 +327,8 @@ LLUUID gLastAgentSessionId;
# define LL_PLATFORM_KEY "mac"
#elif LL_LINUX
# define LL_PLATFORM_KEY "lnx"
+#elif __FreeBSD__
+# define LL_PLATFORM_KEY "bsd"
#else
# error "Unknown Platform"
#endif
@@ -386,6 +399,7 @@ 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";
+
//----------------------------------------------------------------------------
// List of entries from strings.xml to always replace
@@ -544,11 +558,13 @@ static void settings_to_globals()
{
LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
-#if LL_DARWIN
+//#if LL_DARWIN
LLRender::sGLCoreProfile = true;
+/*
#else
LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLContextCoreProfile");
#endif
+*/
LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport");
LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures");
@@ -575,8 +591,13 @@ 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");
+ gHDRDisplaySupport = gSavedSettings.getBOOL("MPHDRDisplay");
#endif
}
@@ -588,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");
}
@@ -680,7 +703,7 @@ LLAppViewer::LLAppViewer()
// Need to do this initialization before we do anything else, since anything
// that touches files should really go through the lldir API
- gDirUtilp->initAppDirs("SecondLife");
+ gDirUtilp->initAppDirs("Megapahit");
//
// IMPORTANT! Do NOT put anything that will write
// into the log files during normal startup until AFTER
@@ -912,7 +935,7 @@ bool LLAppViewer::init()
std::string mime_types_name;
#if LL_DARWIN
mime_types_name = "mime_types_mac.xml";
-#elif LL_LINUX
+#elif LL_LINUX || __FreeBSD__
mime_types_name = "mime_types_linux.xml";
#else
mime_types_name = "mime_types.xml";
@@ -993,6 +1016,7 @@ bool LLAppViewer::init()
return false;
}
+#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || _M_X64
// Without SSE2 support we will crash almost immediately, warn here.
if (!gSysCPU.hasSSE2())
{
@@ -1004,6 +1028,7 @@ bool LLAppViewer::init()
// quit immediately
return false;
}
+#endif
// alert the user if they are using unsupported hardware
if (!gSavedSettings.getBOOL("AlertedUnsupportedHardware"))
@@ -1111,7 +1136,7 @@ bool LLAppViewer::init()
gGLActive = false;
-#if LL_RELEASE_FOR_DOWNLOAD
+#if 0 // LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX
// Skip updater if this is a non-interactive instance
if (!gSavedSettings.getBOOL("CmdLineSkipUpdater") && !gNonInteractive)
{
@@ -1289,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);
}
@@ -1344,6 +1373,13 @@ bool LLAppViewer::frame()
bool LLAppViewer::doFrame()
{
+ U32 fpsLimitMaxFps = (U32)gSavedSettings.getU32("MaxFPS");
+ if(fpsLimitMaxFps > 120) fpsLimitMaxFps = 0;
+
+ using TimePoint = std::chrono::steady_clock::time_point;
+ U64 additionalSleepTime = 0;
+ TimePoint frameStartTime = std::chrono::steady_clock::now();
+
#ifdef LL_DISCORD
{
LL_PROFILE_ZONE_NAMED("discord_callbacks");
@@ -1533,6 +1569,27 @@ bool LLAppViewer::doFrame()
//LL_RECORD_BLOCK_TIME(SLEEP2);
LL_PROFILE_ZONE_WARN("Sleep2");
+ auto elapsed = std::chrono::steady_clock::now() - frameStartTime;
+ long long frameTime = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
+
+ if(fpsLimitMaxFps > 0)
+ {
+ 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
static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1);
if(yield_time >= 0)
@@ -1626,6 +1683,9 @@ bool LLAppViewer::doFrame()
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df resumeMainloopTimeout");
resumeMainloopTimeout();
}
+
+ //swap();
+
pingMainloopTimeout("Main:End");
}
}
@@ -1699,6 +1759,9 @@ bool LLAppViewer::cleanup()
//ditch LLVOAvatarSelf instance
gAgentAvatarp = NULL;
+ // Sanity check to catch cases where someone forgot to do an RlvActions::isRlvEnabled() check
+ LL_ERRS_IF(!RlvHandler::isEnabled() && RlvHandler::instanceExists()) << "RLV handler instance exists even though RLVa is disabled" << LL_ENDL;
+
LLNotifications::instance().clear();
// workaround for DEV-35406 crash on shutdown
@@ -1722,7 +1785,7 @@ bool LLAppViewer::cleanup()
// one because it happens just after mFastTimerLogThread is deleted. This
// comment is in case we guessed wrong, so we can move it here instead.
-#if LL_LINUX
+#if LL_LINUX || __FreeBSD__
// remove any old breakpad minidump files from the log directory
if (! isError())
{
@@ -3373,6 +3436,7 @@ LLSD LLAppViewer::getViewerInfo() const
}
#endif
+ info["RLV_VERSION"] = RlvActions::isRlvEnabled() ? Rlv::Strings::getVersionAbout() : "(disabled)";
info["OPENGL_VERSION"] = ll_safe_string((const char*)(glGetString(GL_VERSION)));
// Settings
@@ -3418,7 +3482,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
}
-#if !LL_LINUX
+#if !_M_ARM64 // !LL_LINUX
std::ostringstream cef_ver_codec;
cef_ver_codec << "Dullahan: ";
cef_ver_codec << DULLAHAN_VERSION_MAJOR;
@@ -3448,7 +3512,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["LIBCEF_VERSION"] = "Undefined";
#endif
-#if !LL_LINUX
+#if !_M_ARM64 // !LL_LINUX
std::ostringstream vlc_ver_codec;
vlc_ver_codec << LIBVLC_VERSION_MAJOR;
vlc_ver_codec << ".";
@@ -5646,7 +5710,7 @@ void LLAppViewer::forceErrorBreakpoint()
LL_WARNS() << "Forcing a deliberate breakpoint" << LL_ENDL;
#ifdef LL_WINDOWS
DebugBreak();
-#else
+#elif __i386__ || __x86_64__
asm ("int $3");
#endif
return;
@@ -5951,7 +6015,7 @@ void LLAppViewer::initDiscordSocial()
gDiscordPartyMaxSize = 0;
gDiscordTimestampsStart = time(nullptr);
gDiscordClient = std::make_shared<discordpp::Client>();
- gDiscordClient->SetApplicationId(1394782217405862001);
+ gDiscordClient->SetApplicationId(1393451183741599796);
updateDiscordActivity();
}