summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-03-27 01:40:12 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-03-27 01:40:12 +0200
commit990c8b81dad8bd0580c2c48f77e99b3ac53e581e (patch)
tree876030bddc3b9e6cd885f829fb4a071aea309508 /indra/llcommon
parentf815b015cecda18098dd2d16f65682a37e1bff7c (diff)
parent9567393f803dfb0c786b8e917e41c8f4b8b22af7 (diff)
Merge branch 'main' into marchcat/yz-merge
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/indra_constants.cpp6
-rw-r--r--indra/llcommon/indra_constants.h5
-rw-r--r--indra/llcommon/llcoros.cpp1
-rw-r--r--indra/llcommon/llerror.cpp42
-rw-r--r--indra/llcommon/llerror.h23
-rw-r--r--indra/llcommon/llexception.cpp1
-rw-r--r--indra/llcommon/llsingleton.h2
7 files changed, 79 insertions, 1 deletions
diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp
index 1b48e4daf3..9a0c565b06 100644
--- a/indra/llcommon/indra_constants.cpp
+++ b/indra/llcommon/indra_constants.cpp
@@ -50,6 +50,7 @@ const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver
const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector
const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver
const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
+const LLUUID IMG_WHITE ("5748decc-f629-461c-9a36-a35a221fe21f"); // dataserver
const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver
const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver
@@ -71,6 +72,11 @@ const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // V
const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
+const LLUUID DEFAULT_OBJECT_TEXTURE ("89556747-24cb-43ed-920b-47caed15465f"); // On dataserver
+const LLUUID DEFAULT_OBJECT_SPECULAR ("87e0e8f7-8729-1ea8-cfc9-8915773009db"); // On dataserver
+const LLUUID DEFAULT_OBJECT_NORMAL ("85f28839-7a1c-b4e3-d71d-967792970a7b"); // On dataserver
+const LLUUID BLANK_OBJECT_NORMAL ("5b53359e-59dd-d8a2-04c3-9e65134da47a"); // VIEWER (has a verion on dataserver, but with compression artifacts)
+
const LLUUID IMG_USE_BAKED_HEAD ("5a9f4a74-30f2-821c-b88d-70499d3e7183");
const LLUUID IMG_USE_BAKED_UPPER ("ae2de45c-d252-50b8-5c6e-19f39ce79317");
const LLUUID IMG_USE_BAKED_LOWER ("24daea5f-0539-cfcf-047f-fbc40b2786ba");
diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h
index 679f79039b..a16cfac2b9 100644
--- a/indra/llcommon/indra_constants.h
+++ b/indra/llcommon/indra_constants.h
@@ -197,6 +197,7 @@ LL_COMMON_API extern const LLUUID IMG_FIRE;
LL_COMMON_API extern const LLUUID IMG_FACE_SELECT;
LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR;
LL_COMMON_API extern const LLUUID IMG_INVISIBLE;
+LL_COMMON_API extern const LLUUID IMG_WHITE;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2;
@@ -230,6 +231,10 @@ LL_COMMON_API extern const LLUUID IMG_USE_BAKED_AUX3;
LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL;
+LL_COMMON_API extern const LLUUID DEFAULT_OBJECT_TEXTURE;
+LL_COMMON_API extern const LLUUID DEFAULT_OBJECT_SPECULAR;
+LL_COMMON_API extern const LLUUID DEFAULT_OBJECT_NORMAL;
+LL_COMMON_API extern const LLUUID BLANK_OBJECT_NORMAL;
// radius within which a chat message is fully audible
const F32 CHAT_NORMAL_RADIUS = 20.f;
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index 3ab97b557f..1d383f174d 100644
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -278,6 +278,7 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl
catch (std::bad_alloc&)
{
// Out of memory on stack allocation?
+ LLError::LLUserWarningMsg::showOutOfMemory();
printActiveCoroutines();
LL_ERRS("LLCoros") << "Bad memory allocation in LLCoros::launch(" << prefix << ")!" << LL_ENDL;
}
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 4268f107e9..0f48ce16b2 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1601,6 +1601,48 @@ namespace LLError
{
return out << boost::stacktrace::stacktrace();
}
+
+ // LLOutOfMemoryWarning
+ std::string LLUserWarningMsg::sLocalizedOutOfMemoryTitle;
+ std::string LLUserWarningMsg::sLocalizedOutOfMemoryWarning;
+ LLUserWarningMsg::Handler LLUserWarningMsg::sHandler;
+
+ void LLUserWarningMsg::show(const std::string& message)
+ {
+ if (sHandler)
+ {
+ sHandler(std::string(), message);
+ }
+ }
+
+ void LLUserWarningMsg::showOutOfMemory()
+ {
+ if (sHandler && !sLocalizedOutOfMemoryTitle.empty())
+ {
+ sHandler(sLocalizedOutOfMemoryTitle, sLocalizedOutOfMemoryWarning);
+ }
+ }
+
+ void LLUserWarningMsg::showMissingFiles()
+ {
+ // Files Are missing, likely can't localize.
+ const std::string error_string =
+ "Second Life viewer couldn't access some of the files it needs and will be closed."
+ "\n\nPlease reinstall viewer from https://secondlife.com/support/downloads/ and "
+ "contact https://support.secondlife.com if issue persists after reinstall.";
+ sHandler("Missing Files", error_string);
+ }
+
+ void LLUserWarningMsg::setHandler(const LLUserWarningMsg::Handler &handler)
+ {
+ sHandler = handler;
+ }
+
+ void LLUserWarningMsg::setOutOfMemoryStrings(const std::string& title, const std::string& message)
+ {
+ sLocalizedOutOfMemoryTitle = title;
+ sLocalizedOutOfMemoryWarning = message;
+ }
}
void crashdriver(void (*callback)(int*))
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 05dd88ee51..6f6b349cf5 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -39,6 +39,7 @@
#include "llpreprocessor.h"
#include <boost/static_assert.hpp>
+#include <functional> // std::function
const int LL_ERR_NOERR = 0;
@@ -301,6 +302,28 @@ namespace LLError
{
friend std::ostream& operator<<(std::ostream& out, const LLStacktrace&);
};
+
+ // Provides access to OS notification popup on error, since
+ // not everything has access to OS's messages
+ class LLUserWarningMsg
+ {
+ public:
+ typedef std::function<void(const std::string&, const std::string&)> Handler;
+ static void setHandler(const Handler&);
+ static void setOutOfMemoryStrings(const std::string& title, const std::string& message);
+
+ // When viewer encounters bad alloc or can't access files try warning user about reasons
+ static void showOutOfMemory();
+ static void showMissingFiles();
+ // Genering error
+ static void show(const std::string&);
+
+ private:
+ // needs to be preallocated before viewer runs out of memory
+ static std::string sLocalizedOutOfMemoryTitle;
+ static std::string sLocalizedOutOfMemoryWarning;
+ static Handler sHandler;
+ };
}
//this is cheaper than llcallstacks if no need to output other variables to call stacks.
diff --git a/indra/llcommon/llexception.cpp b/indra/llcommon/llexception.cpp
index 46560b5e4c..0787bde57f 100644
--- a/indra/llcommon/llexception.cpp
+++ b/indra/llcommon/llexception.cpp
@@ -37,6 +37,7 @@
#include "llerror.h"
#include "llerrorcontrol.h"
+
// used to attach and extract stacktrace information to/from boost::exception,
// see https://www.boost.org/doc/libs/release/doc/html/stacktrace/getting_started.html#stacktrace.getting_started.exceptions_with_stacktrace
// apparently the struct passed as the first template param needs no definition?
diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h
index cbe5ab6406..64027c16c7 100644
--- a/indra/llcommon/llsingleton.h
+++ b/indra/llcommon/llsingleton.h
@@ -455,7 +455,7 @@ public:
static DERIVED_TYPE* getInstance()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD;
+ //LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; // TODO -- reenable this when we have a fix for using Tracy with coroutines
// We know the viewer has LLSingleton dependency circularities. If you
// feel strongly motivated to eliminate them, cheers and good luck.
// (At that point we could consider a much simpler locking mechanism.)