summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewerlistener.cpp13
-rw-r--r--indra/newview/llfeaturemanager.cpp2
-rw-r--r--indra/newview/llglsandbox.cpp2
-rw-r--r--indra/newview/llluamanager.cpp2
-rw-r--r--indra/newview/llpanelemojicomplete.cpp3
-rw-r--r--indra/newview/llurldispatcher.cpp9
-rw-r--r--indra/newview/llviewerdisplay.cpp102
-rw-r--r--indra/newview/llviewermedia.cpp3
-rw-r--r--indra/newview/scripts/lua/frame_profile.lua24
-rw-r--r--indra/newview/scripts/lua/frame_profile_quit.lua25
-rw-r--r--indra/newview/scripts/lua/require/LLAgent.lua9
-rw-r--r--indra/newview/scripts/lua/test_animation.lua28
-rw-r--r--indra/newview/tests/llluamanager_test.cpp2
-rwxr-xr-xindra/newview/viewer_manifest.py6
14 files changed, 177 insertions, 53 deletions
diff --git a/indra/newview/llappviewerlistener.cpp b/indra/newview/llappviewerlistener.cpp
index d02b1b4a79..4690c91b61 100644
--- a/indra/newview/llappviewerlistener.cpp
+++ b/indra/newview/llappviewerlistener.cpp
@@ -35,6 +35,7 @@
// external library headers
// other Linden headers
#include "llappviewer.h"
+#include "workqueue.h"
LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
LLEventAPI("LLAppViewer",
@@ -56,17 +57,23 @@ LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
void LLAppViewerListener::userQuit(const LLSD& event)
{
LL_INFOS() << "Listener requested user quit" << LL_ENDL;
- mAppViewerGetter()->userQuit();
+ // Trying to engage this from (e.g.) a Lua-hosting C++ coroutine runs
+ // afoul of an assert in the logging machinery that LLMutex must be locked
+ // only from the main coroutine.
+ LL::WorkQueue::getInstance("mainloop")->post(
+ [appviewer=mAppViewerGetter()]{ appviewer->userQuit(); });
}
void LLAppViewerListener::requestQuit(const LLSD& event)
{
LL_INFOS() << "Listener requested quit" << LL_ENDL;
- mAppViewerGetter()->requestQuit();
+ LL::WorkQueue::getInstance("mainloop")->post(
+ [appviewer=mAppViewerGetter()]{ appviewer->requestQuit(); });
}
void LLAppViewerListener::forceQuit(const LLSD& event)
{
LL_INFOS() << "Listener requested force quit" << LL_ENDL;
- mAppViewerGetter()->forceQuit();
+ LL::WorkQueue::getInstance("mainloop")->post(
+ [appviewer=mAppViewerGetter()]{ appviewer->forceQuit(); });
}
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index aa04221f4b..dded4d1e92 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -393,7 +393,7 @@ F32 logExceptionBenchmark()
__except (msc_exception_filter(GetExceptionCode(), GetExceptionInformation()))
{
// HACK - ensure that profiling is disabled
- LLGLSLShader::finishProfile(false);
+ LLGLSLShader::finishProfile();
// convert to C++ styled exception
char integer_string[32];
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 0248f5710f..fc02220808 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -923,7 +923,7 @@ struct ShaderProfileHelper
}
~ShaderProfileHelper()
{
- LLGLSLShader::finishProfile(false);
+ LLGLSLShader::finishProfile();
}
};
diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp
index 6a725e785f..0bd21516bc 100644
--- a/indra/newview/llluamanager.cpp
+++ b/indra/newview/llluamanager.cpp
@@ -65,7 +65,7 @@ lua_function(sleep, "sleep(seconds): pause the running coroutine")
// This function consumes ALL Lua stack arguments and returns concatenated
// message string
-std::string lua_print_msg(lua_State* L, const std::string_view& level)
+std::string lua_print_msg(lua_State* L, std::string_view level)
{
// On top of existing Lua arguments, we're going to push tostring() and
// duplicate each existing stack entry so we can stringize each one.
diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp
index cb89a5910e..7f72677e34 100644
--- a/indra/newview/llpanelemojicomplete.cpp
+++ b/indra/newview/llpanelemojicomplete.cpp
@@ -280,8 +280,7 @@ void LLPanelEmojiComplete::onCommit()
{
if (mCurSelected < mTotalEmojis)
{
- LLSD value(wstring_to_utf8str(LLWString(1, mEmojis[mCurSelected].Character)));
- setValue(value);
+ setValue(ll_convert_to<std::string>(mEmojis[mCurSelected].Character));
LLUICtrl::onCommit();
}
}
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 39a9f0f8bc..166542324d 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -289,6 +289,8 @@ public:
LLEventAPI::add("teleport",
"Teleport to specified [\"regionname\"] at\n"
"specified region-relative [\"x\"], [\"y\"], [\"z\"].\n"
+ "If [\"regionname\"] is \"home\", ignore [\"x\"], [\"y\"], [\"z\"]\n"
+ "and teleport home.\n"
"If [\"regionname\"] omitted, teleport to GLOBAL\n"
"coordinates [\"x\"], [\"y\"], [\"z\"].",
&LLTeleportHandler::from_event);
@@ -328,7 +330,12 @@ public:
void from_event(const LLSD& params) const
{
Response response(LLSD(), params);
- if (params.has("regionname"))
+ if (params["regionname"].asString() == "home")
+ {
+ gAgent.teleportHome();
+ response["message"] = "Teleporting home";
+ }
+ else if (params.has("regionname"))
{
// region specified, coordinates (if any) are region-local
LLVector3 local_pos(
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 301ea5c5f6..fdfe477a6c 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -28,58 +28,69 @@
#include "llviewerdisplay.h"
-#include "llgl.h"
-#include "llrender.h"
-#include "llglheaders.h"
-#include "llgltfmateriallist.h"
+#include "fsyspath.h"
+#include "hexdump.h"
#include "llagent.h"
#include "llagentcamera.h"
-#include "llviewercontrol.h"
+#include "llappviewer.h"
#include "llcoord.h"
#include "llcriticaldamp.h"
+#include "llcubemap.h"
#include "lldir.h"
-#include "lldynamictexture.h"
#include "lldrawpoolalpha.h"
+#include "lldrawpoolbump.h"
+#include "lldrawpoolwater.h"
+#include "lldynamictexture.h"
+#include "llenvironment.h"
+#include "llfasttimer.h"
#include "llfeaturemanager.h"
-//#include "llfirstuse.h"
+#include "llfloatertools.h"
+#include "llfocusmgr.h"
+#include "llgl.h"
+#include "llglheaders.h"
+#include "llgltfmateriallist.h"
#include "llhudmanager.h"
#include "llimagepng.h"
+#include "llmachineid.h"
#include "llmemory.h"
+#include "llparcel.h"
+#include "llperfstats.h"
+#include "llpostprocess.h"
+#include "llrender.h"
+#include "llscenemonitor.h"
#include "llselectmgr.h"
#include "llsky.h"
+#include "llspatialpartition.h"
#include "llstartup.h"
+#include "llstartup.h"
+#include "lltooldraganddrop.h"
#include "lltoolfocus.h"
#include "lltoolmgr.h"
-#include "lltooldraganddrop.h"
#include "lltoolpie.h"
#include "lltracker.h"
#include "lltrans.h"
#include "llui.h"
+#include "lluuid.h"
+#include "llversioninfo.h"
#include "llviewercamera.h"
+#include "llviewercontrol.h"
+#include "llviewernetwork.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
+#include "llviewershadermgr.h"
+#include "llviewertexturelist.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
#include "llvograss.h"
#include "llworld.h"
#include "pipeline.h"
-#include "llspatialpartition.h"
-#include "llappviewer.h"
-#include "llstartup.h"
-#include "llviewershadermgr.h"
-#include "llfasttimer.h"
-#include "llfloatertools.h"
-#include "llviewertexturelist.h"
-#include "llfocusmgr.h"
-#include "llcubemap.h"
-#include "llviewerregion.h"
-#include "lldrawpoolwater.h"
-#include "lldrawpoolbump.h"
-#include "llpostprocess.h"
-#include "llscenemonitor.h"
-#include "llenvironment.h"
-#include "llperfstats.h"
+#include <boost/json.hpp>
+
+#include <filesystem>
+#include <iomanip>
+#include <sstream>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
@@ -127,6 +138,8 @@ void render_ui_3d();
void render_ui_2d();
void render_disconnected_background();
+std::string getProfileStatsFilename();
+
void display_startup()
{
if ( !gViewerWindow
@@ -1027,10 +1040,49 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
if (gShaderProfileFrame)
{
gShaderProfileFrame = false;
- LLGLSLShader::finishProfile();
+ LLGLSLShader::finishProfile(getProfileStatsFilename());
}
}
+std::string getProfileStatsFilename()
+{
+ std::ostringstream basebuff;
+ // viewer build
+ basebuff << "profile.v" << LLVersionInfo::instance().getBuild();
+ // machine ID: zero-initialize unique_id in case LLMachineID fails
+ unsigned char unique_id[MAC_ADDRESS_BYTES]{};
+ LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
+ basebuff << ".m" << LL::hexdump(unique_id, sizeof(unique_id));
+ // region ID
+ LLViewerRegion *region = gAgent.getRegion();
+ basebuff << ".r" << (region? region->getRegionID() : LLUUID());
+ // local parcel ID
+ LLParcel* parcel = LLViewerParcelMgr::instance().getAgentParcel();
+ basebuff << ".p" << (parcel? parcel->getLocalID() : 0);
+ // date/time -- omit seconds for now
+ auto now = LLDate::now();
+ basebuff << ".t" << LLDate::now().toHTTPDateString("%Y-%m-%dT%H-%M-");
+ // put this candidate file in our logs directory
+ auto base = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, basebuff.str());
+ S32 sec;
+ now.split(nullptr, nullptr, nullptr, nullptr, nullptr, &sec);
+ // Loop over finished filename, incrementing sec until we find one that
+ // doesn't yet exist. Should rarely loop (only if successive calls within
+ // same second), may produce (e.g.) sec==61, but avoids collisions and
+ // preserves chronological filename sort order.
+ std::string name;
+ std::error_code ec;
+ do
+ {
+ // base + missing 2-digit seconds, append ".json"
+ // post-increment sec in case we have to try again
+ name = stringize(base, std::setw(2), std::setfill('0'), sec++, ".json");
+ } while (std::filesystem::exists(fsyspath(name), ec));
+ // Ignoring ec means we might potentially return a name that does already
+ // exist -- but if we can't check its existence, what more can we do?
+ return name;
+}
+
// WIP simplified copy of display() that does minimal work
void display_cube_face()
{
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 9739cac311..1c8f1a32b9 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2766,7 +2766,8 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char)
{
LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
- mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(false), native_key_data);
+ mMediaSource->textInput(ll_convert_to<std::string>(uni_char),
+ gKeyboard->currentMask(false), native_key_data);
}
}
diff --git a/indra/newview/scripts/lua/frame_profile.lua b/indra/newview/scripts/lua/frame_profile.lua
new file mode 100644
index 0000000000..3c6353ff68
--- /dev/null
+++ b/indra/newview/scripts/lua/frame_profile.lua
@@ -0,0 +1,24 @@
+-- Trigger Develop -> Render Tests -> Frame Profile
+
+LLAgent = require 'LLAgent'
+startup = require 'startup'
+Timer = (require 'timers').Timer
+UI = require 'UI'
+
+startup.wait('STATE_STARTED')
+
+-- teleport to http://maps.secondlife.com/secondlife/Bug%20Island/220/224/27
+print(LLAgent.teleport{regionname='Bug Island', x=220, y=224, z=27})
+Timer(10, 'wait')
+LLAgent.setCamera{camera_pos={220, 224, 26}, camera_locked=true,
+ focus_pos ={228, 232, 26}, focus_locked=true}
+Timer(1, 'wait')
+-- This freezes the viewer for perceptible realtime
+UI.popup:tip('starting Render Tests -> Frame Profile')
+UI.call("Advanced.ClickRenderProfile")
+Timer(1, 'wait')
+LLAgent.removeCamParams()
+LLAgent.setFollowCamActive(false)
+
+-- Home, James!
+print(LLAgent.teleport('home'))
diff --git a/indra/newview/scripts/lua/frame_profile_quit.lua b/indra/newview/scripts/lua/frame_profile_quit.lua
new file mode 100644
index 0000000000..e3177a3f67
--- /dev/null
+++ b/indra/newview/scripts/lua/frame_profile_quit.lua
@@ -0,0 +1,25 @@
+-- Trigger Develop -> Render Tests -> Frame Profile and quit
+
+LLAgent = require 'LLAgent'
+logout = require 'logout'
+startup = require 'startup'
+Timer = (require 'timers').Timer
+UI = require 'UI'
+
+startup.wait('STATE_STARTED')
+
+-- Assume we logged into http://maps.secondlife.com/secondlife/Bug%20Island/220/224/27
+-- (see frame_profile bash script)
+Timer(10, 'wait')
+LLAgent.setCamera{camera_pos={220, 224, 26}, camera_locked=true,
+ focus_pos ={228, 232, 26}, focus_locked=true}
+Timer(1, 'wait')
+-- This freezes the viewer for perceptible realtime
+UI.popup:tip('starting Render Tests -> Frame Profile')
+UI.call("Advanced.ClickRenderProfile")
+Timer(1, 'wait')
+LLAgent.removeCamParams()
+LLAgent.setFollowCamActive(false)
+
+-- done
+logout()
diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua
index 07ef1e0b0b..5cee998fcd 100644
--- a/indra/newview/scripts/lua/require/LLAgent.lua
+++ b/indra/newview/scripts/lua/require/LLAgent.lua
@@ -71,4 +71,13 @@ function LLAgent.getAnimationInfo(item_id)
return leap.request('LLAgent', {op = 'getAnimationInfo', item_id=item_id}).anim_info
end
+-- Teleport to specified "regionname" at specified region-relative "x", "y", "z".
+-- If "regionname" is "home", ignore "x", "y", "z" and teleport home.
+-- If "regionname" omitted, teleport to GLOBAL coordinates "x", "y", "z".
+function LLAgent.teleport(...)
+ local args = mapargs('regionname,x,y,z', ...)
+ args.op = 'teleport'
+ return leap.request('LLTeleportHandler', args).message
+end
+
return LLAgent
diff --git a/indra/newview/scripts/lua/test_animation.lua b/indra/newview/scripts/lua/test_animation.lua
index c16fef4918..37e7254a6c 100644
--- a/indra/newview/scripts/lua/test_animation.lua
+++ b/indra/newview/scripts/lua/test_animation.lua
@@ -11,18 +11,22 @@ for key in pairs(anims) do
table.insert(anim_ids, key)
end
--- Start playing a random animation
-math.randomseed(os.time())
-local random_id = anim_ids[math.random(#anim_ids)]
-local anim_info = LLAgent.getAnimationInfo(random_id)
+if #anim_ids == 0 then
+ print("No animations found")
+else
+ -- Start playing a random animation
+ math.randomseed(os.time())
+ local random_id = anim_ids[math.random(#anim_ids)]
+ local anim_info = LLAgent.getAnimationInfo(random_id)
-print("Starting animation locally: " .. anims[random_id].name)
-print("Loop: " .. anim_info.is_loop .. " Joints: " .. anim_info.num_joints .. " Duration " .. tonumber(string.format("%.2f", anim_info.duration)))
-LLAgent.playAnimation{item_id=random_id}
+ print("Starting animation locally: " .. anims[random_id].name)
+ print("Loop: " .. anim_info.is_loop .. " Joints: " .. anim_info.num_joints .. " Duration " .. tonumber(string.format("%.2f", anim_info.duration)))
+ LLAgent.playAnimation{item_id=random_id}
--- Stop animation after 3 sec if it's looped or longer than 3 sec
-if anim_info.is_loop == 1 or anim_info.duration > 3 then
- LL.sleep(3)
- print("Stop animation.")
- LLAgent.stopAnimation(random_id)
+ -- Stop animation after 3 sec if it's looped or longer than 3 sec
+ if anim_info.is_loop == 1 or anim_info.duration > 3 then
+ LL.sleep(3)
+ print("Stop animation.")
+ LLAgent.stopAnimation(random_id)
+ end
end
diff --git a/indra/newview/tests/llluamanager_test.cpp b/indra/newview/tests/llluamanager_test.cpp
index 8d1333815b..f0a1b32eed 100644
--- a/indra/newview/tests/llluamanager_test.cpp
+++ b/indra/newview/tests/llluamanager_test.cpp
@@ -123,7 +123,7 @@ namespace tut
}
}
- void from_lua(const std::string& desc, const std::string_view& construct, const LLSD& expect)
+ void from_lua(const std::string& desc, std::string_view construct, const LLSD& expect)
{
LLSD fromlua;
LLStreamListener pump("testpump",
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index aa2b0b0e25..9f77dba3bc 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -166,11 +166,7 @@ class ViewerManifest(LLManifest):
self.path("*/*/*/*.js")
self.path("*/*/*.html")
- with self.prefix(src_dst="scripts/lua"):
- self.path("*.lua")
- self.path("*.xml")
- with self.prefix(src_dst='require'):
- self.path("*.lua")
+ self.path('scripts/lua')
#build_data.json. Standard with exception handling is fine. If we can't open a new file for writing, we have worse problems
#platform is computed above with other arg parsing