Merge remote-tracking branch 'origin/release/gltf-maint2' into release/materials_featurette

master
Brad Linden 2024-03-05 11:11:54 -08:00
commit 89b4879627
24 changed files with 189 additions and 19 deletions

View File

@ -24,6 +24,8 @@ jobs:
outputs:
viewer_channel: ${{ steps.build.outputs.viewer_channel }}
viewer_version: ${{ steps.build.outputs.viewer_version }}
viewer_branch: ${{ steps.which-branch.outputs.branch }}
relnotes: ${{ steps.which-branch.outputs.relnotes }}
imagename: ${{ steps.build.outputs.imagename }}
env:
AUTOBUILD_ADDRSIZE: 64
@ -334,7 +336,7 @@ jobs:
version: ${{ needs.build.outputs.viewer_version }}
release:
needs: [sign-and-package-windows, sign-and-package-mac]
needs: [build, sign-and-package-windows, sign-and-package-mac]
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'Second_Life_')
steps:
@ -365,17 +367,31 @@ jobs:
mv newview/viewer_version.txt macOS-viewer_version.txt
# forked from softprops/action-gh-release
- uses: secondlife-3p/action-gh-release@v1
- name: Create GitHub release
id: release
uses: secondlife-3p/action-gh-release@v1
with:
# name the release page for the build number so we can find it
# easily (analogous to looking up a codeticket build page)
name: "v${{ github.run_id }}"
# name the release page for the branch
name: "${{ needs.build.outputs.viewer_branch }}"
# SL-20546: want the channel and version to be visible on the
# release page
body: |
Build ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ needs.build.outputs.viewer_channel }}
${{ needs.build.outputs.viewer_version }}
${{ needs.build.outputs.relnotes }}
prerelease: true
generate_release_notes: true
# the only reason we generate a GH release is to post build products
target_commitish: ${{ github.sha }}
previous_tag: release
append_body: true
fail_on_unmatched_files: true
files: |
*.dmg
*.exe
*-autobuild-package.xml
*-viewer_version.txt
- name: post release URL
run: |
echo "::notice::Release ${{ steps.release.outputs.url }}"

View File

@ -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;
}

View File

@ -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*))

View File

@ -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.

View File

@ -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?

View File

@ -320,6 +320,7 @@ void HttpService::threadRun(LLCoreInt::HttpThread * thread)
LLMemory::logMemoryInfo(TRUE);
//output possible call stacks to log file.
LLError::LLUserWarningMsg::showOutOfMemory();
LLError::LLCallStacks::print();
LL_ERRS() << "Bad memory allocation in HttpService::threadRun()!" << LL_ENDL;

View File

@ -321,6 +321,7 @@ bool LLImageBMP::updateData()
mColorPalette = new(std::nothrow) U8[color_palette_size];
if (!mColorPalette)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Out of memory in LLImageBMP::updateData()" << LL_ENDL;
return false;
}

View File

@ -437,6 +437,7 @@ bool LLImageDXT::convertToDXR()
U8* newdata = (U8*)ll_aligned_malloc_16(total_bytes);
if (!newdata)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Out of memory in LLImageDXT::convertToDXR()" << LL_ENDL;
return false;
}

View File

@ -266,6 +266,7 @@ bool LLImageTGA::updateData()
mColorMap = new(std::nothrow) U8[ color_map_bytes ];
if (!mColorMap)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Out of Memory in bool LLImageTGA::updateData()" << LL_ENDL;
return false;
}

View File

@ -1353,6 +1353,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
@ -1378,6 +1379,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
@ -1406,6 +1408,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}

View File

@ -857,7 +857,7 @@ LLRender::~LLRender()
shutdown();
}
void LLRender::init(bool needs_vertex_buffer)
bool LLRender::init(bool needs_vertex_buffer)
{
#if LL_WINDOWS
if (gGLManager.mHasDebugOutput && gDebugGL)
@ -879,6 +879,13 @@ void LLRender::init(bool needs_vertex_buffer)
// necessary for reflection maps
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
#if LL_WINDOWS
if (glGenVertexArrays == nullptr)
{
return false;
}
#endif
{ //bind a dummy vertex array object so we're core profile compliant
U32 ret;
glGenVertexArrays(1, &ret);
@ -889,6 +896,7 @@ void LLRender::init(bool needs_vertex_buffer)
{
initVertexBuffer();
}
return true;
}
void LLRender::initVertexBuffer()

View File

@ -375,7 +375,7 @@ public:
LLRender();
~LLRender();
void init(bool needs_vertex_buffer);
bool init(bool needs_vertex_buffer);
void initVertexBuffer();
void resetVertexBuffer();
void shutdown();

View File

@ -1553,6 +1553,7 @@ bool LLNotifications::loadTemplates()
if (!success || root.isNull() || !root->hasName( "notifications" ))
{
LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile"));
LL_ERRS() << "Problem reading XML from UI Notifications file: " << base_filename << LL_ENDL;
return false;
}
@ -1563,6 +1564,7 @@ bool LLNotifications::loadTemplates()
if(!params.validateBlock())
{
LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile"));
LL_ERRS() << "Problem reading XUI from UI Notifications file: " << base_filename << LL_ENDL;
return false;
}
@ -1629,6 +1631,7 @@ bool LLNotifications::loadVisibilityRules()
if(!params.validateBlock())
{
LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile"));
LL_ERRS() << "Problem reading UI Notification Visibility Rules file: " << full_filename << LL_ENDL;
return false;
}

View File

@ -2694,6 +2694,7 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length )
char* text = new char[ text_len + 1];
if (text == NULL)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Memory allocation failure." << LL_ENDL;
return FALSE;
}

View File

@ -44,8 +44,13 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set<s
bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root, LLDir::ALL_SKINS);
if (!success)
{
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.";
LLError::LLUserWarningMsg::show(error_string);
gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);
LL_ERRS() << "Couldn't load string table " << xml_filename << ". Please reinstall viewer from https://secondlife.com/support/downloads/ and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
LL_ERRS() << "Couldn't load string table " << xml_filename << " " << errno << LL_ENDL;
return false;
}
@ -60,6 +65,7 @@ bool LLTransUtil::parseLanguageStrings(const std::string& xml_filename)
if (!success)
{
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS() << "Couldn't load localization table " << xml_filename << LL_ENDL;
return false;
}

View File

@ -168,6 +168,7 @@ void LLAppCoreHttp::init()
}
else
{
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS("Init") << "Missing CA File; should be at " << ca_file << LL_ENDL;
}

View File

@ -363,7 +363,6 @@ BOOL gRandomizeFramerate = FALSE;
BOOL gPeriodicSlowFrame = FALSE;
BOOL gCrashOnStartup = FALSE;
BOOL gLLErrorActivated = FALSE;
BOOL gLogoutInProgress = FALSE;
BOOL gSimulateMemLeak = FALSE;
@ -2254,9 +2253,6 @@ void errorCallback(LLError::ELevel level, const std::string &error_string)
OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK);
#endif
//Set the ErrorActivated global so we know to create a marker file
gLLErrorActivated = true;
gDebugInfo["FatalMessage"] = error_string;
// We're not already crashing -- we simply *intend* to crash. Since we
// haven't actually trashed anything yet, we can afford to write the whole
@ -2265,6 +2261,14 @@ void errorCallback(LLError::ELevel level, const std::string &error_string)
}
}
void errorMSG(const std::string& title_string, const std::string& message_string)
{
if (!message_string.empty())
{
OSMessageBox(message_string, title_string.empty() ? LLTrans::getString("MBFatalError") : title_string, OSMB_OK);
}
}
void LLAppViewer::initLoggingAndGetLastDuration()
{
//
@ -2276,6 +2280,8 @@ void LLAppViewer::initLoggingAndGetLastDuration()
LLError::addGenericRecorder(&errorCallback);
//LLError::setTimeFunction(getRuntime);
LLError::LLUserWarningMsg::setHandler(errorMSG);
if (mSecondInstance)
{
@ -2413,6 +2419,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key,
{ // failed to load
if(file.required)
{
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS() << "Error: Cannot load required settings file from: " << full_settings_path << LL_ENDL;
return false;
}
@ -2511,6 +2518,7 @@ bool LLAppViewer::initConfiguration()
if (!success)
{
LL_WARNS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL;
LLError::LLUserWarningMsg::showMissingFiles();
if (gDirUtilp->fileExists(settings_file_list))
{
LL_ERRS() << "Cannot load default configuration file settings_files.xml. "
@ -2534,6 +2542,7 @@ bool LLAppViewer::initConfiguration()
if (!mSettingsLocationList->validateBlock())
{
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS() << "Invalid settings file list " << settings_file_list << LL_ENDL;
}
@ -2968,6 +2977,8 @@ bool LLAppViewer::initConfiguration()
LLEventPumps::instance().obtain("LLControlGroup").post(LLSDMap("init", key));
}
LLError::LLUserWarningMsg::setOutOfMemoryStrings(LLTrans::getString("MBOutOfMemoryTitle"), LLTrans::getString("MBOutOfMemoryErr"));
return true; // Config was successful.
}
@ -3005,6 +3016,7 @@ void LLAppViewer::initStrings()
// initial check to make sure files are there failed
gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS() << "Viewer failed to find localization and UI files."
<< " Please reinstall viewer from https://secondlife.com/support/downloads"
<< " and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
@ -4310,6 +4322,7 @@ void LLAppViewer::loadKeyBindings()
key_bindings_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "key_bindings.xml");
if (!gViewerInput.loadBindingsXML(key_bindings_file))
{
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS("InitInfo") << "Unable to open default key bindings from " << key_bindings_file << LL_ENDL;
}
}
@ -5400,6 +5413,14 @@ void LLAppViewer::forceErrorLLError()
LL_ERRS() << "This is a deliberate llerror" << LL_ENDL;
}
void LLAppViewer::forceErrorLLErrorMsg()
{
LLError::LLUserWarningMsg::show("Deliberate error");
// Note: under debug this will show a message as well,
// but release won't show anything and will quit silently
LL_ERRS() << "This is a deliberate llerror with a message" << LL_ENDL;
}
void LLAppViewer::forceErrorBreakpoint()
{
LL_WARNS() << "Forcing a deliberate breakpoint" << LL_ENDL;

View File

@ -152,6 +152,7 @@ public:
// LLAppViewer testing helpers.
// *NOTE: These will potentially crash the viewer. Only for debugging.
virtual void forceErrorLLError();
virtual void forceErrorLLErrorMsg();
virtual void forceErrorBreakpoint();
virtual void forceErrorBadMemoryAccess();
virtual void forceErrorInfiniteLoop();

View File

@ -339,6 +339,7 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio
}
catch (std::bad_alloc&)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "LLCoros::launch() allocation failure" << LL_ENDL;
}
}
@ -370,6 +371,7 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi
}
catch (std::bad_alloc&)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "LLCoros::launch() allocation failure" << LL_ENDL;
}
}

View File

@ -1360,7 +1360,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry)
U8* buffer = new(std::nothrow) U8[size];
if (!buffer)
{
LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL;
LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL;
return false;
}
LLMeshRepository::sCacheBytesRead += size;
@ -1473,7 +1473,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
U8* buffer = new(std::nothrow) U8[size];
if (!buffer)
{
LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL;
LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL;
return false;
}
LLMeshRepository::sCacheBytesRead += size;
@ -1575,7 +1575,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
U8* buffer = new(std::nothrow) U8[size];
if (!buffer)
{
LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for physics shape, size: " << size << LL_ENDL;
LL_WARNS(LOG_MESH) << "Failed to allocate memory for physics shape, size: " << size << LL_ENDL;
return false;
}
file.read(buffer, size);
@ -1770,7 +1770,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod,
U8* buffer = new(std::nothrow) U8[size];
if (!buffer)
{
LL_WARNS_ONCE(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL;
LL_WARNS(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL;
// todo: for now it will result in indefinite constant retries, should result in timeout
// or in retry-count and disabling mesh. (but usually viewer is beyond saving at this point)
return false;

View File

@ -289,6 +289,7 @@ void handle_disconnect_viewer(void *);
void force_error_breakpoint(void *);
void force_error_llerror(void *);
void force_error_llerror_msg(void*);
void force_error_bad_memory_access(void *);
void force_error_infinite_loop(void *);
void force_error_software_exception(void *);
@ -2414,6 +2415,15 @@ class LLAdvancedForceErrorLlerror : public view_listener_t
}
};
class LLAdvancedForceErrorLlerrorMsg: public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
force_error_llerror_msg(NULL);
return true;
}
};
class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -8393,6 +8403,11 @@ void force_error_llerror(void *)
LLAppViewer::instance()->forceErrorLLError();
}
void force_error_llerror_msg(void*)
{
LLAppViewer::instance()->forceErrorLLErrorMsg();
}
void force_error_bad_memory_access(void *)
{
LLAppViewer::instance()->forceErrorBadMemoryAccess();
@ -9619,6 +9634,7 @@ void initialize_menus()
// Advanced > Debugging
view_listener_t::addMenu(new LLAdvancedForceErrorBreakpoint(), "Advanced.ForceErrorBreakpoint");
view_listener_t::addMenu(new LLAdvancedForceErrorLlerror(), "Advanced.ForceErrorLlerror");
view_listener_t::addMenu(new LLAdvancedForceErrorLlerrorMsg(), "Advanced.ForceErrorLlerrorMsg");
view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccess(), "Advanced.ForceErrorBadMemoryAccess");
view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccessCoro(), "Advanced.ForceErrorBadMemoryAccessCoro");
view_listener_t::addMenu(new LLAdvancedForceErrorInfiniteLoop(), "Advanced.ForceErrorInfiniteLoop");

View File

@ -1957,7 +1957,11 @@ LLViewerWindow::LLViewerWindow(const Params& p)
// Initialize OpenGL Renderer
LLVertexBuffer::initClass(mWindow);
LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ;
gGL.init(true);
if (!gGL.init(true))
{
LLError::LLUserWarningMsg::show(LLTrans::getString("MBVideoDrvErr"));
LL_ERRS() << "gGL not initialized" << LL_ENDL;
}
if (LLFeatureManager::getInstance()->isSafe()
|| (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())

View File

@ -2716,6 +2716,12 @@ function="World.EnvPreset"
<menu_item_call.on_click
function="Advanced.ForceErrorLlerror" />
</menu_item_call>
<menu_item_call
label="Force LLError, Message And Crash"
name="Force LLError And Crash">
<menu_item_call.on_click
function="Advanced.ForceErrorLlerrorMsg" />
</menu_item_call>
<menu_item_call
label="Force Bad Memory Access"
name="Force Bad Memory Access">

View File

@ -3019,8 +3019,19 @@ Running in window.
If you continue to receive this message, contact the [SUPPORT_SITE].
</string>
<string name="MBOutOfMemoryTitle">Out Of Memory</string>
<string name="MBOutOfMemoryErr">
[APP_NAME]'s request for memory failed. Application can't proceed and will be closed.
<!-- Avatar Shape Information -->
If your computer's RAM is low, quit any heavy applications before runing Second Life, allocate a page file or reduce graphical settings like draw distance.
</string>
<string name="MBMissingFile">
[APP_NAME] couldn't access or find some of the files it needs and will be closed.
Please reinstall viewer from https://secondlife.com/support/downloads/ and contact https://support.secondlife.com if issue persists after reinstall.
</string>
<!-- Avatar Shape Information -->
<string name="5 O'Clock Shadow">5 O'Clock Shadow</string>
<string name="All White">All White</string>