Commit Graph

45259 Commits (c5e3ace94de01ed61ed43284ea72dacec197cdc9)

Author SHA1 Message Date
Nat Goodspeed 95958bc8b2 SL-16207: Guess Microsoft compiler isn't smart about default params?
clang allows us to specify, as a default function parameter, an expression
involving a preceding parameter, e.g. (char* ptr, size_t len=strlen(ptr)). The
Microsoft compiler produces errors, requiring more overloads to address that.

Also #undef llstring.h's declaration helper macros at the bottom of the file.
Once we've used them to declare stuff, they need not (should not) be visible
to the consuming source file.
2021-11-02 11:31:47 -04:00
Nat Goodspeed 10692ab4a4 SL-16207: Create uniform overload sets for wide-string conversions.
Use new ll_convert_forms() macro in llstring.h to declare, for each
wide-string conversion function of interest, four overloads. The real one, the
nontrivial one, is (const char*, size_t len), implemented in llstring.cpp. Then
(const string&, size_t len), (const char*) and (const string&) are each
trivially implemented with an inline call to (const char*, size_t len).

Notably, we change all S32 len parameters to size_t. Using S32 is old skool.

Tweak each nontrivial implementation in llstring.cpp to accept (const char*,
size_t len) instead of (const string&) with or without explicit length.
Eliminate from llstring.cpp trivial overloads (deriving length from either a
const char* or from a string), since those are now inline in the header.

Of course three of those overloads will be unified once we enable C++17 and
change each relevant parameter to std::string_view, but we're not yet there.
Meanwhile, this suite of overloads minimizes, to the best of our ability, new
string allocations solely for parameter passing. And use of a macro means we
need only change the macro once we get std::string_view.

We take this step because some use cases require (const char*), some require
(const string&, size_t len), others (const char*, size_t len) ... We were
missing some key overloads, and had to work around them by instantiating new
string objects (necessitating both allocation and character copying) just to
pass the desired parameter. Using the macro ensures this consistent set of
overloads for every wide-string conversion function.

Additionally, knowing that the ugly-name overloads exist, ll_convert_forms()
implicitly defines corresponding ll_convert<TARGET>() overloads.

Streamline declarations of utf16str_to_wstring(), wstring_to_utf16str(),
utf8str_to_utf16str(), utf16str_to_utf8str(), utf8str_to_wstring(),
wstring_to_utf8str(), ll_convert_wide_to_wstring() and
ll_convert_wstring_to_wide() using ll_convert_forms().

Use corresponding new ll_convert_cp_forms() macro to declare consistent
overloads for conversion functions accepting an optional unsigned int
code_page parameter. We used to delegate to the .cpp file the implementation
of each overload accepting code_page so llstring.h need not include the
Windows header defining the CP_UTF8 default; this is more simply accomplished
by introducing a small ll_wstring_default_code_page() function to retrieve it
from the .cpp file. That lets us specify the code_page parameter as optional,
using that function as its default value.

Use ll_convert_cp_forms() to streamline declarations of
ll_convert_wide_to_string() and ll_convert_string_to_wide().

Introduce real implementations of ll_convert_wide_to_wstring() and
ll_convert_wstring_to_wide(). The previous implementations merely copied
individual characters, which is wrong: when we convert UTF16LE to UTF32, we
can and should fold multi-character UTF16LE encodings to the corresponding
single UTF32 character. The real implemenations leverage our awareness that
both llutf16string and Windows std::wstring (either variant) use UTF16LE
encoding, so we can reuse the corresponding llutf16string conversions.

Introduce generic ll_convert_length() function, specialized as either
std::strlen() or std::wcslen() depending on parameter type. (Even if
std::wcslen() is derived from classic C, why doesn't the C++ standard library
define a std::strlen(const wchar_t*) overload to call it?)

Fix ll_convert_alias()'s ll_convert_impl specialization's operator() to accept
boost::call_traits::param_type, so we can pass (e.g.) const std::wstring& but
also const wchar_t* instead of const wchar_t*&.
2021-11-02 10:35:34 -04:00
Andrey Kleshchev f2cf005e0e SL-14992 fmod shutdown crash 2021-11-02 12:03:10 +02:00
Nat Goodspeed a88da4ca16 SL-16207: Remove CMake cxx_range_for from media_plugin_cef.
Now that we've enabled -std=c++14 for the whole viewer source tree, that CMake
directive is actually a step backwards -- since it introduces -std=gnu++11 on
the compiler command line, after the one we want, which apparently overrides
c++14 with gnu++11 and causes errors with legitimate C++14 constructs.
2021-11-01 16:48:57 -04:00
Andrey Lihatskiy 6921edcc39 SL-16293 Updated vlc to CT build 565299 2021-11-01 21:23:12 +02:00
Mnikolenko Productengine 3faba7515c SL-16237 FIXED Viewer hangs on login 2021-11-01 19:38:55 +02:00
Michael Pohoreski 2369af6999 Merged in SL-16127_More_tweaks (pull request #752)
SL-16127 More tweaks

Approved-by: Euclid Linden
Approved-by: Dave Parks
2021-11-01 16:30:01 +00:00
Ptolemy 1be8a8d10b Fix merge conflict 2021-10-29 15:11:42 -07:00
Andrey Kleshchev e791737032 SL-14664 Fix missed pixmap init 2021-10-29 12:14:12 +03:00
Dave Parks 68b75be652 SL-9436 Don't render 100% transparent objects. 2021-10-28 22:09:22 +00:00
Andrey Kleshchev 90286fa476 SL-16235 Restart music in case of an error
Additional logging
2021-10-28 23:42:38 +03:00
Andrey Kleshchev 404e69e594 SL-15462 Convert waitForChannel() into state machine 2021-10-28 21:25:38 +03:00
Dave Parks 8d20480c5f SL-16148 SL-16244 SL-16270 SL-16253 Remove most BlockTimers, remove LLMemTracked, introduce alignas, hook most/all reamining allocs, disable synchronous occlusion, and convert frequently accessed LLSingletons to LLSimpleton 2021-10-28 18:06:21 +00:00
Andrey Kleshchev bfcb1f61a8 SL-16263 RaiseException in LLVolumeFace::createSide 2021-10-28 01:27:18 +03:00
Andrey Lihatskiy 8acce67f95 SL-16247 Post-d520 libvlc plugin fixes
by Callum
2021-10-28 00:52:03 +03:00
Nat Goodspeed 8b16ecb9cf SL-16220: Add tests for WorkQueue::waitForResult(), void & non-void. 2021-10-27 15:31:54 -04:00
Ptolemy 61bca72d37 Merge branch 'SL-16127_More_tweaks' of bitbucket.org:lindenlab/viewer into SL-16127_More_tweaks 2021-10-27 10:22:03 -07:00
Ptolemy ad91d0fd92 SL-16127: Make another pass removing redundant LLSD op [] calls, unused vars, and use atmospheric already calculated 2021-10-27 10:05:13 -07:00
Nat Goodspeed af5c5a994b SL-16207: Update llstring.h handling of different string types.
In llpreprocessor.h, consider the case of clang on Windows: #define
LL_WCHAR_T_NATIVE there as well as for the Microsoft compiler with /Zc:wchar_t
switch.

In stdtypes.h, inject a LLWCHAR_IS_WCHAR_T symbol to allow the preprocessor to
make decisions about when the types are identical.

llstring.h's conversion logic deals with three types of wide strings
(LLWString, std::wstring and utf16string) based on three types of wide char
(llwchar, wchar_t and U16, respectively). Sometimes they're three distinct
types, sometimes wchar_t is identical to llwchar and sometimes wchar_t is
identical to U16. Rationalize the three cases using ll_convert_u16_alias() and
new ll_convert_wstr_alias() macros.

stringize.h was directly calling wstring_to_utf8str() and utf8str_to_wstring(),
which was producing errors with VS 2019 clang since there isn't actually a
wstring_to_utf8str(std::wstring) overload. Use ll_convert<std::string>()
instead, since that redirects to the relevant ll_convert_wide_to_string()
function. (And now you see why we've been trying to migrate to the uniform
ll_convert<target>() wrapper!) Similarly, call ll_convert<std::wstring>()
instead of a two-step conversion from utf8str_to_wstring(), producing LLWString,
then a character-by-character copy from LLWString to std::wstring. That
isn't even correct: on Windows, we should be encoding from UTF32 to UTF16.
2021-10-27 13:01:37 -04:00
Andrey Kleshchev 2e760ae7dd SL-16235 Update fmod to 2.02.03 2021-10-27 19:18:54 +03:00
Michael Pohoreski aa7ca0aea1 Merged in SL-16127 (pull request #741)
SL-16127

Approved-by: Euclid Linden
Approved-by: Dave Parks
2021-10-27 15:59:53 +00:00
Ptolemy 1f00c43201 SL-16127: Make another pass removing redundant LLSD op [] calls, unused vars, and use atmospheric already calculated 2021-10-26 22:09:27 -07:00
Nat Goodspeed f06765cba8 SL-16220: Make WorkQueue::postTo() return exception to caller.
postTo() sets up two-way communication: the caller asks to run work on some
other WorkQueue, expecting an eventual callback on the originating WorkQueue.
That permits us to transport any exception thrown by the work callable back to
rethrow on the originating WorkQueue.
2021-10-26 12:29:49 -04:00
Nat Goodspeed e6eebea8da SL-16220: Change WorkQueue::runOn() to waitForResult().
In addition to the name making the blocking explicit, we changed the
signature: instead of specifying a target WorkQueue on which to run,
waitForResult() runs the passed callable on its own WorkQueue.

Why is that? Because, unlike postTo(), we do not require a handshake between
two different WorkQueues. postTo() allows running arbitrary callback code,
setting variables or whatever, on the originating WorkQueue (presumably on the
originating thread). waitForResult() synchronizes using Promise/Future, which
are explicitly designed for cross-thread communication. We need not call
set_value() on the originating thread, so we don't need a postTo() callback
lambda.
2021-10-26 11:49:53 -04:00
Runitai Linden c907d067f4 SL-16243 Followup -- fix for inconsistently calling TracyAlloc/TracyFree 2021-10-26 09:23:17 -05:00
Dave Parks 4e8cd9437b SL-16193 Fix for mesh selection outline not rendering correctly (and broken physics shapes display). 2021-10-26 14:07:00 +00:00
Dave Houlton 081ae57831 SL-16246 protect null deference 2021-10-25 16:27:34 -06:00
Nat Goodspeed 023d39963e SL-16220: WorkQueue::runOn() methods submit work, wait for result.
The idea is that you can call runOn(target, callable) from a (non-default)
coroutine and block that coroutine until the result becomes available.

As a safety check, we forbid calling runOn() from a thread's default
coroutine, assuming that a given thread's default coroutine is the one
servicing the relevant WorkQueue.
2021-10-25 17:31:27 -04:00
Andrey Kleshchev 4d61fa32ad SL-15992 Crash rapidly switching gestures 2021-10-26 00:20:26 +03:00
Dave Parks 647d0224d3 SL-16243 Add Tracy timers to global new/delete overrides. 2021-10-25 21:11:03 +00:00
Nat Goodspeed e7b8c27741 SL-16220: Specialize WorkQueue for callable with void return.
Add a test exercising this feature.
2021-10-25 15:55:49 -04:00
Mnikolenko Productengine a5b1c01354 SL-16234 handle closing floater correctly 2021-10-25 21:23:26 +03:00
Andrey Kleshchev 3614083377 SL-16121 Fix intaller complaining about missing string 2021-10-25 21:11:43 +03:00
Andrey Kleshchev e4cac17f3d SL-16121 Fix viewer not cleaning up obsolete plugin modules on install 2021-10-25 19:35:18 +03:00
Vir Linden c173b07b72 Merged in SL-15999 (pull request #746)
SL-15999 support --noninteractive option for viewer

Approved-by: Dave Parks
Approved-by: Michael Pohoreski
2021-10-25 15:55:31 +00:00
Vir Linden ba3459f77f Merged DRTVWR-546 into SL-15999 2021-10-25 15:55:06 +00:00
Mnikolenko Productengine a95d846a5c SL-16218 treat texture selection similar to diffuse map handling. 2021-10-25 15:15:02 +03:00
Nat Goodspeed d2763897f2 SL-16220: Fix thread name expression. 2021-10-22 21:51:44 -04:00
Ptolemy 2c2f6f2a9b Merge branch 'DRTVWR-546' into SL-16127 2021-10-22 15:15:07 -07:00
Runitai Linden 3efd4c50a0 SL-16222 Don't use bindFast for legacy bump maps (weird loading path sometimes has stale texture state). 2021-10-22 16:56:20 -05:00
Brad Payne (Vir Linden) a42b5d6809 SL-15999 - made cwd handling a bit more robust in perfbot_run.py 2021-10-22 18:49:54 +01:00
Brad Payne (Vir Linden) e5cd9cb90f merge 2021-10-22 18:11:48 +01:00
Dave Parks 5553d61421 SL-16203 Fix for wonky handling of mouse deltas. 2021-10-22 17:01:33 +00:00
Nat Goodspeed 14dae8bc8e SL-16220: Merge branch 'master' into sl-16220 2021-10-22 11:54:18 -04:00
Nat Goodspeed 11afa09ea3 SL-16220: Add LL::ThreadPool class and a "General" instance.
ThreadPool bundles a WorkQueue with the specified number of worker threads to
service it. Each ThreadPool has a name that can be used to locate its
WorkQueue.

Each worker thread calls WorkQueue::runUntilClose().

ThreadPool listens on the "LLApp" LLEventPump for shutdown notification. On
receiving that, it closes its WorkQueue and then join()s each of its worker
threads for orderly shutdown.

Add a settings.xml entry "ThreadPoolSizes", the first LLSD-valued settings
entry to expect a map: pool name->size. The expectation is that usually code
instantiating a particular ThreadPool will have a default size in mind, but it
should check "ThreadPoolSizes" for a user override.

Make idle_startup()'s STATE_SEED_CAP_GRANTED state instantiate a "General"
ThreadPool. This is function-static for lazy initialization.

Eliminate LLMainLoopRepeater, which is completely unreferenced. Any potential
future use cases are better addressed by posting to the main loop's WorkQueue.

Eliminate llappviewer.cpp's private LLDeferredTaskList class, which
implemented LLAppViewer::addOnIdleCallback(). Make addOnIdleCallback() post
work to the main loop's WorkQueue instead.
2021-10-22 11:36:31 -04:00
Mnikolenko Productengine f2eba1909d SL-16234 FIXED Frame stall caused by unnecessary building the floater when exiting viewer 2021-10-22 16:09:41 +03:00
Andrey Lihatskiy bb92dae312 DRTVWR-530 Updated uriparser to codeticket build 564957 2021-10-22 15:32:06 +03:00
Andrey Lihatskiy 07aa342bc4 Merge branch 'master' into DRTVWR-530-maint
# Conflicts:
#	autobuild.xml
2021-10-22 15:27:15 +03:00
Andrey Lihatskiy 97dc98504e DRTVWR-527 Updated dullahan to codeticket build 564956 2021-10-22 15:22:54 +03:00
Andrey Lihatskiy f1a7e400a2 Merge branch 'master' into DRTVWR-527-maint
# Conflicts:
#	autobuild.xml
2021-10-22 15:03:00 +03:00