diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-06-07 21:08:53 +0300 | 
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-06-07 21:08:53 +0300 | 
| commit | 07a118889e9a15391e950710864800e8d5c43efc (patch) | |
| tree | c47c0a617f48c57cab2f5a5784f1e4f71880f79c | |
| parent | 0c5a621e2945133bca35b7d81998a9fb313d05db (diff) | |
| parent | 4623b822386accfae5907c88099c2a88377a0271 (diff) | |
Merge branch 'master' into DRTVWR-486
194 files changed, 3429 insertions, 3166 deletions
| diff --git a/autobuild.xml b/autobuild.xml index f7edff294f..2470b2e5aa 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -2187,18 +2187,18 @@              <key>archive</key>              <map>                <key>hash</key> -              <string>c541838a933e0714a954e9ef6c89345d</string> +              <string>40a87f5d505a141b2ec79513a6197c35</string>                <key>hash_algorithm</key>                <string>md5</string>                <key>url</key> -              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/73387/708088/llca-202012011600.553112-common-553112.tar.bz2</string> +              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/76516/728250/llca-202102021657.555615-common-555615.tar.bz2</string>              </map>              <key>name</key>              <string>common</string>            </map>          </map>          <key>version</key> -        <string>202012011600.553112</string> +        <string>202102021657.555615</string>        </map>        <key>llphysicsextensions_source</key>        <map> @@ -3128,9 +3128,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>              <key>archive</key>              <map>                <key>hash</key> -              <string>d463360491b6b5cb7a57cd67a90ececb</string> +              <string>60f008c5fd31641ad4e61ac751ce15d1</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54838/510050/uriparser-0.8.0.1-darwin64-538968.tar.bz2</string> +              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/75748/723495/uriparser-0.9.4-darwin64-555117.tar.bz2</string>              </map>              <key>name</key>              <string>darwin64</string> @@ -3164,9 +3164,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>              <key>archive</key>              <map>                <key>hash</key> -              <string>57a88be57694de6cf9f516125af2c4c9</string> +              <string>00aff37a6f5e1fe08456702d28706cf6</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54963/511746/uriparser-0.8.0.1-windows-538968.tar.bz2</string> +              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/75751/723507/uriparser-0.9.4-windows-555117.tar.bz2</string>              </map>              <key>name</key>              <string>windows</string> @@ -3176,16 +3176,16 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>              <key>archive</key>              <map>                <key>hash</key> -              <string>f39cc91f2a5dad13790ec18269844ae4</string> +              <string>ff27a91f3941c7bef5e1613a064cb048</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54962/511739/uriparser-0.8.0.1-windows64-538968.tar.bz2</string> +              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/75750/723506/uriparser-0.9.4-windows64-555117.tar.bz2</string>              </map>              <key>name</key>              <string>windows64</string>            </map>          </map>          <key>version</key> -        <string>0.8.0.1</string> +        <string>0.9.4</string>        </map>        <key>viewer-manager</key>        <map> @@ -3206,9 +3206,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>              <key>archive</key>              <map>                <key>hash</key> -              <string>c5ab9d9d7482e48cd76f4bf391900a8c</string> +              <string>6989053898b8e81e904e75553e378820</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/43369/385585/viewer_manager-2.0.531000-darwin64-531000.tar.bz2</string> +              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/77523/735051/viewer_manager-2.0.556340-darwin64-556340.tar.bz2</string>              </map>              <key>name</key>              <string>darwin64</string> @@ -3230,9 +3230,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>              <key>archive</key>              <map>                <key>hash</key> -              <string>6b10d7407686d9e12e63576256581e3e</string> +              <string>3446c1e54bb32542677caad0ec0d42ac</string>                <key>url</key> -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/43370/385592/viewer_manager-2.0.531000-windows-531000.tar.bz2</string> +              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/77525/735058/viewer_manager-2.0.556340-windows-556340.tar.bz2</string>              </map>              <key>name</key>              <string>windows</string> @@ -3243,7 +3243,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>          <key>source_type</key>          <string>hg</string>          <key>version</key> -        <string>2.0.531000</string> +        <string>2.0.556340</string>        </map>        <key>vlc-bin</key>        <map> diff --git a/doc/contributions.txt b/doc/contributions.txt index bbdfaf655d..6a23e8093c 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -226,6 +226,7 @@ Ansariel Hiller  	SL-13364  	SL-13858  	SL-13697 +	SL-3136  Aralara Rajal  Arare Chantilly  	CHUIBUG-191 @@ -263,10 +264,11 @@ Benja Kepler  Benjamin Bigdipper  Beq Janus  	BUG-227094 -Beth Walcher -Beq Janus  	SL-10288 +    SL-11300  	SL-13583 +	SL-14766 +Beth Walcher  Bezilon Kasei  Biancaluce Robbiani  	CT-225 @@ -1353,6 +1355,12 @@ Sovereign Engineer      SL-11079      OPEN-343  	SL-11625 +	SL-14705 +	SL-14706 +	SL-14707 +	SL-14731 +	SL-14732 +	SL-15096  SpacedOut Frye  	VWR-34  	VWR-45 diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 8efad33f71..de81512eef 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -61,6 +61,7 @@ if(WINDOWS)          nghttp2.dll          glod.dll          libhunspell.dll +        uriparser.dll          )      # Filenames are different for 32/64 bit BugSplat file and we don't @@ -165,6 +166,9 @@ elseif(DARWIN)          libnghttp2.dylib          libnghttp2.14.dylib          libnghttp2.14.19.0.dylib +        liburiparser.dylib +        liburiparser.1.dylib +        liburiparser.1.0.27.dylib         )      if (FMODSTUDIO) diff --git a/indra/cmake/URIPARSER.cmake b/indra/cmake/URIPARSER.cmake index de146885a0..ecc5b74ef1 100644 --- a/indra/cmake/URIPARSER.cmake +++ b/indra/cmake/URIPARSER.cmake @@ -29,7 +29,7 @@ else (USESYSTEMLIBS)      set(URIPARSER_PRELOAD_ARCHIVES -Wl,--whole-archive uriparser -Wl,--no-whole-archive)      set(URIPARSER_LIBRARIES uriparser)    elseif (DARWIN) -    set(URIPARSER_LIBRARIES uriparser) +    set(URIPARSER_LIBRARIES liburiparser.dylib)    endif (WINDOWS)    set(URIPARSER_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/uriparser)  endif (USESYSTEMLIBS) diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt index 48082f72f0..5366987cff 100644 --- a/indra/edit-me-to-trigger-new-build.txt +++ b/indra/edit-me-to-trigger-new-build.txt @@ -1 +1,3 @@ -12 +euclid 5/29/2020 +euclid 7/23/2020 +euclid 4/29/2021
\ No newline at end of file diff --git a/indra/llappearance/llavatarjoint.cpp b/indra/llappearance/llavatarjoint.cpp index 80b3e42b52..a1d4fe6423 100644 --- a/indra/llappearance/llavatarjoint.cpp +++ b/indra/llappearance/llavatarjoint.cpp @@ -103,7 +103,7 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )  		for (joints_t::iterator iter = mChildren.begin();  			 iter != mChildren.end(); ++iter)  		{ -			LLAvatarJoint* joint = (LLAvatarJoint*)(*iter); +			LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);  			joint->setValid(valid, TRUE);  		}  	} @@ -136,7 +136,7 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)  		for (joints_t::iterator iter = mChildren.begin();  			 iter != mChildren.end(); ++iter)  		{ -			LLAvatarJoint* joint = (LLAvatarJoint*)(*iter); +			LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);  			joint->setVisible(visible, recursive);  		}  	} @@ -167,7 +167,7 @@ void LLAvatarJoint::updateJointGeometry()  	for (joints_t::iterator iter = mChildren.begin();  		 iter != mChildren.end(); ++iter)  	{ -		LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); +		LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);  		joint->updateJointGeometry();  	}  } diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 255b50c8d0..565d7cfb63 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -29,7 +29,7 @@  #ifndef LL_LLAPR_H  #define LL_LLAPR_H -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  #include <sys/param.h>  // Need PATH_MAX in APR headers...  #endif diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 262929006d..23419a52a7 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -56,10 +56,6 @@  #include "stringize.h"  #include "llexception.h" -#if LL_WINDOWS -#include <excpt.h> -#endif -  // static  LLCoros::CoroData& LLCoros::get_CoroData(const std::string& caller)  { @@ -253,29 +249,13 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl  #if LL_WINDOWS -static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific - -U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop) -{ -    if (code == STATUS_MSC_EXCEPTION) -    { -        // C++ exception, go on -        return EXCEPTION_CONTINUE_SEARCH; -    } -    else -    { -        // handle it -        return EXCEPTION_EXECUTE_HANDLER; -    } -} -  void LLCoros::winlevel(const callable_t& callable)  {      __try      {          callable();      } -    __except (exception_filter(GetExceptionCode(), GetExceptionInformation())) +    __except (msc_exception_filter(GetExceptionCode(), GetExceptionInformation()))      {          // convert to C++ styled exception          // Note: it might be better to use _se_set_translator diff --git a/indra/llcommon/llexception.cpp b/indra/llcommon/llexception.cpp index 5ce8958687..b584b0ff8b 100644 --- a/indra/llcommon/llexception.cpp +++ b/indra/llcommon/llexception.cpp @@ -24,11 +24,14 @@  // `_GNU_SOURCE` macro or `BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED` if  // _Unwind_Backtrace is available without `_GNU_SOURCE`."  #define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED +  #if LL_WINDOWS  // On Windows, header-only implementation causes macro collisions -- use  // prebuilt library  #define BOOST_STACKTRACE_LINK +#include <excpt.h>  #endif // LL_WINDOWS +  #include <boost/stacktrace.hpp>  // other Linden headers  #include "llerror.h" @@ -85,3 +88,25 @@ void annotate_exception_(boost::exception& exc)      // Anyway, which of us is really going to examine more than 100 frames?      exc << errinfo_stacktrace(boost::stacktrace::stacktrace(1, 100));  } + +#if LL_WINDOWS + +// For windows SEH exception handling we sometimes need a filter that will +// separate C++ exceptions from C SEH exceptions +static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific + +U32 msc_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop) +{ +    if (code == STATUS_MSC_EXCEPTION) +    { +        // C++ exception, go on +        return EXCEPTION_CONTINUE_SEARCH; +    } +    else +    { +        // handle it +        return EXCEPTION_EXECUTE_HANDLER; +    } +} + +#endif //LL_WINDOWS diff --git a/indra/llcommon/llexception.h b/indra/llcommon/llexception.h index 422dd8810a..375bea4a57 100644 --- a/indra/llcommon/llexception.h +++ b/indra/llcommon/llexception.h @@ -102,4 +102,14 @@ void crash_on_unhandled_exception_(const char*, int, const char*, const std::str       log_unhandled_exception_(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, CONTEXT)  void log_unhandled_exception_(const char*, int, const char*, const std::string&); + +#if LL_WINDOWS + +// SEH exception filtering for use in __try __except +// Separates C++ exceptions from C SEH exceptions +// Todo: might be good idea to do some kind of seh_to_msc_wrapper(function, ARGS&&); +U32 msc_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop); + +#endif //LL_WINDOWS +  #endif /* ! defined(LL_LLEXCEPTION_H) */ diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 08ea668964..5b6a7b82f8 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -43,7 +43,7 @@  #if LL_WINDOWS  #include "lltimer.h" -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX  #include <sys/time.h>  #include <sched.h>  #include "lltimer.h" @@ -64,7 +64,7 @@ bool        BlockTimer::sLog		     = false;  std::string BlockTimer::sLogName         = "";  bool        BlockTimer::sMetricLog       = false; -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  U64         BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution  #else  U64         BlockTimer::sClockResolution = 1000000; // Microsecond resolution @@ -151,12 +151,12 @@ void BlockTimer::setLogLock(LLMutex* lock)  //static -#if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#if (LL_DARWIN || LL_LINUX) && !(defined(__i386__) || defined(__amd64__))  U64 BlockTimer::countsPerSecond()  {  	return sClockResolution;  } -#else // windows or x86-mac or x86-linux or x86-solaris +#else // windows or x86-mac or x86-linux  U64 BlockTimer::countsPerSecond()  {  #if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 5628a05b00..dfc63d08a2 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -125,9 +125,9 @@ public:  #endif -#if (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX) && !(defined(__i386__) || defined(__amd64__))  	// -	// Linux and Solaris implementation of CPU clock - non-x86. +	// Linux implementation of CPU clock - non-x86.  	// This is accurate but SLOW!  Only use out of desperation.  	//  	// Try to use the MONOTONIC clock if available, this is a constant time counter @@ -153,12 +153,12 @@ public:  		return (U32)(getCPUClockCount64() >> 8);  	} -#endif // (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#endif // (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) -#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX || LL_DARWIN) && (defined(__i386__) || defined(__amd64__))  	// -	// Mac+Linux+Solaris FAST x86 implementation of CPU clock +	// Mac+Linux FAST x86 implementation of CPU clock  	static U32 getCPUClockCount32()  	{  		U32 low(0),high(0); diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 1884d6f04f..ea84e4c1ea 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -35,7 +35,7 @@  # include <sys/types.h>  # include <mach/task.h>  # include <mach/mach_init.h> -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX  # include <unistd.h>  #endif @@ -55,7 +55,6 @@ static LLTrace::SampleStatHandle<F64Megabytes> sVirtualMem("virtual_mem", "virtu  U32Kilobytes LLMemory::sAllocatedMemInKB(0);  U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0);  U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX); -BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE;  void ll_assert_aligned_func(uintptr_t ptr,U32 alignment)  { @@ -75,10 +74,9 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment)  }  //static  -void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) +void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size)  {  	sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); -	sEnableMemoryFailurePrevention = prevent_heap_failure ;  }  //static  @@ -158,56 +156,6 @@ void LLMemory::logMemoryInfo(BOOL update)  	LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ;  } -//return 0: everything is normal; -//return 1: the memory pool is low, but not in danger; -//return -1: the memory pool is in danger, is about to crash. -//static  -bool LLMemory::isMemoryPoolLow() -{ -	static const U32Megabytes LOW_MEMORY_POOL_THRESHOLD(64); -	const static U32Megabytes MAX_SIZE_CHECKED_MEMORY_BLOCK(64); -	static void* last_reserved_address = NULL ; - -	if(!sEnableMemoryFailurePrevention) -	{ -		return false ; //no memory failure prevention. -	} - -	if(sAvailPhysicalMemInKB < (LOW_MEMORY_POOL_THRESHOLD / 4)) //out of physical memory -	{ -		return true ; -	} - -	if(sAllocatedPageSizeInKB + (LOW_MEMORY_POOL_THRESHOLD / 4) > sMaxHeapSizeInKB) //out of virtual address space. -	{ -		return true ; -	} - -	bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD  -						|| sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ; - -	//check the virtual address space fragmentation -	if(!is_low) -	{ -		if(!last_reserved_address) -		{ -			last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; -		} -		else -		{ -			last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; -			if(!last_reserved_address) //failed, try once more -			{ -				last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; -			} -		} - -		is_low = !last_reserved_address ; //allocation failed -	} - -	return is_low ; -} -  //static   U32Kilobytes LLMemory::getAvailableMemKB()   { @@ -309,35 +257,6 @@ U64 LLMemory::getCurrentRSS()  	return rss;  } -#elif LL_SOLARIS -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#define _STRUCTURED_PROC 1 -#include <sys/procfs.h> - -U64 LLMemory::getCurrentRSS() -{ -	char path [LL_MAX_PATH];	/* Flawfinder: ignore */  - -	sprintf(path, "/proc/%d/psinfo", (int)getpid()); -	int proc_fd = -1; -	if((proc_fd = open(path, O_RDONLY)) == -1){ -		LL_WARNS() << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << LL_ENDL; -		return 0; -	} -	psinfo_t proc_psinfo; -	if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ -		LL_WARNS() << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << LL_ENDL; -		close(proc_fd); -		return 0; -	} - -	close(proc_fd); - -	return((U64)proc_psinfo.pr_rssize * 1024); -} -  #else  U64 LLMemory::getCurrentRSS() diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index f04ae5f5cb..24f86cc11e 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -344,10 +344,9 @@ public:  	// Return value is zero if not known.  	static U64 getCurrentRSS();  	static void* tryToAlloc(void* address, U32 size); -	static void initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure); +	static void initMaxHeapSizeGB(F32Gigabytes max_heap_size);  	static void updateMemoryInfo() ;  	static void logMemoryInfo(BOOL update = FALSE); -	static bool isMemoryPoolLow();  	static U32Kilobytes getAvailableMemKB() ;  	static U32Kilobytes getMaxMemKB() ; @@ -359,7 +358,6 @@ private:  	static U32Kilobytes sAllocatedPageSizeInKB ;  	static U32Kilobytes sMaxHeapSizeInKB; -	static BOOL sEnableMemoryFailurePrevention;  };  // LLRefCount moved to llrefcount.h diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index bae402110a..b17a8e761a 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -34,16 +34,7 @@  #include <endian.h>  #endif	//	LL_LINUX -#if LL_SOLARIS -#   ifdef  __sparc     // Since we're talking Solaris 10 and up, only 64 bit is supported. -#      define LL_BIG_ENDIAN 1 -#      define LL_SOLARIS_ALIGNED_CPU 1     //  used to designate issues where SPARC alignment is addressed -#      define LL_SOLARIS_NON_MESA_GL 1      //  The SPARC GL does not provide a MESA-based GL API -#   endif -#   include <sys/isa_defs.h> // ensure we know which end is up -#endif // LL_SOLARIS - -#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386))) +#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)))  #define LL_LITTLE_ENDIAN 1  #else  #define LL_BIG_ENDIAN 1 diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 3f3edb661f..eb3a96b133 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -33,7 +33,7 @@  #if LL_WINDOWS  #	define WIN32_LEAN_AND_MEAN  #	include <winsock2.h>	// for htonl -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX  #	include <netinet/in.h>  #elif LL_DARWIN  #	include <arpa/inet.h> diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index 83a4b64e8f..ad933154c2 100644 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -388,7 +388,7 @@ LLSingletonBase::vec_t LLSingletonBase::dep_sort()      // extracts just the first (key) element from each sorted_iterator, then      // uses vec_t's range constructor... but frankly this is more      // straightforward, as long as we remember the above reserve() call! -    for (const SingletonDeps::sorted_iterator::value_type& pair : sdeps.sort()) +    for (const SingletonDeps::sorted_iterator::value_type pair : sdeps.sort())      {          ret.push_back(pair.first);      } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 6b1a1e0a03..4263122f36 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -37,7 +37,7 @@  #include <map>  #include "llformat.h" -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  #include <wctype.h>  #include <wchar.h>  #endif @@ -45,16 +45,10 @@  #include <string.h>  #include <boost/scoped_ptr.hpp> -#if LL_SOLARIS -// stricmp and strnicmp do not exist on Solaris: -#define stricmp strcasecmp -#define strnicmp strncasecmp -#endif -  const char LL_UNKNOWN_CHAR = '?';  class LLSD; -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX  // Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already)  #include <cstring> diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 1f8d558fbe..4e61fb8a58 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -55,6 +55,7 @@  #include <boost/utility/enable_if.hpp>  #include <boost/type_traits/is_integral.hpp>  #include <boost/type_traits/is_float.hpp> +#include "llfasttimer.h"  using namespace llsd; @@ -87,17 +88,6 @@ using namespace llsd;  #   include <stdexcept>  const char MEMINFO_FILE[] = "/proc/meminfo";  #   include <gnu/libc-version.h> -#elif LL_SOLARIS -#	include <stdio.h> -#	include <unistd.h> -#	include <sys/utsname.h> -#	define _STRUCTURED_PROC 1 -#	include <sys/procfs.h> -#	include <sys/types.h> -#	include <sys/stat.h> -#	include <fcntl.h> -#	include <errno.h> -extern int errno;  #endif  LLCPUInfo gSysCPU; @@ -543,8 +533,6 @@ const std::string& LLOSInfo::getOSVersionString() const  U32 LLOSInfo::getProcessVirtualSizeKB()  {  	U32 virtual_size = 0; -#if LL_WINDOWS -#endif  #if LL_LINUX  #   define STATUS_SIZE 2048	  	LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); @@ -564,24 +552,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB()  		}  		fclose(status_filep);  	} -#elif LL_SOLARIS -	char proc_ps[LL_MAX_PATH]; -	sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); -	int proc_fd = -1; -	if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ -		LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; -		return 0; -	} -	psinfo_t proc_psinfo; -	if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ -		LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; -		close(proc_fd); -		return 0; -	} - -	close(proc_fd); - -	virtual_size = proc_psinfo.pr_size;  #endif  	return virtual_size;  } @@ -590,8 +560,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB()  U32 LLOSInfo::getProcessResidentSizeKB()  {  	U32 resident_size = 0; -#if LL_WINDOWS -#endif  #if LL_LINUX  	LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");  	if (status_filep != NULL) @@ -610,24 +578,6 @@ U32 LLOSInfo::getProcessResidentSizeKB()  		}  		fclose(status_filep);  	} -#elif LL_SOLARIS -	char proc_ps[LL_MAX_PATH]; -	sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); -	int proc_fd = -1; -	if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ -		LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; -		return 0; -	} -	psinfo_t proc_psinfo; -	if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ -		LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; -		close(proc_fd); -		return 0; -	} - -	close(proc_fd); - -	resident_size = proc_psinfo.pr_rssize;  #endif  	return resident_size;  } @@ -772,11 +722,6 @@ U32Kilobytes LLMemoryInfo::getPhysicalMemoryKB() const  	phys = (U64)(getpagesize()) * (U64)(get_phys_pages());  	return U64Bytes(phys); -#elif LL_SOLARIS -	U64 phys = 0; -	phys = (U64)(getpagesize()) * (U64)(sysconf(_SC_PHYS_PAGES)); -	return U64Bytes(phys); -  #else  	return 0; @@ -925,8 +870,12 @@ LLMemoryInfo& LLMemoryInfo::refresh()  	return *this;  } +static LLTrace::BlockTimerStatHandle FTM_MEMINFO_LOAD_STATS("MemInfo Load Stats"); +  LLSD LLMemoryInfo::loadStatsMap()  { +	LL_RECORD_BLOCK_TIME(FTM_MEMINFO_LOAD_STATS); +  	// This implementation is derived from stream() code (as of 2011-06-29).  	Stats stats; @@ -948,24 +897,11 @@ LLSD LLMemoryInfo::loadStatsMap()  	stats.add("Total Virtual KB",   state.ullTotalVirtual/div);  	stats.add("Avail Virtual KB",   state.ullAvailVirtual/div); -	PERFORMANCE_INFORMATION perf; -	perf.cb = sizeof(perf); -	GetPerformanceInfo(&perf, sizeof(perf)); - -	SIZE_T pagekb(perf.PageSize/1024); -	stats.add("CommitTotal KB",     perf.CommitTotal * pagekb); -	stats.add("CommitLimit KB",     perf.CommitLimit * pagekb); -	stats.add("CommitPeak KB",      perf.CommitPeak * pagekb); -	stats.add("PhysicalTotal KB",   perf.PhysicalTotal * pagekb); -	stats.add("PhysicalAvail KB",   perf.PhysicalAvailable * pagekb); -	stats.add("SystemCache KB",     perf.SystemCache * pagekb); -	stats.add("KernelTotal KB",     perf.KernelTotal * pagekb); -	stats.add("KernelPaged KB",     perf.KernelPaged * pagekb); -	stats.add("KernelNonpaged KB",  perf.KernelNonpaged * pagekb); -	stats.add("PageSize KB",        pagekb); -	stats.add("HandleCount",        perf.HandleCount); -	stats.add("ProcessCount",       perf.ProcessCount); -	stats.add("ThreadCount",        perf.ThreadCount); +	// SL-12122 - Call to GetPerformanceInfo() was removed here. Took +	// on order of 10 ms, causing unacceptable frame time spike every +	// second, and results were never used. If this is needed in the +	// future, must find a way to avoid frame time impact (e.g. move +	// to another thread, call much less often).  	PROCESS_MEMORY_COUNTERS_EX pmem;  	pmem.cb = sizeof(pmem); @@ -1074,13 +1010,6 @@ LLSD LLMemoryInfo::loadStatsMap()  			}  	} -#elif LL_SOLARIS -	U64 phys = 0; - -	phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - -	stats.add("Total Physical KB", phys); -  #elif LL_LINUX  	std::ifstream meminfo(MEMINFO_FILE);  	if (meminfo.is_open()) diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 0b9dec969c..98905f3b71 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -36,7 +36,7 @@  #include "lltracethreadrecorder.h"  #include "llexception.h" -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  #include <sched.h>  #endif diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 76e892212a..aaa6df325c 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -32,7 +32,7 @@  #if LL_WINDOWS  #	include "llwin32headerslean.h" -#elif LL_LINUX || LL_SOLARIS || LL_DARWIN +#elif LL_LINUX || LL_DARWIN  #   include <errno.h>  #	include <sys/time.h>  #else  @@ -74,7 +74,7 @@ U32 micro_sleep(U64 us, U32 max_yields)  	ms_sleep((U32)(us / 1000));      return 0;  } -#elif LL_LINUX || LL_SOLARIS || LL_DARWIN +#elif LL_LINUX || LL_DARWIN  static void _sleep_loop(struct timespec& thiswait)  {  	struct timespec nextwait; @@ -187,7 +187,7 @@ F64 calc_clock_frequency()  #endif // LL_WINDOWS -#if LL_LINUX || LL_DARWIN || LL_SOLARIS +#if LL_LINUX || LL_DARWIN  // Both Linux and Mac use gettimeofday for accurate time  F64 calc_clock_frequency()  { diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index ec70213447..010f290b24 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -27,7 +27,7 @@  #ifndef LL_TIMER_H					  #define LL_TIMER_H -#if LL_LINUX || LL_DARWIN || LL_SOLARIS +#if LL_LINUX || LL_DARWIN  #include <sys/time.h>  #endif  #include <limits.h> diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index c275b90120..e4f229dd16 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -29,10 +29,13 @@  #include "linden_common.h"  #include "lluriparser.h" +#if LL_DARWIN +#include <signal.h> +#include <setjmp.h> +#endif +  LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedTmp(false), mRes(0)  { -	mState.uri = &mUri; -  	if (u.find("://") == std::string::npos)  	{  		mNormalizedUri = "http://"; @@ -51,7 +54,7 @@ LLUriParser::~LLUriParser()  S32 LLUriParser::parse()  { -	mRes = uriParseUriA(&mState, mNormalizedUri.c_str()); +	mRes = uriParseSingleUriA(&mUri, mNormalizedUri.c_str(), NULL);  	return mRes;  } @@ -158,31 +161,69 @@ void LLUriParser::extractParts()  	}  } +#if LL_DARWIN +typedef void(*sighandler_t)(int); +jmp_buf return_to_normalize; +void uri_signal_handler(int signal) +{ +    // Apparently signal handler throwing an exception doesn't work. +    // This is ugly and unsafe due to not unwinding content of uriparser library, +    // but unless we have a way to catch this as NSexception, jump appears to be the only option. +    longjmp(return_to_normalize, 1 /*setjmp will return this value*/); +} +#endif +  S32 LLUriParser::normalize()  {  	mNormalizedTmp = mTmpScheme;  	if (!mRes)  	{ -		mRes = uriNormalizeSyntaxExA(&mUri, URI_NORMALIZE_SCHEME | URI_NORMALIZE_HOST); - -		if (!mRes) -		{ -			S32 chars_required; -			mRes = uriToStringCharsRequiredA(&mUri, &chars_required); - -			if (!mRes) -			{ -				chars_required++; -				std::vector<char> label_buf(chars_required); -				mRes = uriToStringA(&label_buf[0], &mUri, chars_required, NULL); - -				if (!mRes) -				{ -					mNormalizedUri = &label_buf[mTmpScheme ? 7 : 0]; -					mTmpScheme = false; -				} -			} -		} +#if LL_DARWIN +        sighandler_t last_handler; +        last_handler = signal(SIGILL, &uri_signal_handler);		// illegal instruction +        if (setjmp(return_to_normalize)) +        { +            // Issue: external library crashed via signal +            // If you encountered this, please try to figure out what's wrong: +            // 1. Verify that library's input is 'sane' +            // 2. Check if we have an NSexception to work with (unlikely) +            // 3. See if passing same string causes exception to repeat +            // +            // Crash happens at uriNormalizeSyntaxExA +            // Warning!!! This does not properly unwind stack, +            // if this can be handled by NSexception, it needs to be remade +            llassert(0); + +            LL_WARNS() << "Uriparser crashed with SIGILL, while processing: " << mNormalizedUri << LL_ENDL; +            signal(SIGILL, last_handler); +            return 1; +        } +#endif + +        mRes = uriNormalizeSyntaxExA(&mUri, URI_NORMALIZE_SCHEME | URI_NORMALIZE_HOST); + +#if LL_DARWIN +        signal(SIGILL, last_handler); +#endif + +        if (!mRes) +        { +            S32 chars_required; +            mRes = uriToStringCharsRequiredA(&mUri, &chars_required); + +            if (!mRes) +            { +                chars_required++; +                std::vector<char> label_buf(chars_required); +                mRes = uriToStringA(&label_buf[0], &mUri, chars_required, NULL); + +                if (!mRes) +                { +                    mNormalizedUri = &label_buf[mTmpScheme ? 7 : 0]; +                    mTmpScheme = false; +                } +            } +        }  	}  	if(mTmpScheme) diff --git a/indra/llcommon/lluriparser.h b/indra/llcommon/lluriparser.h index cfbf54f3c8..92626b9054 100644 --- a/indra/llcommon/lluriparser.h +++ b/indra/llcommon/lluriparser.h @@ -76,7 +76,6 @@ private:  	std::string mFragment;  	std::string mNormalizedUri; -	UriParserStateA mState;  	UriUriA mUri;  	S32 mRes; diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index b05630c6b5..e3b293e465 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -601,9 +601,7 @@ S32 LLUUID::getNodeID(unsigned char *node_id)  #define HAVE_NETINET_IN_H  #ifdef HAVE_NETINET_IN_H  #include <netinet/in.h> -#if LL_SOLARIS -#include <sys/sockio.h> -#elif !LL_DARWIN +#if !LL_DARWIN  #include <linux/sockios.h>  #endif  #endif diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index 6c9871e76c..887f6ab733 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -57,7 +57,7 @@ typedef unsigned __int64		U64;  #else  typedef long long int			S64;  typedef long long unsigned int		U64; -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX  #define S64L(a)				(a##LL)  #define U64L(a)				(a##ULL)  #endif diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index 11b2e3e929..240ea2da83 100644 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -178,6 +178,7 @@ if (DARWIN)      libaprutil-1.0.dylib      libexception_handler.dylib      libnghttp2*.dylib +    liburiparser*.dylib      ${EXPAT_COPY}      ) diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 8f01ad6c1c..e4ccd81faf 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -47,9 +47,6 @@  #elif (LL_LINUX && __GNUC__ <= 2)  #define llisnan(val)	isnan(val)  #define llfinite(val)	isfinite(val) -#elif LL_SOLARIS -#define llisnan(val)    isnan(val) -#define llfinite(val)   (val <= std::numeric_limits<double>::max())  #else  #define llisnan(val)	std::isnan(val)  #define llfinite(val)	std::isfinite(val) diff --git a/indra/llmath/llsdutil_math.cpp b/indra/llmath/llsdutil_math.cpp index 591f7fde36..51e5e3764f 100644 --- a/indra/llmath/llsdutil_math.cpp +++ b/indra/llmath/llsdutil_math.cpp @@ -40,7 +40,7 @@  #if LL_WINDOWS  #	define WIN32_LEAN_AND_MEAN  #	include <winsock2.h>	// for htonl -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX  #	include <netinet/in.h>  #elif LL_DARWIN  #	include <arpa/inet.h> diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index c799d8eefc..7e4572f50f 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -262,7 +262,7 @@ public:      virtual void logAssetStorageInfo() = 0; -	void checkForTimeouts(); +	virtual void checkForTimeouts();  	void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,  									const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype, diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 7380df041d..c67f59bc0c 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -145,10 +145,10 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU      }      LLSD httpResults; +    bool success = true;      try      { -        bool success = true;          LLCoreHttpUtil::HttpCoroutineAdapter httpAdapter("NameCache", sHttpPolicy);          LLSD results = httpAdapter.getAndSuspend(sHttpRequest, url); @@ -163,35 +163,47 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU          else          {              httpResults = results["http_result"]; -            success = httpResults["success"].asBoolean(); -            if (!success) +            if (!httpResults.isMap())              { -                LL_WARNS("AvNameCache") << "Error result from LLCoreHttpUtil::HttpCoroHandler. Code " -                    << httpResults["status"] << ": '" << httpResults["message"] << "'" << LL_ENDL; +                success = false; +                LL_WARNS("AvNameCache") << " Invalid http_result returned from LLCoreHttpUtil::HttpCoroHandler." << LL_ENDL;              } -        } - -        if (!success) -        {   // on any sort of failure add dummy records for any agent IDs  -            // in this request that we do not have cached already -            std::vector<LLUUID>::const_iterator it = agentIds.begin(); -            for ( ; it != agentIds.end(); ++it) +            else              { -                const LLUUID& agent_id = *it; -                LLAvatarNameCache::getInstance()->handleAgentError(agent_id); +                success = httpResults["success"].asBoolean(); +                if (!success) +                { +                    LL_WARNS("AvNameCache") << "Error result from LLCoreHttpUtil::HttpCoroHandler. Code " +                        << httpResults["status"] << ": '" << httpResults["message"] << "'" << LL_ENDL; +                }              } -            return;          } -        LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults); +        if (LLAvatarNameCache::instanceExists()) +        { +            if (!success) +            {   // on any sort of failure add dummy records for any agent IDs  +                // in this request that we do not have cached already +                std::vector<LLUUID>::const_iterator it = agentIds.begin(); +                for (; it != agentIds.end(); ++it) +                { +                    const LLUUID& agent_id = *it; +                    LLAvatarNameCache::getInstance()->handleAgentError(agent_id); +                } +                return; +            } +            LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults); +        }      }      catch (...)      {          LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::getName() -                                          << "('" << url << "', " << agentIds.size() -                                          << " http result: " << httpResults.asString() -                                          << " Agent Ids)")); +                                          << "('" << url << "', " +                                          << agentIds.size() << "Agent Ids," +                                          << " http result: " << S32(success) +                                          << " has response: " << S32(httpResults.size()) +                                          << ")"));          throw;      }  } diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index a4fe3a2a8e..4d76dacdf7 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -47,7 +47,7 @@ static const std::map<std::string, U32> DefaultPoolSizes{  };  static const U32 DEFAULT_POOL_SIZE = 5; -static const U32 DEFAULT_QUEUE_SIZE = 4096; +const U32 LLCoprocedureManager::DEFAULT_QUEUE_SIZE = 4096;  //=========================================================================  class LLCoprocedurePool: private boost::noncopyable @@ -194,7 +194,7 @@ void LLCoprocedureManager::setPropertyMethods(SettingQuery_t queryfn, SettingUpd      mPropertyDefineFn = updatefn;      // workaround until we get mutex into initializePool -    initializePool("VAssetStorage"); +    initializePool("AssetStorage");      initializePool("Upload");  } @@ -281,7 +281,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):      mPoolSize(size),      mActiveCoprocsCount(0),      mPending(0), -    mPendingCoprocs(boost::make_shared<CoprocQueue_t>(DEFAULT_QUEUE_SIZE)), +    mPendingCoprocs(boost::make_shared<CoprocQueue_t>(LLCoprocedureManager::DEFAULT_QUEUE_SIZE)),      mHTTPPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),      mCoroMapping()  { @@ -332,7 +332,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):          mCoroMapping.insert(CoroAdapterMap_t::value_type(pooledCoro, httpAdapter));      } -    LL_INFOS("CoProcMgr") << "Created coprocedure pool named \"" << mPoolName << "\" with " << size << " items, queue max " << DEFAULT_QUEUE_SIZE << LL_ENDL; +    LL_INFOS("CoProcMgr") << "Created coprocedure pool named \"" << mPoolName << "\" with " << size << " items, queue max " << LLCoprocedureManager::DEFAULT_QUEUE_SIZE << LL_ENDL;  }  LLCoprocedurePool::~LLCoprocedurePool()  diff --git a/indra/llmessage/llcoproceduremanager.h b/indra/llmessage/llcoproceduremanager.h index 70204ba02b..d5557c129f 100644 --- a/indra/llmessage/llcoproceduremanager.h +++ b/indra/llmessage/llcoproceduremanager.h @@ -91,6 +91,9 @@ private:      SettingQuery_t mPropertyQueryFn;      SettingUpdate_t mPropertyDefineFn; + +public: +    static const U32 DEFAULT_QUEUE_SIZE;  };  #endif diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 52dbf871db..e25a9ea7ef 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -35,10 +35,6 @@  #include <netinet/in.h>  #endif -#if LL_SOLARIS -#include <netinet/in.h> -#endif -  #if LL_WINDOWS  #include "winsock2.h" // htons etc.  #endif diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index ee02a90b54..43fedeca64 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -151,7 +151,7 @@ LLMatrix4 gGLObliqueProjectionInverse;  std::list<LLGLUpdate*> LLGLUpdate::sGLQ; -#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS)  && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX)  && !LL_MESA_HEADLESS  // ATI prototypes  #if LL_WINDOWS @@ -328,7 +328,7 @@ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;  #endif  // vertex shader prototypes -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;  PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL;  PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; @@ -347,7 +347,7 @@ PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL;  PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL;  PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL;  PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL; -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX  PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL;  PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL;  PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL; @@ -355,7 +355,7 @@ PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL;  PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL;  PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL;  PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; -#if LL_LINUX  || LL_SOLARIS +#if LL_LINUX  PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL;  PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL;  PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; @@ -393,7 +393,7 @@ PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL;  PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL;  PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL;  PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX  PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL;  PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL;  PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; @@ -471,8 +471,6 @@ LLGLManager::LLGLManager() :  	mHasSeparateSpecularColor(FALSE), -	mDebugGPU(FALSE), -  	mDriverVersionMajor(1),  	mDriverVersionMinor(0),  	mDriverVersionRelease(0), @@ -854,10 +852,6 @@ bool LLGLManager::initGL()  	stop_glerror(); -	setToDebugGPU(); - -	stop_glerror(); -  	initGLStates();  	stop_glerror(); @@ -865,17 +859,6 @@ bool LLGLManager::initGL()  	return true;  } -void LLGLManager::setToDebugGPU() -{ -	//"MOBILE INTEL(R) 965 EXPRESS CHIP",  -	if (mGLRenderer.find("INTEL") != std::string::npos && mGLRenderer.find("965") != std::string::npos) -	{ -		mDebugGPU = TRUE ; -	} - -	return ; -} -  void LLGLManager::getGLInfo(LLSD& info)  {  	if (gHeadlessClient) @@ -1032,7 +1015,6 @@ void LLGLManager::asLLSD(LLSD& info)  	// Other fields  	info["has_requirements"] = mHasRequirements;  	info["has_separate_specular_color"] = mHasSeparateSpecularColor; -	info["debug_gpu"] = mDebugGPU;  	info["max_vertex_range"] = mGLMaxVertexRange;  	info["max_index_range"] = mGLMaxIndexRange;  	info["max_texture_size"] = mGLMaxTextureSize; @@ -1167,7 +1149,7 @@ void LLGLManager::initExtensions()  	mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));  #endif -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  	LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL;  	// Our extension support for the Linux Client is very young with some  	// potential driver gotchas, so offer a semi-secret way to turn it off. @@ -1237,7 +1219,7 @@ void LLGLManager::initExtensions()  		if (strchr(blacklist,'u')) mHasDepthClamp = FALSE;  	} -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX  	if (!mHasMultitexture)  	{ @@ -1315,7 +1297,7 @@ void LLGLManager::initExtensions()  	glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange);  	glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize); -#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS  	LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;  	if (mHasVertexBufferObject)  	{ @@ -1414,7 +1396,7 @@ void LLGLManager::initExtensions()  		glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB");  		glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB");  	} -#if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS +#if (!LL_LINUX) || LL_LINUX_NV_GL_HEADERS  	// This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah  	glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");  	if (!glDrawRangeElements) @@ -2775,8 +2757,9 @@ LLGLSPipelineBlendSkyBox::LLGLSPipelineBlendSkyBox(bool depth_test, bool depth_w  #if LL_WINDOWS  // Expose desired use of high-performance graphics processor to Optimus driver and to AMD driver +// https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm  extern "C"  -{ +{       __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;      __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;  } diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 966c4b3c77..a07e2d9bb0 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -142,9 +142,6 @@ public:  	// Misc extensions  	BOOL mHasSeparateSpecularColor; -	//whether this GPU is in the debug list. -	BOOL mDebugGPU; -	  	S32 mDriverVersionMajor;  	S32 mDriverVersionMinor;  	S32 mDriverVersionRelease; @@ -178,7 +175,6 @@ private:  	void initExtensions();  	void initGLStates();  	void initGLImages(); -	void setToDebugGPU();  };  extern LLGLManager gGLManager; diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 36fbb381bb..6bca3623e0 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -27,242 +27,7 @@  #ifndef LL_LLGLHEADERS_H  #define LL_LLGLHEADERS_H -#if LL_SOLARIS -#   if defined(__sparc) -#      define I_NEED_OS2_H 	//  avoiding BOOL conflicts -#   endif -#   include "GL/gl.h" -#   if defined(__sparc) -#      undef I_NEED_OS2_H -#      ifdef BOOL -#         undef BOOL		// now get rid of Xmd.h crap -#      endif -#   endif -#   include "GL/glx.h" -#   define  GL_GLEXT_PROTOTYPES 1 -#   include "GL/glext.h" -#   include "GL/glu.h" -#   include "GL/glx.h" -#   define  GLX_GLXEXT_PROTOTYPES 1 -#   include "GL/glxext.h" -//#   define  GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB((const GLubyte*)(p)) -#   define  GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddress((const GLubyte*)(p)) - -// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly -// This header is distributed with SL.  You'll find it in linden/libraries/include/GL/ -# define __APPLE__ -# include "GL/glh_extensions.h" -# undef __APPLE__ - - -// GL_ARB_vertex_buffer_object -extern PFNGLBINDBUFFERARBPROC		glBindBufferARB; -extern PFNGLDELETEBUFFERSARBPROC	glDeleteBuffersARB; -extern PFNGLGENBUFFERSARBPROC		glGenBuffersARB; -extern PFNGLISBUFFERARBPROC			glIsBufferARB; -extern PFNGLBUFFERDATAARBPROC		glBufferDataARB; -extern PFNGLBUFFERSUBDATAARBPROC	glBufferSubDataARB; -extern PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB; -extern PFNGLMAPBUFFERARBPROC		glMapBufferARB; -extern PFNGLUNMAPBUFFERARBPROC		glUnmapBufferARB; -extern PFNGLGETBUFFERPARAMETERIVARBPROC	glGetBufferParameterivARB; -extern PFNGLGETBUFFERPOINTERVARBPROC	glGetBufferPointervARB; - -// GL_ARB_vertex_array_object -extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray; -extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; -extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; -extern PFNGLISVERTEXARRAYPROC glIsVertexArray; - -// GL_ARB_sync -extern PFNGLFENCESYNCPROC				glFenceSync; -extern PFNGLISSYNCPROC					glIsSync; -extern PFNGLDELETESYNCPROC				glDeleteSync; -extern PFNGLCLIENTWAITSYNCPROC			glClientWaitSync; -extern PFNGLWAITSYNCPROC				glWaitSync; -extern PFNGLGETINTEGER64VPROC			glGetInteger64v; -extern PFNGLGETSYNCIVPROC				glGetSynciv; - -// GL_APPLE_flush_buffer_range -extern PFNGLBUFFERPARAMETERIAPPLEPROC	glBufferParameteriAPPLE; -extern PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC glFlushMappedBufferRangeAPPLE; - -// GL_ARB_map_buffer_range -extern PFNGLMAPBUFFERRANGEPROC			glMapBufferRange; -extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC	glFlushMappedBufferRange; - -// GL_ATI_vertex_array_object -extern PFNGLNEWOBJECTBUFFERATIPROC			glNewObjectBufferATI; -extern PFNGLISOBJECTBUFFERATIPROC			glIsObjectBufferATI; -extern PFNGLUPDATEOBJECTBUFFERATIPROC		glUpdateObjectBufferATI; -extern PFNGLGETOBJECTBUFFERFVATIPROC		glGetObjectBufferfvATI; -extern PFNGLGETOBJECTBUFFERIVATIPROC		glGetObjectBufferivATI; -extern PFNGLFREEOBJECTBUFFERATIPROC		    glFreeObjectBufferATI; -extern PFNGLARRAYOBJECTATIPROC				glArrayObjectATI; -extern PFNGLVERTEXATTRIBARRAYOBJECTATIPROC	glVertexAttribArrayObjectATI; -extern PFNGLGETARRAYOBJECTFVATIPROC			glGetArrayObjectfvATI; -extern PFNGLGETARRAYOBJECTIVATIPROC			glGetArrayObjectivATI; -extern PFNGLVARIANTARRAYOBJECTATIPROC		glVariantObjectArrayATI; -extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC	glGetVariantArrayObjectfvATI; -extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC	glGetVariantArrayObjectivATI; - -// GL_ARB_occlusion_query -extern PFNGLGENQUERIESARBPROC glGenQueriesARB; -extern PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB; -extern PFNGLISQUERYARBPROC glIsQueryARB; -extern PFNGLBEGINQUERYARBPROC glBeginQueryARB; -extern PFNGLENDQUERYARBPROC glEndQueryARB; -extern PFNGLGETQUERYIVARBPROC glGetQueryivARB; -extern PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB; -extern PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB; - -// GL_ARB_timer_query -extern PFNGLQUERYCOUNTERPROC glQueryCounter; -extern PFNGLGETQUERYOBJECTI64VPROC glGetQueryObjecti64v; -extern PFNGLGETQUERYOBJECTUI64VPROC glGetQueryObjectui64v; - -// GL_ARB_point_parameters -extern PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB; -extern PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB; - -// GL_ARB_shader_objects -extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; -extern PFNGLGETHANDLEARBPROC glGetHandleARB; -extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB; -extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; -extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB; -extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB; -extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; -extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB; -extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB; -extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; -extern PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB; -extern PFNGLUNIFORM1FARBPROC glUniform1fARB; -extern PFNGLUNIFORM2FARBPROC glUniform2fARB; -extern PFNGLUNIFORM3FARBPROC glUniform3fARB; -extern PFNGLUNIFORM4FARBPROC glUniform4fARB; -extern PFNGLUNIFORM1IARBPROC glUniform1iARB; -extern PFNGLUNIFORM2IARBPROC glUniform2iARB; -extern PFNGLUNIFORM3IARBPROC glUniform3iARB; -extern PFNGLUNIFORM4IARBPROC glUniform4iARB; -extern PFNGLUNIFORM1FVARBPROC glUniform1fvARB; -extern PFNGLUNIFORM2FVARBPROC glUniform2fvARB; -extern PFNGLUNIFORM3FVARBPROC glUniform3fvARB; -extern PFNGLUNIFORM4FVARBPROC glUniform4fvARB; -extern PFNGLUNIFORM1IVARBPROC glUniform1ivARB; -extern PFNGLUNIFORM2IVARBPROC glUniform2ivARB; -extern PFNGLUNIFORM3IVARBPROC glUniform3ivARB; -extern PFNGLUNIFORM4IVARBPROC glUniform4ivARB; -extern PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB; -extern PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB; -extern PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv; -extern PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB; -extern PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB; -extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; -extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB; -extern PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB; -extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; -extern PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB; -extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB; -extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; -extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; - -// GL_ARB_vertex_shader -extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; -extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; -extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; -extern PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB; -extern PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB; -extern PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB; -extern PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB; -extern PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB; -extern PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB; -extern PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB; -extern PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB; -extern PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB; -extern PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB; -extern PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB; -extern PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB; -extern PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB; -extern PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB; -extern PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB; -extern PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB; -extern PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB; -extern PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB; -extern PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB; -extern PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB; -extern PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB; -extern PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB; -extern PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB; -extern PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB; -extern PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB; -extern PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB; -extern PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB; -extern PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB; -extern PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB; -extern PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB; -extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB; -extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB; -extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB; -extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; -extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer; -extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; -extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; -extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB; -extern PFNGLBINDPROGRAMARBPROC glBindProgramARB; -extern PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB; -extern PFNGLGENPROGRAMSARBPROC glGenProgramsARB; -extern PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB; -extern PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB; -extern PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; -extern PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB; -extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB; -extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB; -extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB; -extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB; -extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB; -extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB; -extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB; -extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB; -extern PFNGLGETPROGRAMIVARBPROC glGetProgramivARB; -extern PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB; -extern PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB; -extern PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB; -extern PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB; -extern PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB; -extern PFNGLISPROGRAMARBPROC glIsProgramARB; -extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; -extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB; -extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; - -extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB; -extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB; - -extern PFNGLCOLORTABLEEXTPROC glColorTableEXT; - -//GL_EXT_blend_func_separate -extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT; - -//GL_EXT_framebuffer_object -extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; -extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; -extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; -extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; -extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; -extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; -extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; -extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; -extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; -extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; -extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; -extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; -extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; -extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; -extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; -extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; -extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; - -#elif LL_MESA +#if LL_MESA  //----------------------------------------------------------------------------  // MESA headers  // quotes so we get libraries/.../GL/ version diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 384e5bf99f..4351f6e2c8 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -37,6 +37,10 @@  #include "OpenGL/OpenGL.h"  #endif +// Print-print list of shader included source files that are linked together via glAttachObjectARB() +// i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state. +#define DEBUG_SHADER_INCLUDES 0 +  // Lots of STL stuff in here, using namespace std to keep things more readable  using std::vector;  using std::pair; @@ -392,16 +396,28 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,      mLightHash = 0xFFFFFFFF;      llassert_always(!mShaderFiles.empty()); -    BOOL success = TRUE;      // Create program      mProgramObject = glCreateProgramObjectARB(); +    if (mProgramObject == 0) +    { +        // Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist. +        LL_SHADER_LOADING_WARNS() << "Failed to create handle for shader: " << mName << LL_ENDL; +        unloadInternal(); +        return FALSE; +    } + +    BOOL success = TRUE;  #if LL_DARWIN      // work-around missing mix(vec3,vec3,bvec3)      mDefines["OLD_SELECT"] = "1";  #endif +#if DEBUG_SHADER_INCLUDES +    fprintf(stderr, "--- %s ---\n", mName.c_str()); +#endif // DEBUG_SHADER_INCLUDES +      //compile new source      vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();      for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -485,11 +501,36 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,      return success;  } -BOOL LLGLSLShader::attachVertexObject(std::string object_path) { +#if DEBUG_SHADER_INCLUDES +void dumpAttachObject( const char *func_name, GLhandleARB program_object, const std::string &object_path ) +{ +    GLcharARB* info_log; +    GLint      info_len_expect = 0; +    GLint      info_len_actual = 0; + +    glGetObjectParameterivARB(program_object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_len_expect); +    fprintf(stderr, " * %-20s(), log size: %d, %s\n", func_name, info_len_expect, object_path.c_str()); + +    if (info_len_expect > 0) +    { +        fprintf(stderr, " ========== %s() ========== \n", func_name); +        info_log = new GLcharARB [ info_len_expect ]; +        glGetInfoLogARB(program_object, info_len_expect, &info_len_actual, info_log); +        fprintf(stderr, "%s\n",  info_log); +        delete [] info_log; +    } +} +#endif // DEBUG_SHADER_INCLUDES + +BOOL LLGLSLShader::attachVertexObject(std::string object_path) +{      if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0)      {          stop_glerror();          glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]); +#if DEBUG_SHADER_INCLUDES +        dumpAttachObject("attachVertexObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES          stop_glerror();          return TRUE;      } @@ -506,6 +547,9 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)      {          stop_glerror();          glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]); +#if DEBUG_SHADER_INCLUDES +        dumpAttachObject("attachFragmentObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES          stop_glerror();          return TRUE;      } @@ -522,6 +566,10 @@ void LLGLSLShader::attachObject(GLhandleARB object)      {          stop_glerror();          glAttachObjectARB(mProgramObject, object); +#if DEBUG_SHADER_INCLUDES +        std::string object_path("???"); +        dumpAttachObject("attachObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES          stop_glerror();      }      else diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 11d9ef3f57..d515fc707a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -871,10 +871,10 @@ void LLTexUnit::setTextureColorSpace(eTextureColorSpace space)          }      }      else -#endif      {          glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);      } +#endif  }  LLLightState::LLLightState(S32 index) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 236ebbd78f..e8c6295930 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -611,13 +611,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade  #endif  	GLenum error = GL_NO_ERROR; -	if (gDebugGL) + +	error = glGetError(); +	if (error != GL_NO_ERROR)  	{ -		error = glGetError(); -		if (error != GL_NO_ERROR) -		{ -			LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << LL_ENDL; -		} +		LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << " for file: " << filename << LL_ENDL;  	}  	if (filename.empty())  @@ -966,55 +964,45 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade  	//create shader object  	GLhandleARB ret = glCreateShaderObjectARB(type); -	if (gDebugGL) + +	error = glGetError(); +	if (error != GL_NO_ERROR)  	{ -		error = glGetError(); -		if (error != GL_NO_ERROR) -		{ -			LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << LL_ENDL; -		} +		LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << " for file: " << open_file_name << LL_ENDL;  	} -	 +  	//load source  	glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL); -	if (gDebugGL) +	error = glGetError(); +	if (error != GL_NO_ERROR)  	{ -		error = glGetError(); -		if (error != GL_NO_ERROR) -		{ -			LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << LL_ENDL; -		} +		LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << " for file: " << open_file_name << LL_ENDL;  	}  	//compile source  	glCompileShaderARB(ret); -	if (gDebugGL) +	error = glGetError(); +	if (error != GL_NO_ERROR)  	{ -		error = glGetError(); -		if (error != GL_NO_ERROR) -		{ -			LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << LL_ENDL; -		} +		LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << " for file: " << open_file_name << LL_ENDL;  	} -		 +  	if (error == GL_NO_ERROR)  	{  		//check for errors  		GLint success = GL_TRUE;  		glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success); -		if (gDebugGL || success == GL_FALSE) + +		error = glGetError(); +		if (error != GL_NO_ERROR || success == GL_FALSE)   		{ -			error = glGetError(); -			if (error != GL_NO_ERROR || success == GL_FALSE)  -			{ -				//an error occured, print log -				LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL; -				dumpObjectLog(ret, TRUE, open_file_name); -                dumpShaderSource(shader_code_count, shader_code_text); -				ret = 0; -			} +			//an error occured, print log +			LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL; +			dumpObjectLog(ret, TRUE, open_file_name); +			dumpShaderSource(shader_code_count, shader_code_text); +			ret = 0;  		}  	}  	else diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 127b5ce5b6..3908efd4ec 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -36,221 +36,223 @@ public:  	LLShaderMgr();  	virtual ~LLShaderMgr(); -	typedef enum -	{ -		MODELVIEW_MATRIX = 0, -		PROJECTION_MATRIX, -		INVERSE_PROJECTION_MATRIX, -		MODELVIEW_PROJECTION_MATRIX, -        INVERSE_MODELVIEW_MATRIX, -		NORMAL_MATRIX, -		TEXTURE_MATRIX0, -		TEXTURE_MATRIX1, -		TEXTURE_MATRIX2, -		TEXTURE_MATRIX3, -		OBJECT_PLANE_S, -		OBJECT_PLANE_T, -		VIEWPORT, -		LIGHT_POSITION, -		LIGHT_DIRECTION, -		LIGHT_ATTENUATION, -		LIGHT_DIFFUSE, -		LIGHT_AMBIENT, -		MULTI_LIGHT_COUNT, -		MULTI_LIGHT, -		MULTI_LIGHT_COL, -		MULTI_LIGHT_FAR_Z, -		PROJECTOR_MATRIX, -		PROJECTOR_NEAR, -		PROJECTOR_P, -		PROJECTOR_N, -		PROJECTOR_ORIGIN, -		PROJECTOR_RANGE, -		PROJECTOR_AMBIANCE, -		PROJECTOR_SHADOW_INDEX, -		PROJECTOR_SHADOW_FADE, -		PROJECTOR_FOCUS, -		PROJECTOR_LOD, -		PROJECTOR_AMBIENT_LOD, -		DIFFUSE_COLOR, -		DIFFUSE_MAP, -        ALTERNATE_DIFFUSE_MAP, -		SPECULAR_MAP, -		BUMP_MAP, -        BUMP_MAP2, -		ENVIRONMENT_MAP, -		CLOUD_NOISE_MAP, -        CLOUD_NOISE_MAP_NEXT, -		FULLBRIGHT, -		LIGHTNORM, -		SUNLIGHT_COLOR, -		AMBIENT, -		BLUE_HORIZON, -		BLUE_DENSITY, -		HAZE_HORIZON, -		HAZE_DENSITY, -		CLOUD_SHADOW, -		DENSITY_MULTIPLIER, -		DISTANCE_MULTIPLIER, -		MAX_Y, -		GLOW, -		CLOUD_COLOR, -		CLOUD_POS_DENSITY1, -		CLOUD_POS_DENSITY2, -		CLOUD_SCALE, -		GAMMA, -		SCENE_LIGHT_STRENGTH, -		LIGHT_CENTER, -		LIGHT_SIZE, -		LIGHT_FALLOFF, -		BOX_CENTER, -		BOX_SIZE, - -		GLOW_MIN_LUMINANCE, -		GLOW_MAX_EXTRACT_ALPHA, -		GLOW_LUM_WEIGHTS, -		GLOW_WARMTH_WEIGHTS, -		GLOW_WARMTH_AMOUNT, -		GLOW_STRENGTH, -		GLOW_DELTA, - -		MINIMUM_ALPHA, -		EMISSIVE_BRIGHTNESS, - -		DEFERRED_SHADOW_MATRIX, -		DEFERRED_ENV_MAT, -		DEFERRED_SHADOW_CLIP, -		DEFERRED_SUN_WASH, -		DEFERRED_SHADOW_NOISE, -		DEFERRED_BLUR_SIZE, -		DEFERRED_SSAO_RADIUS, -		DEFERRED_SSAO_MAX_RADIUS, -		DEFERRED_SSAO_FACTOR, -		DEFERRED_SSAO_FACTOR_INV, -		DEFERRED_SSAO_EFFECT_MAT, -		DEFERRED_SCREEN_RES, -		DEFERRED_NEAR_CLIP, -		DEFERRED_SHADOW_OFFSET, -		DEFERRED_SHADOW_BIAS, -		DEFERRED_SPOT_SHADOW_BIAS, -		DEFERRED_SPOT_SHADOW_OFFSET, -		DEFERRED_SUN_DIR, -        DEFERRED_MOON_DIR, -		DEFERRED_SHADOW_RES, -		DEFERRED_PROJ_SHADOW_RES, -		DEFERRED_DEPTH_CUTOFF, -		DEFERRED_NORM_CUTOFF, -		DEFERRED_SHADOW_TARGET_WIDTH, - -		FXAA_TC_SCALE, -		FXAA_RCP_SCREEN_RES, -		FXAA_RCP_FRAME_OPT, -		FXAA_RCP_FRAME_OPT2, - -		DOF_FOCAL_DISTANCE, -		DOF_BLUR_CONSTANT, -		DOF_TAN_PIXEL_ANGLE, -		DOF_MAGNIFICATION, -		DOF_MAX_COF, -		DOF_RES_SCALE, -		DOF_WIDTH, -		DOF_HEIGHT, - -		DEFERRED_DEPTH, -		DEFERRED_SHADOW0, -		DEFERRED_SHADOW1, -		DEFERRED_SHADOW2, -		DEFERRED_SHADOW3, -		DEFERRED_SHADOW4, -		DEFERRED_SHADOW5, -		DEFERRED_NORMAL, -		DEFERRED_POSITION, -		DEFERRED_DIFFUSE, -		DEFERRED_SPECULAR, -		DEFERRED_NOISE, -		DEFERRED_LIGHTFUNC, -		DEFERRED_LIGHT, -		DEFERRED_BLOOM, -		DEFERRED_PROJECTION, -		DEFERRED_NORM_MATRIX, -		TEXTURE_GAMMA,		 -		SPECULAR_COLOR, -		ENVIRONMENT_INTENSITY, -		 -		AVATAR_MATRIX, -		AVATAR_TRANSLATION, - -		WATER_SCREENTEX, -		WATER_SCREENDEPTH, -		WATER_REFTEX, -		WATER_EYEVEC, -		WATER_TIME, -		WATER_WAVE_DIR1, -		WATER_WAVE_DIR2, -		WATER_LIGHT_DIR, -		WATER_SPECULAR, -		WATER_SPECULAR_EXP, -		WATER_FOGCOLOR, -		WATER_FOGDENSITY, -		WATER_FOGKS, -		WATER_REFSCALE, -		WATER_WATERHEIGHT, -		WATER_WATERPLANE, -		WATER_NORM_SCALE, -		WATER_FRESNEL_SCALE, -		WATER_FRESNEL_OFFSET, -		WATER_BLUR_MULTIPLIER, -		WATER_SUN_ANGLE, -		WATER_SCALED_ANGLE, -		WATER_SUN_ANGLE2, -		 -		WL_CAMPOSLOCAL, - -		AVATAR_WIND, -		AVATAR_SINWAVE, -		AVATAR_GRAVITY, - -		TERRAIN_DETAIL0, -		TERRAIN_DETAIL1, -		TERRAIN_DETAIL2, -		TERRAIN_DETAIL3, -		TERRAIN_ALPHARAMP, -		 -		SHINY_ORIGIN, -        DISPLAY_GAMMA, - -        INSCATTER_RT, -        SUN_SIZE, -        FOG_COLOR, +    // clang-format off +    typedef enum +    {                                       // Shader uniform name, set in LLShaderMgr::initAttribsAndUniforms() +        MODELVIEW_MATRIX = 0,               //  "modelview_matrix" +        PROJECTION_MATRIX,                  //  "projection_matrix" +        INVERSE_PROJECTION_MATRIX,          //  "inv_proj" +        MODELVIEW_PROJECTION_MATRIX,        //  "modelview_projection_matrix" +        INVERSE_MODELVIEW_MATRIX,           //  "inv_modelview" +        NORMAL_MATRIX,                      //  "normal_matrix" +        TEXTURE_MATRIX0,                    //  "texture_matrix0" +        TEXTURE_MATRIX1,                    //  "texture_matrix1" +        TEXTURE_MATRIX2,                    //  "texture_matrix2" +        TEXTURE_MATRIX3,                    //  "texture_matrix3" +        OBJECT_PLANE_S,                     //  "object_plane_s" +        OBJECT_PLANE_T,                     //  "object_plane_t" +        VIEWPORT,                           //  "viewport" +        LIGHT_POSITION,                     //  "light_position" +        LIGHT_DIRECTION,                    //  "light_direction" +        LIGHT_ATTENUATION,                  //  "light_attenuation" +        LIGHT_DIFFUSE,                      //  "light_diffuse" +        LIGHT_AMBIENT,                      //  "light_ambient" +        MULTI_LIGHT_COUNT,                  //  "light_count" +        MULTI_LIGHT,                        //  "light" +        MULTI_LIGHT_COL,                    //  "light_col" +        MULTI_LIGHT_FAR_Z,                  //  "far_z" +        PROJECTOR_MATRIX,                   //  "proj_mat" +        PROJECTOR_NEAR,                     //  "proj_near" +        PROJECTOR_P,                        //  "proj_p" +        PROJECTOR_N,                        //  "proj_n" +        PROJECTOR_ORIGIN,                   //  "proj_origin" +        PROJECTOR_RANGE,                    //  "proj_range" +        PROJECTOR_AMBIANCE,                 //  "proj_ambiance" +        PROJECTOR_SHADOW_INDEX,             //  "proj_shadow_idx" +        PROJECTOR_SHADOW_FADE,              //  "shadow_fade" +        PROJECTOR_FOCUS,                    //  "proj_focus" +        PROJECTOR_LOD,                      //  "proj_lod" +        PROJECTOR_AMBIENT_LOD,              //  "proj_ambient_lod" +        DIFFUSE_COLOR,                      //  "color" +        DIFFUSE_MAP,                        //  "diffuseMap" +        ALTERNATE_DIFFUSE_MAP,              //  "altDiffuseMap" +        SPECULAR_MAP,                       //  "specularMap" +        BUMP_MAP,                           //  "bumpMap" +        BUMP_MAP2,                          //  "bumpMap2" +        ENVIRONMENT_MAP,                    //  "environmentMap" +        CLOUD_NOISE_MAP,                    //  "cloud_noise_texture" +        CLOUD_NOISE_MAP_NEXT,               //  "cloud_noise_texture_next" +        FULLBRIGHT,                         //  "fullbright" +        LIGHTNORM,                          //  "lightnorm" +        SUNLIGHT_COLOR,                     //  "sunlight_color" +        AMBIENT,                            //  "ambient_color" +        BLUE_HORIZON,                       //  "blue_horizon" +        BLUE_DENSITY,                       //  "blue_density" +        HAZE_HORIZON,                       //  "haze_horizon" +        HAZE_DENSITY,                       //  "haze_density" +        CLOUD_SHADOW,                       //  "cloud_shadow" +        DENSITY_MULTIPLIER,                 //  "density_multiplier" +        DISTANCE_MULTIPLIER,                //  "distance_multiplier" +        MAX_Y,                              //  "max_y" +        GLOW,                               //  "glow" +        CLOUD_COLOR,                        //  "cloud_color" +        CLOUD_POS_DENSITY1,                 //  "cloud_pos_density1" +        CLOUD_POS_DENSITY2,                 //  "cloud_pos_density2" +        CLOUD_SCALE,                        //  "cloud_scale" +        GAMMA,                              //  "gamma" +        SCENE_LIGHT_STRENGTH,               //  "scene_light_strength" +        LIGHT_CENTER,                       //  "center" +        LIGHT_SIZE,                         //  "size" +        LIGHT_FALLOFF,                      //  "falloff" +        BOX_CENTER,                         //  "box_center" +        BOX_SIZE,                           //  "box_size" + +        GLOW_MIN_LUMINANCE,                 //  "minLuminance" +        GLOW_MAX_EXTRACT_ALPHA,             //  "maxExtractAlpha" +        GLOW_LUM_WEIGHTS,                   //  "lumWeights" +        GLOW_WARMTH_WEIGHTS,                //  "warmthWeights" +        GLOW_WARMTH_AMOUNT,                 //  "warmthAmount" +        GLOW_STRENGTH,                      //  "glowStrength" +        GLOW_DELTA,                         //  "glowDelta" + +        MINIMUM_ALPHA,                      //  "minimum_alpha" +        EMISSIVE_BRIGHTNESS,                //  "emissive_brightness" + +        DEFERRED_SHADOW_MATRIX,             //  "shadow_matrix" +        DEFERRED_ENV_MAT,                   //  "env_mat" +        DEFERRED_SHADOW_CLIP,               //  "shadow_clip" +        DEFERRED_SUN_WASH,                  //  "sun_wash" +        DEFERRED_SHADOW_NOISE,              //  "shadow_noise" +        DEFERRED_BLUR_SIZE,                 //  "blur_size" +        DEFERRED_SSAO_RADIUS,               //  "ssao_radius" +        DEFERRED_SSAO_MAX_RADIUS,           //  "ssao_max_radius" +        DEFERRED_SSAO_FACTOR,               //  "ssao_factor" +        DEFERRED_SSAO_FACTOR_INV,           //  "ssao_factor_inv" +        DEFERRED_SSAO_EFFECT_MAT,           //  "ssao_effect_mat" +        DEFERRED_SCREEN_RES,                //  "screen_res" +        DEFERRED_NEAR_CLIP,                 //  "near_clip" +        DEFERRED_SHADOW_OFFSET,             //  "shadow_offset" +        DEFERRED_SHADOW_BIAS,               //  "shadow_bias" +        DEFERRED_SPOT_SHADOW_BIAS,          //  "spot_shadow_bias" +        DEFERRED_SPOT_SHADOW_OFFSET,        //  "spot_shadow_offset" +        DEFERRED_SUN_DIR,                   //  "sun_dir" +        DEFERRED_MOON_DIR,                  //  "moon_dir" +        DEFERRED_SHADOW_RES,                //  "shadow_res" +        DEFERRED_PROJ_SHADOW_RES,           //  "proj_shadow_res" +        DEFERRED_DEPTH_CUTOFF,              //  "depth_cutoff" +        DEFERRED_NORM_CUTOFF,               //  "norm_cutoff" +        DEFERRED_SHADOW_TARGET_WIDTH,       //  "shadow_target_width" + +        FXAA_TC_SCALE,                      //  "tc_scale" +        FXAA_RCP_SCREEN_RES,                //  "rcp_screen_res" +        FXAA_RCP_FRAME_OPT,                 //  "rcp_frame_opt" +        FXAA_RCP_FRAME_OPT2,                //  "rcp_frame_opt2" + +        DOF_FOCAL_DISTANCE,                 //  "focal_distance" +        DOF_BLUR_CONSTANT,                  //  "blur_constant" +        DOF_TAN_PIXEL_ANGLE,                //  "tan_pixel_angle" +        DOF_MAGNIFICATION,                  //  "magnification" +        DOF_MAX_COF,                        //  "max_cof" +        DOF_RES_SCALE,                      //  "res_scale" +        DOF_WIDTH,                          //  "dof_width" +        DOF_HEIGHT,                         //  "dof_height" + +        DEFERRED_DEPTH,                     //  "depthMap" +        DEFERRED_SHADOW0,                   //  "shadowMap0" +        DEFERRED_SHADOW1,                   //  "shadowMap1" +        DEFERRED_SHADOW2,                   //  "shadowMap2" +        DEFERRED_SHADOW3,                   //  "shadowMap3" +        DEFERRED_SHADOW4,                   //  "shadowMap4" +        DEFERRED_SHADOW5,                   //  "shadowMap5" +        DEFERRED_NORMAL,                    //  "normalMap" +        DEFERRED_POSITION,                  //  "positionMap" +        DEFERRED_DIFFUSE,                   //  "diffuseRect" +        DEFERRED_SPECULAR,                  //  "specularRect" +        DEFERRED_NOISE,                     //  "noiseMap" +        DEFERRED_LIGHTFUNC,                 //  "lightFunc" +        DEFERRED_LIGHT,                     //  "lightMap" +        DEFERRED_BLOOM,                     //  "bloomMap" +        DEFERRED_PROJECTION,                //  "projectionMap" +        DEFERRED_NORM_MATRIX,               //  "norm_mat" +        TEXTURE_GAMMA,                      //  "texture_gamma" +        SPECULAR_COLOR,                     //  "specular_color" +        ENVIRONMENT_INTENSITY,              //  "env_intensity" + +        AVATAR_MATRIX,                      //  "matrixPalette" +        AVATAR_TRANSLATION,                 //  "translationPalette" + +        WATER_SCREENTEX,                    //  "screenTex" +        WATER_SCREENDEPTH,                  //  "screenDepth" +        WATER_REFTEX,                       //  "refTex" +        WATER_EYEVEC,                       //  "eyeVec" +        WATER_TIME,                         //  "time" +        WATER_WAVE_DIR1,                    //  "waveDir1" +        WATER_WAVE_DIR2,                    //  "waveDir2" +        WATER_LIGHT_DIR,                    //  "lightDir" +        WATER_SPECULAR,                     //  "specular" +        WATER_SPECULAR_EXP,                 //  "lightExp" +        WATER_FOGCOLOR,                     //  "waterFogColor" +        WATER_FOGDENSITY,                   //  "waterFogDensity" +        WATER_FOGKS,                        //  "waterFogKS" +        WATER_REFSCALE,                     //  "refScale" +        WATER_WATERHEIGHT,                  //  "waterHeight" +        WATER_WATERPLANE,                   //  "waterPlane" +        WATER_NORM_SCALE,                   //  "normScale" +        WATER_FRESNEL_SCALE,                //  "fresnelScale" +        WATER_FRESNEL_OFFSET,               //  "fresnelOffset" +        WATER_BLUR_MULTIPLIER,              //  "blurMultiplier" +        WATER_SUN_ANGLE,                    //  "sunAngle" +        WATER_SCALED_ANGLE,                 //  "scaledAngle" +        WATER_SUN_ANGLE2,                   //  "sunAngle2" + +        WL_CAMPOSLOCAL,                     //  "camPosLocal" + +        AVATAR_WIND,                        //  "gWindDir" +        AVATAR_SINWAVE,                     //  "gSinWaveParams" +        AVATAR_GRAVITY,                     //  "gGravity" + +        TERRAIN_DETAIL0,                    //  "detail_0" +        TERRAIN_DETAIL1,                    //  "detail_1" +        TERRAIN_DETAIL2,                    //  "detail_2" +        TERRAIN_DETAIL3,                    //  "detail_3" +        TERRAIN_ALPHARAMP,                  //  "alpha_ramp" + +        SHINY_ORIGIN,                       //  "origin" +        DISPLAY_GAMMA,                      //  "display_gamma" + +        INSCATTER_RT,                       //  "inscatter" +        SUN_SIZE,                           //  "sun_size" +        FOG_COLOR,                          //  "fog_color"          // precomputed textures -        TRANSMITTANCE_TEX, -        SCATTER_TEX, -        SINGLE_MIE_SCATTER_TEX, -        ILLUMINANCE_TEX, -        BLEND_FACTOR, - -        NO_ATMO, -        MOISTURE_LEVEL, -        DROPLET_RADIUS, -        ICE_LEVEL, -        RAINBOW_MAP, -        HALO_MAP, - -        MOON_BRIGHTNESS, - -        CLOUD_VARIANCE, - -        SH_INPUT_L1R, -        SH_INPUT_L1G, -        SH_INPUT_L1B, - -        SUN_MOON_GLOW_FACTOR, -        WATER_EDGE_FACTOR, -        SUN_UP_FACTOR, -        MOONLIGHT_COLOR, -		END_RESERVED_UNIFORMS -	} eGLSLReservedUniforms; +        TRANSMITTANCE_TEX,                  //  "transmittance_texture" +        SCATTER_TEX,                        //  "scattering_texture" +        SINGLE_MIE_SCATTER_TEX,             //  "single_mie_scattering_texture" +        ILLUMINANCE_TEX,                    //  "irradiance_texture" +        BLEND_FACTOR,                       //  "blend_factor" + +        NO_ATMO,                            //  "no_atmo" +        MOISTURE_LEVEL,                     //  "moisture_level" +        DROPLET_RADIUS,                     //  "droplet_radius" +        ICE_LEVEL,                          //  "ice_level" +        RAINBOW_MAP,                        //  "rainbow_map" +        HALO_MAP,                           //  "halo_map" + +        MOON_BRIGHTNESS,                    //  "moon_brightness" + +        CLOUD_VARIANCE,                     //  "cloud_variance" + +        SH_INPUT_L1R,                       //  "sh_input_r" +        SH_INPUT_L1G,                       //  "sh_input_g" +        SH_INPUT_L1B,                       //  "sh_input_b" + +        SUN_MOON_GLOW_FACTOR,               //  "sun_moon_glow_factor" +        WATER_EDGE_FACTOR,                  //  "water_edge" +        SUN_UP_FACTOR,                      //  "sun_up_factor" +        MOONLIGHT_COLOR,                    //  "moonlight_color" +        END_RESERVED_UNIFORMS +    } eGLSLReservedUniforms; +    // clang-format on  	// singleton pattern implementation  	static LLShaderMgr * instance(); diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 9867bd16d6..dbe1a3687f 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -155,9 +155,8 @@ public:  	//get the size of a buffer with the given typemask and vertex count  	//fill offsets with the offset of each vertex component array into the buffer  	// indexed by the following enum -	static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices);		 +	static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices); -	  	//WARNING -- when updating these enums you MUST   	// 1 - update LLVertexBuffer::sTypeSize  	// 2 - add a strider accessor @@ -165,24 +164,28 @@ public:  	// 4 - modify LLVertexBuffer::setupClientArray  	// 5 - modify LLViewerShaderMgr::mReservedAttribs  	// 6 - update LLVertexBuffer::setupVertexArray -	enum { -		TYPE_VERTEX = 0, -		TYPE_NORMAL, -		TYPE_TEXCOORD0, -		TYPE_TEXCOORD1, -		TYPE_TEXCOORD2, -		TYPE_TEXCOORD3, -		TYPE_COLOR, -		TYPE_EMISSIVE, -		TYPE_TANGENT, -		TYPE_WEIGHT, -		TYPE_WEIGHT4, -		TYPE_CLOTHWEIGHT, -		TYPE_TEXTURE_INDEX, -		TYPE_MAX,   // TYPE_MAX is the size/boundary marker for attributes that go in the vertex buffer -		TYPE_INDEX,	// TYPE_INDEX is beyond _MAX because it lives in a separate (index) buffer	 -	}; -	enum { + +    // clang-format off +    enum {                      // Shader attribute name, set in LLShaderMgr::initAttribsAndUniforms() +        TYPE_VERTEX = 0,        //  "position" +        TYPE_NORMAL,            //  "normal" +        TYPE_TEXCOORD0,         //  "texcoord0" +        TYPE_TEXCOORD1,         //  "texcoord1" +        TYPE_TEXCOORD2,         //  "texcoord2" +        TYPE_TEXCOORD3,         //  "texcoord3" +        TYPE_COLOR,             //  "diffuse_color" +        TYPE_EMISSIVE,          //  "emissive" +        TYPE_TANGENT,           //  "tangent" +        TYPE_WEIGHT,            //  "weight" +        TYPE_WEIGHT4,           //  "weight4" +        TYPE_CLOTHWEIGHT,       //  "clothing" +        TYPE_TEXTURE_INDEX,     //  "texture_index" +        TYPE_MAX,   // TYPE_MAX is the size/boundary marker for attributes that go in the vertex buffer +        TYPE_INDEX,	// TYPE_INDEX is beyond _MAX because it lives in a separate (index) buffer	 +    }; +    // clang-format on + +    enum {  		MAP_VERTEX = (1<<TYPE_VERTEX),  		MAP_NORMAL = (1<<TYPE_NORMAL),  		MAP_TEXCOORD0 = (1<<TYPE_TEXCOORD0), diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 6a51c4240b..08da599ef2 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -187,10 +187,32 @@ void LLCheckBoxCtrl::clear()  void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)  { -	S32 label_top = mLabel->getRect().mTop; -	mLabel->reshapeToFitText(); +    LLRect rect = getRect(); +    S32 delta_width = width - rect.getWidth(); +    S32 delta_height = height - rect.getHeight(); -	LLRect label_rect = mLabel->getRect(); +    if (delta_width || delta_height) +    { +        // adjust our rectangle +        rect.mRight = getRect().mLeft + width; +        rect.mTop = getRect().mBottom + height; +        setRect(rect); +    } + +    // reshapeToFitText reshapes label to minimal size according to last bounding box +    // it will work fine in case of decrease of space, but if we get more space or text +    // becomes longer, label will fail to grow so reinit label's dimentions. +     +    static LLUICachedControl<S32> llcheckboxctrl_hpad("UICheckboxctrlHPad", 0); +    LLRect label_rect = mLabel->getRect(); +    S32 new_width = getRect().getWidth() - label_rect.mLeft - llcheckboxctrl_hpad; +    label_rect.mRight = label_rect.mLeft + new_width; +    mLabel->setRect(label_rect); + +	S32 label_top = label_rect.mTop; +	mLabel->reshapeToFitText(TRUE); + +    label_rect = mLabel->getRect();  	if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN)  	{  		// reshapeToFitText uses LLView::reshape() which always reshapes @@ -210,6 +232,8 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)  		llmax(btn_rect.getWidth(), label_rect.mRight - btn_rect.mLeft),  		llmax(label_rect.mTop - btn_rect.mBottom, btn_rect.getHeight()));  	mButton->setShape(btn_rect); + +    updateBoundingRect();  }  //virtual diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index f4ddfa8f18..e62b2779dd 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -204,6 +204,7 @@ public:  	virtual bool hasChildren() const = 0;  	virtual void addChild(LLFolderViewModelItem* child) = 0;  	virtual void removeChild(LLFolderViewModelItem* child) = 0; +	virtual void clearChildren() = 0;  	// This method will be called to determine if a drop can be  	// performed, and will set drop to TRUE if a drop is @@ -301,9 +302,8 @@ public:  	virtual void clearChildren()  	{ -		// As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects -		// This is different and not equivalent to calling removeChild() on each child -		std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); +		// We are working with models that belong to views as LLPointers, clean the list, let poiters handle the rest +		std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); });  		mChildren.clear();  		dirtyDescendantsFilter();  		dirtyFilter(); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 4aae1e374b..29a156e933 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -166,7 +166,7 @@ void LLLayoutPanel::setVisible( BOOL visible )  void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ )  { -	if (width == getRect().getWidth() && height == getRect().getHeight()) return; +	if (width == getRect().getWidth() && height == getRect().getHeight() && !LLView::sForceReshape) return;  	if (!mIgnoreReshape && mAutoResize == false)  	{ diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index b87819102b..37dbe9b40e 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3276,7 +3276,7 @@ void hide_top_view( LLView* view )  // x and y are the desired location for the popup, in the spawning_view's  // coordinate frame, NOT necessarily the mouse location  // static -void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) +void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x, S32 mouse_y)  {  	const S32 CURSOR_HEIGHT = 22;		// Approximate "normal" cursor size  	const S32 CURSOR_WIDTH = 12; @@ -3307,12 +3307,6 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)  		}  	} -	// Save click point for detecting cursor moves before mouse-up. -	// Must be in local coords to compare with mouseUp events. -	// If the mouse doesn't move, the menu will stay open ala the Mac. -	// See also LLContextMenu::show() -	S32 mouse_x, mouse_y; -  	// Resetting scrolling position  	if (menu->isScrollable() && menu->isScrollPositionOnShowReset())  	{ @@ -3323,7 +3317,18 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)  	menu->needsArrange();  	menu->arrangeAndClear(); -	LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); +	if ((mouse_x == 0) || (mouse_y == 0)) + +	{ +		// Save click point for detecting cursor moves before mouse-up. +		// Must be in local coords to compare with mouseUp events. +		// If the mouse doesn't move, the menu will stay open ala the Mac. +		// See also LLContextMenu::show() + +		LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); +	} +	 +	  	LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y);  	const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect(); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 8cef9c6463..273bd789c4 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -519,7 +519,7 @@ public:  	void createJumpKeys();  	// Show popup at a specific location, in the spawn_view's coordinate frame -	static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y); +	static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x = 0, S32 mouse_y = 0);  	// Whether to drop shadow menu bar   	void setDropShadowed( const BOOL shadowed ); diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 6e924c1f19..d65c220974 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -295,9 +295,6 @@ const std::string LLLocale::SYSTEM_LOCALE("English_United States.1252");  #elif LL_DARWIN  const std::string LLLocale::USER_LOCALE("en_US.iso8859-1");// = LLStringUtil::null;  const std::string LLLocale::SYSTEM_LOCALE("en_US.iso8859-1"); -#elif LL_SOLARIS -const std::string LLLocale::USER_LOCALE("en_US.ISO8859-1"); -const std::string LLLocale::SYSTEM_LOCALE("C");  #else // LL_LINUX likes this  const std::string LLLocale::USER_LOCALE("en_US.utf8");  const std::string LLLocale::SYSTEM_LOCALE("C"); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ff72417867..20bea7fe24 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1179,7 +1179,7 @@ BOOL LLTextBase::handleToolTip(S32 x, S32 y, MASK mask)  void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent)  { -	if (width != getRect().getWidth() || height != getRect().getHeight()) +	if (width != getRect().getWidth() || height != getRect().getHeight() || LLView::sForceReshape)  	{  		bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false; diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 0afd32f332..134afc005b 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -163,13 +163,13 @@ BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text  } -void LLTextBox::reshapeToFitText() +void LLTextBox::reshapeToFitText(BOOL called_from_parent)  {  	reflow();  	S32 width = getTextPixelWidth();  	S32 height = getTextPixelHeight(); -	reshape( width + 2 * mHPad, height + 2 * mVPad, FALSE ); +	reshape( width + 2 * mHPad, height + 2 * mVPad, called_from_parent );  } diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 061d2dd23d..c3e3b61912 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -60,7 +60,7 @@ public:  	void			setHAlign( LLFontGL::HAlign align )		{ mHAlign = align; }  	void			setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ); -	void			reshapeToFitText(); +	void			reshapeToFitText(BOOL called_from_parent = FALSE);  	S32				getTextPixelWidth();  	S32				getTextPixelHeight(); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index a69c0eb008..20dda54771 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -517,8 +517,7 @@ LLUrlEntrySimpleSecondlifeURL::LLUrlEntrySimpleSecondlifeURL()  // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about  // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about  // -LLUrlEntryAgent::LLUrlEntryAgent() : -	mAvatarNameCacheConnection() +LLUrlEntryAgent::LLUrlEntryAgent()  {  	mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+",  							boost::regex::perl|boost::regex::icase); @@ -549,7 +548,15 @@ void LLUrlEntryAgent::callObservers(const std::string &id,  void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id,  										const LLAvatarName& av_name)  { -	mAvatarNameCacheConnection.disconnect(); +	avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); +	if (it != mAvatarNameCacheConnections.end()) +	{ +		if (it->second.connected()) +		{ +			it->second.disconnect(); +		} +		mAvatarNameCacheConnections.erase(it); +	}   	std::string label = av_name.getCompleteName(); @@ -636,11 +643,17 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa  	}  	else  	{ -		if (mAvatarNameCacheConnection.connected()) +		avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); +		if (it != mAvatarNameCacheConnections.end())  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			} +			mAvatarNameCacheConnections.erase(it);  		} -		mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); +		mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); +  		addObserver(agent_id_string, url, cb);  		return LLTrans::getString("LoadingData");  	} @@ -701,14 +714,21 @@ std::string LLUrlEntryAgent::getIcon(const std::string &url)  // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username)  // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username)  // -LLUrlEntryAgentName::LLUrlEntryAgentName() : -	mAvatarNameCacheConnection() +LLUrlEntryAgentName::LLUrlEntryAgentName()  {}  void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id,  										const LLAvatarName& av_name)  { -	mAvatarNameCacheConnection.disconnect(); +	avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); +	if (it != mAvatarNameCacheConnections.end()) +	{ +		if (it->second.connected()) +		{ +			it->second.disconnect(); +		} +		mAvatarNameCacheConnections.erase(it); +	}  	std::string label = getName(av_name);  	// received the agent name from the server - tell our observers @@ -743,11 +763,17 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab  	}  	else  	{ -		if (mAvatarNameCacheConnection.connected()) +		avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); +		if (it != mAvatarNameCacheConnections.end())  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			} +			mAvatarNameCacheConnections.erase(it);  		} -		mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); +		mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); +  		addObserver(agent_id_string, url, cb);  		return LLTrans::getString("LoadingData");  	} diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 0a0c247a6a..4af1ab5096 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -212,10 +212,14 @@ public:  	LLUrlEntryAgent();  	~LLUrlEntryAgent()  	{ -		if (mAvatarNameCacheConnection.connected()) +		for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			}  		} +		mAvatarNameCacheConnections.clear();  	}  	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);  	/*virtual*/ std::string getIcon(const std::string &url); @@ -227,7 +231,9 @@ protected:  	/*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon);  private:  	void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); -	boost::signals2::connection mAvatarNameCacheConnection; + +	typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; +	avatar_name_cache_connection_map_t mAvatarNameCacheConnections;  };  /// @@ -241,10 +247,14 @@ public:  	LLUrlEntryAgentName();  	~LLUrlEntryAgentName()  	{ -		if (mAvatarNameCacheConnection.connected()) +		for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			}  		} +		mAvatarNameCacheConnections.clear();  	}  	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);  	/*virtual*/ LLStyle::Params getStyle() const; @@ -253,7 +263,9 @@ protected:  	virtual std::string getName(const LLAvatarName& avatar_name) = 0;  private:  	void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); -	boost::signals2::connection mAvatarNameCacheConnection; + +	typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; +	avatar_name_cache_connection_map_t mAvatarNameCacheConnections;  }; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index e3a6a98a9f..cd47e2ecea 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1402,7 +1402,9 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)  			S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;  			S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;  			viewp->translate( delta_x, delta_y ); -			if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight()) +			if (child_rect.getWidth() != viewp->getRect().getWidth() +                || child_rect.getHeight() != viewp->getRect().getHeight() +                || sForceReshape)  			{  				viewp->reshape(child_rect.getWidth(), child_rect.getHeight());  			} diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index 10fbc06c61..9e9abbadff 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -61,9 +61,6 @@ LLDir_Win32 gDirUtil;  #elif LL_DARWIN  #include "lldir_mac.h"  LLDir_Mac gDirUtil; -#elif LL_SOLARIS -#include "lldir_solaris.h" -LLDir_Solaris gDirUtil;  #else  #include "lldir_linux.h"  LLDir_Linux gDirUtil; diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 38e204ef04..4988b9c6e3 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -27,11 +27,6 @@  #ifndef LL_LLDIR_H  #define LL_LLDIR_H -#if LL_SOLARIS -#include <sys/param.h> -#define MAX_PATH MAXPATHLEN -#endif -  // these numbers are read from settings_files.xml, so we need to be explicit  typedef enum ELLPath  { diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp deleted file mode 100644 index f18560ff20..0000000000 --- a/indra/llvfs/lldir_solaris.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/**  - * @file fmodwrapper.cpp - * @brief dummy source file for building a shared library to wrap libfmod.a - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - *  - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - *  - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU - * Lesser General Public License for more details. - *  - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "lldir_solaris.h" -#include "llerror.h" -#include "llrand.h" -#include "llstring.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <glob.h> -#include <pwd.h> -#include <sys/utsname.h> -#define _STRUCTURED_PROC 1 -#include <sys/procfs.h> -#include <fcntl.h> - -static std::string getCurrentUserHome(char* fallback) -{ -	// fwiw this exactly duplicates getCurrentUserHome() in lldir_linux.cpp... -	// we should either derive both from LLDir_Posix or just axe Solaris. -	const uid_t uid = getuid(); -	struct passwd *pw; - -	pw = getpwuid(uid); -	if ((pw != NULL) && (pw->pw_dir != NULL)) -	{ -		return pw->pw_dir; -	} - -	LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL; -	auto home_env = LLStringUtil::getoptenv("HOME"); -	if (home_env) -	{ -		return *home_env; -	} -	else -	{ -		LL_WARNS() << "Couldn't detect home directory!  Falling back to " << fallback << LL_ENDL; -		return fallback; -	} -} - - -LLDir_Solaris::LLDir_Solaris() -{ -	mDirDelimiter = "/"; -	mCurrentDirIndex = -1; -	mCurrentDirCount = -1; -	mDirp = NULL; - -	char tmp_str[LL_MAX_PATH];	/* Flawfinder: ignore */  -	if (getcwd(tmp_str, LL_MAX_PATH) == NULL) -	{ -		strcpy(tmp_str, "/tmp"); -		LL_WARNS() << "Could not get current directory; changing to " -				<< tmp_str << LL_ENDL; -		if (chdir(tmp_str) == -1) -		{ -			LL_ERRS() << "Could not change directory to " << tmp_str << LL_ENDL; -		} -	} - -	mExecutableFilename = ""; -	mExecutablePathAndName = ""; -	mExecutableDir = strdup(tmp_str); -	mWorkingDir = strdup(tmp_str); -	mAppRODataDir = strdup(tmp_str); -	mOSUserDir = getCurrentUserHome(tmp_str); -	mOSUserAppDir = ""; -	mLindenUserDir = ""; - -	char path [LL_MAX_PATH];	/* Flawfinder: ignore */  - -	sprintf(path, "/proc/%d/psinfo", (int)getpid()); -	int proc_fd = -1; -	if((proc_fd = open(path, O_RDONLY)) == -1){ -		LL_WARNS() << "unable to open " << path << LL_ENDL; -		return; -	} -	psinfo_t proc_psinfo; -	if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ -		LL_WARNS() << "Unable to read " << path << LL_ENDL; -		close(proc_fd); -		return; -	} - -	close(proc_fd); - -	mExecutableFilename = strdup(proc_psinfo.pr_fname); -	LL_INFOS() << "mExecutableFilename = [" << mExecutableFilename << "]" << LL_ENDL; - -	sprintf(path, "/proc/%d/path/a.out", (int)getpid()); - -	char execpath[LL_MAX_PATH]; -	if(readlink(path, execpath, LL_MAX_PATH) == -1){ -		LL_WARNS() << "Unable to read link from " << path << LL_ENDL; -		return; -	} - -	char *p = execpath;			// nuke trash in link, if any exists -	int i = 0; -	while(*p != NULL && ++i < LL_MAX_PATH && isprint((int)(*p++))); -	*p = NULL; - -	mExecutablePathAndName = strdup(execpath); -	LL_INFOS() << "mExecutablePathAndName = [" << mExecutablePathAndName << "]" << LL_ENDL; - -	//NOTE: Why force people to cd into the package directory? -	//      Look for SECONDLIFE env variable and use it, if set. - -	auto SECONDLIFE(LLDirUtil::getoptenv("SECONDLIFE")); -	if(SECONDLIFE){ -		mExecutableDir = add(*SECONDLIFE, "bin"); //NOTE:  make sure we point at the bin -	}else{ -		mExecutableDir = getDirName(execpath); -		LL_INFOS() << "mExecutableDir = [" << mExecutableDir << "]" << LL_ENDL; -	} - -	mLLPluginDir = add(mExecutableDir, "llplugin"); - -	// *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. -	mTempDir = "/tmp"; -} - -LLDir_Solaris::~LLDir_Solaris() -{ -} - -// Implementation - - -void LLDir_Solaris::initAppDirs(const std::string &app_name, -								const std::string& app_read_only_data_dir) -{ -	// Allow override so test apps can read newview directory -	if (!app_read_only_data_dir.empty()) -	{ -		mAppRODataDir = app_read_only_data_dir; -		mSkinBaseDir = add(mAppRODataDir, "skins"); -	} -	mAppName = app_name; - -	std::string upper_app_name(app_name); -	LLStringUtil::toUpper(upper_app_name); - -	auto app_home_env(LLStringUtil::getoptenv(upper_app_name + "_USER_DIR")); -	if (app_home_env) -	{ -		// user has specified own userappdir i.e. $SECONDLIFE_USER_DIR -		mOSUserAppDir = *app_home_env; -	} -	else -	{ -		// traditionally on unixoids, MyApp gets ~/.myapp dir for data -		mOSUserAppDir = mOSUserDir; -		mOSUserAppDir += "/"; -		mOSUserAppDir += "."; -		std::string lower_app_name(app_name); -		LLStringUtil::toLower(lower_app_name); -		mOSUserAppDir += lower_app_name; -	} - -	// create any directories we expect to write to. - -	int res = LLFile::mkdir(mOSUserAppDir); -	if (res == -1) -	{ -		LL_WARNS() << "Couldn't create app user dir " << mOSUserAppDir << LL_ENDL; -		LL_WARNS() << "Default to base dir" << mOSUserDir << LL_ENDL; -		mOSUserAppDir = mOSUserDir; -	} - -	res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"")); -	if (res == -1) -	{ -		LL_WARNS() << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << LL_ENDL; -	} -	 -	res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"")); -	if (res == -1) -	{ -		LL_WARNS() << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << LL_ENDL; -	} - -	res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"")); -	if (res == -1) -	{ -		LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL; -	} - -	mCAFile = getExpandedFilename(LL_PATH_EXECUTABLE, "ca-bundle.crt"); -} - -U32 LLDir_Solaris::countFilesInDir(const std::string &dirname, const std::string &mask) -{ -	U32 file_count = 0; -	glob_t g; - -	std::string tmp_str; -	tmp_str = dirname; -	tmp_str += mask; -	 -	if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) -	{ -		file_count = g.gl_pathc; - -		globfree(&g); -	} - -	return (file_count); -} - -std::string LLDir_Solaris::getCurPath() -{ -	char tmp_str[LL_MAX_PATH];	/* Flawfinder: ignore */  -	if (getcwd(tmp_str, LL_MAX_PATH) == NULL) -	{ -		LL_WARNS() << "Could not get current directory" << LL_ENDL; -		tmp_str[0] = '\0'; -	} -	return tmp_str; -} - - -bool LLDir_Solaris::fileExists(const std::string &filename) const -{ -	struct stat stat_data; -	// Check the age of the file -	// Now, we see if the files we've gathered are recent... -	int res = stat(filename.c_str(), &stat_data); -	if (!res) -	{ -		return TRUE; -	} -	else -	{ -		return FALSE; -	} -} - diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h deleted file mode 100644 index c6dac57e14..0000000000 --- a/indra/llvfs/lldir_solaris.h +++ /dev/null @@ -1,61 +0,0 @@ -/**  - * @file fmodwrapper.cpp - * @brief dummy source file for building a shared library to wrap libfmod.a - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - *  - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - *  - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU - * Lesser General Public License for more details. - *  - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA - * $/LicenseInfo$ - */ - -#if !LL_SOLARIS -#error This header must not be included when compiling for any target other than Solaris. Consider including lldir.h instead. -#endif // !LL_SOLARIS - -#ifndef LL_LLDIR_SOLARIS_H -#define LL_LLDIR_SOLARIS_H - -#include "lldir.h" - -#include <dirent.h> -#include <errno.h> - -class LLDir_Solaris : public LLDir -{ -public: -	LLDir_Solaris(); -	virtual ~LLDir_Solaris(); - -	/*virtual*/ void initAppDirs(const std::string &app_name, -		const std::string& app_read_only_data_dir); - -	virtual std::string getCurPath(); -	virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); -	/*virtual*/ bool fileExists(const std::string &filename) const; - -private: -	DIR *mDirp; -	int mCurrentDirIndex; -	int mCurrentDirCount; -	std::string mCurrentDir; -}; - -#endif // LL_LLDIR_SOLARIS_H - - diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index 617056d94d..2c64bf563e 100644 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -33,10 +33,6 @@  #include <map>  #if LL_WINDOWS  #include <share.h> -#elif LL_SOLARIS -#include <sys/types.h> -#include <unistd.h> -#include <fcntl.h>  #else  #include <sys/file.h>  #endif @@ -2146,12 +2142,6 @@ LLFILE *LLVFS::openAndLock(const std::string& filename, const char* mode, BOOL r  	int fd;  	// first test the lock in a non-destructive way -#if LL_SOLARIS -        struct flock fl; -        fl.l_whence = SEEK_SET; -        fl.l_start = 0; -        fl.l_len = 1; -#else // !LL_SOLARIS  	if (strchr(mode, 'w') != NULL)  	{  		fp = LLFile::fopen(filename, "rb");	/* Flawfinder: ignore */ @@ -2167,19 +2157,13 @@ LLFILE *LLVFS::openAndLock(const std::string& filename, const char* mode, BOOL r  			fclose(fp);  		}  	} -#endif // !LL_SOLARIS  	// now actually open the file for use  	fp = LLFile::fopen(filename, mode);	/* Flawfinder: ignore */  	if (fp)  	{  		fd = fileno(fp); -#if LL_SOLARIS -                fl.l_type = read_lock ? F_RDLCK : F_WRLCK; -                if (fcntl(fd, F_SETLK, &fl) == -1) -#else  		if (flock(fd, (read_lock ? LOCK_SH : LOCK_EX) | LOCK_NB) == -1) -#endif  		{  			fclose(fp);  			fp = NULL; @@ -2207,14 +2191,6 @@ void LLVFS::unlockAndClose(LLFILE *fp)  	  flock(fd, LOCK_UN);  	  #endif      */ -#if LL_SOLARIS -	        struct flock fl; -		fl.l_whence = SEEK_SET; -		fl.l_start = 0; -		fl.l_len = 1; -		fl.l_type = F_UNLCK; -		fcntl(fileno(fp), F_SETLK, &fl); -#endif  		fclose(fp);  	}  } diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index d77997a928..30bc743e72 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -263,6 +263,18 @@ std::vector<std::string> LLWindow::getDynamicFallbackFontList()  #endif  } +// static +std::vector<std::string> LLWindow::getDisplaysResolutionList() +{ +#if LL_WINDOWS +	return LLWindowWin32::getDisplaysResolutionList(); +#elif LL_DARWIN +	return LLWindowMacOSX::getDisplaysResolutionList(); +#else +	return std::vector<std::string>(); +#endif +} +  #define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400)  #define UTF16_IS_LOW_SURROGATE(U)  ((U16)((U) - 0xDC00) < 0x0400)  #define UTF16_SURROGATE_PAIR_TO_UTF32(H,L) (((H) << 10) + (L) - (0xD800 << 10) - 0xDC00 + 0x00010000) diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index f1113acd5f..d4d5b76937 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -169,6 +169,8 @@ public:  	// Get system UI size based on DPI (for 96 DPI UI size should be 1.0)  	virtual F32 getSystemUISize() { return 1.0; } +	static std::vector<std::string> getDisplaysResolutionList(); +      // windows only DirectInput8 for joysticks      virtual void* getDirectInput8() { return NULL; };      virtual bool getInputDevices(U32 device_type_filter, void * devices_callback, void* userdata) { return false; }; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 2604a23c85..0d0607a0bb 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -41,6 +41,7 @@  #include <OpenGL/OpenGL.h>  #include <Carbon/Carbon.h>  #include <CoreServices/CoreServices.h> +#include <CoreGraphics/CGDisplayConfiguration.h>  extern BOOL gDebugWindowProc;  BOOL gHiDPISupport = TRUE; @@ -1911,6 +1912,35 @@ void LLWindowMacOSX::interruptLanguageTextInput()  	commitCurrentPreedit(mGLView);  } +std::vector<std::string> LLWindowMacOSX::getDisplaysResolutionList() +{ +	std::vector<std::string> resolution_list; +	 +	CGDirectDisplayID display_ids[10]; +	uint32_t found_displays = 0; +	CGError err = CGGetActiveDisplayList(10, display_ids, &found_displays); +	 +	if (kCGErrorSuccess != err) +	{ +		LL_WARNS() << "Couldn't get a list of active displays" << LL_ENDL; +		return std::vector<std::string>(); +	} +	 +	for (uint32_t i = 0; i < found_displays; i++) +	{ +		S32 monitor_width = CGDisplayPixelsWide(display_ids[i]); +		S32 monitor_height = CGDisplayPixelsHigh(display_ids[i]); +		 +		std::ostringstream sstream; +		sstream << monitor_width << "x" << monitor_height;; +		std::string res = sstream.str(); +		 +		resolution_list.push_back(res); +	} +	 +	return resolution_list; +} +  //static  std::vector<std::string> LLWindowMacOSX::getDynamicFallbackFontList()  { diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 24651027e8..bf45238c8d 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -114,6 +114,8 @@ public:  	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);  	/*virtual*/ F32 getSystemUISize(); +	static std::vector<std::string> getDisplaysResolutionList(); +  	static std::vector<std::string> getDynamicFallbackFontList();  	// Provide native key event data diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index c20e639fc7..85eb9d6d1b 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -51,13 +51,13 @@ extern "C" {  # include "fontconfig/fontconfig.h"  } -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  // not necessarily available on random SDL platforms, so #if LL_LINUX  // for execv(), waitpid(), fork()  # include <unistd.h>  # include <sys/types.h>  # include <sys/wait.h> -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX  extern BOOL gDebugWindowProc; @@ -323,12 +323,6 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)  static int x11_detect_VRAM_kb()  { -#if LL_SOLARIS && defined(__sparc) -      //  NOTE: there's no Xorg server on SPARC so just return 0 -      //        and allow SDL to attempt to get the amount of VRAM -      return(0); -#else -  	std::string x_log_location("/var/log/");  	std::string fname;  	int rtn = 0; // 'could not detect' @@ -409,7 +403,6 @@ static int x11_detect_VRAM_kb()  		}  	}  	return rtn; -#endif // LL_SOLARIS  }  #endif // LL_X11 @@ -484,27 +477,10 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B  	SDL_GL_SetAttribute(SDL_GL_RED_SIZE,  8);  	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8);  	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); -#if !LL_SOLARIS -        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, (bits <= 16) ? 16 : 24); +    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, (bits <= 16) ? 16 : 24);  	// We need stencil support for a few (minor) things.  	if (!getenv("LL_GL_NO_STENCIL"))  		SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); -#else -	// NOTE- use smaller Z-buffer to enable more graphics cards -        //     - This should not affect better GPUs and has been proven -        //	 to provide 24-bit z-buffers when available. -	// -        // As the API states:  -	// -        // GLX_DEPTH_SIZE    Must be followed by a nonnegative -        //                   minimum size specification.  If this -        //                   value is zero, visuals with no depth -        //                   buffer are preferred.  Otherwise, the -        //                   largest available depth buffer of at -        //                   least the minimum size is preferred. - -        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); -#endif          SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, (bits <= 16) ? 1 : 8);          // *FIX: try to toggle vsync here? @@ -682,25 +658,13 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B  	// fixme: actually, it's REALLY important for picking that we get at  	// least 8 bits each of red,green,blue.  Alpha we can be a bit more  	// relaxed about if we have to. -#if LL_SOLARIS && defined(__sparc) -//  again the __sparc required because Xsun support, 32bit are very pricey on SPARC -	if(colorBits < 24)		//HACK:  on SPARC allow 24-bit color -#else  	if (colorBits < 32) -#endif  	{  		close();  		setupFailure( -#if LL_SOLARIS && defined(__sparc) -			"Second Life requires at least 24-bit color on SPARC to run in a window.\n" -			"Please use fbconfig to set your default color depth to 24 bits.\n" -			"You may also need to adjust the X11 setting in SMF.  To do so use\n" -			"  'svccfg -s svc:/application/x11/x11-server setprop options/default_depth=24'\n" -#else  			"Second Life requires True Color (32-bit) to run in a window.\n"  			"Please go to Control Panels -> Display -> Settings and\n"  			"set the screen to 32-bit color.\n" -#endif  			"Alternately, if you choose to run fullscreen, Second Life\n"  			"will automatically adjust the screen each time it runs.",  			"Error", @@ -2503,7 +2467,7 @@ BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)  }  #endif // LL_GTK -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  // extracted from spawnWebBrowser for clarity and to eliminate  //  compiler confusion regarding close(int fd) vs. LLWindow::close()  void exec_cmd(const std::string& cmd, const std::string& arg) @@ -2559,7 +2523,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)  	LL_INFOS() << "spawn_web_browser: " << escaped_url << LL_ENDL; -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  # if LL_X11  	if (mSDL_Display)  	{ @@ -2578,7 +2542,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)  	cmd += "launch_url.sh";  	arg = escaped_url;  	exec_cmd(cmd, arg); -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX  	LL_INFOS() << "spawn_web_browser returning." << LL_ENDL;  } diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index e8abb9f31a..b2b123f0da 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -38,6 +38,7 @@  // Linden library includes  #include "llerror.h" +#include "llexception.h"  #include "llfasttimer.h"  #include "llgl.h"  #include "llstring.h" @@ -121,7 +122,7 @@ void show_window_creation_error(const std::string& title)  	LL_WARNS("Window") << title << LL_ENDL;  } -HGLRC SafeCreateContext(HDC hdc) +HGLRC SafeCreateContext(HDC &hdc)  {  	__try   	{ @@ -133,6 +134,22 @@ HGLRC SafeCreateContext(HDC hdc)  	}  } +GLuint SafeChoosePixelFormat(HDC &hdc, const PIXELFORMATDESCRIPTOR *ppfd) +{ +    __try +    { +        return ChoosePixelFormat(hdc, ppfd); +    } +    __except (EXCEPTION_EXECUTE_HANDLER) +    { +        // convert to C++ styled exception +        // C exception don't allow classes, so it's a regular char array +        char integer_string[32]; +        sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode()); +        throw std::exception(integer_string); +    } +} +  //static  BOOL LLWindowWin32::sIsClassRegistered = FALSE; @@ -404,6 +421,39 @@ LLWinImm::~LLWinImm()  } +class LLMonitorInfo +{ +public: + +	std::vector<std::string> getResolutionsList() { return mResList; } + +	LLMonitorInfo() +	{ +		EnumDisplayMonitors(0, 0, MonitorEnum, (LPARAM)this); +	} + +private: + +	static BOOL CALLBACK MonitorEnum(HMONITOR hMon, HDC hdc, LPRECT lprcMonitor, LPARAM pData) +	{ +		int monitor_width = lprcMonitor->right - lprcMonitor->left; +		int monitor_height = lprcMonitor->bottom - lprcMonitor->top; +		 +		std::ostringstream sstream; +		sstream << monitor_width << "x" << monitor_height;; +		std::string res = sstream.str(); + +		LLMonitorInfo* pThis = reinterpret_cast<LLMonitorInfo*>(pData); +		pThis->mResList.push_back(res); + +		return TRUE; +	} + +	std::vector<std::string> mResList; +}; + +static LLMonitorInfo sMonitorInfo; +  LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,  							 const std::string& title, const std::string& name, S32 x, S32 y, S32 width,  							 S32 height, U32 flags,  @@ -432,6 +482,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,  	memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp));  	memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp));  	mCustomGammaSet = FALSE; +	mWindowHandle = NULL;  	if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0))  	{ @@ -695,6 +746,37 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,  	//		TrackMouseEvent( &track_mouse_event );   	//	} +    // SL-12971 dual GPU display +    DISPLAY_DEVICEA display_device; +    int             display_index = -1; +    DWORD           display_flags = 0; // EDD_GET_DEVICE_INTERFACE_NAME ? +    const size_t    display_bytes = sizeof(display_device); + +    do +    { +        if (display_index >= 0) +        { +            // CHAR DeviceName  [ 32] Adapter name +            // CHAR DeviceString[128] +            CHAR text[256]; + +            size_t name_len = strlen(display_device.DeviceName  ); +            size_t desc_len = strlen(display_device.DeviceString); + +            CHAR *name = name_len ? display_device.DeviceName   : "???"; +            CHAR *desc = desc_len ? display_device.DeviceString : "???"; + +            sprintf(text, "Display Device %d: %s, %s", display_index, name, desc); +            LL_INFOS("Window") << text << LL_ENDL; +        } + +        ::ZeroMemory(&display_device,display_bytes); +        display_device.cb = display_bytes; + +        display_index++; +    }  while( EnumDisplayDevicesA(NULL, display_index, &display_device, display_flags )); + +    LL_INFOS("Window") << "Total Display Devices: " << display_index << LL_ENDL;  	//-----------------------------------------------------------------------  	// Create GL drawing context @@ -1157,7 +1239,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO          << " Height: " << (window_rect.bottom - window_rect.top)          << " Fullscreen: " << mFullscreen          << LL_ENDL; -    if (!destroy_window_handler(mWindowHandle)) +    if (mWindowHandle && !destroy_window_handler(mWindowHandle))      {          LL_WARNS("Window") << "Failed to properly close window before recreating it!" << LL_ENDL;      }	 @@ -1216,11 +1298,24 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO  	LL_INFOS("Window") << "Device context retrieved." << LL_ENDL ; -	if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd))) +    try +    { +        // Looks like ChoosePixelFormat can crash in case of faulty driver +        if (!(pixel_format = SafeChoosePixelFormat(mhDC, &pfd)))  	{ +            LL_WARNS("Window") << "ChoosePixelFormat failed, code: " << GetLastError() << LL_ENDL; +            OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), +                mCallbacks->translateString("MBError"), OSMB_OK);  		close(); +            return FALSE; +        } +    } +    catch (...) +    { +        LOG_UNHANDLED_EXCEPTION("ChoosePixelFormat");  		OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"),  			mCallbacks->translateString("MBError"), OSMB_OK); +        close();  		return FALSE;  	} @@ -1449,21 +1544,27 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO  		LL_INFOS("Window") << "pixel formats done." << LL_ENDL ;  		S32 swap_method = 0; -		S32 cur_format = num_formats-1; +		S32   cur_format  = 0; +const	S32   max_format  = (S32)num_formats - 1;  		GLint swap_query = WGL_SWAP_METHOD_ARB; -		BOOL found_format = FALSE; - -		while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method)) +		// SL-14705 Fix name tags showing in front of objects with AMD GPUs. +		// On AMD hardware we need to iterate from the first pixel format to the end. +		// Spec: +		//     https://www.khronos.org/registry/OpenGL/extensions/ARB/WGL_ARB_pixel_format.txt +		while (wglGetPixelFormatAttribivARB(mhDC, pixel_formats[cur_format], 0, 1, &swap_query, &swap_method))  		{ -			if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0) +			if (swap_method == WGL_SWAP_UNDEFINED_ARB)  			{ -				found_format = TRUE; +				break;  			} -			else +			else if (cur_format >= max_format)  			{ -				--cur_format; +				cur_format = 0; +				break;  			} + +			++cur_format;  		}  		pixel_format = pixel_formats[cur_format]; @@ -1482,7 +1583,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO  		}          // Destroy The Window -        if (!destroy_window_handler(mWindowHandle)) +        if (mWindowHandle && !destroy_window_handler(mWindowHandle))          {              LL_WARNS("Window") << "Failed to properly close window!" << LL_ENDL;          }		 @@ -4288,6 +4389,12 @@ F32 LLWindowWin32::getSystemUISize()  }  //static +std::vector<std::string> LLWindowWin32::getDisplaysResolutionList() +{  +	return sMonitorInfo.getResolutionsList(); +} + +//static  std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()  {  	// Fonts previously in getFontListSans() have moved to fonts.xml. diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index ee0df570e9..0b3d14fb16 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -114,6 +114,7 @@ public:  	LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url ); +	static std::vector<std::string> getDisplaysResolutionList();  	static std::vector<std::string> getDynamicFallbackFontList();  	static void setDPIAwareness(); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 87ee77a117..fc8d8b805b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -234,6 +234,7 @@ set(viewer_SOURCE_FILES      llfloaterconversationpreview.cpp      llfloaterdeleteprefpreset.cpp      llfloaterdestinations.cpp +    llfloatereditenvironmentbase.cpp      llfloatereditextdaycycle.cpp      llfloaterenvironmentadjust.cpp      llfloaterevent.cpp @@ -585,6 +586,7 @@ set(viewer_SOURCE_FILES      llsyntaxid.cpp      llsyswellitem.cpp      llsyswellwindow.cpp +    lltelemetry.cpp      llteleporthistory.cpp      llteleporthistorystorage.cpp      lltextureatlas.cpp @@ -867,6 +869,7 @@ set(viewer_HEADER_FILES      llfloaterconversationpreview.h      llfloaterdeleteprefpreset.h      llfloaterdestinations.h +    llfloatereditenvironmentbase.h      llfloatereditextdaycycle.h      llfloaterenvironmentadjust.h      llfloaterevent.h @@ -1816,6 +1819,8 @@ if (WINDOWS)        ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll        ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll        ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll +      ${SHARED_LIB_STAGING_DIR}/Release/uriparser.dll +      ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll        ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe        ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll        ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index a0b6fce83f..e786022da5 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -6.4.18 +6.4.20 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 626a3d1ff3..6de3fd04e6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5935,7 +5935,7 @@        <key>Type</key>        <string>String</string>        <key>Value</key> -      <string>http://map.secondlife.com.s3.amazonaws.com/</string> +      <string>https://map.secondlife.com/</string>      </map>      <key>CurrentMapServerURL</key>      <map> @@ -6586,7 +6586,7 @@      <key>Value</key>      <integer>1</integer>    </map> -  <key>MemoryFailurePreventionEnabled</key> +  <key>MemoryFailurePreventionEnabled</key> <!-- deprecated, only used for obsolete-in-2020 Intel 965 Express GPU -->    <map>      <key>Comment</key>      <string>If set, the viewer will quit to avoid crash when memory failure happens</string> @@ -9113,7 +9113,7 @@      <key>Type</key>      <string>F32</string>      <key>Value</key> -    <real>0.03</real> +    <real>0.1</real>    </map>    <key>RenderDebugPipeline</key>      <map> @@ -15169,7 +15169,7 @@          <key>Value</key>              <real>1</real>          </map> -    <key>PoolSizeVAssetStorage</key> +    <key>PoolSizeAssetStorage</key>          <map>          <key>Comment</key>              <string>Coroutine Pool size for AssetStorage requests</string> diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index b7036e02cf..8e0a001403 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -1,24 +1,24 @@ -/** +/**    * @file WLCloudsV.glsl   *   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2005, Linden Research, Inc. - * + *    * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - * + *    * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - * + *    * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - * + *    * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ @@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0;  ///////////////////////////////////////////////////////////////////////////////  // Output parameters -VARYING vec4  vary_CloudColorSun; -VARYING vec4  vary_CloudColorAmbient; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient;  VARYING float vary_CloudDensity; -VARYING vec2  vary_texcoord0; -VARYING vec2  vary_texcoord1; -VARYING vec2  vary_texcoord2; -VARYING vec2  vary_texcoord3; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3;  VARYING float altitude_blend_factor;  // Inputs  uniform vec3 camPosLocal; -uniform vec4  lightnorm; -uniform vec4  sunlight_color; -uniform vec4  moonlight_color; -uniform int   sun_up_factor; -uniform vec4  ambient_color; -uniform vec4  blue_horizon; -uniform vec4  blue_density; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 moonlight_color; +uniform int sun_up_factor; +uniform vec4 ambient_color; +uniform vec4 blue_horizon; +uniform vec4 blue_density;  uniform float haze_horizon;  uniform float haze_density; @@ -60,7 +60,7 @@ uniform float cloud_shadow;  uniform float density_multiplier;  uniform float max_y; -uniform vec4  glow; +uniform vec4 glow;  uniform float sun_moon_glow_factor;  uniform vec4 cloud_color; @@ -75,53 +75,53 @@ uniform float cloud_scale;  //       indra\newview\llsettingsvo.cpp  void main()  { -    // World / view / projection -    gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); +	// World / view / projection +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); -    // Texture coords +	// Texture coords      // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll      vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y);  // See: LLSettingsVOSky::applySpecial -    vary_texcoord0.xy -= 0.5; -    vary_texcoord0.xy /= cloud_scale; -    vary_texcoord0.xy += 0.5; +	vary_texcoord0.xy -= 0.5; +	vary_texcoord0.xy /= cloud_scale; +	vary_texcoord0.xy += 0.5; -    vary_texcoord1 = vary_texcoord0; -    vary_texcoord1.x += lightnorm.x * 0.0125; -    vary_texcoord1.y += lightnorm.z * 0.0125; +	vary_texcoord1 = vary_texcoord0; +	vary_texcoord1.x += lightnorm.x * 0.0125; +	vary_texcoord1.y += lightnorm.z * 0.0125; -    vary_texcoord2 = vary_texcoord0 * 16.; -    vary_texcoord3 = vary_texcoord1 * 16.; +	vary_texcoord2 = vary_texcoord0 * 16.; +	vary_texcoord3 = vary_texcoord1 * 16.; -    // Get relative position +	// Get relative position      vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);      altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); -    // Set altitude +	// Set altitude      if (rel_pos.y > 0) -    { +	{          rel_pos *= (max_y / rel_pos.y); -    } +	}      if (rel_pos.y < 0) -    { -        altitude_blend_factor = 0;  // SL-11589 Fix clouds drooping below horizon +	{ +		altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon          rel_pos *= (-32000. / rel_pos.y); -    } +	} -    // Can normalize then +	// Can normalize then      vec3  rel_pos_norm = normalize(rel_pos);      float rel_pos_len  = length(rel_pos); -    // Initialize temp variables -    vec4 sunlight = sunlight_color; -    vec4 light_atten; +	// Initialize temp variables +	vec4 sunlight = sunlight_color; +	vec4 light_atten; -    // Sunlight attenuation effect (hue and brightness) due to atmosphere -    // this is used later for sunlight modulation at various altitudes +	// Sunlight attenuation effect (hue and brightness) due to atmosphere +	// this is used later for sunlight modulation at various altitudes      light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); -    // Calculate relative weights +	// Calculate relative weights      vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));      vec4 blue_weight   = blue_density / combined_haze;      vec4 haze_weight   = haze_density / combined_haze; @@ -130,63 +130,64 @@ void main()      float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);      sunlight *= exp(-light_atten * off_axis); -    // Distance +	// Distance      float density_dist = rel_pos_len * density_multiplier;      // Transparency (-> combined_haze)      // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati -    // compiler gets confused. +	// compiler gets confused.      combined_haze = exp(-combined_haze * density_dist); -    // Compute haze glow +	// Compute haze glow      float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);      // haze_glow is 0 at the sun and increases away from sun      haze_glow = max(haze_glow, .001); -    // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) +		// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)      haze_glow *= glow.x; -    // Higher glow.x gives dimmer glow (because next step is 1 / "angle") +		// Higher glow.x gives dimmer glow (because next step is 1 / "angle")      haze_glow = pow(haze_glow, glow.z); -    // glow.z should be negative, so we're doing a sort of (1 / "angle") function +		// glow.z should be negative, so we're doing a sort of (1 / "angle") function      haze_glow *= sun_moon_glow_factor; -    // Add "minimum anti-solar illumination" +	// Add "minimum anti-solar illumination"      // For sun, add to glow.  For moon, remove glow entirely. SL-13768      haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); -    // Increase ambient when there are more clouds -    vec4 tmpAmbient = ambient_color; -    tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; +	// Increase ambient when there are more clouds +	vec4 tmpAmbient = ambient_color; +	tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;  -    // Dim sunlight by cloud shadow percentage -    sunlight *= (1. - cloud_shadow); +	// Dim sunlight by cloud shadow percentage +	sunlight *= (1. - cloud_shadow); -    // Haze color below cloud +	// Haze color below cloud      vec4 additiveColorBelowCloud =          (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); -    // CLOUDS +	// CLOUDS +    sunlight = sunlight_color;  // SL-14707 reset color -- Clouds are unusually dim in EEP      off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);      sunlight *= exp(-light_atten * off_axis); -    // Cloud color out +	// Cloud color out      vary_CloudColorSun     = (sunlight * haze_glow) * cloud_color; -    vary_CloudColorAmbient = tmpAmbient * cloud_color; - -    // Attenuate cloud color by atmosphere +	vary_CloudColorAmbient = tmpAmbient * cloud_color; +	 +	// Attenuate cloud color by atmosphere      combined_haze = sqrt(combined_haze);  // less atmos opacity (more transparency) below clouds      vary_CloudColorSun *= combined_haze;      vary_CloudColorAmbient *= combined_haze;      vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); -    // Make a nice cloud density based on the cloud_shadow value that was passed in. -    vary_CloudDensity = 2. * (cloud_shadow - 0.25); +	// Make a nice cloud density based on the cloud_shadow value that was passed in. +	vary_CloudDensity = 2. * (cloud_shadow - 0.25); -    // Combine these to minimize register use -    vary_CloudColorAmbient += oHazeColorBelowCloud; +	// Combine these to minimize register use +	vary_CloudColorAmbient += oHazeColorBelowCloud; -    // needs this to compile on mac -    // vary_AtmosAttenuation = vec3(0.0,0.0,0.0); +	// needs this to compile on mac +	//vary_AtmosAttenuation = vec3(0.0,0.0,0.0); -    // END CLOUDS +	// END CLOUDS  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index 6b36d00f97..9fcee04c32 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -64,28 +64,27 @@ void main()  #else  	vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);  #endif - +	  	color.rgb *= vertex_color.rgb;  	// SL-9632 HUDs are affected by Atmosphere  	if (no_atmo == 0)  	{ -		vec3 sunlit; -		vec3 amblit; -		vec3 additive; -		vec3 atten; +	vec3 sunlit; +	vec3 amblit; +	vec3 additive; +	vec3 atten;  		vec3 pos = vary_position.xyz/vary_position.w; -		calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - -		vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; -		float env_intensity = vertex_color.a; +	calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); +	 +	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	 +	float env_intensity = vertex_color.a;  	//color.rgb = srgb_to_linear(color.rgb);  		color.rgb = mix(color.rgb, envColor.rgb, env_intensity); - -		color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); -		color.rgb = fullbrightScaleSoftClip(color.rgb); +	color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); +	color.rgb = fullbrightScaleSoftClip(color.rgb);  	}  /* diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index d29e8a9423..eb6e56e718 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -40,6 +40,8 @@ uniform sampler2D specularMap;  VARYING vec2 vary_texcoord0; +vec3 linear_to_srgb(vec3 c); +  void main()   {  	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); @@ -52,6 +54,7 @@ void main()  	vec4 norm = texture2D(normalMap,   vary_texcoord0.xy);  	vec4 spec = texture2D(specularMap, vary_texcoord0.xy); +	col.rgb = linear_to_srgb(col.rgb);  	frag_data[0] = vec4(col.rgb, 0.0);  	frag_data[1] = spec;  	frag_data[2] = vec4(norm.xy,0,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 80d19102b6..e1f7031af6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -406,6 +406,8 @@ void main()      vec3 light = vec3(0, 0, 0); +    final_specular.rgb = srgb_to_linear(final_specular.rgb); // SL-14035 +  #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w );      LIGHT_LOOP(1) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 8c402fcb54..09c47165dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -73,9 +73,7 @@ void main()      vec3 norm = getNorm(frag.xy);      vec4 spec = texture2DRect(specularRect, frag.xy); -    spec.rgb  = srgb_to_linear(spec.rgb);      vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; -    diff.rgb  = srgb_to_linear(diff.rgb);      float noise = texture2D(noiseMap, frag.xy / 128.0).b;      vec3  npos  = normalize(-pos); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 9bba45bc4e..ec3fb9c543 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -182,10 +182,6 @@ void main()  	vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; -    // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. -    //          We can't switch to linear here unless we do it everywhere* -	// *gbuffer is sRGB, convert to linear whenever sampling from it -    diff_tex.rgb = srgb_to_linear(diff_tex.rgb);  	vec3 dlit = vec3(0, 0, 0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index d805c9ea48..18616a9bb3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -90,7 +90,6 @@ void main()      float noise = texture2D(noiseMap, frag.xy/128.0).b;      vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; -    col.rgb = srgb_to_linear(col.rgb);      float fa = falloff+1.0;      float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); @@ -127,7 +126,7 @@ void main()      {          discard;      } -//col.rgb = vec3(0);         +      frag_color.rgb = col;         frag_color.a = 0.0;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index f80f1a985a..7f2c603f87 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -90,7 +90,7 @@ void main()      vec4 diffuse = texture2DRect(diffuseRect, tc);      //convert to gamma space -    //diffuse.rgb = linear_to_srgb(diffuse.rgb); +    diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035      vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);      vec3 color = vec3(0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index 454af2a9bc..b2fa5d8a25 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -49,10 +49,6 @@ void main()      vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy);      vec4 c     = mix(sunDiscA, sunDiscB, blend_factor); -    c.rgb = srgb_to_linear(c.rgb); -    c.rgb = clamp(c.rgb, vec3(0), vec3(1)); -    c.rgb = pow(c.rgb, vec3(0.7f)); -      //c.rgb = fullbrightAtmosTransport(c.rgb);      c.rgb = fullbrightScaleSoftClip(c.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index 6f7e777d23..5e966293c6 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -48,15 +48,15 @@ void fullbright_shiny_lighting()  {  	vec4 color = diffuseLookup(vary_texcoord0.xy);  	color.rgb *= vertex_color.rgb; - +	  	// SL-9632 HUDs are affected by Atmosphere  	if (no_atmo == 0)  	{ -		vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; -		color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low +	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	 +	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low -		color.rgb = fullbrightShinyAtmosTransport(color.rgb); -		color.rgb = fullbrightScaleSoftClip(color.rgb); +	color.rgb = fullbrightShinyAtmosTransport(color.rgb); +	color.rgb = fullbrightScaleSoftClip(color.rgb);  	}  /*  	// NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects. diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index a0699affbf..3b4d358cfa 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -1,30 +1,37 @@ -/**  +/**   * @file class1\windlight\atmosphericVarsF.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2007, Linden Research, Inc. - *  + *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - *  + *   * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - *  + *   * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  -vec3 getPositionEye() -{ -	return vec3(0,0,0); -} +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 getAmblitColor() { return vec3(0, 0, 0); } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } + +vec3 getAtmosAttenuation() { return vec3(vary_AtmosAttenuation); } + +vec3 getSunlitColor() { return vec3(0, 0, 0); } + +vec3 getPositionEye() { return vec3(0, 0, 0); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index bd1d150fc8..1fea2c3628 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -1,36 +1,56 @@ -/**  +/**   * @file class1\windlight\atmosphericVarsV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2007, Linden Research, Inc. - *  + *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - *  + *   * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - *  + *   * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; -vec3 getPositionEye() +vec3 additive_color; +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; +vec3 position_eye; + +vec3 getSunlitColor() { return sunlit_color; } +void setSunlitColor(vec3 v) { sunlit_color = v; } + +vec3 getAdditiveColor() { return additive_color; } +void setAdditiveColor(vec3 v)  { -	return vec3(0,0,0); +    additive_color     = v; +    vary_AdditiveColor = v;  } -void setPositionEye(vec3 v) +vec3 getAmblitColor() { return amblit_color; } +void setAmblitColor(vec3 v) { amblit_color = v; } + +vec3 getAtmosAttenuation() { return atmos_attenuation; } +void setAtmosAttenuation(vec3 v)  { -	 +    atmos_attenuation     = v; +    vary_AtmosAttenuation = v;  } + +vec3 getPositionEye() { return position_eye; } +void setPositionEye(vec3 v) { position_eye = v; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl index 5dc086ab1e..f83434b7ec 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl @@ -1,33 +1,38 @@ -/**  +/**   * @file class1\windlight\atmosphericVarsWaterF.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2007, Linden Research, Inc. - *  + *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - *  + *   * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - *  + *   * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -   VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 getSunlitColor() { return vec3(0, 0, 0); } + +vec3 getAmblitColor() { return vec3(0, 0, 0); } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } -vec3 getPositionEye() -{ -	return vary_PositionEye; -} +vec3 getAtmosAttenuation() { return vary_AtmosAttenuation; } +vec3 getPositionEye() { return vary_PositionEye; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl index e59eca265a..65d1176777 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl @@ -1,37 +1,51 @@ -/**  +/**   * @file class1\windlight\atmosphericVarsWaterV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2007, Linden Research, Inc. - *  + *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - *  + *   * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - *  + *   * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  -  +  VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; -vec3 getPositionEye() -{ -	return vary_PositionEye; -} +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; + +vec3 getSunlitColor() { return sunlit_color; } +void setSunlitColor(vec3 v) { sunlit_color = v; } + +vec3 getAmblitColor() { return amblit_color; } +void setAmblitColor(vec3 v) { amblit_color = v; } -void setPositionEye(vec3 v) +vec3 getAdditiveColor() { return vary_AdditiveColor; } +void setAdditiveColor(vec3 v) { vary_AdditiveColor = v; } + +vec3 getAtmosAttenuation() { return atmos_attenuation; } +void setAtmosAttenuation(vec3 v)  { -	vary_PositionEye = v; +    atmos_attenuation     = v; +    vary_AtmosAttenuation = v;  } + +vec3 getPositionEye() { return vary_PositionEye; } +void setPositionEye(vec3 v) { vary_PositionEye = v; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index b9ae7a0226..5a41dc644a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -51,7 +51,6 @@ void main()  // SL-9806 stars poke through  //    c.a *= sun_fade; -    c.rgb = pow(c.rgb, vec3(0.7f));      c.rgb = fullbrightAtmosTransport(c.rgb);      c.rgb = fullbrightScaleSoftClip(c.rgb);      frag_color = c; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 5d7a28c359..1b7a1cc6ec 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -191,10 +191,6 @@ void main()      float da = dot(norm, lv);      vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; -    // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. -    //          We can't switch to linear here unless we do it everywhere* -    // *gbuffer IS sRGB, convert to linear since this shader outputs linear -    diff_tex.rgb = srgb_to_linear(diff_tex.rgb);      vec4 spec = texture2DRect(specularRect, frag.xy); diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl index 1485c515a4..6841a8194f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl @@ -73,7 +73,21 @@ uniform float ice_level;  vec3 rainbow(float d)  { -    d         = clamp(d, -1.0, 0.0); +    // d is the dot product of view and sun directions, so ranging -1.0..1.0 +    // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec +    // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175. + +    // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted. +    // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the +    // interesting range, but in reversed order:  i.e. d = (1 - d) - 1.575 +    d = clamp(-0.575 - d, 0.0, 1.0); + +    // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. +    // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate +    // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 +    float interior_coord = max(0.0, d - 0.25) * 4.2857; +    d = clamp(d, 0.0, 0.25) + interior_coord; +      float rad = (droplet_radius - 5.0f) / 1024.0f;      return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f4db53e0b7..7700d16007 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -87,8 +87,9 @@ void main()      float light_gamma = 1.0 / 1.3;      da                = pow(da, light_gamma); -    vec4 diffuse = texture2DRect(diffuseRect, tc); -    vec4 spec    = texture2DRect(specularRect, vary_fragcoord.xy); +    vec4 diffuse     = texture2DRect(diffuseRect, tc); +         diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14025 +    vec4 spec        = texture2DRect(specularRect, vary_fragcoord.xy);      vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;      scol_ambocc      = pow(scol_ambocc, vec2(light_gamma)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 5ab0b5c5b4..774f537821 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -189,7 +189,7 @@ void main()  	lv = normalize(lv);  	float da = dot(norm, lv); -	vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb); +	vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;  	vec4 spec = texture2DRect(specularRect, frag.xy);  	vec3 dlit = vec3(0, 0, 0); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index d758f85d71..07733bda18 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -1,5 +1,5 @@  /**  - * @file class2\wl\atmosphericVars.glsl + * @file class2\wl\atmosphericVarsF.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * Second Life Viewer Source Code diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 75bf8730df..fa928d993e 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -26,9 +26,9 @@  /*[EXTRA_CODE_HERE]*/   #ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; +out vec4 frag_color;  #else -#define frag_data gl_FragData +#define frag_color gl_FragColor  #endif  ///////////////////////////////////////////////////////////////////////// @@ -126,8 +126,6 @@ void main()      color.rgb = scaleSoftClip(color.rgb);      /// Gamma correct for WL (soft clip effect). -    frag_data[0] = vec4(color.rgb, alpha1); -    frag_data[1] = vec4(0.0,0.0,0.0,0.0); -    frag_data[2] = vec4(0,0,0,1); +    frag_color = vec4(color.rgb, alpha1);  } diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 1f881eb44b..97ffa9feef 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -1,24 +1,24 @@ -/** +/**    * @file class2\wl\cloudsV.glsl   *   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2005, Linden Research, Inc. - * + *    * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - * + *    * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - * + *    * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - * + *    * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ @@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0;  ///////////////////////////////////////////////////////////////////////////////  // Output parameters -VARYING vec4  vary_CloudColorSun; -VARYING vec4  vary_CloudColorAmbient; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient;  VARYING float vary_CloudDensity; -VARYING vec2  vary_texcoord0; -VARYING vec2  vary_texcoord1; -VARYING vec2  vary_texcoord2; -VARYING vec2  vary_texcoord3; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3;  VARYING float altitude_blend_factor;  // Inputs  uniform vec3 camPosLocal; -uniform vec4  lightnorm; -uniform vec4  sunlight_color; -uniform vec4  moonlight_color; -uniform int   sun_up_factor; -uniform vec4  ambient_color; -uniform vec4  blue_horizon; -uniform vec4  blue_density; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 moonlight_color; +uniform int sun_up_factor; +uniform vec4 ambient_color; +uniform vec4 blue_horizon; +uniform vec4 blue_density;  uniform float haze_horizon;  uniform float haze_density; @@ -60,7 +60,7 @@ uniform float cloud_shadow;  uniform float density_multiplier;  uniform float max_y; -uniform vec4  glow; +uniform vec4 glow;  uniform float sun_moon_glow_factor;  uniform vec4 cloud_color; @@ -75,8 +75,8 @@ uniform float cloud_scale;  //       indra\newview\llsettingsvo.cpp  void main()  { -    // World / view / projection -    gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); +	// World / view / projection +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);      // Texture coords      // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll @@ -93,7 +93,7 @@ void main()      vary_texcoord2 = vary_texcoord0 * 16.;      vary_texcoord3 = vary_texcoord1 * 16.; -    // Get relative position +	// Get relative position      vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);      // fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude @@ -101,27 +101,27 @@ void main()      // Adj position vector to clamp altitude      if (rel_pos.y > 0.) -    { +	{          rel_pos *= (max_y / rel_pos.y); -    } +	}      if (rel_pos.y < 0.) -    { +	{          rel_pos *= (-32000. / rel_pos.y); -    } +	} -    // Can normalize then +	// Can normalize then      vec3  rel_pos_norm = normalize(rel_pos);      float rel_pos_len  = length(rel_pos); -    // Initialize temp variables -    vec4 sunlight = sunlight_color; -    vec4 light_atten; +	// Initialize temp variables +	vec4 sunlight = sunlight_color; +	vec4 light_atten; -    // Sunlight attenuation effect (hue and brightness) due to atmosphere -    // this is used later for sunlight modulation at various altitudes +	// Sunlight attenuation effect (hue and brightness) due to atmosphere +	// this is used later for sunlight modulation at various altitudes      light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); -    // Calculate relative weights +	// Calculate relative weights      vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));      vec4 blue_weight   = blue_density / combined_haze;      vec4 haze_weight   = haze_density / combined_haze; @@ -130,63 +130,64 @@ void main()      float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);      sunlight *= exp(-light_atten * off_axis); -    // Distance +	// Distance      float density_dist = rel_pos_len * density_multiplier;      // Transparency (-> combined_haze)      // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati -    // compiler gets confused. +	// compiler gets confused.      combined_haze = exp(-combined_haze * density_dist); -    // Compute haze glow +	// Compute haze glow      float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);      // haze_glow is 0 at the sun and increases away from sun      haze_glow = max(haze_glow, .001); -    // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) +		// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)      haze_glow *= glow.x; -    // Higher glow.x gives dimmer glow (because next step is 1 / "angle") +		// Higher glow.x gives dimmer glow (because next step is 1 / "angle")      haze_glow = pow(haze_glow, glow.z); -    // glow.z should be negative, so we're doing a sort of (1 / "angle") function +		// glow.z should be negative, so we're doing a sort of (1 / "angle") function      haze_glow *= sun_moon_glow_factor; -    // Add "minimum anti-solar illumination" +	// Add "minimum anti-solar illumination"      // For sun, add to glow.  For moon, remove glow entirely. SL-13768      haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); -    // Increase ambient when there are more clouds -    vec4 tmpAmbient = ambient_color; -    tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; +	// Increase ambient when there are more clouds +	vec4 tmpAmbient = ambient_color; +	tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;  -    // Dim sunlight by cloud shadow percentage -    sunlight *= (1. - cloud_shadow); +	// Dim sunlight by cloud shadow percentage +	sunlight *= (1. - cloud_shadow); -    // Haze color below cloud +	// Haze color below cloud      vec4 additiveColorBelowCloud =          (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); -    // CLOUDS +	// CLOUDS +    sunlight = sunlight_color;  // SL-14707 reset color -- Clouds are unusually dim in EEP      off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);      sunlight *= exp(-light_atten * off_axis); -    // Cloud color out +	// Cloud color out      vary_CloudColorSun     = (sunlight * haze_glow) * cloud_color; -    vary_CloudColorAmbient = tmpAmbient * cloud_color; - -    // Attenuate cloud color by atmosphere +	vary_CloudColorAmbient = tmpAmbient * cloud_color; +	 +	// Attenuate cloud color by atmosphere      combined_haze = sqrt(combined_haze);  // less atmos opacity (more transparency) below clouds      vary_CloudColorSun *= combined_haze;      vary_CloudColorAmbient *= combined_haze;      vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); -    // Make a nice cloud density based on the cloud_shadow value that was passed in. -    vary_CloudDensity = 2. * (cloud_shadow - 0.25); +	// Make a nice cloud density based on the cloud_shadow value that was passed in. +	vary_CloudDensity = 2. * (cloud_shadow - 0.25); -    // Combine these to minimize register use -    vary_CloudColorAmbient += oHazeColorBelowCloud; +	// Combine these to minimize register use +	vary_CloudColorAmbient += oHazeColorBelowCloud; -    // needs this to compile on mac -    // vary_AtmosAttenuation = vec3(0.0,0.0,0.0); +	// needs this to compile on mac +	//vary_AtmosAttenuation = vec3(0.0,0.0,0.0); -    // END CLOUDS +	// END CLOUDS  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl deleted file mode 100644 index 8bb3f07fc6..0000000000 --- a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl +++ /dev/null @@ -1,117 +0,0 @@ -/**  - * @file lightInfo.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - *  - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - *  - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU - * Lesser General Public License for more details. - *  - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA - * $/LicenseInfo$ - */ - -struct DirectionalLightInfo -{ -    vec4 pos; -    float depth; -    vec4 normal; -    vec3 normalizedLightDirection; -    vec3 normalizedToLight; -    float lightIntensity; -    vec3 lightDiffuseColor; -    float specExponent; -    float shadow; -}; - -struct SpotLightInfo -{ -    vec4 pos; -    float depth; -    vec4 normal; -    vec3 normalizedLightDirection; -    vec3 normalizedToLight; -    float lightIntensity; -    float attenuation; -    float distanceToLight; -    vec3 lightDiffuseColor; -    float innerHalfAngleCos; -    float outerHalfAngleCos; -    float spotExponent; -    float specExponent; -    float shadow; -}; - -struct PointLightInfo -{ -    vec4 pos; -    float depth; -    vec4 normal; -    vec3 normalizedToLight; -    float lightIntensity; -    float attenuation; -    float distanceToLight; -    vec3 lightDiffuseColor; -    float lightRadius; -    float specExponent; -    vec3 worldspaceLightDirection; -    float shadow; -}; - -float attenuate(float attenuationSelection, float distanceToLight) -{ -// LLRENDER_REVIEW -// sh/could eventually consume attenuation func defined in texture -    return (attenuationSelection == 0.0f) ? 1.0f : // none -           (attenuationSelection <  1.0f) ? (1.0f / distanceToLight) : // linear atten  -           (attenuationSelection <  2.0f) ? (1.0f / (distanceToLight*distanceToLight)) // quadratic atten -										  : (1.0f / (distanceToLight*distanceToLight*distanceToLight));	// cubic atten     -} - - -vec3 lightDirectional(struct DirectionalLightInfo dli) -{ -    float lightIntensity = dli.lightIntensity; -	lightIntensity *= dot(dli.normal.xyz, dli.normalizedLightDirection); -    //lightIntensity *= directionalShadowSample(vec4(dli.pos.xyz, 1.0f), dli.depth, dli.directionalShadowMap, dli.directionalShadowMatrix); -	return lightIntensity * dli.lightDiffuseColor; -} - - -vec3 lightSpot(struct SpotLightInfo sli)     -{ -	float penumbraRange = (sli.outerHalfAngleCos - sli.innerHalfAngleCos); -    float coneAngleCos = max(dot(sli.normalizedLightDirection, sli.normalizedToLight), 0.0); -	float coneAttenFactor = (coneAngleCos <= sli.outerHalfAngleCos) ? 1.0f : pow(smoothstep(1,0, sli.outerHalfAngleCos / penumbraRange), sli.spotExponent); -    float distanceAttenuation = attenuate(sli.attenuation, sli.distanceToLight); -    float lightIntensity = sli.lightIntensity; -    lightIntensity *= distanceAttenuation; -	lightIntensity *= max(dot(sli.normal.xyz, sli.normalizedLightDirection), 0.0); -	lightIntensity *= coneAttenFactor; -    lightIntensity *= sli.shadow; -	return lightIntensity * sli.lightDiffuseColor; -} - -vec3 lightPoint(struct PointLightInfo pli) -{ -    float padRadius = pli.lightRadius * 0.1; // distance for which to perform smoothed dropoff past light radius -	float distanceAttenuation =	attenuate(pli.attenuation, pli.distanceToLight); -    float lightIntensity = pli.lightIntensity; -    lightIntensity*= distanceAttenuation;     -	lightIntensity *= clamp((padRadius - pli.distanceToLight + pli.lightRadius) / padRadius, 0.0, 1.0); -    lightIntensity *= pli.shadow; -    lightIntensity *= max(dot(pli.normal.xyz, pli.normalizedToLight), 0.0); -	return lightIntensity * pli.lightDiffuseColor; -} diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 6de01cb667..a0b082ed7c 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -56,8 +56,23 @@ vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir  vec3 ColorFromRadiance(vec3 radiance);  vec3 rainbow(float d)  { -   float rad = (droplet_radius - 5.0f) / 1024.0f; -   return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; +    // d is the dot product of view and sun directions, so ranging -1.0..1.0 +    // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec +    // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175. + +    // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted. +    // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the +    // interesting range, but in reversed order:  i.e. d = (1 - d) - 1.575 +    d = clamp(-0.575 - d, 0.0, 1.0); + +    // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. +    // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate +    // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 +    float interior_coord = max(0.0, d - 0.25) * 4.2857; +    d = clamp(d, 0.0, 0.25) + interior_coord; + +    float rad = (droplet_radius - 5.0f) / 1024.0f; +    return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;  }  vec3 halo22(float d) diff --git a/indra/newview/icons/release/secondlife.icns b/indra/newview/icons/release/secondlife.icnsBinary files differ index e15e34140d..a30b51b67a 100644 --- a/indra/newview/icons/release/secondlife.icns +++ b/indra/newview/icons/release/secondlife.icns diff --git a/indra/newview/icons/release/secondlife.ico b/indra/newview/icons/release/secondlife.icoBinary files differ index 28bf1e7664..93d4fa54ba 100644 --- a/indra/newview/icons/release/secondlife.ico +++ b/indra/newview/icons/release/secondlife.ico diff --git a/indra/newview/icons/release/secondlife_128.png b/indra/newview/icons/release/secondlife_128.pngBinary files differ index 4c9544f498..2f21c1c7fc 100644 --- a/indra/newview/icons/release/secondlife_128.png +++ b/indra/newview/icons/release/secondlife_128.png diff --git a/indra/newview/icons/release/secondlife_16.png b/indra/newview/icons/release/secondlife_16.pngBinary files differ index bb3168b8be..68f1427309 100644 --- a/indra/newview/icons/release/secondlife_16.png +++ b/indra/newview/icons/release/secondlife_16.png diff --git a/indra/newview/icons/release/secondlife_256.BMP b/indra/newview/icons/release/secondlife_256.BMPBinary files differ index 74deedd7d3..dba2636803 100644 --- a/indra/newview/icons/release/secondlife_256.BMP +++ b/indra/newview/icons/release/secondlife_256.BMP diff --git a/indra/newview/icons/release/secondlife_256.png b/indra/newview/icons/release/secondlife_256.pngBinary files differ index bece338a90..8f324910e7 100644 --- a/indra/newview/icons/release/secondlife_256.png +++ b/indra/newview/icons/release/secondlife_256.png diff --git a/indra/newview/icons/release/secondlife_32.png b/indra/newview/icons/release/secondlife_32.pngBinary files differ index 736359c147..2b7cdef03d 100644 --- a/indra/newview/icons/release/secondlife_32.png +++ b/indra/newview/icons/release/secondlife_32.png diff --git a/indra/newview/icons/release/secondlife_48.png b/indra/newview/icons/release/secondlife_48.pngBinary files differ index 07d39ae585..c2ef372dd7 100644 --- a/indra/newview/icons/release/secondlife_48.png +++ b/indra/newview/icons/release/secondlife_48.png diff --git a/indra/newview/icons/release/secondlife_512.png b/indra/newview/icons/release/secondlife_512.pngBinary files differ index 53d1643f45..d8a0c2924d 100644 --- a/indra/newview/icons/release/secondlife_512.png +++ b/indra/newview/icons/release/secondlife_512.png diff --git a/indra/newview/installers/windows/install_icon.BMP b/indra/newview/installers/windows/install_icon.BMPBinary files differ index 09df573870..dba2636803 100644 --- a/indra/newview/installers/windows/install_icon.BMP +++ b/indra/newview/installers/windows/install_icon.BMP diff --git a/indra/newview/installers/windows/install_icon.ico b/indra/newview/installers/windows/install_icon.icoBinary files differ index efe6c4f323..93d4fa54ba 100644 --- a/indra/newview/installers/windows/install_icon.ico +++ b/indra/newview/installers/windows/install_icon.ico diff --git a/indra/newview/installers/windows/uninstall_icon.BMP b/indra/newview/installers/windows/uninstall_icon.BMPBinary files differ index 562b56676a..dba2636803 100644 --- a/indra/newview/installers/windows/uninstall_icon.BMP +++ b/indra/newview/installers/windows/uninstall_icon.BMP diff --git a/indra/newview/installers/windows/uninstall_icon.ico b/indra/newview/installers/windows/uninstall_icon.icoBinary files differ index 05e1546860..93d4fa54ba 100644 --- a/indra/newview/installers/windows/uninstall_icon.ico +++ b/indra/newview/installers/windows/uninstall_icon.ico diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index a2b7362608..3f1b5139c5 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -134,6 +134,7 @@  		// called again. Since it returned false, do not yet cancel  		// frameTimer.  		handleQuit(); +		[[NSApplication sharedApplication] stopModal];  		return NSTerminateCancel;  	} else {  		// pumpMainLoop() returned true: it's done. Okay, done with frameTimer. diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 5a64f5e01c..053c0a5ab7 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -90,6 +90,7 @@  #include "llsdutil_math.h"  #include "lllocationhistory.h"  #include "llfasttimerview.h" +#include "lltelemetry.h"  #include "llvector4a.h"  #include "llviewermenufile.h"  #include "llvoicechannel.h" @@ -256,9 +257,9 @@  // define a self-registering event API object  #include "llappviewerlistener.h" -#if (LL_LINUX || LL_SOLARIS) && LL_GTK +#if LL_LINUX && LL_GTK  #include "glib.h" -#endif // (LL_LINUX || LL_SOLARIS) && LL_GTK +#endif // (LL_LINUX) && LL_GTK  #if LL_MSVC  // disable boost::lexical_cast warning @@ -1098,6 +1099,46 @@ bool LLAppViewer::init()  		}  	} +#if LL_WINDOWS && ADDRESS_SIZE == 64 +    if (gGLManager.mIsIntel) +    { +        // Check intel driver's version +        // Ex: "3.1.0 - Build 8.15.10.2559"; +        std::string version = ll_safe_string((const char *)glGetString(GL_VERSION)); + +        const boost::regex is_intel_string("[0-9].[0-9].[0-9] - Build [0-9]{1,2}.[0-9]{2}.[0-9]{2}.[0-9]{4}"); + +        if (boost::regex_search(version, is_intel_string)) +        { +            // Valid string, extract driver version +            std::size_t found = version.find("Build "); +            std::string driver = version.substr(found + 6); +            S32 v1, v2, v3, v4; +            S32 count = sscanf(driver.c_str(), "%d.%d.%d.%d", &v1, &v2, &v3, &v4); +            if (count > 0 && v1 <= 10) +            { +                LL_INFOS("AppInit") << "Detected obsolete intel driver: " << driver << LL_ENDL; +                LLUIString details = LLNotifications::instance().getGlobalString("UnsupportedIntelDriver"); +                std::string gpu_name = ll_safe_string((const char *)glGetString(GL_RENDERER)); +                details.setArg("[VERSION]", driver); +                details.setArg("[GPUNAME]", gpu_name); +                S32 button = OSMessageBox(details.getString(), +                                          LLStringUtil::null, +                                          OSMB_YESNO); +                if (OSBTN_YES == button && gViewerWindow) +                { +                    std::string url = LLWeb::escapeURL(LLTrans::getString("IntelDriverPage")); +                    if (gViewerWindow->getWindow()) +                    { +                        gViewerWindow->getWindow()->spawnWebBrowser(url, false); +                    } +                } +            } +        } +    } +#endif + +    // Obsolete? mExpectedGLVersion is always zero  #if LL_WINDOWS  	if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())  	{ @@ -1172,7 +1213,16 @@ bool LLAppViewer::init()  	// add LEAP mode command-line argument to whichever of these we selected  	updater.args.add("leap");  	// UpdaterServiceSettings -	updater.args.add(stringize(gSavedSettings.getU32("UpdaterServiceSetting"))); +    if (gSavedSettings.getBOOL("FirstLoginThisInstall")) +    { +        // Befor first login, treat this as 'manual' updates, +        // updater won't install anything, but required updates +        updater.args.add("0"); +    } +    else +    { +        updater.args.add(stringize(gSavedSettings.getU32("UpdaterServiceSetting"))); +    }  	// channel  	updater.args.add(LLVersionInfo::instance().getChannel());  	// testok @@ -1313,39 +1363,8 @@ void LLAppViewer::initMaxHeapSize()  	//F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ;  	F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ; -	BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ; -	LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ; -} - -void LLAppViewer::checkMemory() -{ -	const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second -	//const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds -	//static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; - -	if(!gGLManager.mDebugGPU) -	{ -		return ; -	} - -	if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32()) -	{ -		return ; -	} -	mMemCheckTimer.reset() ; - -		//update the availability of memory -		LLMemory::updateMemoryInfo() ; - -	bool is_low = LLMemory::isMemoryPoolLow() ; - -	LLPipeline::throttleNewMemoryAllocation(is_low) ; - -	if(is_low) -	{ -		LLMemory::logMemoryInfo() ; -	} +	LLMemory::initMaxHeapSizeGB(max_heap_size_gb);  }  static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages"); @@ -1424,9 +1443,6 @@ bool LLAppViewer::doFrame()  	//clear call stack records  	LL_CLEAR_CALLSTACKS(); -	//check memory availability information -	checkMemory() ; -  	{  		pingMainloopTimeout("Main:MiscNativeWindowEvents"); @@ -1654,12 +1670,15 @@ bool LLAppViewer::doFrame()  		}  		delete gServicePump; +		gServicePump = NULL;  		destroyMainloopTimeout();  		LL_INFOS() << "Exiting main_loop" << LL_ENDL;  	} +    LLPROFILE_UPDATE(); +  	return ! LLApp::isRunning();  } @@ -1711,7 +1730,11 @@ bool LLAppViewer::cleanup()  	//dump scene loading monitor results  	if (LLSceneMonitor::instanceExists())  	{ -		LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); +		if (!isSecondInstance()) +		{ +			LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); +		} +		LLSceneMonitor::deleteSingleton();  	}  	// There used to be an 'if (LLFastTimerView::sAnalyzePerformance)' block @@ -3505,6 +3528,12 @@ void LLAppViewer::writeSystemInfo()  	gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall");      gDebugInfo["StartupState"] = LLStartUp::getStartupStateString(); +	std::vector<std::string> resolutions = gViewerWindow->getWindow()->getDisplaysResolutionList(); +	for (auto res_iter : resolutions) +	{ +		gDebugInfo["DisplayInfo"].append(res_iter); +	} +  	writeDebugInfo(); // Save out debug_info.log early, in case of crash.  } diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index d24cdcedc7..5ceb540784 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -235,7 +235,6 @@ private:  	bool initConfiguration(); // Initialize settings from the command line/config file.  	void initStrings();       // Initialize LLTrans machinery  	bool initCache(); // Initialize local client cache. -	void checkMemory() ;  	// We have switched locations of both Mac and Windows cache, make sure  	// files migrate and old cache is cleared out. @@ -314,8 +313,6 @@ private:      LLAllocator mAlloc; -	LLFrameTimer mMemCheckTimer; -  	// llcorehttp library init/shutdown helper  	LLAppCoreHttp mAppCoreHttp; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 6f32aab851..dc487967fc 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -73,10 +73,6 @@ static void exceptionTerminateHandler()  int main( int argc, char **argv )   { -#if LL_SOLARIS && defined(__sparc) -	asm ("ta\t6");		 // NOTE:  Make sure memory alignment is enforced on SPARC -#endif -  	gArgC = argc;  	gArgV = argv; @@ -336,8 +332,6 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze)  	cmd += gDirUtilp->getDirDelimiter();  #if LL_LINUX  	cmd += "linux-crash-logger.bin"; -#elif LL_SOLARIS -	cmd += "solaris-crash-logger";  #else  # error Unknown platform  #endif @@ -394,9 +388,6 @@ bool LLAppViewerLinux::beingDebugged()  {  	static enum {unknown, no, yes} debugged = unknown; -#if LL_SOLARIS -	return debugged == no;	// BUG: fix this for Solaris -#else  	if (debugged == unknown)  	{  		pid_t ppid = getppid(); @@ -431,7 +422,6 @@ bool LLAppViewerLinux::beingDebugged()  	}  	return debugged == yes; -#endif  }  void LLAppViewerLinux::initLoggingAndGetLastDuration() diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index d3e66289d1..0fd6009074 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -248,6 +248,7 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments()          {              if (isAgentAvatarValid() &&                  gAgentAvatarp->isWearingAttachment(*it) && +                !gAgentAvatarp->getWornAttachment(*it)->isTempAttachment() && // Don't link temp attachments in COF!                  !LLAppearanceMgr::instance().isLinkedInCOF(*it))              {                  LLUUID item_id = *it; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 9430bb3ca3..a696c99a82 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -398,6 +398,24 @@ void LLConversationLog::deleteBackupLogs()  	}  } +void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name) +{ +    conversations_vec_t::iterator conv_it = mConversations.begin(); +    for (; conv_it != mConversations.end(); ++conv_it) +    { +        if (conv_it->getSessionID() == session_id) +        { +            if (conv_it->getHistoryFileName() != expected_filename) +            { +                LLLogChat::renameLogFile(conv_it->getHistoryFileName(), expected_filename); +                conv_it->updateHistoryFileName(expected_filename); +                conv_it->setConversationName(new_session_name); +            } +            break; +        } +    } +} +  bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory)  { @@ -518,7 +536,9 @@ bool LLConversationLog::loadFromFile(const std::string& filename)  	}  	bool purge_required = false; -	char buffer[MAX_STRING]; +	static constexpr int UTF_BUFFER{ 1024 }; // long enough to handle the most extreme Unicode nonsense and some to spare + +	char buffer[UTF_BUFFER];  	char conv_name_buffer[MAX_STRING];  	char part_id_buffer[MAX_STRING];  	char conv_id_buffer[MAX_STRING]; @@ -529,11 +549,14 @@ bool LLConversationLog::loadFromFile(const std::string& filename)  	// before CHUI-348 it was a flag of conversation voice state  	int prereserved_unused; -	while (!feof(fp) && fgets(buffer, MAX_STRING, fp)) +	memset(buffer, '\0', UTF_BUFFER); +	while (!feof(fp) && fgets(buffer, UTF_BUFFER, fp))  	{ -		conv_name_buffer[0] = '\0'; -		part_id_buffer[0]	= '\0'; -		conv_id_buffer[0]	= '\0'; +        // force blank for added safety +        memset(conv_name_buffer, '\0', MAX_STRING); +        memset(part_id_buffer, '\0', MAX_STRING); +        memset(conv_id_buffer, '\0', MAX_STRING); +        memset(history_file_name, '\0', MAX_STRING);  		sscanf(buffer, "[%lld] %d %d %d %[^|]| %s %s %[^|]|",  				&time, @@ -570,6 +593,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename)  		}  		mConversations.push_back(conversation); +		memset(buffer, '\0', UTF_BUFFER);  	}  	fclose(fp); diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 46e46a3278..820a5db491 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -59,7 +59,7 @@ public:  						getTime()				const	{ return mTime; }  	bool				hasOfflineMessages()	const	{ return mHasOfflineIMs; } -	void setConversationName(std::string conv_name) { mConversationName = conv_name; } +	void setConversationName(const std::string &conv_name) { mConversationName = conv_name; }  	void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; }  	bool isOlderThan(U32Days days) const; @@ -68,6 +68,8 @@ public:  	 */  	void updateTimestamp(); +    void updateHistoryFileName(const std::string &new_name) { mHistoryFileName = new_name; } +  	/*  	 * Resets flag of unread offline message to false when im floater with this conversation is opened.  	 */ @@ -137,6 +139,8 @@ public:  	 * public method which is called on viewer exit to save conversation log  	 */  	void cache(); +    // will check if current name is edentical with the one on disk and will rename the one on disk if it isn't +	void verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name);  	bool moveLog(const std::string &originDirectory, const std::string &targetDirectory);  	void getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs);  	void deleteBackupLogs(); diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 4aa74a550c..a685639427 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -341,11 +341,36 @@ void LLConversationItemSession::removeParticipant(const LLUUID& participant_id)  void LLConversationItemSession::clearParticipants()  { +    // clearParticipants function potentially is malfunctioning since it only cleans children of models, +    // it does nothing to views that own those models (listeners) +    // probably needs to post some kind of 'remove all participants' event  	clearChildren();  	mIsLoaded = false;  	mNeedsRefresh = true;  } + +void LLConversationItemSession::clearAndDeparentModels() +{ +    std::for_each(mChildren.begin(), mChildren.end(), +        [](LLFolderViewModelItem* c) +        { +            if (c->getNumRefs() == 0) +            { +                // LLConversationItemParticipant can be created but not assigned to any view, +                // it was waiting for an "add_participant" event to be processed +                delete c; +            } +            else +            { +                // Model is still assigned to some view/widget +                c->setParent(NULL); +            } +        } +    ); +    mChildren.clear(); +} +  LLConversationItemParticipant* LLConversationItemSession::findParticipant(const LLUUID& participant_id)  {  	// This is *not* a general tree parsing algorithm. It assumes that a session contains only  @@ -355,7 +380,7 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const  	for (iter = mChildren.begin(); iter != mChildren.end(); iter++)  	{  		participant = dynamic_cast<LLConversationItemParticipant*>(*iter); -		if (participant->hasSameValue(participant_id)) +		if (participant && participant->hasSameValue(participant_id))  		{  			break;  		} @@ -466,7 +491,7 @@ const bool LLConversationItemSession::getTime(F64& time) const  	{  		participant = dynamic_cast<LLConversationItemParticipant*>(*iter);  		F64 participant_time; -		if (participant->getTime(participant_time)) +		if (participant && participant->getTime(participant_time))  		{  			has_time = true;  			most_recent_time = llmax(most_recent_time,participant_time); diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 30c7481864..787deeb594 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -165,6 +165,7 @@ public:  	void removeParticipant(LLConversationItemParticipant* participant);  	void removeParticipant(const LLUUID& participant_id);  	void clearParticipants(); +	void clearAndDeparentModels(); // will delete unowned models and deparent owned ones  	LLConversationItemParticipant* findParticipant(const LLUUID& participant_id);  	void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 093e772abe..65cec68884 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -31,6 +31,7 @@  #include <boost/bind.hpp>  #include "llagentdata.h" +#include "llavataractions.h"  #include "llconversationmodel.h"  #include "llfloaterimsession.h"  #include "llfloaterimnearbychat.h" @@ -102,6 +103,56 @@ LLConversationViewSession::~LLConversationViewSession()  	mFlashTimer->unset();  } +void LLConversationViewSession::destroyView() +{ +    // Chat can create and parent models(listeners) to session's model before creating +    // coresponding views, such participant's models normally will wait for idle cycles +    // but since we are deleting session and won't be processing any more events, make +    // sure unowned LLConversationItemParticipant models are removed as well. + +    LLConversationItemSession* vmi = dynamic_cast<LLConversationItemSession*>(getViewModelItem()); + +    // CONV_SESSION_1_ON_1 stores participants as two models that belong to views independent +    // from session (nasty! These views are widgets in LLFloaterIMSessionTab, see buildConversationViewParticipant) +    if (vmi && vmi->getType() != LLConversationItem::CONV_SESSION_1_ON_1) +    { +        // Destroy existing views +        while (!mItems.empty()) +        { +            LLFolderViewItem *itemp = mItems.back(); +            mItems.pop_back(); + +            LLFolderViewModelItem* item_vmi = itemp->getViewModelItem(); +            if (item_vmi) // supposed to exist +            { +                // unparent to remove from child list +                vmi->removeChild(item_vmi); +            } +            itemp->destroyView(); +        } + +        // Not needed in scope of sessions, but just in case +        while (!mFolders.empty()) +        { +            LLFolderViewFolder *folderp = mFolders.back(); +            mFolders.pop_back(); + +            LLFolderViewModelItem* folder_vmi = folderp->getViewModelItem(); +            if (folder_vmi) +            { +                vmi->removeChild(folder_vmi); +            } +            folderp->destroyView(); +        } + +        // Now everything that is left in model(listener) is not owned by views, +        // only by sessions, deparent so it won't point to soon to be dead model +        vmi->clearAndDeparentModels(); +    } + +    LLFolderViewFolder::destroyView(); +} +  void LLConversationViewSession::setFlashState(bool flash_state)  {  	if (flash_state && !mFlashStateOn) @@ -432,8 +483,13 @@ void LLConversationViewSession::refresh()  	vmi->resetRefresh();  	if (mSessionTitle) -	{ -		mSessionTitle->setText(vmi->getDisplayName()); +	{		 +		if (!highlightFriendTitle(vmi)) +		{ +			LLStyle::Params title_style; +			title_style.color = LLUIColorTable::instance().getColor("LabelTextColor"); +			mSessionTitle->setText(vmi->getDisplayName(), title_style); +		}  	}  	// Update all speaking indicators @@ -478,6 +534,22 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi  	}  } +bool LLConversationViewSession::highlightFriendTitle(LLConversationItem* vmi) +{ +	if(vmi->getType() == LLConversationItem::CONV_PARTICIPANT || vmi->getType() == LLConversationItem::CONV_SESSION_1_ON_1) +	{ +		LLIMModel::LLIMSession* session=  LLIMModel::instance().findIMSession(vmi->getUUID()); +		if (session && LLAvatarActions::isFriend(session->mOtherParticipantID)) +		{ +			LLStyle::Params title_style; +			title_style.color = LLUIColorTable::instance().getColor("ConversationFriendColor"); +			mSessionTitle->setText(vmi->getDisplayName(), title_style); +			return true; +		} +	} +	return false; +} +  //  // Implementation of conversations list participant (avatar) widgets  // @@ -578,7 +650,14 @@ void LLConversationViewParticipant::draw()  	}  	else  	{ -		color = mIsSelected ? sHighlightFgColor : sFgColor; +		if (LLAvatarActions::isFriend(mUUID)) +		{ +			color = LLUIColorTable::instance().getColor("ConversationFriendColor"); +		} +		else +		{ +			color = mIsSelected ? sHighlightFgColor : sFgColor; +		}  	}  	LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem()); @@ -617,10 +696,13 @@ void LLConversationViewParticipant::refresh()  {  	// Refresh the participant view from its model data  	LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem()); -	participant_model->resetRefresh(); -	 -	// *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat -	mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted()); +    if (participant_model) +    { +        participant_model->resetRefresh(); + +        // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat +        mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted()); +    }  	// Do the regular upstream refresh  	LLFolderViewItem::refresh(); diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index c5930c8a29..0932d24dfe 100644 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -36,6 +36,7 @@  class LLTextBox;  class LLFloater;  class LLFloaterIMContainer; +class LLConversationItem;  class LLConversationViewSession;  class LLConversationViewParticipant; @@ -66,6 +67,8 @@ protected:  public:  	virtual ~LLConversationViewSession(); +	/*virtual*/ void destroyView(); +  	/*virtual*/ BOOL postBuild();  	/*virtual*/ void draw();  	/*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); @@ -93,6 +96,8 @@ public:  	LLFloater* getSessionFloater();  	bool isInActiveVoiceChannel() { return mIsInActiveVoiceChannel; } +	bool highlightFriendTitle(LLConversationItem* vmi); +  private:  	void onCurrentVoiceSessionChanged(const LLUUID& session_id); diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index b8e6e81ee6..01790ad19e 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -37,7 +37,7 @@  #include "llviewercontrol.h"  #include "llwin32headerslean.h" -#if LL_LINUX || LL_SOLARIS || LL_DARWIN +#if LL_LINUX || LL_DARWIN  # include "llfilepicker.h"  #endif @@ -187,7 +187,7 @@ std::string LLDirPicker::getDirName()  	return mFilePicker->getFirstFile();  } -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX  LLDirPicker::LLDirPicker() :  	mFileName(NULL), diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h index c7dba12130..52febe4523 100644 --- a/indra/newview/lldirpicker.h +++ b/indra/newview/lldirpicker.h @@ -78,7 +78,7 @@ private:  	void buildDirname( void );  	bool check_local_file_access_enabled(); -#if LL_LINUX || LL_SOLARIS || LL_DARWIN +#if LL_LINUX || LL_DARWIN  	// On Linux we just implement LLDirPicker on top of LLFilePicker  	LLFilePicker *mFilePicker;  #endif diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5034bd1c5e..507af56cb0 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -912,22 +912,18 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)              if (volume->getAvatar())              {                  const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents(); -                LLVector3d cam_pos = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); -                LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal()); -                 -                LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box); +                LLVector3 cam_pos_from_agent = LLViewerCamera::getInstance()->getOrigin(); +                LLVector3 cam_to_box_offset = point_to_box_offset(cam_pos_from_agent, av_box);                  mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f));                  LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname()                                           << " pos (ignored) " << pos -                                        << " cam pos " << cam_pos -                                        << " cam region pos " << cam_region_pos +                                        << " cam pos " << cam_pos_from_agent                                          << " box " << av_box[0] << "," << av_box[1]                                           << " -> dist " << mDistanceWRTCamera                                          << LL_ENDL;                  mVObjp->updateLOD();                  return;              } -              		}  		else  		{ diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index d4e7f1600e..0c3d8f3098 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -226,7 +226,7 @@ void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightL      }  } -void LLDrawPoolWLSky::renderStars(void) const +void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const  {      LLGLSPipelineBlendSkyBox gls_skybox(true, false); @@ -266,6 +266,7 @@ void LLDrawPoolWLSky::renderStars(void) const      }  	gGL.pushMatrix(); +	gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);  	gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);  	if (LLGLSLShader::sNoFixedFunction)  	{ @@ -296,7 +297,7 @@ void LLDrawPoolWLSky::renderStars(void) const  	}  } -void LLDrawPoolWLSky::renderStarsDeferred(void) const +void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const  {  	LLGLSPipelineBlendSkyBox gls_sky(true, false); @@ -337,6 +338,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const          gGL.getTexUnit(1)->bind(tex_b);      } +	gGL.pushMatrix(); +	gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);      gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);      if (LLPipeline::sReflectionRender) @@ -355,6 +358,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const      gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);      gDeferredStarProgram.unbind(); + +	gGL.popMatrix();  }  void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const @@ -601,7 +606,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)      if (gPipeline.canUseWindLightShaders())      {          renderSkyHazeDeferred(origin, camHeightLocal); -        renderStarsDeferred(); +        renderStarsDeferred(origin);          renderHeavenlyBodies();          renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader);      } @@ -620,7 +625,7 @@ void LLDrawPoolWLSky::render(S32 pass)      LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();  	renderSkyHaze(origin, camHeightLocal);     -    renderStars(); +    renderStars(origin);      renderHeavenlyBodies();	  	renderSkyClouds(origin, camHeightLocal, cloud_shader); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index a4f176d6db..324886ed42 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -78,8 +78,8 @@ private:  	void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const;      void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; -    void renderStarsDeferred(void) const; -	void renderStars(void) const; +    void renderStarsDeferred(const LLVector3& camPosLocal) const; +	void renderStars(const LLVector3& camPosLocal) const;  	void renderHeavenlyBodies();      }; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 89c20904c1..8b8273d183 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -56,13 +56,6 @@ LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 compon  {  	llassert((1 <= components) && (components <= 4)); -	if(gGLManager.mDebugGPU) -	{ -		if(components == 3) -		{ -			mComponents = 4 ; //convert to 32bits. -		} -	}  	generateGLTexture();  	llassert( 0 <= order && order < ORDER_COUNT ); @@ -211,7 +204,7 @@ void LLViewerDynamicTexture::postRender(BOOL success)  BOOL LLViewerDynamicTexture::updateAllInstances()  {  	sNumRenders = 0; -	if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled) +	if (gGLManager.mIsDisabled)  	{  		return TRUE;  	} diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 347997a69a..7a887a2549 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -384,6 +384,8 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p)  	mUpdateDropDownItems(true),  	mRestoreOverflowMenu(false),  	mGetPrevItems(true), +	mMouseX(0), +	mMouseY(0),  	mItemsChangedTimer()  {  	// Register callback for menus with current registrar (will be parent panel's registrar) @@ -399,7 +401,7 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p)  	//make chevron button                                                                                                                                 	LLTextBox::Params more_button_params(p.more_button);  	mMoreTextBox = LLUICtrlFactory::create<LLTextBox> (more_button_params); -	mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this)); +	mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::onMoreTextBoxClicked, this));  	addChild(mMoreTextBox);  	mDropDownItemsCount = 0; @@ -975,6 +977,12 @@ BOOL LLFavoritesBarCtrl::collectFavoriteItems(LLInventoryModel::item_array_t &it  	return TRUE;  } +void LLFavoritesBarCtrl::onMoreTextBoxClicked() +{ +	LLUI::getInstance()->getMousePositionScreen(&mMouseX, &mMouseY); +	showDropDownMenu(); +} +  void LLFavoritesBarCtrl::showDropDownMenu()  {  	if (mOverflowMenuHandle.isDead()) @@ -1130,7 +1138,7 @@ void LLFavoritesBarCtrl::positionAndShowMenu(LLToggleableMenu* menu)  		}  	} -	LLMenuGL::showPopup(this, menu, menu_x, menu_y); +	LLMenuGL::showPopup(this, menu, menu_x, menu_y, mMouseX, mMouseY);  }  void LLFavoritesBarCtrl::onButtonClick(LLUUID item_id) diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index 571208aa31..868f1c83c8 100644 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -96,6 +96,8 @@ protected:  	void showDropDownMenu(); +	void onMoreTextBoxClicked(); +  	LLHandle<LLView> mOverflowMenuHandle;  	LLHandle<LLView> mContextMenuHandle; @@ -163,6 +165,9 @@ private:  	BOOL mTabsHighlightEnabled; +	S32 mMouseX; +	S32 mMouseY; +  	boost::signals2::connection mEndDragConnection;  }; diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index d915a9fd26..e6bbe234b3 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -379,22 +379,6 @@ F32 gpu_benchmark();  #if LL_WINDOWS -static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific - -U32 exception_benchmark_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop) -{ -    if (code == STATUS_MSC_EXCEPTION) -    { -        // C++ exception, go on -        return EXCEPTION_CONTINUE_SEARCH; -    } -    else -    { -        // handle it -        return EXCEPTION_EXECUTE_HANDLER; -    } -} -  F32 logExceptionBenchmark()  {      // Todo: make a wrapper/class for SEH exceptions @@ -403,7 +387,7 @@ F32 logExceptionBenchmark()      {          gbps = gpu_benchmark();      } -    __except (exception_benchmark_filter(GetExceptionCode(), GetExceptionInformation())) +    __except (msc_exception_filter(GetExceptionCode(), GetExceptionInformation()))      {          // convert to C++ styled exception          char integer_string[32]; @@ -771,12 +755,7 @@ void LLFeatureManager::applyBaseMasks()  		maskFeatures("RAM256MB");  	} -#if LL_SOLARIS && defined(__sparc) 	//  even low MHz SPARCs are fast -#error The 800 is hinky. Would something like a LL_MIN_MHZ make more sense here? -	if (gSysCPU.getMHz() < 800) -#else  	if (gSysCPU.getMHz() < 1100) -#endif  	{  		maskFeatures("CPUSlow");  	} diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index b6fd70452e..3669fb1eeb 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -40,7 +40,7 @@  #include "llwindowsdl.h" // for some X/GTK utils to help with filepickers  #endif // LL_SDL -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX  #include "llhttpconstants.h"    // file picker uses some of thes constants on Linux  #endif @@ -939,7 +939,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,  }  //END LL_DARWIN -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX  # if LL_GTK @@ -1504,4 +1504,4 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)  	return FALSE;  } -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 4d3ebcda1e..ea93d3bfaa 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -49,7 +49,8 @@  #include "lltrans.h"  LLFloaterBuy::LLFloaterBuy(const LLSD& key) -:	LLFloater(key) +:	LLFloater(key), +	mSelectionUpdateSlot()  {  } @@ -179,12 +180,19 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)  	floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));  	floater->getChild<LLUICtrl>("buy_name_text")->setTextArg("[NAME]", owner_name); +	floater->showViews(true); +  	// Must do this after the floater is created, because  	// sometimes the inventory is already there and   	// the callback is called immediately.  	LLViewerObject* obj = selection->getFirstRootObject();  	floater->registerVOInventoryListener(obj,NULL);  	floater->requestVOInventory(); + +	if (!floater->mSelectionUpdateSlot.connected()) +	{ +		floater->mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterBuy::onSelectionChanged, floater)); +	}  }  void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, @@ -280,6 +288,30 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,  	removeVOInventoryListener();  } +void LLFloaterBuy::onSelectionChanged() +{ +	 +	if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() == 0) +	{ +		removeVOInventoryListener(); +		closeFloater(); +	} +	else if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() > 1) +	{ +		removeVOInventoryListener(); +		showViews(false); +		reset(); +		setTitle(getString("mupliple_selected")); +	} +} + +void LLFloaterBuy::showViews(bool show) +{ +	getChild<LLUICtrl>("buy_btn")->setEnabled(show); +	getChild<LLUICtrl>("buy_text")->setVisible(show); +	getChild<LLUICtrl>("buy_name_text")->setVisible(show); +} +  void LLFloaterBuy::onClickBuy()  {  	// Put the items where we put new folders. @@ -303,5 +335,10 @@ void LLFloaterBuy::onClickCancel()  // virtual  void LLFloaterBuy::onClose(bool app_quitting)  { +	if (mSelectionUpdateSlot.connected()) +	{ +		mSelectionUpdateSlot.disconnect(); +	} +  	mObjectSelection.clear();  } diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h index 3ec642dee1..e83b3c6ba6 100644 --- a/indra/newview/llfloaterbuy.h +++ b/indra/newview/llfloaterbuy.h @@ -63,12 +63,17 @@ protected:  								 S32 serial_num,  								 void* data); +	void onSelectionChanged(); +	void showViews(bool show); +  	void onClickBuy();  	void onClickCancel();  private:  	LLSafeHandle<LLObjectSelection>	mObjectSelection;  	LLSaleInfo mSaleInfo; + +	boost::signals2::connection mSelectionUpdateSlot;  };  #endif diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index d574f1433f..3b192ff81b 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -457,6 +457,7 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode)  	switch (mode)  	{ +	case CAMERA_CTRL_MODE_PRESETS:  	case CAMERA_CTRL_MODE_PAN:  		sFreeCamera = false;  		clear_camera_tool(); @@ -467,13 +468,6 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode)  		activate_camera_tool();  		break; -	case CAMERA_CTRL_MODE_PRESETS: -		if(sFreeCamera) -		{ -			switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); -		} -		break; -  	default:  		//normally we won't occur here  		llassert_always(FALSE); @@ -528,7 +522,6 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param)  		{  			camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA);  			camera_floater->updateItemsSelection(); -			camera_floater->fromFreeToPresets();  		}  	}  	else @@ -586,15 +579,7 @@ void LLFloaterCamera::switchToPreset(const std::string& name)  	if (camera_floater)  	{  		camera_floater->updateItemsSelection(); -		camera_floater->fromFreeToPresets(); -	} -} - -void LLFloaterCamera::fromFreeToPresets() -{ -	if (!sFreeCamera && mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && mPrevMode == CAMERA_CTRL_MODE_PRESETS) -	{ -		switchMode(CAMERA_CTRL_MODE_PRESETS); +		camera_floater->switchMode(CAMERA_CTRL_MODE_PRESETS);  	}  } diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 9440f50c3f..a69b87ad16 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -69,10 +69,6 @@ public:  	/*switch to one of the camera presets (front, rear, side)*/  	static void switchToPreset(const std::string& name); -	/* move to CAMERA_CTRL_MODE_PRESETS from CAMERA_CTRL_MODE_FREE_CAMERA if we are on presets panel and -	   are not in free camera mode*/ -	void fromFreeToPresets(); -  	virtual void onOpen(const LLSD& key);  	virtual void onClose(bool app_quitting); diff --git a/indra/newview/llfloatereditenvironmentbase.cpp b/indra/newview/llfloatereditenvironmentbase.cpp new file mode 100644 index 0000000000..e888144b6a --- /dev/null +++ b/indra/newview/llfloatereditenvironmentbase.cpp @@ -0,0 +1,479 @@ +/**  + * @file llfloatereditenvironmentbase.cpp + * @brief Floaters to create and edit fixed settings for sky and water. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatereditenvironmentbase.h" + +#include <boost/make_shared.hpp> + +// libs +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llfilepicker.h" +#include "llsettingspicker.h" +#include "llviewerparcelmgr.h" + +// newview +#include "llsettingssky.h" +#include "llsettingswater.h" + +#include "llenvironment.h" +#include "llagent.h" +#include "llparcel.h" + +#include "llsettingsvo.h" +#include "llinventorymodel.h" + +namespace +{ +    const std::string ACTION_APPLY_LOCAL("apply_local"); +    const std::string ACTION_APPLY_PARCEL("apply_parcel"); +    const std::string ACTION_APPLY_REGION("apply_region"); +} + +//========================================================================= +const std::string LLFloaterEditEnvironmentBase::KEY_INVENTORY_ID("inventory_id"); + + +//========================================================================= + +class LLFixedSettingCopiedCallback : public LLInventoryCallback +{ +public: +    LLFixedSettingCopiedCallback(LLHandle<LLFloater> handle) : mHandle(handle) {} + +    virtual void fire(const LLUUID& inv_item_id) +    { +        if (!mHandle.isDead()) +        { +            LLViewerInventoryItem* item = gInventory.getItem(inv_item_id); +            if (item) +            { +                LLFloaterEditEnvironmentBase* floater = (LLFloaterEditEnvironmentBase*)mHandle.get(); +                floater->onInventoryCreated(item->getAssetUUID(), inv_item_id); +            } +        } +    } + +private: +    LLHandle<LLFloater> mHandle; +}; + +//========================================================================= +LLFloaterEditEnvironmentBase::LLFloaterEditEnvironmentBase(const LLSD &key) : +    LLFloater(key), +    mInventoryId(), +    mInventoryItem(nullptr), +    mIsDirty(false), +    mCanCopy(false), +    mCanMod(false), +    mCanTrans(false), +    mCanSave(false) +{ +} + +LLFloaterEditEnvironmentBase::~LLFloaterEditEnvironmentBase() +{ +} + +void LLFloaterEditEnvironmentBase::onFocusReceived() +{ +    if (isInVisibleChain()) +    { +        updateEditEnvironment(); +        LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); +    } +} + +void LLFloaterEditEnvironmentBase::onFocusLost() +{ +} + +void LLFloaterEditEnvironmentBase::loadInventoryItem(const LLUUID  &inventoryId, bool can_trans) +{ +    if (inventoryId.isNull()) +    { +        mInventoryItem = nullptr; +        mInventoryId.setNull(); +        mCanMod = true; +        mCanCopy = true; +        mCanTrans = true; +        return; +    } + +    mInventoryId = inventoryId; +    LL_INFOS("SETTINGS") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; +    mInventoryItem = gInventory.getItem(mInventoryId); + +    if (!mInventoryItem) +    { +        LL_WARNS("SETTINGS") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; +        LLNotificationsUtil::add("CantFindInvItem"); +        closeFloater(); + +        mInventoryId.setNull(); +        mInventoryItem = nullptr; +        return; +    } + +    if (mInventoryItem->getAssetUUID().isNull()) +    { +        LL_WARNS("ENVIRONMENT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; +        LLNotificationsUtil::add("UnableEditItem"); +        closeFloater(); + +        mInventoryId.setNull(); +        mInventoryItem = nullptr; +        return; +    } + +    mCanSave = true; +    mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); +    mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); +    mCanTrans = can_trans && mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); + +    mExpectingAssetId = mInventoryItem->getAssetUUID(); +    LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), +        [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); +} + + +void LLFloaterEditEnvironmentBase::checkAndConfirmSettingsLoss(LLFloaterEditEnvironmentBase::on_confirm_fn cb) +{ +    if (isDirty()) +    { +        LLSD args(LLSDMap("TYPE", getEditSettings()->getSettingsType()) +            ("NAME", getEditSettings()->getName())); + +        // create and show confirmation textbox +        LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), +            [cb](const LLSD¬if, const LLSD&resp) +            { +                S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); +                if (opt == 0) +                    cb(); +            }); +    } +    else if (cb) +    { +        cb(); +    } +} + +void LLFloaterEditEnvironmentBase::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) +{ +    if (asset_id != mExpectingAssetId) +    { +        LL_WARNS("ENVDAYEDIT") << "Expecting {" << mExpectingAssetId << "} got {" << asset_id << "} - throwing away." << LL_ENDL; +        return; +    } +    mExpectingAssetId.setNull(); +    clearDirtyFlag(); + +    if (!settings || status) +    { +        LLSD args; +        args["NAME"] = (mInventoryItem) ? mInventoryItem->getName() : asset_id.asString(); +        LLNotificationsUtil::add("FailedToFindSettings", args); +        closeFloater(); +        return; +    } + +    if (settings->getFlag(LLSettingsBase::FLAG_NOSAVE)) +    { +        mCanSave = false; +        mCanCopy = false; +        mCanMod = false; +        mCanTrans = false; +    } +    else +    { +        if (mInventoryItem) +            settings->setName(mInventoryItem->getName()); + +        if (mCanCopy) +            settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); +        else +            settings->setFlag(LLSettingsBase::FLAG_NOCOPY); + +        if (mCanMod) +            settings->clearFlag(LLSettingsBase::FLAG_NOMOD); +        else +            settings->setFlag(LLSettingsBase::FLAG_NOMOD); + +        if (mCanTrans) +            settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); +        else +            settings->setFlag(LLSettingsBase::FLAG_NOTRANS); +    } + +    setEditSettingsAndUpdate(settings); +} + +void LLFloaterEditEnvironmentBase::onButtonImport() +{ +    checkAndConfirmSettingsLoss([this](){ doImportFromDisk(); }); +} + +void LLFloaterEditEnvironmentBase::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings) +{ +    S32 option = LLNotificationsUtil::getSelectedOption(notification, response); +    if (0 == option) +    { +        std::string settings_name = response["message"].asString(); + +        LLInventoryObject::correctInventoryName(settings_name); +        if (settings_name.empty()) +        { +            // Ideally notification should disable 'OK' button if name won't fit our requirements, +            // for now either display notification, or use some default name +            settings_name = "Unnamed"; +        } + +        if (mCanMod) +        { +            doApplyCreateNewInventory(settings_name, settings); +        } +        else if (mInventoryItem) +        { +            const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); +            LLUUID parent_id = mInventoryItem->getParentUUID(); +            if (marketplacelistings_id == parent_id) +            { +                parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); +            } + +            LLPointer<LLInventoryCallback> cb = new LLFixedSettingCopiedCallback(getHandle()); +            copy_inventory_item( +                gAgent.getID(), +                mInventoryItem->getPermissions().getOwner(), +                mInventoryItem->getUUID(), +                parent_id, +                settings_name, +                cb); +        } +        else +        { +            LL_WARNS() << "Failed to copy fixed env setting" << LL_ENDL; +        } +    } +} + +void LLFloaterEditEnvironmentBase::onClickCloseBtn(bool app_quitting) +{ +    if (!app_quitting) +        checkAndConfirmSettingsLoss([this](){ closeFloater(); clearDirtyFlag(); }); +    else +        closeFloater(); +} + +void LLFloaterEditEnvironmentBase::doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings) +{ +    if (mInventoryItem) +    { +        LLUUID parent_id = mInventoryItem->getParentUUID(); +        U32 next_owner_perm = mInventoryItem->getPermissions().getMaskNextOwner(); +        LLSettingsVOBase::createInventoryItem(settings, next_owner_perm, parent_id, settings_name, +            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); +    } +    else +    { +        LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); +        // This method knows what sort of settings object to create. +        LLSettingsVOBase::createInventoryItem(settings, parent_id, settings_name, +            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); +    } +} + +void LLFloaterEditEnvironmentBase::doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings) +{ +    LL_DEBUGS("ENVEDIT") << "Update inventory for " << mInventoryId << LL_ENDL; +    if (mInventoryId.isNull()) +    { +        LLSettingsVOBase::createInventoryItem(settings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), +            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); +    } +    else +    { +        LLSettingsVOBase::updateInventoryItem(settings, mInventoryId, +            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); +    } +} + +void LLFloaterEditEnvironmentBase::doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings) +{ +    U32 flags(0); + +    if (mInventoryItem) +    { +        if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) +            flags |= LLSettingsBase::FLAG_NOMOD; +        if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) +            flags |= LLSettingsBase::FLAG_NOTRANS; +    } + +    flags |= settings->getFlags(); +    settings->setFlag(flags); + +    if (where == ACTION_APPLY_LOCAL) +    { +        settings->setName("Local"); // To distinguish and make sure there is a name. Safe, because this is a copy. +        LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, settings); +    } +    else if (where == ACTION_APPLY_PARCEL) +    { +        LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); + +        if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID)) +        { +            LL_WARNS("ENVIRONMENT") << "Can not identify parcel. Not applying." << LL_ENDL; +            LLNotificationsUtil::add("WLParcelApplyFail"); +            return; +        } + +        if (mInventoryItem && !isDirty()) +        { +            LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); +        } +        else if (settings->getSettingsType() == "sky") +        { +            LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); +        } +        else if (settings->getSettingsType() == "water") +        { +            LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); +        } +        else if (settings->getSettingsType() == "day") +        { +            LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsDay>(settings), -1, -1); +        } +    } +    else if (where == ACTION_APPLY_REGION) +    { +        if (mInventoryItem && !isDirty()) +        { +            LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); +        } +        else if (settings->getSettingsType() == "sky") +        { +            LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); +        } +        else if (settings->getSettingsType() == "water") +        { +            LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); +        } +        else if (settings->getSettingsType() == "day") +        { +            LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsDay>(settings), -1, -1); +        } +    } +    else +    { +        LL_WARNS("ENVIRONMENT") << "Unknown apply '" << where << "'" << LL_ENDL; +        return; +    } + +} + +void LLFloaterEditEnvironmentBase::doCloseInventoryFloater(bool quitting) +{ +    LLFloater* floaterp = mInventoryFloater.get(); + +    if (floaterp) +    { +        floaterp->closeFloater(quitting); +    } +} + +void LLFloaterEditEnvironmentBase::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results) +{ +    LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; + +    if (inventory_id.isNull() || !results["success"].asBoolean()) +    { +        LLNotificationsUtil::add("CantCreateInventory"); +        return; +    } +    onInventoryCreated(asset_id, inventory_id); +} + +void LLFloaterEditEnvironmentBase::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id) +{ +    bool can_trans = true; +    if (mInventoryItem) +    { +        LLPermissions perms = mInventoryItem->getPermissions(); + +        LLInventoryItem *created_item = gInventory.getItem(mInventoryId); + +        if (created_item) +        { +            can_trans = perms.allowOperationBy(PERM_TRANSFER, gAgent.getID()); +            created_item->setPermissions(perms); +            created_item->updateServer(false); +        } +    } + +    clearDirtyFlag(); +    setFocus(TRUE);                 // Call back the focus... +    loadInventoryItem(inventory_id, can_trans); +} + +void LLFloaterEditEnvironmentBase::onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results) +{ +    LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL; + +    clearDirtyFlag(); +    if (inventory_id != mInventoryId) +    { +        loadInventoryItem(inventory_id); +    } +} + +void LLFloaterEditEnvironmentBase::onPanelDirtyFlagChanged(bool value) +{ +    if (value) +        setDirtyFlag(); +} + +//------------------------------------------------------------------------- +bool LLFloaterEditEnvironmentBase::canUseInventory() const +{ +    return LLEnvironment::instance().isInventoryEnabled(); +} + +bool LLFloaterEditEnvironmentBase::canApplyRegion() const +{ +    return gAgent.canManageEstate(); +} + +bool LLFloaterEditEnvironmentBase::canApplyParcel() const +{ +    return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); +} + +//========================================================================= diff --git a/indra/newview/llfloatereditenvironmentbase.h b/indra/newview/llfloatereditenvironmentbase.h new file mode 100644 index 0000000000..7c7cf5bdcd --- /dev/null +++ b/indra/newview/llfloatereditenvironmentbase.h @@ -0,0 +1,148 @@ +/**  + * @file llfloatereditenvironmentbase.h + * @brief Floaters to create and edit fixed settings for sky and water. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +#ifndef LL_FLOATEREDITENVIRONMENTBASE_H +#define LL_FLOATEREDITENVIRONMENTBASE_H + +#include "llfloater.h" +#include "llsettingsbase.h" +#include "llflyoutcombobtn.h" +#include "llinventory.h" + +#include "boost/signals2.hpp" + +class LLTabContainer; +class LLButton; +class LLLineEditor; +class LLFloaterSettingsPicker; +class LLFixedSettingCopiedCallback; + +class LLFloaterEditEnvironmentBase : public LLFloater +{ +    LOG_CLASS(LLFloaterEditEnvironmentBase); + +    friend class LLFixedSettingCopiedCallback; + +public: +    static const std::string    KEY_INVENTORY_ID; + +                            LLFloaterEditEnvironmentBase(const LLSD &key); +                            ~LLFloaterEditEnvironmentBase(); + +    virtual void            onFocusReceived()           override; +    virtual void            onFocusLost()               override; +     +    virtual LLSettingsBase::ptr_t   getEditSettings()   const = 0; + +    virtual BOOL            isDirty() const override            { return getIsDirty(); } + +protected: +    typedef std::function<void()> on_confirm_fn; + +    virtual void            setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) = 0; +    virtual void            updateEditEnvironment() = 0; + +    virtual LLFloaterSettingsPicker *getSettingsPicker() = 0; + +    void                    loadInventoryItem(const LLUUID  &inventoryId, bool can_trans = true); + +    void                    checkAndConfirmSettingsLoss(on_confirm_fn cb); + +    virtual void            doImportFromDisk() = 0; +    virtual void            doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings); +    virtual void            doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings); +    virtual void            doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings); +    void                    doCloseInventoryFloater(bool quitting = false); + +    bool                    canUseInventory() const; +    bool                    canApplyRegion() const; +    bool                    canApplyParcel() const; + +    LLUUID                  mInventoryId; +    LLInventoryItem *       mInventoryItem; +    LLHandle<LLFloater>     mInventoryFloater; +    bool                    mCanCopy; +    bool                    mCanMod; +    bool                    mCanTrans; +    bool                    mCanSave; + +    bool                    mIsDirty; + +    void                    onInventoryCreated(LLUUID asset_id, LLUUID inventory_id); +    void                    onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); +    void                    onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); + +    bool                    getIsDirty() const  { return mIsDirty; } +    void                    setDirtyFlag()      { mIsDirty = true; } +    virtual void            clearDirtyFlag() = 0; + +    void                    onPanelDirtyFlagChanged(bool); + +    virtual void            onClickCloseBtn(bool app_quitting = false) override; +    void                    onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings); +    void                    onButtonImport(); + +    void                    onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status); + +private: +    LLUUID                  mExpectingAssetId; // for asset load confirmation +}; + +class LLSettingsEditPanel : public LLPanel +{ +public: +    virtual void setSettings(const LLSettingsBase::ptr_t &) = 0; + +    typedef boost::signals2::signal<void(LLPanel *, bool)> on_dirty_charged_sg; +    typedef boost::signals2::connection connection_t; + +    inline bool         getIsDirty() const      { return mIsDirty; } +    inline void         setIsDirty()            { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } +    inline void         clearIsDirty()          { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } + +    inline bool        getCanChangeSettings() const    { return mCanEdit; } +    inline void        setCanChangeSettings(bool flag) { mCanEdit = flag; } + +    inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb)    { return mOnDirtyChanged.connect(cb); } + + +protected: +    LLSettingsEditPanel() : +        LLPanel(), +        mIsDirty(false), +        mOnDirtyChanged() +    {} + +private: +    void onTextureChanged(LLUUID &inventory_item_id); + +    bool                mIsDirty; +    bool                mCanEdit; +     +    on_dirty_charged_sg mOnDirtyChanged; +}; + +#endif // LL_FLOATERENVIRONMENTBASE_H diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index a7c2cbbeaa..0501c287ad 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -125,7 +125,6 @@ namespace {  }  //========================================================================= -const std::string LLFloaterEditExtDayCycle::KEY_INVENTORY_ID("inventory_id");  const std::string LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT("edit_context");  const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length");  const std::string LLFloaterEditExtDayCycle::KEY_CANMOD("canmod"); @@ -133,7 +132,7 @@ const std::string LLFloaterEditExtDayCycle::KEY_CANMOD("canmod");  const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_INVENTORY("inventory");  const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL("parcel");  const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION("region"); - +/*  //=========================================================================  class LLDaySettingCopiedCallback : public LLInventoryCallback @@ -156,12 +155,12 @@ public:  private:      LLHandle<LLFloater> mHandle; -}; +};*/  //=========================================================================  LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : -    LLFloater(key), +    LLFloaterEditEnvironmentBase(key),      mFlyoutControl(nullptr),      mDayLength(0),      mCurrentTrack(1), @@ -170,19 +169,12 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) :      mFramesSlider(nullptr),      mCurrentTimeLabel(nullptr),      mImportButton(nullptr), -    mInventoryId(), -    mInventoryItem(nullptr),      mLoadFrame(nullptr),      mSkyBlender(),      mWaterBlender(),      mScratchSky(),      mScratchWater(),      mIsPlaying(false), -    mIsDirty(false), -    mCanSave(false), -    mCanCopy(false), -    mCanMod(false), -    mCanTrans(false),      mCloneTrack(nullptr),      mLoadTrack(nullptr),      mClearTrack(nullptr) @@ -425,19 +417,6 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting)      }  } -void LLFloaterEditExtDayCycle::onFocusReceived() -{ -    if (isInVisibleChain()) -    { -        updateEditEnvironment(); -        LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); -    } -} - -void LLFloaterEditExtDayCycle::onFocusLost() -{ -} -  void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility)  { @@ -488,6 +467,10 @@ void LLFloaterEditExtDayCycle::refresh()      LLFloater::refresh();  } +void LLFloaterEditExtDayCycle::setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) +{ +    setEditDayCycle(std::dynamic_pointer_cast<LLSettingsDay>(settings)); +}  void LLFloaterEditExtDayCycle::setEditDayCycle(const LLSettingsDay::ptr_t &pday)  { @@ -700,63 +683,6 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data)      }  } -void LLFloaterEditExtDayCycle::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day) -{ -    S32 option = LLNotificationsUtil::getSelectedOption(notification, response); -    if (0 == option) -    { -        std::string settings_name = response["message"].asString(); - -        LLInventoryObject::correctInventoryName(settings_name); -        if (settings_name.empty()) -        { -            // Ideally notification should disable 'OK' button if name won't fit our requirements, -            // for now either display notification, or use some default name -            settings_name = "Unnamed"; -        } - -        if (mCanMod) -        { -            doApplyCreateNewInventory(day, settings_name); -        } -        else if (mInventoryItem) -        { -            const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); -            LLUUID parent_id = mInventoryItem->getParentUUID(); -            if (marketplacelistings_id == parent_id) -            { -                parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); -            } - -            LLPointer<LLInventoryCallback> cb = new LLDaySettingCopiedCallback(getHandle()); -            copy_inventory_item( -                gAgent.getID(), -                mInventoryItem->getPermissions().getOwner(), -                mInventoryItem->getUUID(), -                parent_id, -                settings_name, -                cb); -        } -        else -        { -            LL_WARNS() << "Failed to copy day setting" << LL_ENDL; -        } -    } -} - -void LLFloaterEditExtDayCycle::onClickCloseBtn(bool app_quitting /*= false*/) -{ -    if (!app_quitting) -        checkAndConfirmSettingsLoss([this](){ closeFloater(); clearDirtyFlag(); }); -    else -        closeFloater(); -} - -void LLFloaterEditExtDayCycle::onButtonImport() -{ -    checkAndConfirmSettingsLoss([this]() { doImportFromDisk(); }); -} -  void LLFloaterEditExtDayCycle::onButtonLoadFrame()  {      doOpenInventoryFloater((mCurrentTrack == LLSettingsDay::TRACK_WATER) ? LLSettingsType::ST_WATER : LLSettingsType::ST_SKY, LLUUID::null); @@ -1053,35 +979,6 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask)      selectFrame(sliderpos, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);  } - -void LLFloaterEditExtDayCycle::onPanelDirtyFlagChanged(bool value) -{ -    if (value) -        setDirtyFlag(); -} - -void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb) -{ -    if (isDirty()) -    { -        LLSD args(LLSDMap("TYPE", mEditDay->getSettingsType()) -            ("NAME", mEditDay->getName())); - -        // create and show confirmation textbox -        LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), -            [cb](const LLSD¬if, const LLSD&resp) -            { -                S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); -                if (opt == 0) -                    cb(); -            }); -    } -    else if (cb) -    { -        cb(); -    } -} -  void LLFloaterEditExtDayCycle::onTimeSliderCallback()  {      stopPlay(); @@ -1435,106 +1332,6 @@ LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSi      return mCommitSignal.connect(cb);  } -void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID  &inventoryId, bool can_trans) -{ -    if (inventoryId.isNull()) -    { -        mInventoryItem = nullptr; -        mInventoryId.setNull(); -        mCanSave = true; -        mCanCopy = true; -        mCanMod = true; -        mCanTrans = true; -        return; -    } - -    mInventoryId = inventoryId; -    LL_INFOS("ENVDAYEDIT") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; -    mInventoryItem = gInventory.getItem(mInventoryId); - -    if (!mInventoryItem) -    { -        LL_WARNS("ENVDAYEDIT") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; - -        LLNotificationsUtil::add("CantFindInvItem"); -        closeFloater(); -        mInventoryId.setNull(); -        mInventoryItem = nullptr; -        return; -    } - -    if (mInventoryItem->getAssetUUID().isNull()) -    { -        LL_WARNS("ENVDAYEDIT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" <<  LL_ENDL; - -        LLNotificationsUtil::add("UnableEditItem"); -        closeFloater(); - -        mInventoryId.setNull(); -        mInventoryItem = nullptr; -        return; -    } - -    mCanSave = true; -    mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); -    mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); -    mCanTrans = can_trans && mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); - -    mExpectingAssetId = mInventoryItem->getAssetUUID(); -    LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), -        [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); -} - -void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) -{ -    if (asset_id != mExpectingAssetId) -    { -        LL_WARNS("ENVDAYEDIT") << "Expecting {" << mExpectingAssetId << "} got {" << asset_id << "} - throwing away." << LL_ENDL; -        return; -    } -    mExpectingAssetId.setNull(); -    clearDirtyFlag(); - -    if (!settings || status) -    { -        LLSD args; -        args["NAME"] = (mInventoryItem) ? mInventoryItem->getName() : asset_id.asString(); -        LLNotificationsUtil::add("FailedToFindSettings", args); -        closeFloater(); -        return; -    } - -    if (settings->getFlag(LLSettingsBase::FLAG_NOSAVE)) -    { -        mCanSave = false; -        mCanCopy = false; -        mCanMod = false; -        mCanTrans = false; -    } -    else -    { -        if (mCanCopy) -            settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); -        else -            settings->setFlag(LLSettingsBase::FLAG_NOCOPY); - -        if (mCanMod) -            settings->clearFlag(LLSettingsBase::FLAG_NOMOD); -        else -            settings->setFlag(LLSettingsBase::FLAG_NOMOD); - -        if (mCanTrans) -            settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); -        else -            settings->setFlag(LLSettingsBase::FLAG_NOTRANS); - -        if (mInventoryItem) -            settings->setName(mInventoryItem->getName()); -    } - -    setEditDayCycle(std::dynamic_pointer_cast<LLSettingsDay>(settings)); -} -  void LLFloaterEditExtDayCycle::updateEditEnvironment(void)  {      if (!mEditDay) @@ -1670,93 +1467,6 @@ void LLFloaterEditExtDayCycle::reblendSettings()      mWaterBlender->setPosition(position);      } -void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name) -{ -    if (mInventoryItem) -    { -        LLUUID parent_id = mInventoryItem->getParentUUID(); -        U32 next_owner_perm = mInventoryItem->getPermissions().getMaskNextOwner(); -        LLSettingsVOBase::createInventoryItem(day, next_owner_perm, parent_id, settings_name, -            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); -    } -    else -    { -        LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); -        // This method knows what sort of settings object to create. -        LLSettingsVOBase::createInventoryItem(day, parent_id, settings_name, -            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); -    } -} - -void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day) -{ -    if (mInventoryId.isNull()) -        LLSettingsVOBase::createInventoryItem(day, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), -                [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); -    else -        LLSettingsVOBase::updateInventoryItem(day, mInventoryId, -                [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); -} - -void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day) -{ -    U32 flags(0); - -    if (mInventoryItem) -    { -        if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) -            flags |= LLSettingsBase::FLAG_NOMOD; -        if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) -            flags |= LLSettingsBase::FLAG_NOTRANS; -    } - -    flags |= day->getFlags(); -    day->setFlag(flags); - -    if (where == ACTION_APPLY_LOCAL) -    { -        day->setName("Local"); // To distinguish and make sure there is a name. Safe, because this is a copy. -        LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, day); -    } -    else if (where == ACTION_APPLY_PARCEL) -    { -        LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); - -        if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID)) -        { -            LL_WARNS("ENVDAYEDIT") << "Can not identify parcel. Not applying." << LL_ENDL; -            LLNotificationsUtil::add("WLParcelApplyFail"); -            return; -        } - -        if (mInventoryItem && !isDirty()) -        { -            LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); -        } -        else -        { -            LLEnvironment::instance().updateParcel(parcel->getLocalID(), day, -1, -1); -        } -    } -    else if (where == ACTION_APPLY_REGION) -    { -        if (mInventoryItem && !isDirty()) -        { -            LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); -        } -        else -        { -            LLEnvironment::instance().updateRegion(day, -1, -1); -        } -    } -    else -    { -        LL_WARNS("ENVDAYEDIT") << "Unknown apply '" << where << "'" << LL_ENDL; -        return; -    } - -} -  void LLFloaterEditExtDayCycle::doApplyCommit(LLSettingsDay::ptr_t day)  {      if (!mCommitSignal.empty()) @@ -1793,51 +1503,6 @@ bool LLFloaterEditExtDayCycle::isAddingFrameAllowed()      return mFramesSlider->canAddSliders();  } -void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results) -{ -    LL_INFOS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; - -    if (inventory_id.isNull() || !results["success"].asBoolean()) -    { -        LLNotificationsUtil::add("CantCreateInventory"); -        return; -    } -    onInventoryCreated(asset_id, inventory_id); -} - -void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id) -{ -    bool can_trans = true; -    if (mInventoryItem) -    { -        LLPermissions perms = mInventoryItem->getPermissions(); - -        LLInventoryItem *created_item = gInventory.getItem(mInventoryId); -         -        if (created_item) -        { -            can_trans = perms.allowOperationBy(PERM_TRANSFER, gAgent.getID()); -            created_item->setPermissions(perms); -            created_item->updateServer(false); -        } -    } - -    clearDirtyFlag(); -    setFocus(TRUE);                 // Call back the focus... -    loadInventoryItem(inventory_id, can_trans); -} - -void LLFloaterEditExtDayCycle::onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results) -{ -    LL_WARNS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL; - -    clearDirtyFlag(); -    if (inventory_id != mInventoryId) -    { -        loadInventoryItem(inventory_id); -    } -} -  void LLFloaterEditExtDayCycle::doImportFromDisk()  {   // Load a a legacy Windlight XML from disk.      (new LLFilePickerReplyThread(boost::bind(&LLFloaterEditExtDayCycle::loadSettingFromFile, this, _1), LLFilePicker::FFLOAD_XML, false))->getFile(); @@ -1864,21 +1529,6 @@ void LLFloaterEditExtDayCycle::loadSettingFromFile(const std::vector<std::string      setEditDayCycle(legacyday);  } -bool LLFloaterEditExtDayCycle::canUseInventory() const -{ -    return LLEnvironment::instance().isInventoryEnabled(); -} - -bool LLFloaterEditExtDayCycle::canApplyRegion() const -{ -    return gAgent.canManageEstate(); -} - -bool LLFloaterEditExtDayCycle::canApplyParcel() const -{ -    return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); -} -  void LLFloaterEditExtDayCycle::startPlay()  {      doCloseInventoryFloater(); @@ -1983,14 +1633,8 @@ void LLFloaterEditExtDayCycle::doCloseTrackFloater(bool quitting)      }  } -void LLFloaterEditExtDayCycle::onPickerCommitTrackId(U32 track_id) +LLFloaterSettingsPicker * LLFloaterEditExtDayCycle::getSettingsPicker()  { -    cloneTrack(track_id, mCurrentTrack); -} - -void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem) -{ -//  LLUI::sWindow->setCursor(UI_CURSOR_WAIT);      LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get());      // Show the dialog @@ -2003,7 +1647,17 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ          picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitSetting(data["ItemId"].asUUID(), data["Track"].asInteger()); });      } +    return picker; +} + +void LLFloaterEditExtDayCycle::onPickerCommitTrackId(U32 track_id) +{ +    cloneTrack(track_id, mCurrentTrack); +} +void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem) +{ +    LLFloaterSettingsPicker *picker = getSettingsPicker();      picker->setSettingsFilter(type);      picker->setSettingsItemId(curritem);      if (type == LLSettingsType::ST_DAYCYCLE) @@ -2018,16 +1672,6 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ      picker->setFocus(TRUE);  } -void LLFloaterEditExtDayCycle::doCloseInventoryFloater(bool quitting) -{ -    LLFloater* floaterp = mInventoryFloater.get(); - -    if (floaterp) -    { -        floaterp->closeFloater(quitting); -    } -} -  void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID item_id, S32 track)  {      LLSettingsBase::TrackPosition frame(mTimeSlider->getCurSliderValue()); @@ -2118,7 +1762,9 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForInsertion(LLUUID item_id, LLUUID      LLInventoryItem *inv_item = gInventory.getItem(item_id); -    if (inv_item && !inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) +    if (inv_item +        && (!inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()) +            || !inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())))      {          // Need to check if item is already no-transfer, otherwise make it no-transfer          bool no_transfer = false; diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index b6e9fdb14f..9a30fb199f 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -32,6 +32,7 @@  #include <boost/signals2.hpp>  #include "llenvironment.h" +#include "llfloatereditenvironmentbase.h"  class LLCheckBoxCtrl;  class LLComboBox; @@ -50,14 +51,13 @@ typedef std::shared_ptr<LLSettingsBase> LLSettingsBasePtr_t;  /**   * Floater for creating or editing a day cycle.   */ -class LLFloaterEditExtDayCycle : public LLFloater +class LLFloaterEditExtDayCycle : public LLFloaterEditEnvironmentBase  {  	LOG_CLASS(LLFloaterEditExtDayCycle);      friend class LLDaySettingCopiedCallback;  public: -    static const std::string    KEY_INVENTORY_ID;      static const std::string    KEY_EDIT_CONTEXT;      static const std::string    KEY_DAY_LENGTH;      static const std::string    KEY_CANMOD; @@ -82,8 +82,8 @@ public:      virtual BOOL                postBuild() override;      virtual void                onOpen(const LLSD& key) override;      virtual void                onClose(bool app_quitting) override; -    virtual void                onFocusReceived() override; -    virtual void                onFocusLost() override; +    //virtual void                onFocusReceived() override; +    //virtual void                onFocusLost() override;      virtual void                onVisibilityChange(BOOL new_visibility) override;      connection_t                setEditCommitSignal(edit_commit_signal_t::slot_type cb); @@ -97,10 +97,13 @@ public:      LLUUID                      getEditingAssetId() { return mEditDay ? mEditDay->getAssetId() : LLUUID::null; }      LLUUID                      getEditingInventoryId() { return mInventoryId; } +    virtual LLSettingsBase::ptr_t getEditSettings()   const override { return mEditDay; } +      BOOL			            handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override; -    BOOL                        isDirty() const override { return getIsDirty(); }  +protected: +    virtual void                setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) override;  private:      typedef std::function<void()> on_confirm_fn; @@ -108,8 +111,8 @@ private:  	// flyout response/click  	void                        onButtonApply(LLUICtrl *ctrl, const LLSD &data); -    virtual void                onClickCloseBtn(bool app_quitting = false) override; -    void                        onButtonImport(); +    //virtual void                onClickCloseBtn(bool app_quitting = false) override; +    //void                        onButtonImport();      void                        onButtonLoadFrame();      void                        onAddFrame();  	void                        onRemoveFrame(); @@ -119,7 +122,6 @@ private:  	void                        onCommitName(class LLLineEditor* caller, void* user_data);  	void                        onTrackSelectionCallback(const LLSD& user_data);  	void                        onPlayActionCallback(const LLSD& user_data); -	void                        onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day);  	// time slider clicked  	void                        onTimeSliderCallback();  	// a frame moved or frame selection changed @@ -128,10 +130,6 @@ private:      void                        onFrameSliderMouseDown(S32 x, S32 y, MASK mask);      void                        onFrameSliderMouseUp(S32 x, S32 y, MASK mask); -    void                        onPanelDirtyFlagChanged(bool); - -    void                        checkAndConfirmSettingsLoss(on_confirm_fn cb); -      void                        cloneTrack(U32 source_index, U32 dest_index);      void                        cloneTrack(const LLSettingsDay::ptr_t &source_day, U32 source_index, U32 dest_index);  	void                        selectTrack(U32 track_index, bool force = false); @@ -148,25 +146,21 @@ private:      void                        removeCurrentSliderFrame();      void                        removeSliderFrame(F32 frame); -    void                        loadInventoryItem(const LLUUID  &inventoryId, bool can_trans = true); -    void                        onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status); - -    void                        doImportFromDisk(); +    virtual void                doImportFromDisk() override;      void                        loadSettingFromFile(const std::vector<std::string>& filenames); -    void                        doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name); -    void                        doApplyUpdateInventory(const LLSettingsDay::ptr_t &day); -    void                        doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day);      void                        doApplyCommit(LLSettingsDay::ptr_t day);      void                        onInventoryCreated(LLUUID asset_id, LLUUID inventory_id);      void                        onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);      void                        onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); +      void                        doOpenTrackFloater(const LLSD &args);      void                        doCloseTrackFloater(bool quitting = false); +    virtual LLFloaterSettingsPicker* getSettingsPicker() override;      void                        onPickerCommitTrackId(U32 track_id);      void                        doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem); -    void                        doCloseInventoryFloater(bool quitting = false); +    //void                        doCloseInventoryFloater(bool quitting = false);      void                        onPickerCommitSetting(LLUUID item_id, S32 track);      void                        onAssetLoadedForInsertion(LLUUID item_id,                                                            LLUUID asset_id, @@ -176,11 +170,7 @@ private:                                                            S32 dest_track,                                                            LLSettingsBase::TrackPosition dest_frame); -    bool                        canUseInventory() const; -    bool                        canApplyRegion() const; -    bool                        canApplyParcel() const; - -    void                        updateEditEnvironment(); +    virtual void                updateEditEnvironment() override;      void                        synchronizeTabs();      void                        reblendSettings(); @@ -193,7 +183,7 @@ private:      bool                        getIsDirty() const  { return mIsDirty; }      void                        setDirtyFlag()      { mIsDirty = true; } -    virtual void                clearDirtyFlag(); +    virtual void                clearDirtyFlag() override;      bool                        isRemovingFrameAllowed();      bool                        isAddingFrameAllowed(); @@ -218,11 +208,8 @@ private:      LLView*                     mSkyTabLayoutContainer;      LLView*                     mWaterTabLayoutContainer;      LLTextBox*                  mCurrentTimeLabel; -    LLUUID                      mInventoryId; -    LLInventoryItem *           mInventoryItem;      LLFlyoutComboBtnCtrl *      mFlyoutControl; -    LLHandle<LLFloater>         mInventoryFloater;      LLHandle<LLFloater>         mTrackFloater;      LLTrackBlenderLoopingManual::ptr_t  mSkyBlender; @@ -236,11 +223,6 @@ private:      LLFrameTimer                mPlayTimer;      F32                         mPlayStartFrame; // an env frame      bool                        mIsPlaying; -    bool                        mIsDirty; -    bool                        mCanCopy; -    bool                        mCanMod; -    bool                        mCanTrans; -    bool                        mCanSave;      edit_commit_signal_t        mCommitSignal; diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index cd8e0a48e7..41bbd5e8f9 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -81,44 +81,11 @@ namespace      const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml");  } -//========================================================================= -const std::string LLFloaterFixedEnvironment::KEY_INVENTORY_ID("inventory_id"); - - -//========================================================================= - -class LLFixedSettingCopiedCallback : public LLInventoryCallback -{ -public: -    LLFixedSettingCopiedCallback(LLHandle<LLFloater> handle) : mHandle(handle) {} - -    virtual void fire(const LLUUID& inv_item_id) -    { -        if (!mHandle.isDead()) -        { -            LLViewerInventoryItem* item = gInventory.getItem(inv_item_id); -            if (item) -            { -                LLFloaterFixedEnvironment* floater = (LLFloaterFixedEnvironment*)mHandle.get(); -                floater->onInventoryCreated(item->getAssetUUID(), inv_item_id); -            } -        } -    } - -private: -    LLHandle<LLFloater> mHandle; -};  //=========================================================================  LLFloaterFixedEnvironment::LLFloaterFixedEnvironment(const LLSD &key) : -    LLFloater(key), -    mFlyoutControl(nullptr), -    mInventoryId(), -    mInventoryItem(nullptr), -    mIsDirty(false), -    mCanCopy(false), -    mCanMod(false), -    mCanTrans(false) +    LLFloaterEditEnvironmentBase(key), +    mFlyoutControl(nullptr)  {  } @@ -176,19 +143,6 @@ void LLFloaterFixedEnvironment::onClose(bool app_quitting)      syncronizeTabs();  } -void LLFloaterFixedEnvironment::onFocusReceived() -{ -    if (isInVisibleChain()) -    { -        updateEditEnvironment(); -        LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); -    } -} - -void LLFloaterFixedEnvironment::onFocusLost() -{ -} -  void LLFloaterFixedEnvironment::refresh()  {      if (!mSettings) @@ -220,6 +174,15 @@ void LLFloaterFixedEnvironment::refresh()      }  } +void LLFloaterFixedEnvironment::setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) +{ +    mSettings = settings; // shouldn't this do buildDeepCloneAndUncompress() ? +    updateEditEnvironment(); +    syncronizeTabs(); +    refresh(); +    LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST); +} +  void LLFloaterFixedEnvironment::syncronizeTabs()  {      S32 count = mTab->getTabCount(); @@ -250,131 +213,9 @@ LLFloaterSettingsPicker * LLFloaterFixedEnvironment::getSettingsPicker()      return picker;  } -void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID  &inventoryId, bool can_trans) -{ -    if (inventoryId.isNull()) -    { -        mInventoryItem = nullptr; -        mInventoryId.setNull(); -        mCanMod = true; -        mCanCopy = true; -        mCanTrans = true; -        return; -    } - -    mInventoryId = inventoryId; -    LL_INFOS("SETTINGS") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; -    mInventoryItem = gInventory.getItem(mInventoryId); - -    if (!mInventoryItem) -    { -        LL_WARNS("SETTINGS") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; -        LLNotificationsUtil::add("CantFindInvItem"); -        closeFloater(); - -        mInventoryId.setNull(); -        mInventoryItem = nullptr; -        return; -    } - -    if (mInventoryItem->getAssetUUID().isNull()) -    { -        LL_WARNS("ENVIRONMENT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; -        LLNotificationsUtil::add("UnableEditItem"); -        closeFloater(); - -        mInventoryId.setNull(); -        mInventoryItem = nullptr; -        return; -    } - -    mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); -    mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); -    mCanTrans = can_trans && mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); - -    LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), -        [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); -} - - -void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnvironment::on_confirm_fn cb) -{ -    if (isDirty()) -    { -        LLSD args(LLSDMap("TYPE", mSettings->getSettingsType()) -            ("NAME", mSettings->getName())); - -        // create and show confirmation textbox -        LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), -            [cb](const LLSD¬if, const LLSD&resp) -            { -                S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); -                if (opt == 0) -                    cb(); -            }); -    } -    else if (cb) -    { -        cb(); -    } -} -  void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID item_id)  {      loadInventoryItem(item_id); -//     mInventoryId = item_id; -//     mInventoryItem = gInventory.getItem(mInventoryId); -//  -//     mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); -//     mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); -//     mCanTrans = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); -//  -//     LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), -//         [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); -} - -void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) -{ -    if (mInventoryItem && mInventoryItem->getAssetUUID() != asset_id) -    { -        LL_WARNS("ENVIRONMENT") << "Discarding obsolete asset callback" << LL_ENDL; -        return; -    } - -    clearDirtyFlag(); - -    if (!settings || status) -    { -        LLSD args; -        args["NAME"] = (mInventoryItem) ? mInventoryItem->getName() : asset_id.asString(); -        LLNotificationsUtil::add("FailedToFindSettings", args); -        closeFloater(); -        return; -    } - -    mSettings = settings; -    if (mInventoryItem) -        mSettings->setName(mInventoryItem->getName()); - -    if (mCanCopy) -        settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); -    else -        settings->setFlag(LLSettingsBase::FLAG_NOCOPY); - -    if (mCanMod) -        settings->clearFlag(LLSettingsBase::FLAG_NOMOD); -    else -        settings->setFlag(LLSettingsBase::FLAG_NOMOD); - -    if (mCanTrans) -        settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); -    else -        settings->setFlag(LLSettingsBase::FLAG_NOTRANS); - -    updateEditEnvironment(); -    syncronizeTabs(); -    refresh(); -    LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST);  }  void LLFloaterFixedEnvironment::onNameChanged(const std::string &name) @@ -473,50 +314,6 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data)      }  } -void LLFloaterFixedEnvironment::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings) -{ -    S32 option = LLNotificationsUtil::getSelectedOption(notification, response); -    if (0 == option) -    { -        std::string settings_name = response["message"].asString(); - -        LLInventoryObject::correctInventoryName(settings_name); -        if (settings_name.empty()) -        { -            // Ideally notification should disable 'OK' button if name won't fit our requirements, -            // for now either display notification, or use some default name -            settings_name = "Unnamed"; -        } - -        if (mCanMod) -        { -            doApplyCreateNewInventory(settings_name, settings); -        } -        else if (mInventoryItem) -        { -            const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); -            LLUUID parent_id = mInventoryItem->getParentUUID(); -            if (marketplacelistings_id == parent_id) -            { -                parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); -            } - -            LLPointer<LLInventoryCallback> cb = new LLFixedSettingCopiedCallback(getHandle()); -            copy_inventory_item( -                gAgent.getID(), -                mInventoryItem->getPermissions().getOwner(), -                mInventoryItem->getUUID(), -                parent_id, -                settings_name, -                cb); -        } -        else -        { -            LL_WARNS() << "Failed to copy fixed env setting" << LL_ENDL; -        } -    } -} -  void LLFloaterFixedEnvironment::onClickCloseBtn(bool app_quitting)  {      if (!app_quitting) @@ -530,116 +327,6 @@ void LLFloaterFixedEnvironment::onButtonLoad()      checkAndConfirmSettingsLoss([this](){ doSelectFromInventory(); });  } -void LLFloaterFixedEnvironment::doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings) -{ -    if (mInventoryItem) -    { -        LLUUID parent_id = mInventoryItem->getParentUUID(); -        U32 next_owner_perm = mInventoryItem->getPermissions().getMaskNextOwner(); -        LLSettingsVOBase::createInventoryItem(settings, next_owner_perm, parent_id, settings_name, -            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); -    } -    else -    { -        LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); -        // This method knows what sort of settings object to create. -        LLSettingsVOBase::createInventoryItem(settings, parent_id, settings_name, -            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); -    } -} - -void LLFloaterFixedEnvironment::doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings) -{ -    LL_DEBUGS("ENVEDIT") << "Update inventory for " << mInventoryId << LL_ENDL; -    if (mInventoryId.isNull()) -    { -        LLSettingsVOBase::createInventoryItem(settings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), -            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); -    } -    else -    { -        LLSettingsVOBase::updateInventoryItem(settings, mInventoryId, -            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); -    } -} - -void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings) -{ -    U32 flags(0); - -    if (mInventoryItem) -    { -        if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) -            flags |= LLSettingsBase::FLAG_NOMOD; -        if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) -            flags |= LLSettingsBase::FLAG_NOTRANS; -    } - -    flags |= settings->getFlags(); -    settings->setFlag(flags); - -    if (where == ACTION_APPLY_LOCAL) -    { -        settings->setName("Local"); // To distinguish and make sure there is a name. Safe, because this is a copy. -        LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, settings); -    } -    else if (where == ACTION_APPLY_PARCEL) -    { -        LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); - -        if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID)) -        { -            LL_WARNS("ENVIRONMENT") << "Can not identify parcel. Not applying." << LL_ENDL; -            LLNotificationsUtil::add("WLParcelApplyFail"); -            return; -        } - -        if (mInventoryItem && !isDirty()) -        { -            LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); -        } -        else if (settings->getSettingsType() == "sky") -        { -            LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); -        } -        else if (settings->getSettingsType() == "water") -        { -            LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); -        } -    } -    else if (where == ACTION_APPLY_REGION) -    { -        if (mInventoryItem && !isDirty()) -        { -            LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); -        } -        else if (settings->getSettingsType() == "sky") -        { -            LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); -        } -        else if (settings->getSettingsType() == "water") -        { -            LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); -        } -    } -    else -    { -        LL_WARNS("ENVIRONMENT") << "Unknown apply '" << where << "'" << LL_ENDL; -        return; -    } - -} - -void LLFloaterFixedEnvironment::doCloseInventoryFloater(bool quitting) -{ -    LLFloater* floaterp = mInventoryFloater.get(); - -    if (floaterp) -    { -        floaterp->closeFloater(quitting); -    } -} -  void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results)  {      LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; @@ -709,28 +396,6 @@ void LLFloaterFixedEnvironment::doSelectFromInventory()      picker->setFocus(TRUE);  } -void LLFloaterFixedEnvironment::onPanelDirtyFlagChanged(bool value) -{ -    if (value) -        setDirtyFlag(); -} - -//------------------------------------------------------------------------- -bool LLFloaterFixedEnvironment::canUseInventory() const -{ -    return LLEnvironment::instance().isInventoryEnabled(); -} - -bool LLFloaterFixedEnvironment::canApplyRegion() const -{ -    return gAgent.canManageEstate(); -} - -bool LLFloaterFixedEnvironment::canApplyParcel() const -{ -    return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); -} -  //=========================================================================  LLFloaterFixedEnvironmentWater::LLFloaterFixedEnvironmentWater(const LLSD &key):      LLFloaterFixedEnvironment(key) diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 513996c4a3..f35f4a4368 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -27,7 +27,7 @@  #ifndef LL_FLOATERFIXEDENVIRONMENT_H  #define LL_FLOATERFIXEDENVIRONMENT_H -#include "llfloater.h" +#include "llfloatereditenvironmentbase.h"  #include "llsettingsbase.h"  #include "llflyoutcombobtn.h"  #include "llinventory.h" @@ -43,15 +43,10 @@ class LLFixedSettingCopiedCallback;  /**   * Floater container for creating and editing fixed environment settings.   */ -class LLFloaterFixedEnvironment : public LLFloater +class LLFloaterFixedEnvironment : public LLFloaterEditEnvironmentBase  {      LOG_CLASS(LLFloaterFixedEnvironment); - -    friend class LLFixedSettingCopiedCallback; -  public: -    static const std::string    KEY_INVENTORY_ID; -                              LLFloaterFixedEnvironment(const LLSD &key);                              ~LLFloaterFixedEnvironment(); @@ -59,64 +54,35 @@ public:      virtual void            onOpen(const LLSD& key)     override;      virtual void            onClose(bool app_quitting)  override; -    virtual void            onFocusReceived()           override; -    virtual void            onFocusLost()               override; -      void                    setEditSettings(const LLSettingsBase::ptr_t &settings)  { mSettings = settings; clearDirtyFlag(); syncronizeTabs(); refresh(); } -    LLSettingsBase::ptr_t   getEditSettings()   const                           { return mSettings; } - -    virtual BOOL            isDirty() const override            { return getIsDirty(); } +    virtual LLSettingsBase::ptr_t getEditSettings()   const override                { return mSettings; }  protected:      typedef std::function<void()> on_confirm_fn; -    virtual void            updateEditEnvironment() = 0;      virtual void            refresh()                   override; +    void                    setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) override;      virtual void            syncronizeTabs(); -    LLFloaterSettingsPicker *getSettingsPicker(); - -    void                    loadInventoryItem(const LLUUID  &inventoryId, bool can_trans = true); - -    void                    checkAndConfirmSettingsLoss(on_confirm_fn cb); +    virtual LLFloaterSettingsPicker *getSettingsPicker() override;      LLTabContainer *        mTab;      LLLineEditor *          mTxtName;      LLSettingsBase::ptr_t   mSettings; -    virtual void            doImportFromDisk() = 0; -    virtual void            doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings); -    virtual void            doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings); -    virtual void            doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings); -    void                    doCloseInventoryFloater(bool quitting = false); - -    bool                    canUseInventory() const; -    bool                    canApplyRegion() const; -    bool                    canApplyParcel() const; -      LLFlyoutComboBtnCtrl *      mFlyoutControl; -    LLUUID                  mInventoryId; -    LLInventoryItem *       mInventoryItem; -    LLHandle<LLFloater>     mInventoryFloater; -    bool                    mCanCopy; -    bool                    mCanMod; -    bool                    mCanTrans; -      void                    onInventoryCreated(LLUUID asset_id, LLUUID inventory_id);      void                    onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);      void                    onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); -    bool                    getIsDirty() const  { return mIsDirty; } -    void                    setDirtyFlag()      { mIsDirty = true; } -    virtual void            clearDirtyFlag(); +    virtual void            clearDirtyFlag() override; +    void                    updatePermissionFlags();      void                    doSelectFromInventory(); -    void                    onPanelDirtyFlagChanged(bool);      virtual void            onClickCloseBtn(bool app_quitting = false) override; -    void                    onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings);  private:      void                    onNameChanged(const std::string &name); @@ -126,9 +92,6 @@ private:      void                    onButtonLoad();      void                    onPickerCommitSetting(LLUUID item_id); -    void                    onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status); - -    bool                    mIsDirty;  };  class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment @@ -172,36 +135,4 @@ protected:  private:  }; -class LLSettingsEditPanel : public LLPanel -{ -public: -    virtual void setSettings(const LLSettingsBase::ptr_t &) = 0; - -    typedef boost::signals2::signal<void(LLPanel *, bool)> on_dirty_charged_sg; -    typedef boost::signals2::connection connection_t; - -    inline bool         getIsDirty() const      { return mIsDirty; } -    inline void         setIsDirty()            { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } -    inline void         clearIsDirty()          { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } - -    inline bool        getCanChangeSettings() const    { return mCanEdit; } -    inline void        setCanChangeSettings(bool flag) { mCanEdit = flag; } - -    inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb)    { return mOnDirtyChanged.connect(cb); } - - -protected: -    LLSettingsEditPanel() : -        LLPanel(), -        mIsDirty(false), -        mOnDirtyChanged() -    {} - -private: -    bool                mIsDirty; -    bool                mCanEdit; -     -    on_dirty_charged_sg mOnDirtyChanged; -}; -  #endif // LL_FLOATERFIXEDENVIRONMENT_H diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index c6e9069d09..9c84fa1991 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -59,7 +59,9 @@  #include "boost/foreach.hpp" -const S32 EVENTS_PER_IDLE_LOOP = 100; +const S32 EVENTS_PER_IDLE_LOOP_CURRENT_SESSION = 80; +const S32 EVENTS_PER_IDLE_LOOP_BACKGROUND = 40; +const F32 EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE = 0.01f; // process a minimum of 1% of total events per frame  //  // LLFloaterIMContainer @@ -309,12 +311,15 @@ void LLFloaterIMContainer::addFloater(LLFloater* floaterp,  	LLIconCtrl* icon = 0; +	bool is_in_group = gAgent.isInGroup(session_id, TRUE); +	LLUUID icon_id; -	if(gAgent.isInGroup(session_id, TRUE)) +	if (is_in_group)  	{  		LLGroupIconCtrl::Params icon_params;  		icon_params.group_id = session_id;  		icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params); +		icon_id = session_id;  		mSessions[session_id] = floaterp;  		floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id)); @@ -326,11 +331,18 @@ void LLFloaterIMContainer::addFloater(LLFloater* floaterp,  		LLAvatarIconCtrl::Params icon_params;  		icon_params.avatar_id = avatar_id;  		icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params); +		icon_id = avatar_id;  		mSessions[session_id] = floaterp;  		floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id));  	} +	LLFloaterIMSessionTab* floater = LLFloaterIMSessionTab::getConversation(session_id); +	if (floater) +	{ +		floater->updateChatIcon(icon_id); +	} +  	// forced resize of the floater  	LLRect wrapper_rect = this->mTabContainer->getLocalRect();  	floaterp->setRect(wrapper_rect); @@ -416,8 +428,11 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate()  		while (current_participant_model != end_participant_model)  		{  			LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model); -			// Get the avatar name for this participant id from the cache and update the model -			participant_model->updateName(); +            if (participant_model) +            { +                // Get the avatar name for this participant id from the cache and update the model +                participant_model->updateName(); +            }  			// Next participant  			current_participant_model++;  		} @@ -464,8 +479,11 @@ void LLFloaterIMContainer::idleUpdate()                  while (current_participant_model != end_participant_model)                  {                      LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model); -                    participant_model->setModeratorOptionsVisible(is_moderator); -                    participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID); +                    if (participant_model) +                    { +                        participant_model->setModeratorOptionsVisible(is_moderator); +                        participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID); +                    }                      current_participant_model++;                  } @@ -498,20 +516,49 @@ void LLFloaterIMContainer::idleUpdate()  void LLFloaterIMContainer::idleProcessEvents()  { -	if (!mConversationEventQueue.empty()) -	{ -		S32 events_to_handle = llmin((S32)mConversationEventQueue.size(), EVENTS_PER_IDLE_LOOP); -		for (S32 i = 0; i < events_to_handle; i++) -		{ -			handleConversationModelEvent(mConversationEventQueue.back()); -			mConversationEventQueue.pop_back(); -		} -	} +    LLUUID current_session_id = getSelectedSession(); +    conversations_items_deque::iterator iter = mConversationEventQueue.begin(); +    conversations_items_deque::iterator end = mConversationEventQueue.end(); +    while (iter != end) +    { +        std::deque<LLSD> &events = iter->second; +        if (!events.empty()) +        { +            S32 events_to_handle; +            S32 query_size = (S32)events.size(); +            if (current_session_id == iter->first) +            { +                events_to_handle = EVENTS_PER_IDLE_LOOP_CURRENT_SESSION; +            } +            else +            { +                events_to_handle = EVENTS_PER_IDLE_LOOP_BACKGROUND; +            } + +            if (events_to_handle <= query_size) +            { +                // Some groups can be very large and can generate huge amount of updates, scale processing up to keep up +                events_to_handle = llmax(events_to_handle, (S32)(query_size * EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE)); +            } +            else +            { +                events_to_handle = query_size; +            } + +            for (S32 i = 0; i < events_to_handle; i++) +            { +                handleConversationModelEvent(events.back()); +                events.pop_back(); +            } +        } +        iter++; +    }  }  bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)  { -	mConversationEventQueue.push_front(event); +	LLUUID id = event.get("session_uuid").asUUID(); +	mConversationEventQueue[id].push_front(event);  	return true;  } @@ -1816,12 +1863,16 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c  		{  			new_selection = mConversationsRoot->getPreviousFromChild(widget, FALSE);  		} + +		// Will destroy views and delete models that are not assigned to any views  		widget->destroyView();  	}  	// Suppress the conversation items and widgets from their respective maps  	mConversationsItems.erase(uuid);  	mConversationsWidgets.erase(uuid); +	// Clear event query (otherwise reopening session in some way can bombard session with stale data) +	mConversationEventQueue.erase(uuid);  	// Don't let the focus fall IW, select and refocus on the first conversation in the list  	if (change_focus) diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 468b47f1f1..b4a9d377ab 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -229,9 +229,10 @@ private:  	conversations_widgets_map mConversationsWidgets;  	LLConversationViewModel mConversationViewModel;  	LLFolderView* mConversationsRoot; -	LLEventStream mConversationsEventStream;  +	LLEventStream mConversationsEventStream; -	std::deque<LLSD> mConversationEventQueue; +	typedef std::map<LLUUID, std::deque<LLSD> > conversations_items_deque; +	conversations_items_deque mConversationEventQueue;  	LLTimer mParticipantRefreshTimer;  }; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index d604d0a789..7541bb5efe 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -32,6 +32,8 @@  #include "llagent.h"  #include "llagentcamera.h"  #include "llavataractions.h" +#include "llavatariconctrl.h" +#include "llgroupiconctrl.h"  #include "llchatentry.h"  #include "llchathistory.h"  #include "llchiclet.h" @@ -45,6 +47,9 @@  #include "llfloaterimnearbychat.h"  const F32 REFRESH_INTERVAL = 1.0f; +const std::string ICN_GROUP("group_chat_icon"); +const std::string ICN_NEARBY("nearby_chat_icon"); +const std::string ICN_AVATAR("avatar_icon");  void cb_group_do_nothing()  { @@ -492,7 +497,10 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant()  	while (current_participant_model != end_participant_model)  	{  		LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model); -		addConversationViewParticipant(participant_model); +        if (participant_model) +        { +            addConversationViewParticipant(participant_model); +        }  		current_participant_model++;  	}  } @@ -529,8 +537,7 @@ void LLFloaterIMSessionTab::removeConversationViewParticipant(const LLUUID& part  	LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,participant_id);  	if (widget)  	{ -		mConversationsRoot->extractItem(widget); -		delete widget; +		widget->destroyView();  	}  	mConversationsWidgets.erase(participant_id);  } @@ -700,6 +707,39 @@ void LLFloaterIMSessionTab::updateSessionName(const std::string& name)  	mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + name);  } +void LLFloaterIMSessionTab::updateChatIcon(const LLUUID& id) +{ +	if (mSession) +	{ +		if (mSession->isP2PSessionType()) +		{ +			LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>(ICN_AVATAR); +			icon->setVisible(true); +			icon->setValue(id); +		} +		if (mSession->isAdHocSessionType()) +		{ +			LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP); +			icon->setVisible(true); +		} +		if (mSession->isGroupSessionType()) +		{ +			LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP); +			icon->setVisible(true); +			icon->setValue(id); +		} +	} +	else +	{ +		if (mIsNearbyChat) +		{ +			LLIconCtrl* icon = getChild<LLIconCtrl>(ICN_NEARBY); +			icon->setVisible(true); +		} +	} + +} +  void LLFloaterIMSessionTab::hideAllStandardButtons()  {  	for (S32 i = 0; i < BUTTON_COUNT; i++) diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 5357a14ab9..375461cfc1 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -103,6 +103,8 @@ public:  	void restoreFloater();  	void saveCollapsedState(); +	void updateChatIcon(const LLUUID& id); +  	LLView* getChatHistory();  protected: diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 889d017389..524162ba51 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -103,14 +103,17 @@ void LLPanelMarketplaceListings::buildAllPanels()      panel = buildInventoryPanel("Active Items", "panel_marketplace_listings_listed.xml");  	panel->getFilter().setFilterMarketplaceActiveFolders();  	panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems"); +	panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");  	panel->getFilter().markDefault();      panel = buildInventoryPanel("Inactive Items", "panel_marketplace_listings_unlisted.xml");  	panel->getFilter().setFilterMarketplaceInactiveFolders();  	panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems"); +	panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");  	panel->getFilter().markDefault();      panel = buildInventoryPanel("Unassociated Items", "panel_marketplace_listings_unassociated.xml");  	panel->getFilter().setFilterMarketplaceUnassociatedFolders();  	panel->getFilter().setEmptyLookupMessage("MarketplaceNoMatchingItems"); +	panel->getFilter().setDefaultEmptyLookupMessage("MarketplaceNoListing");  	panel->getFilter().markDefault();      // Set the tab panel diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b9c03f66a3..d9edd4dc30 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -103,6 +103,11 @@ LLMeshFilePicker::LLMeshFilePicker(LLModelPreview* mp, S32 lod)  void LLMeshFilePicker::notify(const std::vector<std::string>& filenames)  { +	if(LLAppViewer::instance()->quitRequested()) +	{ +		return; +	} +	  	if (filenames.size() > 0)  	{  		mMP->loadModel(filenames[0], mLOD); @@ -906,7 +911,7 @@ BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)      {          LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks);      } -    return TRUE; +	return TRUE;  }  /*virtual*/ @@ -1287,47 +1292,47 @@ void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handl  void LLFloaterModelPreview::addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod)  {      if (sInstance && sInstance->hasString(message)) -    { +	{          std::string str;          switch (lod) -        { +{          case LLModel::LOD_IMPOSTOR: str = "LOD0 "; break;          case LLModel::LOD_LOW:      str = "LOD1 "; break;          case LLModel::LOD_MEDIUM:   str = "LOD2 "; break;          case LLModel::LOD_PHYSICS:  str = "PHYS "; break;          case LLModel::LOD_HIGH:     str = "LOD3 ";   break;          default: break; -        } -         +} +          LLStringUtil::format_map_t args_msg;          LLSD::map_const_iterator iter = args.beginMap();          LLSD::map_const_iterator end = args.endMap();          for (; iter != end; ++iter) -        { +{              args_msg[iter->first] = iter->second.asString(); -        } +		}		          str += sInstance->getString(message, args_msg);          sInstance->addStringToLogTab(str, flash); -    } -} +	} +	}  // static  void LLFloaterModelPreview::addStringToLog(const std::string& str, bool flash) -{ +	{      if (sInstance) -    { +		{          sInstance->addStringToLogTab(str, flash); -    } -} +				} +			}  // static  void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool flash) -{ +			{      if (sInstance) -    { +            {          sInstance->addStringToLogTab(strm.str(), flash); -    } -} +            } +		}  void LLFloaterModelPreview::clearAvatarTab()  { @@ -1338,9 +1343,9 @@ void LLFloaterModelPreview::clearAvatarTab()      joints_pos->deleteAllItems();    mSelectedJointName.clear();      for (U32 i = 0; i < LLModel::NUM_LODS; ++i) -    { +{          mJointOverrides[i].clear(); -    } +	}      LLTextBox *joint_total_descr = panel->getChild<LLTextBox>("conflicts_description");      joint_total_descr->setTextArg("[CONFLICTS]", llformat("%d", 0)); @@ -1349,34 +1354,34 @@ void LLFloaterModelPreview::clearAvatarTab()      LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("pos_overrides_descr");      joint_pos_descr->setTextArg("[JOINT]", std::string("mPelvis")); // Might be better to hide it -} +			}  void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) -{ +			{      S32 display_lod = mModelPreview->mPreviewLOD;      if (mModelPreview->mModel[display_lod].empty()) -    { +				{          mSelectedJointName.clear();          return; -    } +					}      // Joints will be listed as long as they are listed in mAlternateBindMatrix      // even if they are for some reason identical to defaults.      // Todo: Are overrides always identical for all lods? They normally are, but there might be situations where they aren't.      if (mJointOverrides[display_lod].empty()) -    { +					{          // populate map          for (LLModelLoader::scene::iterator iter = mModelPreview->mScene[display_lod].begin(); iter != mModelPreview->mScene[display_lod].end(); ++iter) -        { +					{              for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter) -            { +					{                  LLModelInstance& instance = *model_iter;                  LLModel* model = instance.mModel;                  const LLMeshSkinInfo *skin = &model->mSkinInfo;                  U32 joint_count = LLSkinningUtil::getMeshJointCount(skin);                  U32 bind_count = highlight_overrides ? skin->mAlternateBindMatrix.size() : 0; // simply do not include overrides if data is not needed                  if (bind_count > 0 && bind_count != joint_count) -                { +						{                      std::ostringstream out;                      out << "Invalid joint overrides for model " << model->getName();                      out << ". Amount of joints " << joint_count; @@ -1385,68 +1390,68 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)                      addStringToLog(out.str(), true);                      // Disable overrides for this model                      bind_count = 0; -                } +						}                  if (bind_count > 0) -                { +						{                      for (U32 j = 0; j < joint_count; ++j) -                    { +							{                          const LLVector3& joint_pos = skin->mAlternateBindMatrix[j].getTranslation();                          LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];                          LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j], mModelPreview);                          if (pJoint) -                        { +							{                              // see how voavatar uses aboveJointPosThreshold                              if (pJoint->aboveJointPosThreshold(joint_pos)) -                            { +				{                                  // valid override                                  if (data.mPosOverrides.size() > 0                                      && (data.mPosOverrides.begin()->second - joint_pos).lengthSquared() > (LL_JOINT_TRESHOLD_POS_OFFSET * LL_JOINT_TRESHOLD_POS_OFFSET)) -                                { +					{                                      // File contains multiple meshes with conflicting joint offsets                                      // preview may be incorrect, upload result might wary (depends onto                                      // mesh_id that hasn't been generated yet).                                      data.mHasConflicts = true; -                                } +							}                                  data.mPosOverrides[model->getName()] = joint_pos; -                            } -                            else -                            { +						} +						else +						{                                  // default value, it won't be accounted for by avatar                                  data.mModelsNoOverrides.insert(model->getName()); -                            } -                        } -                    } -                } -                else -                { +					} +					} +				} +			} +			else +			{                      for (U32 j = 0; j < joint_count; ++j) -                    { +				{				                          LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];                          data.mModelsNoOverrides.insert(model->getName());                      }                  } -            } -        } -    } +			} +		} +	}      LLPanel *panel = mTabContainer->getPanelByName("rigging_panel");      LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");      if (joints_list->isEmpty()) -    { +	{          // Populate table -        std::map<std::string, std::string> joint_alias_map; +    std::map<std::string, std::string> joint_alias_map;          mModelPreview->getJointAliases(joint_alias_map); - +              S32 conflicts = 0;          joint_override_data_map_t::iterator joint_iter = mJointOverrides[display_lod].begin();          joint_override_data_map_t::iterator joint_end = mJointOverrides[display_lod].end();          while (joint_iter != joint_end) -        { +	{              const std::string& listName = joint_iter->first; - +                      LLScrollListItem::Params item_params;              item_params.value(listName); @@ -1454,38 +1459,38 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)              cell_params.font = LLFontGL::getFontSansSerif();              cell_params.value = listName;              if (joint_alias_map.find(listName) == joint_alias_map.end()) -            { +	{                  // Missing names                  cell_params.color = LLColor4::red; -            } +	}              if (joint_iter->second.mHasConflicts) -            { +	{                  // Conflicts                  cell_params.color = LLColor4::orange;                  conflicts++; -            } +	}              if (highlight_overrides && joint_iter->second.mPosOverrides.size() > 0) -            { +	{                  cell_params.font.style = "BOLD"; -            } +	}              item_params.columns.add(cell_params);              joints_list->addRow(item_params, ADD_BOTTOM);              joint_iter++; -        } +	}          joints_list->selectFirstItem();          LLScrollListItem *selected = joints_list->getFirstSelected();          if (selected) -        { +{              mSelectedJointName = selected->getValue().asString(); -        } +	}          LLTextBox *joint_conf_descr = panel->getChild<LLTextBox>("conflicts_description");          joint_conf_descr->setTextArg("[CONFLICTS]", llformat("%d", conflicts));          joint_conf_descr->setTextArg("[JOINTS_COUNT]", llformat("%d", mJointOverrides[display_lod].size())); -    } -} +		} +	}  //-----------------------------------------------------------------------------  // addStringToLogTab() @@ -1493,52 +1498,52 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)  void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash)  {      if (str.empty()) -    { -        return; -    } +		{ +		return; +	}      LLWString text = utf8str_to_wstring(str);      S32 add_text_len = text.length() + 1; // newline      S32 editor_max_len = mUploadLogText->getMaxTextLength();      if (add_text_len > editor_max_len) -    { -        return; -    } +		{ +		return; +	}      // Make sure we have space for new string      S32 editor_text_len = mUploadLogText->getLength();      if (editor_max_len < (editor_text_len + add_text_len)          && mUploadLogText->getLineCount() <= 0) -    { +	{          mUploadLogText->getTextBoundingRect();// forces a reflow() to fix line count -    } +			}      while (editor_max_len < (editor_text_len + add_text_len)) -    { +		{          S32 shift = mUploadLogText->removeFirstLine();          if (shift > 0) -        { +	{              // removed a line              editor_text_len -= shift; -        } -        else -        { +} +	else +	{              //nothing to remove?              LL_WARNS() << "Failed to clear log lines" << LL_ENDL; -            break; -        } -    } +					break; +				} +			}      mUploadLogText->appendText(str, true);      if (flash) -    { +	{          LLPanel* panel = mTabContainer->getPanelByName("logs_panel");          if (mTabContainer->getCurrentPanel() != panel) -        { +		{              mTabContainer->setTabPanelFlashing(panel, true); -        } -    } -} +		} +	} +	}  void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost)  { @@ -1546,15 +1551,15 @@ void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost,  	childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x));  	childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y));  	childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z)); -} +		}  void LLFloaterModelPreview::setPreviewLOD(S32 lod) -{ +		{  	if (mModelPreview)  	{  		mModelPreview->setPreviewLOD(lod); -	} -} +								} +							}  void LLFloaterModelPreview::onBrowseLOD(S32 lod)  { @@ -1643,13 +1648,13 @@ void LLFloaterModelPreview::setCtrlLoadFromFile(S32 lod)          }      }      else -    { +{          LLComboBox* lod_combo = findChild<LLComboBox>("lod_source_" + lod_name[lod]);          if (lod_combo) -        { +	{              lod_combo->setCurrentByIndex(0); -        } -    } +	} +}  }  void LLFloaterModelPreview::setStatusMessage(const std::string& msg) diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 7bfba2a6d7..a30c73768d 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -746,9 +746,6 @@ LLSD LLFloaterReporter::gatherReport()  	const char* platform = "Mac";  #elif LL_LINUX  	const char* platform = "Lnx"; -#elif LL_SOLARIS -	const char* platform = "Sol"; -	const char* short_platform = "O:S";  #else  	const char* platform = "???";  #endif diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index d2bd716f55..12d82d101f 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -39,6 +39,7 @@  #include "llfloaterimcontainer.h"  #include "llimview.h" // for gIMMgr  #include "llnotificationsutil.h" +#include "llstartup.h"  #include "llstatusbar.h"	// can_afford_transaction()  #include "groupchatlistener.h" @@ -55,6 +56,11 @@ public:  	bool handle(const LLSD& tokens, const LLSD& query_map,  				LLMediaCtrl* web)  	{ +		if (LLStartUp::getStartupState() < STATE_STARTED) +		{ +			return true; +		} +  		if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableGroupInfo"))  		{  			LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9afb6ca58b..1059324a16 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -969,6 +969,9 @@ void LLIMModel::LLIMSession::buildHistoryFileName()  			// Incoming P2P sessions include a name that we can use to build a history file name  			mHistoryFileName = LLCacheName::buildUsername(mName);  		} + +        // user's account name can change, but filenames and session names are account name based +        LLConversationLog::getInstance()->verifyFilename(mSessionID, mHistoryFileName, av_name.getCompleteName());  	}  	else if (isGroupChat())  	{ diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 72013f7396..2a22eb1329 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -74,6 +74,7 @@ LLInventoryFilter::LLInventoryFilter(const Params& p)  :	mName(p.name),  	mFilterModified(FILTER_NONE),  	mEmptyLookupMessage("InventoryNoMatchingItems"), +	mDefaultEmptyLookupMessage(""),  	mFilterOps(p.filter_ops),  	mBackupFilterOps(mFilterOps),  	mFilterSubString(p.substring), @@ -1441,12 +1442,24 @@ void LLInventoryFilter::setEmptyLookupMessage(const std::string& message)  	mEmptyLookupMessage = message;  } +void LLInventoryFilter::setDefaultEmptyLookupMessage(const std::string& message) +{ +	mDefaultEmptyLookupMessage = message; +} +  std::string LLInventoryFilter::getEmptyLookupMessage() const  { -	LLStringUtil::format_map_t args; -	args["[SEARCH_TERM]"] = LLURI::escape(getFilterSubStringOrig()); +	if (isDefault() && !mDefaultEmptyLookupMessage.empty()) +	{ +		return LLTrans::getString(mDefaultEmptyLookupMessage); +	} +	else +	{ +		LLStringUtil::format_map_t args; +		args["[SEARCH_TERM]"] = LLURI::escape(getFilterSubStringOrig()); -	return LLTrans::getString(mEmptyLookupMessage, args); +		return LLTrans::getString(mEmptyLookupMessage, args); +	}  } diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index be02ee3623..61cc5ae602 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -257,6 +257,7 @@ public:  	EFilterCreatorType		getFilterCreatorType() const;  	void 				setEmptyLookupMessage(const std::string& message); +	void				setDefaultEmptyLookupMessage(const std::string& message);  	std::string			getEmptyLookupMessage() const;  	// +-------------------------------------------------------------------+ @@ -332,6 +333,7 @@ private:  	std::string 			mFilterText;  	std::string 			mEmptyLookupMessage; +	std::string				mDefaultEmptyLookupMessage;  	ESearchType 			mSearchType; diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index b4236c406b..543d2a087f 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -107,11 +107,13 @@ LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t              return NULL;          } +        mRequestedList[asset_uuid] = gFrameTimeSeconds; + +        // Note that getAssetData can callback immediately and cleans mRequestedList  		gAssetStorage->getAssetData(asset_uuid,  									LLAssetType::AT_LANDMARK,  									LLLandmarkList::processGetAssetReply,  									NULL); -		mRequestedList[asset_uuid] = gFrameTimeSeconds;  	}  	return NULL;  } @@ -194,11 +196,15 @@ void LLLandmarkList::processGetAssetReply(              landmark_uuid_list_t::iterator iter = gLandmarkList.mWaitList.begin();              LLUUID asset_uuid = *iter;              gLandmarkList.mWaitList.erase(iter); + +            // add to mRequestedList before calling getAssetData() +            gLandmarkList.mRequestedList[asset_uuid] = gFrameTimeSeconds; + +            // Note that getAssetData can callback immediately and cleans mRequestedList              gAssetStorage->getAssetData(asset_uuid,                  LLAssetType::AT_LANDMARK,                  LLLandmarkList::processGetAssetReply,                  NULL); -            gLandmarkList.mRequestedList[asset_uuid] = gFrameTimeSeconds;          }          scheduling = false;      } diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 415781bc27..eebc2486a2 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -281,6 +281,28 @@ std::string LLLogChat::makeLogFileName(std::string filename)  	return filename;  } +//static +void LLLogChat::renameLogFile(const std::string& old_filename, const std::string& new_filename) +{ +    std::string new_name = cleanFileName(new_filename); +    std::string old_name = cleanFileName(old_filename); +    new_name = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, new_name); +    old_name = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, old_name); + +    if (new_name.empty() || old_name.empty()) +    { +        return; +    } + +    new_name += '.' + LL_TRANSCRIPT_FILE_EXTENSION; +    old_name += '.' + LL_TRANSCRIPT_FILE_EXTENSION; + +    if (!LLFile::isfile(new_name) && LLFile::isfile(old_name)) +    { +        LLFile::rename(old_name, new_name); +    } +} +  std::string LLLogChat::cleanFileName(std::string filename)  {  	std::string invalidChars = "\"\'\\/?*:.<>|[]{}~"; // Cannot match glob or illegal filename chars diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 8b7fe14e16..c4b61ee716 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -94,6 +94,7 @@ public:  	static std::string timestamp(bool withdate = false);  	static std::string makeLogFileName(std::string(filename)); +	static void renameLogFile(const std::string& old_filename, const std::string& new_filename);  	/**  	*Add functions to get old and non date stamped file names when needed  	*/ diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index fa53a21940..e81d2cc082 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -58,6 +58,7 @@  #include "llevents.h"  #include "llappviewer.h"  #include "llsdserialize.h" +#include "lltrans.h"  #include <boost/scoped_ptr.hpp>  #include <sstream> @@ -332,7 +333,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)          {              data["certificate"] = response["certificate"];          } -         +          if (gViewerWindow)              gViewerWindow->setShowProgress(FALSE); @@ -349,13 +350,36 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)          // login.cgi is insisting on a required update. We were called with an          // event that bundles both the login.cgi 'response' and the          // synchronization event from the 'updater'. -        std::string required_version = response["message_args"]["VERSION"]; -        LL_WARNS("LLLogin") << "Login failed because an update to version " << required_version << " is required." << LL_ENDL; +        std::string login_version = response["message_args"]["VERSION"]; +        std::string vvm_version   = updater["VERSION"]; +        std::string relnotes      = updater["URL"]; +        LL_WARNS("LLLogin") << "Login failed because an update to version " << login_version << " is required." << LL_ENDL; +        // vvm_version might be empty because we might not have gotten +        // SLVersionChecker's LoginSync handshake. But if it IS populated, it +        // should (!) be the same as the version we got from login.cgi. +        if ((! vvm_version.empty()) && vvm_version != login_version) +        { +            LL_WARNS("LLLogin") << "VVM update version " << vvm_version +                                << " differs from login version " << login_version +                                << "; presenting VVM version to match release notes URL" +                                << LL_ENDL; +            login_version = vvm_version; +        } +        if (relnotes.empty() || relnotes.find("://") == std::string::npos) +        { +            relnotes = LLTrans::getString("RELEASE_NOTES_BASE_URL"); +            if (!LLStringUtil::endsWith(relnotes, "/")) +                relnotes += "/"; +            relnotes += LLURI::escape(login_version) + ".html"; +        }          if (gViewerWindow)              gViewerWindow->setShowProgress(FALSE); -        LLSD args(LLSDMap("VERSION", required_version)); +        LLSD args; +        args["VERSION"] = login_version; +        args["URL"] = relnotes; +          if (updater.isUndefined())          {              // If the updater failed to shake hands, better advise the user to diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 52c5234137..ef4aced2c7 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -297,6 +297,7 @@ public:  	 * Writes notification message to IM  p2p session.  	 */  	static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only = false); +	static void logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only = false);  	/**  	 * Writes group notice notification message to IM  group session. diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 9a3f1a853a..39a0b9b50e 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -123,15 +123,13 @@ void log_name_callback(const LLAvatarName& av_name, const std::string& from_name  }  // static -void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only) +void LLHandlerUtil::logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only)  {  	if (!gCacheName)  	{  		return;  	} -	LLUUID from_id = notification->getPayload()["from_id"]; -  	if (from_id.isNull())  	{  		// Normal behavior for system generated messages, don't spam. @@ -141,15 +139,22 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi  	if(to_file_only)  	{ -		LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", notification->getMessage(), LLUUID())); +		LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", message, LLUUID()));  	}  	else  	{ -		LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id)); +		LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, message, from_id));  	}  }  // static +void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only) +{ +	LLUUID from_id = notification->getPayload()["from_id"]; +	logToIMP2P(from_id, notification->getMessage(), to_file_only);	 +} + +// static  void LLHandlerUtil::logGroupNoticeToIMGroup(  		const LLNotificationPtr& notification)  { diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 14d25d8158..a9678b1e93 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -37,6 +37,8 @@  #include "llimview.h"  #include "llnotificationsutil.h" +#include <boost/regex.hpp> +  using namespace LLNotificationsUI;  //-------------------------------------------------------------------------- @@ -143,7 +145,19 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification)  		{  			// log only to file if notif panel can be embedded to IM and IM is opened  			bool file_only = add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification); -			LLHandlerUtil::logToIMP2P(notification, file_only); +			if ((notification->getName() == "TeleportOffered" +				|| notification->getName() == "TeleportOffered_MaturityExceeded" +				|| notification->getName() == "TeleportOffered_MaturityBlocked")) +			{ +				boost::regex r("<icon\\s*>\\s*([^<]*)?\\s*</icon\\s*>( - )?", +					boost::regex::perl|boost::regex::icase); +				std::string stripped_msg = boost::regex_replace(notification->getMessage(), r, ""); +				LLHandlerUtil::logToIMP2P(notification->getPayload()["from_id"], stripped_msg,file_only); +			} +			else +			{ +				LLHandlerUtil::logToIMP2P(notification, file_only); +			}  		}  	} diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h index c02c9c95a0..801fb8b9b2 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -29,7 +29,7 @@  #include "llpanel.h"  #include "llsettingssky.h" -#include "llfloaterfixedenvironment.h" +#include "llfloatereditenvironmentbase.h"  //=========================================================================  class LLSlider; diff --git a/indra/newview/llpaneleditwater.h b/indra/newview/llpaneleditwater.h index ab2dc47bcc..4b7ec903c9 100644 --- a/indra/newview/llpaneleditwater.h +++ b/indra/newview/llpaneleditwater.h @@ -30,7 +30,7 @@  #include "llpanel.h"  #include "llsettingswater.h" -#include "llfloaterfixedenvironment.h" +#include "llfloatereditenvironmentbase.h"  //=========================================================================  class LLSlider; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 4f60703488..3964dc075c 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -545,6 +545,16 @@ void LLPanelLogin::show(const LLRect &rect,  }  //static +void LLPanelLogin::reshapePanel() +{ +    if (sInstance) +    { +        LLRect rect = sInstance->getRect(); +        sInstance->reshape(rect.getWidth(), rect.getHeight()); +    } +} + +//static  void LLPanelLogin::populateFields(LLPointer<LLCredential> credential, bool remember_user, bool remember_psswrd)  {      if (!sInstance) diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index c9b8e1b6fc..788c269ffd 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -54,6 +54,7 @@ public:  	static void show(const LLRect &rect,  		void (*callback)(S32 option, void* user_data),   		void* callback_data); +	static void reshapePanel();  	static void populateFields(LLPointer<LLCredential> credential, bool remember_user, bool remember_psswrd);  	static void resetFields(); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index c39df3fe8b..4762e15d8f 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -37,6 +37,7 @@  #include "llfloatersidepanelcontainer.h"  #include "llfloaterworldmap.h"  #include "llnotificationsutil.h" +#include "llstartup.h"  #include "lltexturectrl.h"  #include "lltoggleablemenu.h"  #include "lltrans.h" @@ -84,6 +85,11 @@ public:  	bool handle(const LLSD& params, const LLSD& query_map,  		LLMediaCtrl* web)  	{ +		if (LLStartUp::getStartupState() < STATE_STARTED) +		{ +			return true; +		} +  		if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnablePicks"))  		{  			LLNotificationsUtil::add("NoPicks", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); @@ -198,6 +204,11 @@ public:  	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)  	{ +		if (LLStartUp::getStartupState() < STATE_STARTED) +		{ +			return true; +		} +  		if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableClassifieds"))  		{  			LLNotificationsUtil::add("NoClassifieds", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 2bd78f40ba..c42cd6c6ba 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -74,6 +74,8 @@ const LLPanelPrimMediaControls::EZoomLevel LLPanelPrimMediaControls::kZoomLevels  const int LLPanelPrimMediaControls::kNumZoomLevels = 2;  const F32 EXCEEDING_ZOOM_DISTANCE = 0.5f; +const S32 ADDR_LEFT_PAD = 3; +  //  // LLPanelPrimMediaControls  // @@ -156,7 +158,7 @@ BOOL LLPanelPrimMediaControls::postBuild()  	mMediaProgressPanel		= getChild<LLPanel>("media_progress_indicator");  	mMediaProgressBar		= getChild<LLProgressBar>("media_progress_bar");  	mMediaAddressCtrl		= getChild<LLUICtrl>("media_address"); -	mMediaAddress			= getChild<LLUICtrl>("media_address_url"); +	mMediaAddress			= getChild<LLLineEditor>("media_address_url");  	mMediaPlaySliderPanel	= getChild<LLUICtrl>("media_play_position");  	mMediaPlaySliderCtrl	= getChild<LLUICtrl>("media_play_slider");  	mSkipFwdCtrl			= getChild<LLUICtrl>("skip_forward"); @@ -501,8 +503,10 @@ void LLPanelPrimMediaControls::updateShape()  			std::string test_prefix = mCurrentURL.substr(0, prefix.length());  			LLStringUtil::toLower(test_prefix);              mSecureURL = has_focus && (test_prefix == prefix); -            mCurrentURL = (mSecureURL ? "      " + mCurrentURL : mCurrentURL); -			 + +			S32 left_pad = mSecureURL ? mSecureLockIcon->getRect().getWidth() : ADDR_LEFT_PAD; +			mMediaAddress->setTextPadding(left_pad, 0); +  			if(mCurrentURL!=mPreviousURL)  			{  				setCurrentURL(); diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index 86fc036553..dd0e4ff095 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -39,6 +39,7 @@ class LLProgressBar;  class LLSliderCtrl;  class LLViewerMediaImpl;  class LLWindowShade; +class LLLineEditor;  class LLPanelPrimMediaControls : public LLPanel  { @@ -164,7 +165,7 @@ private:  	LLPanel  *mMediaProgressPanel;  	LLProgressBar *mMediaProgressBar;  	LLUICtrl *mMediaAddressCtrl; -	LLUICtrl *mMediaAddress; +	LLLineEditor *mMediaAddress;  	LLUICtrl *mMediaPlaySliderPanel;  	LLUICtrl *mMediaPlaySliderCtrl;  	LLUICtrl *mVolumeCtrl; diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index ee6893907e..94d20828ec 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -259,11 +259,7 @@ LLParticipantList::~LLParticipantList()  */  void LLParticipantList::onAvalineCallerFound(const LLUUID& participant_id)  { -	LLConversationItemParticipant* participant = findParticipant(participant_id); -	if (participant) -	{ -		removeParticipant(participant); -	} +	removeParticipant(participant_id);  	// re-add avaline caller with a correct class instance.  	addAvatarIDExceptAgent(participant_id);  } @@ -397,6 +393,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)  	// Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id))  	// Add the participant model to the session's children list +	// This will post "add_participant" event  	addParticipant(participant);  	adjustParticipant(avatar_id); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 5e81fa6402..4c539ded38 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -733,7 +733,10 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate)  		}  		if (immediate || (mLiveHelpTimer.getStarted() && mLiveHelpTimer.getElapsedTimeF32() > LIVE_HELP_REFRESH_TIME))  		{ -			std::string help_string = mEditor->getText().substr(segment->getStart(), segment->getEnd() - segment->getStart()); +			// Use Wtext since segment's start/end are made for wstring and will +			// result in a shift for case of multi-byte symbols inside std::string. +			LLWString segment_text = mEditor->getWText().substr(segment->getStart(), segment->getEnd() - segment->getStart()); +			std::string help_string = wstring_to_utf8str(segment_text);  			setHelpPage(help_string);  			mLiveHelpTimer.stop();  		} diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 3c9ce6b752..f9baf5fbd3 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -530,157 +530,163 @@ void LLSceneMonitor::dumpToFile(std::string file_name)  	if (!hasResults()) return;  	LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL;  - -	llofstream os(file_name.c_str()); - -	os << std::setprecision(10); - -	LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); -	const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); - -	F64Seconds frame_time; - -	os << "Stat"; -	for (S32 frame = 1; frame <= frame_count; frame++) +	try  	{ -		frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); -		os << ", " << frame_time.value(); -	} -	os << '\n'; +		llofstream os(file_name.c_str()); -	os << "Sample period(s)"; -	for (S32 frame = 1; frame <= frame_count; frame++) -	{ -		frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); -		os << ", " << frame_time.value(); -	} -	os << '\n'; +		os << std::setprecision(10); +		LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); +		const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); -	typedef LLTrace::StatType<LLTrace::CountAccumulator> trace_count; -	for (auto& it : trace_count::instance_snapshot()) -	{ -		std::ostringstream row; -		row << std::setprecision(10); +		F64Seconds frame_time; -		row << it.getName(); - -		const char* unit_label = it.getUnitLabel(); -		if(unit_label[0]) +		os << "Stat"; +		for (S32 frame = 1; frame <= frame_count; frame++)  		{ -			row << "(" << unit_label << ")"; +			frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); +			os << ", " << frame_time.value();  		} +		os << '\n'; -		S32 samples = 0; - +		os << "Sample period(s)";  		for (S32 frame = 1; frame <= frame_count; frame++)  		{ -			LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); -			samples += recording.getSampleCount(it); -			row << ", " << recording.getSum(it); +			frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); +			os << ", " << frame_time.value();  		} +		os << '\n'; -		row << '\n'; -		if (samples > 0) +		typedef LLTrace::StatType<LLTrace::CountAccumulator> trace_count; +		for (auto& it : trace_count::instance_snapshot())  		{ -			os << row.str(); -		} -	} - -	typedef LLTrace::StatType<LLTrace::EventAccumulator> trace_event; +			std::ostringstream row; +			row << std::setprecision(10); -	for (auto& it : trace_event::instance_snapshot()) -	{ -		std::ostringstream row; -		row << std::setprecision(10); -		row << it.getName(); +			row << it.getName(); -		const char* unit_label = it.getUnitLabel(); -		if(unit_label[0]) -		{ -			row << "(" << unit_label << ")"; -		} +			const char* unit_label = it.getUnitLabel(); +			if (unit_label[0]) +			{ +				row << "(" << unit_label << ")"; +			} -		S32 samples = 0; +			S32 samples = 0; -		for (S32 frame = 1; frame <= frame_count; frame++) -		{ -			LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); -			samples += recording.getSampleCount(it); -			F64 mean = recording.getMean(it); -			if (llisnan(mean)) +			for (S32 frame = 1; frame <= frame_count; frame++)  			{ -				row << ", n/a"; +				LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); +				samples += recording.getSampleCount(it); +				row << ", " << recording.getSum(it);  			} -			else + +			row << '\n'; + +			if (samples > 0)  			{ -				row << ", " << mean; +				os << row.str();  			}  		} -		row << '\n'; +		typedef LLTrace::StatType<LLTrace::EventAccumulator> trace_event; -		if (samples > 0) +		for (auto& it : trace_event::instance_snapshot())  		{ -			os << row.str(); -		} -	} +			std::ostringstream row; +			row << std::setprecision(10); +			row << it.getName(); -	typedef LLTrace::StatType<LLTrace::SampleAccumulator> trace_sample; +			const char* unit_label = it.getUnitLabel(); +			if (unit_label[0]) +			{ +				row << "(" << unit_label << ")"; +			} -	for (auto& it : trace_sample::instance_snapshot()) -	{ -		std::ostringstream row; -		row << std::setprecision(10); -		row << it.getName(); +			S32 samples = 0; -		const char* unit_label = it.getUnitLabel(); -		if(unit_label[0]) -		{ -			row << "(" << unit_label << ")"; +			for (S32 frame = 1; frame <= frame_count; frame++) +			{ +				LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); +				samples += recording.getSampleCount(it); +				F64 mean = recording.getMean(it); +				if (llisnan(mean)) +				{ +					row << ", n/a"; +				} +				else +				{ +					row << ", " << mean; +				} +			} + +			row << '\n'; + +			if (samples > 0) +			{ +				os << row.str(); +			}  		} -		S32 samples = 0; +		typedef LLTrace::StatType<LLTrace::SampleAccumulator> trace_sample; -		for (S32 frame = 1; frame <= frame_count; frame++) +		for (auto& it : trace_sample::instance_snapshot())  		{ -			LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); -			samples += recording.getSampleCount(it); -			F64 mean = recording.getMean(it); -			if (llisnan(mean)) +			std::ostringstream row; +			row << std::setprecision(10); +			row << it.getName(); + +			const char* unit_label = it.getUnitLabel(); +			if (unit_label[0]) +			{ +				row << "(" << unit_label << ")"; +			} + +			S32 samples = 0; + +			for (S32 frame = 1; frame <= frame_count; frame++)  			{ -				row << ", n/a"; +				LLTrace::Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); +				samples += recording.getSampleCount(it); +				F64 mean = recording.getMean(it); +				if (llisnan(mean)) +				{ +					row << ", n/a"; +				} +				else +				{ +					row << ", " << mean; +				}  			} -			else + +			row << '\n'; + +			if (samples > 0)  			{ -				row << ", " << mean; +				os << row.str();  			}  		} -		row << '\n';  - -		if (samples > 0) +		typedef LLTrace::StatType<LLTrace::MemAccumulator> trace_mem; +		for (auto& it : trace_mem::instance_snapshot())  		{ -			os << row.str(); -		} -	} +			os << it.getName() << "(KiB)"; -	typedef LLTrace::StatType<LLTrace::MemAccumulator> trace_mem; -	for (auto& it : trace_mem::instance_snapshot()) -	{ -		os << it.getName() << "(KiB)"; +			for (S32 frame = 1; frame <= frame_count; frame++) +			{ +				os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(it).valueInUnits<LLUnits::Kilobytes>(); +			} -		for (S32 frame = 1; frame <= frame_count; frame++) -		{ -			os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(it).valueInUnits<LLUnits::Kilobytes>(); +			os << '\n';  		} -		os << '\n'; +		os.flush(); +		os.close(); +	} +	catch (const std::ios_base::failure &e) +	{ +		LL_WARNS() << "Unable to dump scene monitor results: " << e.what() << LL_ENDL;  	} - -	os.flush(); -	os.close();  }  //------------------------------------------------------------------------------------------------------------- diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 2cb27d85bc..efa4a7fd66 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2253,52 +2253,91 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)  	}  } -void renderNormals(LLDrawable* drawablep) +void renderNormals(LLDrawable *drawablep)  { -	LLVertexBuffer::unbind(); +    if (!drawablep->isVisible()) +        return; -	LLVOVolume* vol = drawablep->getVOVolume(); -	if (vol) -	{ -		LLVolume* volume = vol->getVolume(); -		gGL.pushMatrix(); -		gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix); -		 -		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +    LLVertexBuffer::unbind(); -		LLVector4a scale(gSavedSettings.getF32("RenderDebugNormalScale")); +    LLVOVolume *vol = drawablep->getVOVolume(); -		for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) -		{ -			const LLVolumeFace& face = volume->getVolumeFace(i); +    if (vol) +    { +        LLVolume *volume = vol->getVolume(); -			for (S32 j = 0; j < face.mNumVertices; ++j) -			{ -				gGL.begin(LLRender::LINES); -				LLVector4a n,p; -				 -				n.setMul(face.mNormals[j], scale); -				p.setAdd(face.mPositions[j], n); -				 -				gGL.diffuseColor4f(1,1,1,1); -				gGL.vertex3fv(face.mPositions[j].getF32ptr()); -				gGL.vertex3fv(p.getF32ptr()); -				 -				if (face.mTangents) -				{ -					n.setMul(face.mTangents[j], scale); -					p.setAdd(face.mPositions[j], n); -				 -					gGL.diffuseColor4f(0,1,1,1); -					gGL.vertex3fv(face.mPositions[j].getF32ptr()); -					gGL.vertex3fv(p.getF32ptr()); -				}	 -				gGL.end(); -			} -		} +        // Drawable's normals & tangents are stored in model space, i.e. before any scaling is applied. +        // +        // SL-13490, using pos + normal to compute the 2nd vertex of a normal line segment doesn't +        // work when there's a non-uniform scale in the mix. Normals require MVP-inverse-transpose +        // transform. We get that effect here by pre-applying the inverse scale (twice, because +        // one forward scale will be re-applied via the MVP in the vertex shader) -		gGL.popMatrix(); -	} +        LLVector3  scale_v3 = vol->getScale(); +        float      scale_len = scale_v3.length(); +        LLVector4a obj_scale(scale_v3.mV[VX], scale_v3.mV[VY], scale_v3.mV[VZ]); +        obj_scale.normalize3(); + +        // Normals &tangent line segments get scaled along with the object. Divide by scale length +        // to keep the as-viewed lengths (relatively) constant with the debug setting length +        float draw_length = gSavedSettings.getF32("RenderDebugNormalScale") / scale_len; + +        // Create inverse-scale vector for normals +        LLVector4a inv_scale(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ]); +        inv_scale.mul(inv_scale);  // Squared, to apply inverse scale twice +        inv_scale.normalize3fast(); + +        gGL.pushMatrix(); +        gGL.multMatrix((F32 *) vol->getRelativeXform().mMatrix); + +        gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + +        for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) +        { +            const LLVolumeFace &face = volume->getVolumeFace(i); + +            gGL.flush(); +            gGL.diffuseColor4f(1, 1, 0, 1); +            gGL.begin(LLRender::LINES); +            for (S32 j = 0; j < face.mNumVertices; ++j) +            { +                LLVector4a n, p; + +                n.setMul(face.mNormals[j], 1.0); +                n.mul(inv_scale);  // Pre-scale normal, so it's left with an inverse-transpose xform after MVP +                n.normalize3fast(); +                n.mul(draw_length); +                p.setAdd(face.mPositions[j], n); + +                gGL.vertex3fv(face.mPositions[j].getF32ptr()); +                gGL.vertex3fv(p.getF32ptr()); +            } +            gGL.end(); + +            // Tangents are simple vectors and do not require reorientation via pre-scaling +            if (face.mTangents) +            { +                gGL.flush(); +                gGL.diffuseColor4f(0, 1, 1, 1); +                gGL.begin(LLRender::LINES); +                for (S32 j = 0; j < face.mNumVertices; ++j) +                { +                    LLVector4a t, p; + +                    t.setMul(face.mTangents[j], 1.0f); +                    t.normalize3fast(); +                    t.mul(draw_length); +                    p.setAdd(face.mPositions[j], t); + +                    gGL.vertex3fv(face.mPositions[j].getF32ptr()); +                    gGL.vertex3fv(p.getF32ptr()); +                } +                gGL.end(); +            } +        } + +        gGL.popMatrix(); +    }  }  S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& scale) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e2a39bdf86..3fb79e4739 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -176,6 +176,7 @@  #include "pipeline.h"  #include "llappviewer.h"  #include "llfasttimerview.h" +#include "lltelemetry.h"  #include "llfloatermap.h"  #include "llweb.h"  #include "llvoiceclient.h" @@ -527,6 +528,8 @@ bool idle_startup()  			}  			#if LL_WINDOWS +                LLPROFILE_STARTUP(); +  				// On the windows dev builds, unpackaged, the message.xml file will   				// be located in indra/build-vc**/newview/<config>/app_settings.  				std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml"); @@ -3540,11 +3543,6 @@ bool process_login_success_response()  	}  	// Request the map server url -	// Non-agni grids have a different default location. -	if (!LLGridManager::getInstance()->isInProductionGrid()) -	{ -		gSavedSettings.setString("MapServerURL", "http://test.map.secondlife.com.s3.amazonaws.com/"); -	}  	std::string map_server_url = response["map-server-url"];  	if(!map_server_url.empty())  	{ diff --git a/indra/newview/lltelemetry.cpp b/indra/newview/lltelemetry.cpp new file mode 100644 index 0000000000..0c63e2fede --- /dev/null +++ b/indra/newview/lltelemetry.cpp @@ -0,0 +1,145 @@ + /** + * @file lltelemetry.cpp + * @brief Wrapper for Rad Game Tools Telemetry + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "lltelemetry.h" + +#if LLPROFILE_USE_RAD_TELEMETRY_PROFILER +    #if LL_WINDOWS +        #include "llwin32headers.h" + +        // build-vc120-64\packages\lib\release +        // build-vc150-64\packages\lib\release +        #ifdef _MSC_VER +            #pragma comment(lib,"rad_tm_win64.lib") +        #else +            #pragma message "NOTE: Rad GameTools Telemetry requested but non-MSVC compiler not yet supported on Windows" +        #endif +    #endif // LL_WINDOWS + +    #if LL_DARWIN +        #pragma message "NOTE: Rad Game Tools Telemetry requested but not yet supported on Darwin" +    #endif + +    #if LL_LINUX +        #pragma message "NOTE: Rad Game Tools Telemetry requested but not yet supported on Linux" +    #endif + +// +// local consts +// +static const tm_int32 TELEMETRY_BUFFER_SIZE  = 8 * 1024 * 1024; + +// +// local globals +// +static char *gTelemetryBufferPtr = NULL; // Telemetry + +static const char *tm_status[ TMERR_INIT_NETWORKING_FAILED + 1 ] = +{ +      "Telemetry pass: connected"                       // TM_OK +    , "Telemetry FAIL: disabled via #define NTELEMETRY" // TMERR_DISABLED +    , "Telemetry FAIL: invalid paramater"               // TMERR_INVALID_PARAM +    , "Telemetry FAIL: DLL not found"                   // TMERR_NULL_API +    , "Telemetry FAIL: out of resources"                // TMERR_OUT_OF_RESOURCES +    , "Telemetry FAIL: tmInitialize() not called"       // TMERR_UNINITIALIZED +    , "Telemetry FAIL: bad hostname"                    // TMERR_BAD_HOSTNAME +    , "Telemetry FAIL: couldn't connect to server"      // TMERR_COULD_NOT_CONNECT +    , "Telemetry FAIL: unknown network error"           // TMERR_UNKNOWN_NETWORK +    , "Telemetry FAIL: tmShutdown() already called"     // TMERR_ALREADY_SHUTDOWN +    , "Telemetry FAIL: memory buffer too small"         // TMERR_ARENA_TOO_SMALL +    , "Telemetry FAIL: server handshake error"          // TMERR_BAD_HANDSHAKE +    , "Telemetry FAIL: unaligned parameters"            // TMERR_UNALIGNED +    , "Telemetry FAIL: network not initialized"         // TMERR_NETWORK_NOT_INITIALIZED -- WSAStartup not called before tmOpen() +    , "Telemetry FAIL: bad version"                     // TMERR_BAD_VERSION +    , "Telemetry FAIL: timer too large"                 // TMERR_BAD_TIMER +    , "Telemetry FAIL: tmOpen() already called"         // TMERR_ALREADY_OPENED +    , "Telemetry FAIL: tmInitialize() already called"   // TMERR_ALREADY_INITIALIZED +    , "Telemetry FAIL: could't open file"               // TMERR_FILE_OPEN_FAILED +    , "Telemetry FAIL: tmOpen() failed networking"      // TMERR_INIT_NETWORKING_FAILED +}; + +// +// exported functionality +// + +void telemetry_shutdown() +{ +    #if LL_WINDOWS +        if (gTelemetryBufferPtr) +        { +            tmClose(0); +            tmShutdown(); + +            delete[] gTelemetryBufferPtr; +            gTelemetryBufferPtr = NULL; +        } +    #endif +} + +void telemetry_startup() +{ +    #if LL_WINDOWS +        tmLoadLibrary(TM_RELEASE); // Loads .dll + +        gTelemetryBufferPtr = new char[ TELEMETRY_BUFFER_SIZE ]; +        tmInitialize(TELEMETRY_BUFFER_SIZE, gTelemetryBufferPtr); + +        tm_error telemetry_status = tmOpen( +            0,                     // unused +            "SecondLife",          // app name +            __DATE__ " " __TIME__, // build identifier +            "localhost",           // server name (or filename) +            TMCT_TCP,              // connection type (or TMCT_FILE) +            4719,                  // port +            TMOF_INIT_NETWORKING,  // open flags +            250 );                 // timeout ms + +        if (telemetry_status == TMERR_UNKNOWN) +        { +            LL_ERRS() << "Telemetry FAIL: unknown error" << LL_ENDL; +        } +        else if (telemetry_status && (telemetry_status <= TMERR_INIT_NETWORKING_FAILED)) +        { +            LL_INFOS() << tm_status[ telemetry_status ] << LL_ENDL; +            free(gTelemetryBufferPtr); +            gTelemetryBufferPtr = NULL; +        } +    #endif // LL_WINDOWS +} + +// Called after we render a frame +void telemetry_update() +{ +    #if LL_WINDOWS +        if (gTelemetryBufferPtr) +        { +            tmTick(0); +        } +    #endif +} +#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER diff --git a/indra/newview/lltelemetry.h b/indra/newview/lltelemetry.h new file mode 100644 index 0000000000..a73e5fcfa2 --- /dev/null +++ b/indra/newview/lltelemetry.h @@ -0,0 +1,81 @@ +/** + * @file lltelemetry.h + * @brief Wrapper for Rad Game Tools Telemetry + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +/* +To use: + +1. Uncomment #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER below + +2. Include this header file +    #include "lltelemetry.h" + +3. Add zones to the functions you wish to profile +    void onFoo() +    { +        LLPROFILE_ZONE("Foo"); +    } +*/ +//#define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 1 + +// Default NO local telemetry profiling +#ifndef LLPROFILE_USE_RAD_TELEMETRY_PROFILER +    #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 0 +    #define LLPROFILE_SHUTDOWN( ...) {} +    #define LLPROFILE_STARTUP(  ...) {} +    #define LLPROFILE_UPDATE(   ...) {} + +    #define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) +    #define LLPROFILE_ENTER(name) +    #define LLPROFILE_ENTER_FORMAT(format, ...) +    #define LLPROFILE_FUNCTION +    #define LLPROFILE_LEAVE() +    #define LLPROFILE_THREAD_NAME(name) +    #define LLPROFILE_ZONE(name) +    #define LLPROFILE_ZONE_FORMAT(format, ...) +#else +    #include <rad_tm.h> + +    #define LLPROFILE_SHUTDOWN                       telemetry_shutdown +    #define LLPROFILE_STARTUP                        telemetry_startup +    #define LLPROFILE_UPDATE                         telemetry_update + +    #define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) tmZoneColor(r, g, b) +    #define LLPROFILE_ENTER(name)                    tmEnter(0, 0, name) +    #define LLPROFILE_ENTER_FORMAT(format, ...)      tmEnter(0, 0, format, __VA_ARGS__) +    #define LLPROFILE_FUNCTION                       tmFunction(0, 0) +    #define LLPROFILE_LEAVE()                        tmLeave(0) +    #define LLPROFILE_THREAD_NAME(name)              tmThreadName(0, 0, name) +    #define LLPROFILE_ZONE(name)                     tmZone(0, 0, name) +    #define LLPROFILE_ZONE_FORMAT(format, ...)       tmZone(0, 0, format, __VA_ARGS__) +#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER + +// +// exported functionality +// + +extern void telemetry_startup(); +extern void telemetry_shutdown(); +extern void telemetry_update(); // called after every frame update diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 54f80a2995..7842d24279 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -49,8 +49,8 @@  /// LLViewerAssetRequest  ///---------------------------------------------------------------------------- - // There is also PoolSizeVAssetStorage value in setting that should mirror this name -static const std::string VIEWER_ASSET_STORAGE_CORO_POOL = "VAssetStorage"; + // There is also PoolSizeAssetStorage value in setting that should mirror this name +static const std::string VIEWER_ASSET_STORAGE_CORO_POOL = "AssetStorage";  /**   * @brief Local class to encapsulate asset fetch requests with a timestamp. @@ -137,6 +137,14 @@ LLViewerAssetStorage::~LLViewerAssetStorage()          // This class has dedicated coroutine pool, clean it up, otherwise coroutines will crash later.           LLCoprocedureManager::instance().close(VIEWER_ASSET_STORAGE_CORO_POOL);      } + +    while (mCoroWaitList.size() > 0) +    { +        CoroWaitList &request = mCoroWaitList.front(); +        // Clean up pending downloads, delete request and trigger callbacks +        removeAndCallbackPendingDownloads(request.mId, request.mType, request.mId, request.mType, LL_ERR_NOERR, LLExtStat::NONE); +        mCoroWaitList.pop_front(); +    }  }  // virtual  @@ -350,6 +358,27 @@ void LLViewerAssetStorage::storeAssetData(      }  } +void LLViewerAssetStorage::checkForTimeouts() +{ +    LLAssetStorage::checkForTimeouts(); + +    // Restore requests +    LLCoprocedureManager* manager = LLCoprocedureManager::getInstance(); +    while (mCoroWaitList.size() > 0 +           && manager->count(VIEWER_ASSET_STORAGE_CORO_POOL) < LLCoprocedureManager::DEFAULT_QUEUE_SIZE) +    { +        CoroWaitList &request = mCoroWaitList.front(); +         +        bool with_http = true; +        bool is_temp = false; +        LLViewerAssetStatsFF::record_enqueue(request.mType, with_http, is_temp); + +        manager->enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL, "LLViewerAssetStorage::assetRequestCoro", +            boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, request.mRequest, request.mId, request.mType, request.mCallback, request.mUserData)); + +        mCoroWaitList.pop_front(); +    } +}  /**   * @brief Allocate and queue an asset fetch request for the viewer @@ -407,12 +436,20 @@ void LLViewerAssetStorage::queueRequestHttp(      // This is the same as the current UDP logic - don't re-request a duplicate.      if (!duplicate)      { -        bool with_http = true; -        bool is_temp = false; -        LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); +        // Coroutine buffer has fixed size (synchronization buffer, so we have no alternatives), so buffer any request above limit +        if (LLCoprocedureManager::instance().count(VIEWER_ASSET_STORAGE_CORO_POOL) < LLCoprocedureManager::DEFAULT_QUEUE_SIZE) +        { +            bool with_http = true; +            bool is_temp = false; +            LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); -        LLCoprocedureManager::instance().enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL,"LLViewerAssetStorage::assetRequestCoro", -            boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); +            LLCoprocedureManager::instance().enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL, "LLViewerAssetStorage::assetRequestCoro", +                boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); +        } +        else +        { +            mCoroWaitList.emplace_back(req, uuid, atype, callback, user_data); +        }      }  } diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index ef01d179b7..c1a5534b81 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -45,7 +45,7 @@ public:  	~LLViewerAssetStorage(); -	virtual void storeAssetData( +	void storeAssetData(  		const LLTransactionID& tid,  		LLAssetType::EType atype,  		LLStoreAssetCallback callback, @@ -54,9 +54,9 @@ public:  		bool is_priority = false,  		bool store_local = false,  		bool user_waiting=FALSE, -		F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); -	 -	virtual void storeAssetData( +		F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override; + +	void storeAssetData(  		const std::string& filename,  		const LLTransactionID& tid,  		LLAssetType::EType type, @@ -65,16 +65,17 @@ public:  		bool temp_file = false,  		bool is_priority = false,  		bool user_waiting=FALSE, -		F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); +		F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override; + +    void checkForTimeouts() override;  protected: -	// virtual  	void _queueDataRequest(const LLUUID& uuid,  						   LLAssetType::EType type,                             LLGetAssetCallback callback,  						   void *user_data,  						   BOOL duplicate, -						   BOOL is_priority); +						   BOOL is_priority) override;      void queueRequestHttp(const LLUUID& uuid,                            LLAssetType::EType type, @@ -93,8 +94,35 @@ protected:      std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype); -    void logAssetStorageInfo(); -     +    void logAssetStorageInfo() override; + +    // Asset storage works through coroutines and coroutines have limited queue capacity +    // This class is meant to temporary store requests when fiber's queue is full +    class CoroWaitList +    { +    public: +        CoroWaitList(LLViewerAssetRequest *req, +            const LLUUID& uuid, +            LLAssetType::EType atype, +            LLGetAssetCallback &callback, +            void *user_data) +          : mRequest(req), +            mId(uuid), +            mType(atype), +            mCallback(callback), +            mUserData(user_data) +        { +        } + +        LLViewerAssetRequest* mRequest; +        LLUUID mId; +        LLAssetType::EType mType; +        LLGetAssetCallback mCallback; +        void *mUserData; +    }; +    typedef std::list<CoroWaitList> wait_list_t; +    wait_list_t mCoroWaitList; +      std::string mViewerAssetUrl;      S32 mAssetCoroCount;      S32 mCountRequests; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index d314b1477a..6d939fbe21 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -753,10 +753,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  				glViewport(0,0,512,512);  				LLVOAvatar::updateFreezeCounter() ; -				if(!LLPipeline::sMemAllocationThrottled) -				{		 -					LLVOAvatar::updateImpostors(); -				} +				LLVOAvatar::updateImpostors();  				set_current_projection(proj);  				set_current_modelview(mod); diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index a448a95904..9653e80b53 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -143,8 +143,10 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )  	//----------------------------------------------------------------  	for (LLJoint* j : mChildren)  	{ -		LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(j); -		F32 jointLOD = joint ? joint->getLOD() : 0; +		// LLViewerJoint is derived from LLAvatarJoint, +		// all children of LLAvatarJoint are assumed to be LLAvatarJoint +		LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(j); +		F32 jointLOD = joint->getLOD();  		if (pixelArea >= jointLOD || sDisableLOD)  		{  			triangle_count += joint->render( pixelArea, TRUE, is_dummy ); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index fdfd22c117..63ad708e59 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -56,7 +56,7 @@  #include "m4math.h"  #include "llmatrix4a.h" -#if !LL_DARWIN && !LL_LINUX && !LL_SOLARIS +#if !LL_DARWIN && !LL_LINUX  extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB;  extern PFNGLWEIGHTFVARBPROC glWeightfvARB;  extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index eef48ad083..9d05f59b09 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5406,7 +5406,7 @@ class LLToolsSelectNextPartFace : public view_listener_t                          new_te = to_select->getNumTEs() - 1;                      }                  } -                LLSelectMgr::getInstance()->addAsIndividual(to_select, new_te, FALSE); +                LLSelectMgr::getInstance()->selectObjectOnly(to_select, new_te);              }              else              { diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index a593905060..be05ac0d3a 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -130,7 +130,7 @@ void LLGridManager::initialize(const std::string& grid_file)  				  "https://secondlife.aditi.lindenlab.com/helpers/",  				  DEFAULT_LOGIN_PAGE,  				  SL_UPDATE_QUERY_URL, -				  "https://my.aditi.lindenlab.com/", +				  "https://my.secondlife-beta.com/",  				  "Aditi");  	LLSD other_grids; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 20a22ba45e..ca01bb46aa 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3314,13 +3314,6 @@ void LLViewerLODTexture::processTextureStats()  	{  		mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel);  	} -	else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions. -	{ -		if(scaleDown()) -		{ -			mDesiredDiscardLevel = mCachedRawDiscardLevel; -		} -	}  }  bool LLViewerLODTexture::scaleDown() diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 9c1aa772d8..21985d5a8a 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -314,6 +314,99 @@ RecordToChatConsole::RecordToChatConsole():  ////////////////////////////////////////////////////////////////////////////  // +// Print Utility +// + +// Convert a normalized float (-1.0 <= x <= +1.0) to a fixed 1.4 format string: +// +//    s#.#### +// +// Where: +//    s  sign character; space if x is positiv, minus if negative +//    #  decimal digits +// +// This is similar to printf("%+.4f") except positive numbers are NOT cluttered with a leading '+' sign. +// NOTE: This does NOT null terminate the output +void normalized_float_to_string(const float x, char *out_str) +{ +    static const unsigned char DECIMAL_BCD2[] = +    { +        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, +        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, +        0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, +        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, +        0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, +        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, +        0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, +        0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, +        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, +        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 +    }; + +    int neg = (x < 0); +    int rem = neg +            ? (int)(x * -10000.) +            : (int)(x *  10000.); + +    int d10 = rem % 100; rem /= 100; +    int d32 = rem % 100; rem /= 100; + +    out_str[6] = '0' + ((DECIMAL_BCD2[ d10 ] >> 0) & 0xF); +    out_str[5] = '0' + ((DECIMAL_BCD2[ d10 ] >> 4) & 0xF); +    out_str[4] = '0' + ((DECIMAL_BCD2[ d32 ] >> 0) & 0xF); +    out_str[3] = '0' + ((DECIMAL_BCD2[ d32 ] >> 4) & 0xF); +    out_str[2] = '.'; +    out_str[1] = '0' + (rem & 1); +    out_str[0] = " -"[neg]; // Could always show '+' for positive but this clutters up the common case +} + +// normalized float +//    printf("%-.4f    %-.4f    %-.4f") +// Params: +//   float  &matrix_row[4] +//   int    matrix_cell_index +//   string out_buffer (size 32) +// Note: The buffer is assumed to be pre-filled with spaces +#define MATRIX_ROW_N32_TO_STR(matrix_row, i, out_buffer)          \ +    normalized_float_to_string(matrix_row[i+0], out_buffer +  0); \ +    normalized_float_to_string(matrix_row[i+1], out_buffer + 11); \ +    normalized_float_to_string(matrix_row[i+2], out_buffer + 22); \ +    out_buffer[31] = 0; + + +// regular float +//    sprintf(buffer, "%-8.2f  %-8.2f  %-8.2f", matrix_row[i+0], matrix_row[i+1], matrix_row[i+2]); +// Params: +//   float  &matrix_row[4] +//   int    matrix_cell_index +//   char   out_buffer[32] +// Note: The buffer is assumed to be pre-filled with spaces +#define MATRIX_ROW_F32_TO_STR(matrix_row, i, out_buffer) {                       \ +    static const char *format[3] = {                                             \ +        "%-8.2f"  ,  /* 0 */                                                     \ +        ">  99K  ",  /* 1 */                                                     \ +        "< -99K  "   /* 2 */                                                     \ +    };                                                                           \ +                                                                                 \ +    F32 temp_0 = matrix_row[i+0];                                                \ +    F32 temp_1 = matrix_row[i+1];                                                \ +    F32 temp_2 = matrix_row[i+2];                                                \ +                                                                                 \ +    U8 flag_0 = (((U8)(temp_0 < -99999.99)) << 1) | ((U8)(temp_0 > 99999.99));   \ +    U8 flag_1 = (((U8)(temp_1 < -99999.99)) << 1) | ((U8)(temp_1 > 99999.99));   \ +    U8 flag_2 = (((U8)(temp_2 < -99999.99)) << 1) | ((U8)(temp_2 > 99999.99));   \ +                                                                                 \ +    if (temp_0 < 0.f) out_buffer[ 0] = '-';                                      \ +    if (temp_1 < 0.f) out_buffer[11] = '-';                                      \ +    if (temp_2 < 0.f) out_buffer[22] = '-';                                      \ +                                                                                 \ +    sprintf(out_buffer+ 1,format[flag_0],fabsf(temp_0)); out_buffer[ 1+8] = ' '; \ +    sprintf(out_buffer+12,format[flag_1],fabsf(temp_1)); out_buffer[12+8] = ' '; \ +    sprintf(out_buffer+23,format[flag_2],fabsf(temp_2)); out_buffer[23+8] =  0 ; \ +} + +//////////////////////////////////////////////////////////////////////////// +//  // LLDebugText  // @@ -334,7 +427,11 @@ private:  	typedef std::vector<Line> line_list_t;  	line_list_t mLineList;  	LLColor4 mTextColor; -	 + +	LLColor4 mBackColor; +	LLRect mBackRectCamera1; +	LLRect mBackRectCamera2; +  	void addText(S32 x, S32 y, const std::string &text)   	{  		mLineList.push_back(Line(text, x, y)); @@ -376,11 +473,22 @@ public:  		mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );  		// Draw stuff growing up from right lower corner of screen -		S32 xpos = mWindow->getWorldViewWidthScaled() - 400; +		S32 x_right = mWindow->getWorldViewWidthScaled(); +		S32 xpos = x_right - 400;  		xpos = llmax(xpos, 0);  		S32 ypos = 64;  		const S32 y_inc = 20; +		// Camera matrix text is hard to see again a white background +		// Add a dark background underneath the matrices for readability (contrast) +		mBackRectCamera1.mLeft   = xpos; +		mBackRectCamera1.mRight  = x_right; +		mBackRectCamera1.mTop    = -1; +		mBackRectCamera1.mBottom = -1; +		mBackRectCamera2 = mBackRectCamera1; + +		mBackColor = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); +  		clearText();  		if (gSavedSettings.getBOOL("DebugShowTime")) @@ -716,48 +824,45 @@ public:  		}  		if (gSavedSettings.getBOOL("DebugShowRenderMatrices"))  		{ -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); -			ypos += y_inc; - -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); -			ypos += y_inc; - -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); -			ypos += y_inc; +			char camera_lines[8][32]; +			memset(camera_lines, ' ', sizeof(camera_lines)); -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); -			ypos += y_inc; +			// Projection last column is always <0,0,-1.0001,0> +			// Projection last row is always <0,0,-0.2> +			mBackRectCamera1.mBottom = ypos - y_inc + 2; +			MATRIX_ROW_N32_TO_STR(gGLProjection, 12,camera_lines[7]); addText(xpos, ypos, std::string(camera_lines[7])); ypos += y_inc; +			MATRIX_ROW_N32_TO_STR(gGLProjection,  8,camera_lines[6]); addText(xpos, ypos, std::string(camera_lines[6])); ypos += y_inc; +			MATRIX_ROW_N32_TO_STR(gGLProjection,  4,camera_lines[5]); addText(xpos, ypos, std::string(camera_lines[5])); ypos += y_inc; mBackRectCamera1.mTop    = ypos + 2; +			MATRIX_ROW_N32_TO_STR(gGLProjection,  0,camera_lines[4]); addText(xpos, ypos, std::string(camera_lines[4])); ypos += y_inc; mBackRectCamera2.mBottom = ypos + 2;  			addText(xpos, ypos, "Projection Matrix");  			ypos += y_inc; - -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); -			ypos += y_inc; - -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); -			ypos += y_inc; - -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); -			ypos += y_inc; - -			addText(xpos, ypos, llformat("%.4f    .%4f    %.4f    %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); -			ypos += y_inc; +			// View last column is always <0,0,0,1> +			MATRIX_ROW_F32_TO_STR(gGLModelView, 12,camera_lines[3]); addText(xpos, ypos, std::string(camera_lines[3])); ypos += y_inc; +			MATRIX_ROW_N32_TO_STR(gGLModelView,  8,camera_lines[2]); addText(xpos, ypos, std::string(camera_lines[2])); ypos += y_inc; +			MATRIX_ROW_N32_TO_STR(gGLModelView,  4,camera_lines[1]); addText(xpos, ypos, std::string(camera_lines[1])); ypos += y_inc; mBackRectCamera2.mTop = ypos + 2; +			MATRIX_ROW_N32_TO_STR(gGLModelView,  0,camera_lines[0]); addText(xpos, ypos, std::string(camera_lines[0])); ypos += y_inc;  			addText(xpos, ypos, "View Matrix");  			ypos += y_inc;  		}  		// disable use of glReadPixels which messes up nVidia nSight graphics debugging -		if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport) -		{ -			U8 color[4]; -			LLCoordGL coord = gViewerWindow->getCurrentMouse(); -			glReadPixels(coord.mX, coord.mY, 1,1,GL_RGBA, GL_UNSIGNED_BYTE, color); -			addText(xpos, ypos, llformat("%d %d %d %d", color[0], color[1], color[2], color[3])); -			ypos += y_inc; -		} +        if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport) +        { +            U8 color[4]; +            LLCoordGL coord = gViewerWindow->getCurrentMouse(); -		// only display these messages if we are actually rendering beacons at this moment +            // Convert x,y to raw pixel coords +            S32 x_raw = llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled()); +            S32 y_raw = llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled()); +             +            glReadPixels(x_raw, y_raw, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color); +            addText(xpos, ypos, llformat("Pixel <%1d, %1d> R:%1d G:%1d B:%1d A:%1d", x_raw, y_raw, color[0], color[1], color[2], color[3])); +            ypos += y_inc; +        } + +        // only display these messages if we are actually rendering beacons at this moment  		if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons"))  		{  			if (LLPipeline::getRenderMOAPBeacons()) @@ -884,6 +989,18 @@ public:  	void draw()  	{  		LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT); + +		// Camera matrix text is hard to see again a white background +		// Add a dark background underneath the matrices for readability (contrast) +		if (mBackRectCamera1.mTop >= 0) +		{ +			mBackColor.setAlpha( 0.75f ); +			gl_rect_2d(mBackRectCamera1, mBackColor, true); + +			mBackColor.setAlpha( 0.66f ); +			gl_rect_2d(mBackRectCamera2, mBackColor, true); +		} +  		for (line_list_t::iterator iter = mLineList.begin();  			 iter != mLineList.end(); ++iter)  		{ @@ -892,7 +1009,6 @@ public:  											 LLFontGL::LEFT, LLFontGL::TOP,  											 LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE);  		} -		mLineList.clear();  	}  }; @@ -1800,8 +1916,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)  		ms_sleep(5000) ; //wait for 5 seconds.  		LLSplashScreen::update(LLTrans::getString("ShuttingDown")); -#if LL_LINUX || LL_SOLARIS -		LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly.  See README-linux.txt or README-solaris.txt for further information." +#if LL_LINUX +		LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly.  See README-linux.txt for further information."  				<< LL_ENDL;  #else  		LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings" @@ -2316,7 +2432,6 @@ void LLViewerWindow::shutdownGL()  LLViewerWindow::~LLViewerWindow()  {  	LL_INFOS() << "Destroying Window" << LL_ENDL; -	gDebugWindowProc = TRUE; // event catching, disable once we figure out cause for exit crashes  	destroyWindow();  	delete mDebugText; @@ -2407,6 +2522,11 @@ void LLViewerWindow::reshape(S32 width, S32 height)  		// round up when converting coordinates to make sure there are no gaps at edge of window  		LLView::sForceReshape = display_scale_changed;  		mRootView->reshape(llceil((F32)width / mDisplayScale.mV[VX]), llceil((F32)height / mDisplayScale.mV[VY])); +        if (display_scale_changed) +        { +            // Needs only a 'scale change' update, everything else gets handled by LLLayoutStack::updateClass() +            LLPanelLogin::reshapePanel(); +        }  		LLView::sForceReshape = FALSE;  		// clear font width caches @@ -4731,10 +4851,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei  		return FALSE;  	}  	//check if there is enough memory for the snapshot image -	if(LLPipeline::sMemAllocationThrottled) -	{ -		return FALSE ; //snapshot taking is disabled due to memory restriction. -	}  	if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K  	{  		if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3)) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 57599c9f3a..e2bd1a39c7 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -180,6 +180,13 @@ void LLVoiceClient::terminate()  {  	if (mVoiceModule) mVoiceModule->terminate();  	mVoiceModule = NULL; +    m_servicePump = NULL; + +    // Shutdown speaker volume storage before LLSingletonBase::deleteAll() does it +    if (LLSpeakerVolumeStorage::instanceExists()) +    { +        LLSpeakerVolumeStorage::deleteSingleton(); +    }  }  const LLVoiceVersionInfo LLVoiceClient::getVersion() diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index a8d668420e..b0f57beff8 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -359,7 +359,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :  //	gMuteListp->addObserver(&mutelist_listener); -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX  		// HACK: THIS DOES NOT BELONG HERE  		// When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.  		// This should cause us to ignore SIGPIPE and handle the error through proper channels. @@ -391,7 +391,7 @@ LLVivoxVoiceClient::~LLVivoxVoiceClient()  void LLVivoxVoiceClient::init(LLPumpIO *pump)  {  	// constructor will set up LLVoiceClient::getInstance() -	LLVivoxVoiceClient::getInstance()->mPump = pump; +	mPump = pump;  //     LLCoros::instance().launch("LLVivoxVoiceClient::voiceControlCoro",  //         boost::bind(&LLVivoxVoiceClient::voiceControlCoro, LLVivoxVoiceClient::getInstance())); @@ -419,6 +419,7 @@ void LLVivoxVoiceClient::terminate()  	}      sShuttingDown = true; +    mPump = NULL;  }  //--------------------------------------------------- @@ -953,10 +954,15 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()      llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS); -    while (!mPump) -    {   // Can't do this until we have the pump available. +    while (!mPump && !sShuttingDown) +    {   // Can't use the pump until we have it available.          llcoro::suspend();      } + +    if (sShuttingDown) +    { +        return false; +    }      // MBW -- Note to self: pumps and pipes examples in      //  indra/test/io.cpp @@ -969,8 +975,10 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()      readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));      readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser())); +      mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS); +      //---------------------------------------------------------------------      llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS); @@ -993,6 +1001,11 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()          // *TODO* Pump a message for wake up.          llcoro::suspend();      } +     +    if (sShuttingDown) +    { +        return false; +    }      std::string url = gAgent.getRegionCapability("ProvisionVoiceAccountRequest"); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 2037aca7e9..878d7287ed 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -209,14 +209,7 @@ void LLSkyTex::create()  void LLSkyTex::createGLImage(S32 which)  {	 -    if (mIsShiny) -    { -        mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA); -    } -    else -    { -        mTexture[which]->setExplicitFormat(GL_SRGB8_ALPHA8, GL_RGBA); -    } +	mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA);  	mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL);  	mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP);  } diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 8e46ccd555..41099cb570 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -45,6 +45,8 @@  #include "llviewertexturelist.h"  #include "llviewerobjectlist.h"  #include "llviewerregion.h" +#include "llvolumemgr.h" +#include "llvovolume.h"  #include "llworld.h"  #include "noise.h"  #include "pipeline.h" @@ -85,6 +87,9 @@ LLVOTree::LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *region  	mFrameCount = 0;  	mWind = mRegionp->mWind.getVelocity(getPositionRegion());  	mTrunkLOD = 0; + +	// if assert triggers, idleUpdate() needs to be revised and adjusted to new LOD levels +	llassert(sMAX_NUM_TREE_LOD_LEVELS == LLVolumeLODGroup::NUM_LODS);  } @@ -347,8 +352,11 @@ void LLVOTree::idleUpdate(LLAgent &agent, const F64 &time)  		return;  	} -	S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; +	S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; // disabled  	F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor; +	F32 distance = mDrawable->mDistanceWRTCamera * LLVOVolume::sDistanceFactor * (F_PI / 3.f); +	F32 diameter = getScale().length(); // trees have very broken scale, but length rougtly outlines proper diameter +	F32 sz = mBillboardScale * mBillboardRatio * diameter;  	for (S32 j = 0; j < sMAX_NUM_TREE_LOD_LEVELS; j++)  	{ @@ -357,7 +365,14 @@ void LLVOTree::idleUpdate(LLAgent &agent, const F64 &time)  			trunk_LOD = j;  			break;  		} -	}  +	} + +    F32 tan_angle = (LLVOTree::sTreeFactor * 64 * sz) / distance; +    S32 cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f)); // larger value, better quality + +    // for trunk_LOD lower value means better quality, but both trunk_LOD and cur_detail have 4 levels +    trunk_LOD = llmax(trunk_LOD, LLVolumeLODGroup::NUM_LODS - cur_detail - 1); +    trunk_LOD = llmin(trunk_LOD, sMAX_NUM_TREE_LOD_LEVELS);  	if (mReferenceBuffer.isNull())  	{ @@ -408,8 +423,9 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent)  	LLVector3 lookAt = center - viewer_pos_agent;  	F32 dist = lookAt.normVec() ;	  	F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ;	 -	 -	F32 range = dist - getMinScale()/2; +	F32 radius = getScale().length()*0.5f; +	F32 range = dist - radius; +  	if (range < F_ALMOST_ZERO || isHUDAttachment())		// range == zero  	{  		mAppAngle = 180.f; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 95cfe29a80..3bdb8a2981 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2337,8 +2337,7 @@ bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture)  	//setup new materials  	for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)  	{ -		// These are placeholder materials, they shouldn't be sent to server -		LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second); +		LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second);  		LLViewerObject::setTEMaterialParams(it->first, it->second);  	} diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7ba7e545f4..cd1b9c7c69 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -129,6 +129,16 @@  //  #define MATERIALS_IN_REFLECTIONS 0 +// NOTE: Keep in sync with indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +// NOTE: Unused consts are commented out since some compilers (on macOS) may complain about unused variables. +//  const S32 WATER_REFLECT_NONE_WATER_OPAQUE       = -2; +    const S32 WATER_REFLECT_NONE_WATER_TRANSPARENT  = -1; +    const S32 WATER_REFLECT_MINIMAL                 =  0; +//  const S32 WATER_REFLECT_TERRAIN                 =  1; +    const S32 WATER_REFLECT_STATIC_OBJECTS          =  2; +    const S32 WATER_REFLECT_AVATARS                 =  3; +    const S32 WATER_REFLECT_EVERYTHING              =  4; +  bool gShiftFrame = false;  //cached settings @@ -348,7 +358,6 @@ bool	LLPipeline::sRenderFrameTest = false;  bool	LLPipeline::sRenderAttachedLights = true;  bool	LLPipeline::sRenderAttachedParticles = true;  bool	LLPipeline::sRenderDeferred = false; -bool    LLPipeline::sMemAllocationThrottled = false;  S32		LLPipeline::sVisibleLightCount = 0;  F32		LLPipeline::sMinRenderSize = 0.f;  bool	LLPipeline::sRenderingHUDs; @@ -718,24 +727,6 @@ void LLPipeline::destroyGL()  static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture"); -//static -void LLPipeline::throttleNewMemoryAllocation(bool disable) -{ -	if(sMemAllocationThrottled != disable) -	{ -		sMemAllocationThrottled = disable ; - -		if(sMemAllocationThrottled) -		{ -			//send out notification -			LLNotification::Params params("LowMemory"); -			LLNotifications::instance().add(params); - -			//release some memory. -		} -	} -} -  void LLPipeline::requestResizeScreenTexture()  {      gResizeScreenTexture = TRUE; @@ -9270,30 +9261,29 @@ inline float sgn(float a)  }  void LLPipeline::generateWaterReflection(LLCamera& camera_in) -{	 -	if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) -	{ -		bool skip_avatar_update = false; -		if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) -		{ -			skip_avatar_update = true; -		} -		 -        LLCamera camera = camera_in; +{ +    if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) +    { +        bool skip_avatar_update = false; +        if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) +        { +            skip_avatar_update = true; +        } +        LLCamera camera = camera_in;          camera.setFar(camera_in.getFar() * 0.75f);          bool camera_is_underwater = LLViewerCamera::getInstance()->cameraUnderWater(); -		LLPipeline::sReflectionRender = true; -		 -		gPipeline.pushRenderTypeMask(); +        LLPipeline::sReflectionRender = true; + +        gPipeline.pushRenderTypeMask();          glh::matrix4f saved_modelview  = get_current_modelview();          glh::matrix4f saved_projection = get_current_projection(); -		glh::matrix4f mat; +        glh::matrix4f mat; -        S32 detail = RenderReflectionDetail; +        S32 reflection_detail  = RenderReflectionDetail;          F32 water_height      = gAgent.getRegion()->getWaterHeight();           F32 camera_height     = camera_in.getOrigin().mV[VZ]; @@ -9307,32 +9297,34 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)          camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point); -		//plane params +        //plane params          LLPlane plane; -		LLVector3 pnorm; -		S32 water_clip = 0; +        LLVector3 pnorm; +        S32 water_clip = 0;          if (!camera_is_underwater) -		{ //camera is above water, clip plane points up -			pnorm.setVec(0,0,1); +        { +            //camera is above water, clip plane points up +            pnorm.setVec(0,0,1);              plane.setVec(pnorm, -water_height);              water_clip = 1; -		} -		else -		{	//camera is below water, clip plane points down -			pnorm = LLVector3(0,0,-1); +        } +        else +        { +            //camera is below water, clip plane points down +            pnorm = LLVector3(0,0,-1);              plane.setVec(pnorm, water_height);              water_clip = -1; -		} +        }          S32 occlusion = LLPipeline::sUseOcclusion; -			//disable occlusion culling for reflection map for now -			LLPipeline::sUseOcclusion = 0; +        //disable occlusion culling for reflection map for now +        LLPipeline::sUseOcclusion = 0;          if (!camera_is_underwater) -        {   //generate planar reflection map - -			LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0; +        { +            //generate planar reflection map +            LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0;              gGL.matrixMode(LLRender::MM_MODELVIEW);              gGL.pushMatrix(); @@ -9345,9 +9337,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)              mReflectionModelView = mat;              set_current_modelview(mat); -			gGL.loadMatrix(mat.m); +            gGL.loadMatrix(mat.m); -			LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE); +            LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE);              glh::vec3f    origin(0, 0, 0);              glh::matrix4f inv_mat = mat.inverse(); @@ -9355,10 +9347,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)              camera.setOrigin(origin.v); -			glCullFace(GL_FRONT); +            glCullFace(GL_FRONT); -			if (LLDrawPoolWater::sNeedsReflectionUpdate) -			{ +            if (LLDrawPoolWater::sNeedsReflectionUpdate) +            {                  gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);                  glClearColor(0,0,0,0);                  mWaterRef.bindTarget(); @@ -9368,106 +9360,127 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)                  gGL.setColorMask(true, false);                  mWaterRef.getViewport(gGLViewport); -				//initial sky pass (no user clip plane) -				{ //mask out everything but the sky -					gPipeline.pushRenderTypeMask(); -					gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, -						LLPipeline::RENDER_TYPE_WL_SKY, -						LLPipeline::RENDER_TYPE_CLOUDS, -						LLPipeline::END_RENDER_TYPES); +                //initial sky pass (no user clip plane) +                //mask out everything but the sky +                gPipeline.pushRenderTypeMask(); +                { +                    if (reflection_detail >= WATER_REFLECT_MINIMAL) +                    { +                        gPipeline.andRenderTypeMask( +                            LLPipeline::RENDER_TYPE_SKY, +                            LLPipeline::RENDER_TYPE_WL_SKY, +                            LLPipeline::RENDER_TYPE_CLOUDS, +                            LLPipeline::END_RENDER_TYPES); +                    } +                    else +                    { +                        gPipeline.andRenderTypeMask( +                            LLPipeline::RENDER_TYPE_SKY, +                            LLPipeline::RENDER_TYPE_WL_SKY, +                            LLPipeline::END_RENDER_TYPES); +                    }                      updateCull(camera, mSky);                      stateSort(camera, mSky); -						renderGeom(camera, TRUE); - -					gPipeline.popRenderTypeMask(); -				} +                    renderGeom(camera, TRUE); +                } +                gPipeline.popRenderTypeMask(); -				gPipeline.pushRenderTypeMask(); +                if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) +                { +                    gPipeline.pushRenderTypeMask(); +                    { +                        clearRenderTypeMask( +                            LLPipeline::RENDER_TYPE_WATER, +                            LLPipeline::RENDER_TYPE_VOIDWATER, +                            LLPipeline::RENDER_TYPE_GROUND, +                            LLPipeline::RENDER_TYPE_SKY, +                            LLPipeline::RENDER_TYPE_CLOUDS, +                            LLPipeline::END_RENDER_TYPES); + +                        if (reflection_detail > WATER_REFLECT_MINIMAL) +                        { //mask out selected geometry based on reflection detail +                            if (reflection_detail < WATER_REFLECT_EVERYTHING) +                            { +                                clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); +                                if (reflection_detail < WATER_REFLECT_AVATARS) +                                { +                                    clearRenderTypeMask( +                                        LLPipeline::RENDER_TYPE_AVATAR, +                                        LLPipeline::RENDER_TYPE_CONTROL_AV, +                                        END_RENDER_TYPES); +                                    if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) +                                    { +                                        clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); +                                    } +                                } +                            } -				clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, -					LLPipeline::RENDER_TYPE_VOIDWATER, -					LLPipeline::RENDER_TYPE_GROUND, -					LLPipeline::RENDER_TYPE_SKY, -					LLPipeline::RENDER_TYPE_CLOUDS, -					LLPipeline::END_RENDER_TYPES);	 - -				if (detail > 0) -				{ //mask out selected geometry based on reflection detail -					if (detail < 4) -					{ -						clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); -						if (detail < 3) -						{ -                            clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); -							if (detail < 2) -							{ -								clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); -							} -						} -					} +                            LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); +                            LLGLDisable cull(GL_CULL_FACE); +                            updateCull(camera, mReflectedObjects, -water_clip, &plane); +                            stateSort(camera, mReflectedObjects); +                            renderGeom(camera); +                        } +                    } +                    gPipeline.popRenderTypeMask(); +                } -                    LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); -					LLGLDisable cull(GL_CULL_FACE); -                    updateCull(camera, mReflectedObjects, -water_clip, &plane); -                    stateSort(camera, mReflectedObjects); -							renderGeom(camera); -						} -                gPipeline.popRenderTypeMask();                  mWaterRef.flush(); -				} +            } -			glCullFace(GL_BACK); +            glCullFace(GL_BACK);              gGL.matrixMode(LLRender::MM_MODELVIEW); -			gGL.popMatrix(); -             +            gGL.popMatrix(); +              set_current_modelview(saved_modelview); -		} +        }          //LLPipeline::sUseOcclusion = occlusion; -		camera.setOrigin(camera_in.getOrigin()); -		//render distortion map -		static bool last_update = true; -		if (last_update) -		{ +        camera.setOrigin(camera_in.getOrigin()); +        //render distortion map +        static bool last_update = true; +        if (last_update) +        {              gPipeline.pushRenderTypeMask(); -			camera.setFar(camera_in.getFar()); -			clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, -								LLPipeline::RENDER_TYPE_VOIDWATER, -								LLPipeline::RENDER_TYPE_GROUND, -								END_RENDER_TYPES);	 +            camera.setFar(camera_in.getFar()); +            clearRenderTypeMask( +                LLPipeline::RENDER_TYPE_WATER, +                LLPipeline::RENDER_TYPE_VOIDWATER, +                LLPipeline::RENDER_TYPE_GROUND, +                END_RENDER_TYPES);              // intentionally inverted so that distortion map contents (objects under the water when we're above it)              // will properly include water fog effects              LLPipeline::sUnderWaterRender = !camera_is_underwater; -			if (LLPipeline::sUnderWaterRender) -			{ +            if (LLPipeline::sUnderWaterRender) +            {                  clearRenderTypeMask( -                                    LLPipeline::RENDER_TYPE_GROUND, -									LLPipeline::RENDER_TYPE_SKY, -									LLPipeline::RENDER_TYPE_CLOUDS, -									LLPipeline::RENDER_TYPE_WL_SKY, -									END_RENDER_TYPES);		 -			} -			LLViewerCamera::updateFrustumPlanes(camera); +                    LLPipeline::RENDER_TYPE_GROUND, +                    LLPipeline::RENDER_TYPE_SKY, +                    LLPipeline::RENDER_TYPE_CLOUDS, +                    LLPipeline::RENDER_TYPE_WL_SKY, +                    END_RENDER_TYPES); +            } +            LLViewerCamera::updateFrustumPlanes(camera); + +            gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -			              if (LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsDistortionUpdate)              {                  LLPipeline::sDistortionRender = true;                  LLColor3 col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor(); -			glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); +                glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); + +                LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1; -			LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1; -			                  mWaterDis.bindTarget(); -			mWaterDis.getViewport(gGLViewport); -			 +                mWaterDis.getViewport(gGLViewport); +                  gGL.setColorMask(true, true);                  mWaterDis.clear();                  gGL.setColorMask(true, false); @@ -9479,66 +9492,69 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)                  LLPlane plane(-pnorm, water_dist);                  LLGLUserClipPlane clip_plane(plane, saved_modelview, saved_projection); -				gGL.setColorMask(true, true); -				mWaterDis.clear(); -				gGL.setColorMask(true, false); +                gGL.setColorMask(true, true); +                mWaterDis.clear(); +                gGL.setColorMask(true, false);                  // ignore clip plane if we're underwater and viewing distortion map of objects above waterline                  if (camera_is_underwater) -				{ +                {                      clip_plane.disable(); -				} +                } -                updateCull(camera, mRefractedObjects, water_clip, &plane); -                stateSort(camera, mRefractedObjects); -					renderGeom(camera); +                if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) +                { +                    updateCull(camera, mRefractedObjects, water_clip, &plane); +                    stateSort(camera, mRefractedObjects); +                    renderGeom(camera); +                } -					if (LLGLSLShader::sNoFixedFunction) -					{ -						gUIProgram.bind(); -					} -					 -					LLWorld::getInstance()->renderPropertyLines(); -					 -					if (LLGLSLShader::sNoFixedFunction) -					{ -						gUIProgram.unbind(); -					} +                if (LLGLSLShader::sNoFixedFunction) +                { +                    gUIProgram.bind(); +                } + +                LLWorld::getInstance()->renderPropertyLines(); + +                if (LLGLSLShader::sNoFixedFunction) +                { +                    gUIProgram.unbind(); +                }                  mWaterDis.flush(); -			} +            }              LLPipeline::sDistortionRender = false; -			 +              gPipeline.popRenderTypeMask(); -		} -		last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate; +        } +        last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;          gPipeline.popRenderTypeMask();          LLPipeline::sUseOcclusion     = occlusion;          LLPipeline::sUnderWaterRender = false; -		LLPipeline::sReflectionRender = false; +        LLPipeline::sReflectionRender = false;          LLDrawPoolWater::sNeedsReflectionUpdate = FALSE;          LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; -		if (!LLRenderTarget::sUseFBO) -		{ -			glClear(GL_DEPTH_BUFFER_BIT); -		} -		glClearColor(0.f, 0.f, 0.f, 0.f); -		gViewerWindow->setup3DViewport(); -		 -		LLGLState::checkStates(); +        if (!LLRenderTarget::sUseFBO) +        { +            glClear(GL_DEPTH_BUFFER_BIT); +        } +        glClearColor(0.f, 0.f, 0.f, 0.f); +        gViewerWindow->setup3DViewport(); -		if (!skip_avatar_update) -		{ -			gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); -		} +        LLGLState::checkStates(); -		LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; -	} +        if (!skip_avatar_update) +        { +            gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); +        } + +        LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; +    }  }  glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 52fd51cd80..0eaa6b141d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -414,10 +414,6 @@ public:  	static void updateRenderDeferred();  	static void refreshCachedSettings(); -	static void throttleNewMemoryAllocation(bool disable); - -	 -  	void addDebugBlip(const LLVector3& position, const LLColor4& color);  	void hidePermanentObjects( std::vector<U32>& restoreList ); @@ -600,7 +596,6 @@ public:  	static bool				sRenderAttachedLights;  	static bool				sRenderAttachedParticles;  	static bool				sRenderDeferred; -	static bool             sMemAllocationThrottled;  	static S32				sVisibleLightCount;  	static F32				sMinRenderSize;  	static bool				sRenderingHUDs; diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index e1cf708094..efe8102f83 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -337,6 +337,9 @@       name="ContextSilhouetteColor"       reference="EmphasisColor" />      <color +     name="ConversationFriendColor" +     value="0.42 0.85 0.71 1" /> +    <color       name="DefaultHighlightDark"       reference="White_10" />      <color diff --git a/indra/newview/skins/default/xui/en/floater_buy_object.xml b/indra/newview/skins/default/xui/en/floater_buy_object.xml index 49be4290c7..1f7d52dbf5 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_object.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_object.xml @@ -32,6 +32,10 @@       name="no_transfer_text">          (no transfer)      </floater.string> +    <floater.string +      name="mupliple_selected"> +        Mupliple selection +    </floater.string>      <scroll_list       background_visible="true"       draw_border="false" diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index c64ee5565a..15f02ab9c3 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -267,6 +267,36 @@                   right="-1">                      <layout_panel                       name="input_editor_layout_panel"> +                        <avatar_icon +                         follows="left|bottom" +                         name="avatar_icon" +                         height="20" +                         default_icon_name="Generic_Person" +                         layout="topleft" +                         left="3" +                         bottom="-9" +                         visible="false" +                         width="20" /> +                        <group_icon +                         follows="left|bottom" +                         name="group_chat_icon" +                         height="20" +                         default_icon_name="Generic_Group" +                         layout="topleft" +                         left="3" +                         bottom="-9" +                         visible="false" +                         width="20" /> +                        <icon +                         follows="left|bottom" +                         height="20" +                         image_name="Nearby_chat_icon" +                         layout="topleft" +                         left="3" +                         bottom="-9" +                         name="nearby_chat_icon" +                         visible="false" +                         width="20"/>                          <chat_editor                           layout="topleft"                           expand_lines_count="5" @@ -280,7 +310,7 @@                           spellcheck="true"                           tab_group="3"                           bottom="-8" -                         left="5" +                         left_pad="5"                           right="-5"                           wrap="true" />                      </layout_panel> diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index e282f1b179..3cc99b28c9 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -724,6 +724,14 @@      name="Reflections"      width="150">        <combo_box.item +        label="None; opaque" +        name="0" +        value="-2"/> +      <combo_box.item +        label="None; transparent" +        name="0" +        value="-1"/> +      <combo_box.item          label="Minimal"          name="0"          value="0"/> diff --git a/indra/newview/skins/default/xui/en/floater_publish_classified.xml b/indra/newview/skins/default/xui/en/floater_publish_classified.xml index 322e34272c..84e0b489d0 100644 --- a/indra/newview/skins/default/xui/en/floater_publish_classified.xml +++ b/indra/newview/skins/default/xui/en/floater_publish_classified.xml @@ -6,6 +6,7 @@   layout="topleft"   name="publish_classified"   title="Publishing Classified" + help_topic="profile_edit_classified"   width="320">      <text       top="20" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 1313632803..ff2d6c0d84 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4039,6 +4039,8 @@ Finished download of raw terrain file to:  [DOWNLOAD_PATH].    </notification> +  <!-- RequiredUpdate does not display release notes URL because we don't get +       that from login.cgi's login failure message. -->    <notification     icon="alertmodal.tga"     name="RequiredUpdate" @@ -4056,6 +4058,8 @@ Please download from https://secondlife.com/support/downloads/     name="PauseForUpdate"     type="alertmodal">  Version [VERSION] is required for login. +Release notes: [URL] +  Click OK to download and install.      <tag>confirm</tag>      <usetemplate @@ -4068,6 +4072,8 @@ Click OK to download and install.     name="OptionalUpdateReady"     type="alertmodal">  Version [VERSION] has been downloaded and is ready to install. +Release notes: [URL] +  Click OK to install.      <tag>confirm</tag>      <usetemplate @@ -4080,6 +4086,8 @@ Click OK to install.     name="PromptOptionalUpdate"     type="alertmodal">  Version [VERSION] has been downloaded and is ready to install. +Release notes: [URL] +  Proceed?      <tag>confirm</tag>      <usetemplate @@ -9603,6 +9611,12 @@ You do not appear to have the proper hardware requirements for [APP_NAME]. [APP_  If you continue to have problems, please visit the [SUPPORT_SITE].    </global> +  <global name="UnsupportedIntelDriver"> +The installed Intel graphics driver for [GPUNAME], version [VERSION], is significantly out of date and is known to cause excessive rates of program crashes. You are strongly advised to update to a current Intel driver + +Do you want to check the Intel driver website? +  </global> +    <global name="UnsupportedCPUAmount">  796    </global> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index a6116dc9be..440e8b140f 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2299,6 +2299,7 @@ For AI Character: Get the closest navigable point to the point provided.  	<string name="InventoryNoMatchingRecentItems">Didn't find what you're looking for? Try [secondlife:///app/inventory/filters Show filters].</string>  	<string name="PlacesNoMatchingItems">Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search].</string>  	<string name="FavoritesNoMatchingItems">Drag a landmark here to add it to your favorites.</string> +	<string name="MarketplaceNoListing">You have no listings yet.</string>  	<string name="MarketplaceNoMatchingItems">No items found. Check the spelling of your search string and try again.</string>  	<string name="InventoryNoTexture">You do not have a copy of this texture in your inventory</string>  	<string name="InventoryInboxNoItems">Your Marketplace purchases will appear here. You may then drag them into your inventory to use them.</string> @@ -3693,10 +3694,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].    Also there are some other places where "generic" is used.    So, let add string with name="generic" with the same value as "generic_request_error" -->    <string name="generic"> -    Error making request, please try again later. +    Please close and reopen the conversation, or relog and try again.    </string>    <string name="generic_request_error"> -    Error making request, please try again later. +    Please close and reopen the conversation, or relog and try again.    </string>    <string name="insufficient_perms_error">      You do not have sufficient permissions. diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 57f2d31eab..f9abc8b25d 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -41,6 +41,7 @@  #include "../test/lltut.h"  #include "llevents.h"  #include "llnotificationsutil.h" +#include "lltrans.h"  #if defined(LL_WINDOWS)  #pragma warning(disable: 4355)      // using 'this' in base-class ctor initializer expr @@ -77,6 +78,11 @@ void LLViewerWindow::setShowProgress(BOOL show) {}  LLProgressView * LLViewerWindow::getProgressView(void) const { return 0; }  LLViewerWindow* gViewerWindow; + +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) +{ +    return std::string("test_trans"); +}  class LLLogin::Impl  { diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 6d231040f7..adac7af712 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -533,6 +533,9 @@ class WindowsManifest(ViewerManifest):              # For textures              self.path("openjpeg.dll") +            # Uriparser +            self.path("uriparser.dll") +              # These need to be installed as a SxS assembly, currently a 'private' assembly.              # See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx              self.path("msvcp140.dll") @@ -1035,6 +1038,7 @@ class DarwinManifest(ViewerManifest):                                  # libnghttp2.major.dylib, which is a symlink to                                  # libnghttp2.version.dylib. Get all of them.                                  "libnghttp2.*dylib", +                                "liburiparser.*dylib",                                  ):                      dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile) | 
