diff --git a/autobuild.xml b/autobuild.xml index a330e2cc1e..ff46f38a09 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -994,11 +994,11 @@ archive hash - 4f9bf4566934e6e8611ef918186f20c5 + c96fbccf3db01230832d8795318ee627 hash_algorithm md5 url - file:///opt/firestorm/fmodstudio-2.01.08-darwin-210441530.tar.bz2 + file:///opt/firestorm/fmodstudio-2.01.09-darwin-211252249.tar.bz2 name darwin @@ -2980,9 +2980,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - e235c5da10f29893e14b14c7a3184d91 + ba2034b4a372fd46c3e09f56bede38a7 url - http://3p.firestormviewer.org/openjpeg-2.3.1.202821233-windows-202821233.tar.bz2 + http://3p.firestormviewer.org/openjpeg-2.4.0.211361403-windows-211361403.tar.bz2 name windows @@ -2992,16 +2992,16 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - d87183b9cab5910a4a0f15e8faebab06 + d7ac606703a9330a2d8a3f7276cb6894 url - http://3p.firestormviewer.org/openjpeg-2.3.1.202821246-windows64-202821246.tar.bz2 + http://3p.firestormviewer.org/openjpeg-2.4.0.211361407-windows64-211361407.tar.bz2 name windows64 version - 2.3.1 + 2.4.0 openssl diff --git a/doc/contributions.txt b/doc/contributions.txt index c4f55d7a5f..e948e0c959 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -270,6 +270,7 @@ Beq Janus SL-10288 SL-13583 SL-14766 + SL-11300 Beth Walcher Bezilon Kasei Biancaluce Robbiani @@ -1363,6 +1364,12 @@ Sovereign Engineer OPEN-343 SL-11625 BUG-229030 + SL-14705 + SL-14706 + SL-14707 + SL-14731 + SL-14732 + SL-15096 SpacedOut Frye VWR-34 VWR-45 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 90d67727e2..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(*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(*iter); joint->setVisible(visible, recursive); } } @@ -167,10 +167,7 @@ void LLAvatarJoint::updateJointGeometry() for (joints_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { -// LLAvatarJoint* joint = dynamic_cast(*iter); -// [SL:KB] - Patch: Viewer-OptimizationAnimesh | Checked: Catznip-6.0 LLAvatarJoint* joint = static_cast(*iter); -// [/SL:KB] joint->updateJointGeometry(); } } diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp index 0d3e58b3e5..ff7dcbd995 100644 --- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp +++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp @@ -155,8 +155,20 @@ void LLStreamingAudio_FMODSTUDIO::update() bool diskbusy; FMOD_OPENSTATE open_state; - if (Check_FMOD_Error(mCurrentInternetStreamp->getOpenState(open_state, &progress, &starving, &diskbusy), "FMOD::Sound::getOpenState") || open_state == FMOD_OPENSTATE_ERROR) + if (Check_FMOD_Error(mCurrentInternetStreamp->getOpenState(open_state, &progress, &starving, &diskbusy), "FMOD::Sound::getOpenState")) { + LL_WARNS() << "Internet stream openstate error: open_state = " << open_state << " - progress = " << progress << " - starving = " << starving << " - diskbusy = " << diskbusy << LL_ENDL; + stop(); + return; + } + else if (open_state == FMOD_OPENSTATE_ERROR) + { + // Actually we might not get into this case at all since according to the + // FMOD API doc, one should check the result of getOpenState for further + // details, which most likely means if open_state is FMOD_OPENSTATE_ERROR, + // calling getOpenState will return anything but FMOD_OK and we end up in + // the if-case above. + LL_WARNS() << "Internet stream openstate error: progress = " << progress << " - starving = " << starving << " - diskbusy = " << diskbusy << LL_ENDL; stop(); return; } diff --git a/indra/llcommon/fstelemetry.h b/indra/llcommon/fstelemetry.h index 87ec75b00a..9a0cdd5e18 100644 --- a/indra/llcommon/fstelemetry.h +++ b/indra/llcommon/fstelemetry.h @@ -45,6 +45,7 @@ #define FSZoneNC( name, color ) ZoneNamedNC( ___tracy_scoped_zone, name, color, FSTelemetry::active) #define FSPlot( name, value ) TracyPlot( name, value) #define FSFrameMark FrameMark +#define FSThreadName( name ) tracy::SetThreadName( name ) #define FSTelemetryIsConnected TracyIsConnected #else // (no telemetry) @@ -58,6 +59,7 @@ #define FSZoneNC( name, color ) #define FSPlot( name, value ) #define FSFrameMark +#define FSThreadName( name ) #define FSTelemetryIsConnected #endif // TRACY_ENABLE diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 34e9e20a36..c9dbb31c9f 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 // Need PATH_MAX in APR headers... #endif diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 4f6afd17fd..53b8d40c7a 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 #include #include "lltimer.h" @@ -69,7 +69,7 @@ bool BlockTimer::sMetricLog = false; #define USE_RDTSC 0 #else #endif -#if LL_LINUX || LL_SOLARIS || LL_DARWIN // AO: Add LL_DARWIN to this list now +#if LL_LINUX || LL_DARWIN // AO: Add LL_DARWIN to this list now U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution #else U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution @@ -156,12 +156,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 2374483c73..f77d880fc4 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -146,11 +146,11 @@ public: // Linux/Mac should honour LL_FASTTIMER_USE_RDTSC too -// #if (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__) -#if (LL_LINUX || LL_SOLARIS) && ( !(defined(__i386__) || defined(__amd64__)) || !LL_FASTTIMER_USE_RDTSC ) +// #if (LL_LINUX) && !(defined(__i386__) || defined(__amd64__) +#if (LL_LINUX) && ( !(defined(__i386__) || defined(__amd64__)) || !LL_FASTTIMER_USE_RDTSC ) // // - // 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 @@ -176,15 +176,15 @@ public: return (U32)(getCPUClockCount64() >> 8); } -#endif // (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#endif // (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) // Linux/Mac should honour LL_FASTTIMER_USE_RDTSC too -//#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) -#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) && LL_FASTTIMER_USE_RDTSC +//#if (LL_LINUX || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) && LL_FASTTIMER_USE_RDTSC // // - // 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 # include # include -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #endif @@ -55,7 +55,6 @@ static LLTrace::SampleStatHandle 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 -#include -#include -#define _STRUCTURED_PROC 1 -#include - -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 ddb474c2c7..260fb56cf8 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -356,10 +356,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() ; @@ -371,7 +370,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 7e71409203..26197cb692 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -34,16 +34,7 @@ #include #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 // 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/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index e953451d49..3f3ef2be8a 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -442,7 +442,15 @@ S32 LLQueuedThread::processNextRequest() // safe to access req. if (req) { - // process request + // Image thread pool from CoolVL + if (req->getFlags() & FLAG_ASYNC) + { + req->processRequest(); + return getPending(); + } + // + + // process request bool complete = req->processRequest(); if (complete) diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index 5d3f873646..858d578b7f 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -67,6 +67,7 @@ public: FLAG_AUTO_COMPLETE = 1, FLAG_AUTO_DELETE = 2, // child-class dependent FLAG_ABORT = 4 + ,FLAG_ASYNC = 8 // Image thread pool from CoolVL }; typedef U32 handle_t; diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 478dd6e771..d5cc14ff55 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -33,7 +33,7 @@ #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN # include // for htonl -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #elif LL_DARWIN # include diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 5ebfe1f607..1c6dd6b75f 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -41,7 +41,7 @@ #include // [/RLVa:KB] -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include #include #endif @@ -49,16 +49,10 @@ #include #include -#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 diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index d8703b5bdf..dc4e6eda01 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -88,17 +88,6 @@ using namespace llsd; # include const char MEMINFO_FILE[] = "/proc/meminfo"; # include -#elif LL_SOLARIS -# include -# include -# include -# define _STRUCTURED_PROC 1 -# include -# include -# include -# include -# include -extern int errno; #endif LLCPUInfo gSysCPU; @@ -551,8 +540,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"); @@ -572,24 +559,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; } @@ -598,8 +567,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) @@ -618,24 +585,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; } @@ -780,11 +729,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; @@ -1082,13 +1026,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 8fbbc36162..a56c3f7a51 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -35,8 +35,9 @@ #include "lltrace.h" #include "lltracethreadrecorder.h" #include "llexception.h" +#include "fstelemetry.h" // allow thread naming -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include #endif @@ -140,7 +141,10 @@ void LLThread::threadRun() // for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread mRecorder = new LLTrace::ThreadRecorder(*LLTrace::get_master_thread_recorder()); - + // - Add threadnames to telemetry + LL_INFOS("THREAD") << "Started thread " << mName << LL_ENDL; + FSThreadName( mName.c_str() ); + // // Run the user supplied function do { 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 # include #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 #endif #include diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 447879ef24..be6edd8b7c 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -360,7 +360,7 @@ static BOOL isDefault(const std::string& scheme, U16 port) void LLURI::parseAuthorityAndPathUsingOpaque() { - if (mScheme == "http" || mScheme == "https" || mScheme == "hop" || mScheme == "inworldz" || mScheme == "iw" || + if (mScheme == "http" || mScheme == "https" || mScheme == "hop" || mScheme == "ftp" || mScheme == "secondlife" || mScheme == "x-grid-location-info") { diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index bcff0a8501..7ff040a602 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -602,9 +602,7 @@ S32 LLUUID::getNodeID(unsigned char *node_id) #define HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H #include -#if LL_SOLARIS -#include -#elif !LL_DARWIN +#if !LL_DARWIN #include #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/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index 930c16e2a8..0a1dd3a8d5 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -63,9 +63,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/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h index dda1f9082d..5e9ad015eb 100644 --- a/indra/llfilesystem/lldir.h +++ b/indra/llfilesystem/lldir.h @@ -27,11 +27,6 @@ #ifndef LL_LLDIR_H #define LL_LLDIR_H -#if LL_SOLARIS -#include -#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/llfilesystem/lldir_solaris.cpp b/indra/llfilesystem/lldir_solaris.cpp deleted file mode 100644 index f18560ff20..0000000000 --- a/indra/llfilesystem/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 -#include -#include -#include -#include -#include -#define _STRUCTURED_PROC 1 -#include -#include - -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/llfilesystem/lldir_solaris.h b/indra/llfilesystem/lldir_solaris.h deleted file mode 100644 index c6dac57e14..0000000000 --- a/indra/llfilesystem/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 -#include - -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/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 730a5500cf..9c7688870d 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -43,7 +43,9 @@ static const char* subdirs = "0123456789abcdef"; LLDiskCache::LLDiskCache(const std::string cache_dir, - const int max_size_bytes, + // Fix integer overflow + //const int max_size_bytes, + const uintmax_t max_size_bytes, const bool enable_cache_debug_info) : mCacheDir(cache_dir), mMaxSizeBytes(max_size_bytes), @@ -64,7 +66,7 @@ LLDiskCache::LLDiskCache(const std::string cache_dir, void LLDiskCache::purge() { - if (mEnableCacheDebugInfo) + //if (mEnableCacheDebugInfo) { LL_INFOS() << "Total dir size before purge is " << dirFileSize(mCacheDir) << LL_ENDL; } @@ -144,7 +146,7 @@ void LLDiskCache::purge() } } - if (mEnableCacheDebugInfo) + //if (mEnableCacheDebugInfo) { auto end_time = std::chrono::high_resolution_clock::now(); auto execute_time = std::chrono::duration_cast(end_time - start_time).count(); @@ -369,3 +371,27 @@ uintmax_t LLDiskCache::dirFileSize(const std::string dir) return total_file_size; } + +// Regular disk cache cleanup +FSPurgeDiskCacheThread::FSPurgeDiskCacheThread() : + LLThread("PurgeDiskCacheThread", nullptr) +{ +} + +void FSPurgeDiskCacheThread::run() +{ + constexpr F64 CHECK_INTERVAL = 60; + mTimer.setTimerExpirySec(CHECK_INTERVAL); + mTimer.start(); + + do + { + if (mTimer.checkExpirationAndReset(CHECK_INTERVAL)) + { + LLDiskCache::instance().purge(); + } + + ms_sleep(100); + } while (!isQuitting()); +} +// diff --git a/indra/llfilesystem/lldiskcache.h b/indra/llfilesystem/lldiskcache.h index d3eb91e2ad..42a02a68e4 100644 --- a/indra/llfilesystem/lldiskcache.h +++ b/indra/llfilesystem/lldiskcache.h @@ -86,7 +86,9 @@ class LLDiskCache : * The maximum size of the cache in bytes - Based on the * setting at 'CacheSize' and 'DiskCachePercentOfTotal' */ - const int max_size_bytes, + // Fix integer overflow + //const int max_size_bytes, + const uintmax_t max_size_bytes, /** * A flag that enables extra cache debugging so that * if there are bugs, we can ask uses to enable this @@ -141,6 +143,9 @@ class LLDiskCache : */ const std::string getCacheInfo(); + // Better asset cache size control + void setMaxSizeBytes(uintmax_t size) { mMaxSizeBytes = size; } + private: /** * Utility function to gather the total size the files in a given @@ -188,4 +193,17 @@ class LLDiskCache : bool mEnableCacheDebugInfo; }; +// Regular disk cache cleanup +class FSPurgeDiskCacheThread : public LLThread +{ +public: + FSPurgeDiskCacheThread(); + +protected: + void run() override; + +private: + LLTimer mTimer; +}; +// #endif // _LLDISKCACHE diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 6d3b7511a5..8e1d4f12b6 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -162,7 +162,9 @@ S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType fi BOOL LLFileSystem::read(U8* buffer, S32 bytes) { FSZoneC(tracy::Color::Gold); // measure cache performance - BOOL success = TRUE; + // Cache fixes + //BOOL success = TRUE; + BOOL success = FALSE; std::string id; mFileID.toString(id); @@ -197,14 +199,18 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes) LLFILE* file = LLFile::fopen(filename, "rb"); if (file) { - fseek(file, mPosition, SEEK_SET); - mBytesRead = fread(buffer, 1, bytes, file); - fclose(file); - - mPosition += mBytesRead; - if (!mBytesRead) + if (fseek(file, mPosition, SEEK_SET) == 0) { - success = FALSE; + mBytesRead = fread(buffer, 1, bytes, file); + fclose(file); + + mPosition += mBytesRead; + // It probably would be correct to check for mBytesRead == bytes, + // but that will break avatar rezzing... + if (mBytesRead) + { + success = TRUE; + } } } // @@ -295,10 +301,10 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes) LLFILE* ofs = LLFile::fopen(filename, "a+b"); if (ofs) { - fwrite(buffer, 1, bytes, ofs); + S32 bytes_written = fwrite(buffer, 1, bytes, ofs); mPosition = ftell(ofs); fclose(ofs); - success = TRUE; + success = (bytes_written == bytes); } } else if (mMode == READ_WRITE) @@ -306,21 +312,23 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes) LLFILE* ofs = LLFile::fopen(filename, "r+b"); if (ofs) { - fseek(ofs, mPosition, SEEK_SET); - fwrite(buffer, 1, bytes, ofs); - mPosition = ftell(ofs); - fclose(ofs); - success = TRUE; + if (fseek(ofs, mPosition, SEEK_SET) == 0) + { + S32 bytes_written = fwrite(buffer, 1, bytes, ofs); + mPosition = ftell(ofs); + fclose(ofs); + success = (bytes_written == bytes); + } } else { ofs = LLFile::fopen(filename, "wb"); if (ofs) { - fwrite(buffer, 1, bytes, ofs); + S32 bytes_written = fwrite(buffer, 1, bytes, ofs); mPosition = ftell(ofs); fclose(ofs); - success = TRUE; + success = (bytes_written == bytes); } } } @@ -329,10 +337,10 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes) LLFILE* ofs = LLFile::fopen(filename, "wb"); if (ofs) { - fwrite(buffer, 1, bytes, ofs); + S32 bytes_written = fwrite(buffer, 1, bytes, ofs); mPosition = ftell(ofs); fclose(ofs); - success = TRUE; + success = (bytes_written == bytes); } } // diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 84b03a9e06..468140e408 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -25,17 +25,104 @@ */ #include "linden_common.h" - +#include "fstelemetry.h" // add telemetry support. #include "llimageworker.h" #include "llimagedxt.h" + // Image thread pool from CoolVL +#include "boost/thread.hpp" +std::atomic< U32 > s_ChildThreads; + +class PoolWorkerThread : public LLThread +{ +public: + PoolWorkerThread(std::string name) : LLThread(name), + mCurrentRequest(NULL) + { + } + virtual void run() + { + while (!isQuitting()) + { + auto *pReq = mCurrentRequest.exchange(nullptr); + + if (pReq) + pReq->processRequestIntern(); + checkPause(); + } + } + bool isBusy() + { + auto *pReq = mCurrentRequest.load(); + if (!pReq) + return false; + + auto status = pReq->getStatus(); + + return status == LLQueuedThread::STATUS_QUEUED || status == LLQueuedThread::STATUS_INPROGRESS; + } + + bool runCondition() + { + return mCurrentRequest != NULL; + } + + bool setRequest(LLImageDecodeThread::ImageRequest* req) + { + LLImageDecodeThread::ImageRequest* pOld{ nullptr }; + bool bSuccess = mCurrentRequest.compare_exchange_strong(pOld, req); + wake(); + + return bSuccess; + } + +private: + std::atomic< LLImageDecodeThread::ImageRequest * > mCurrentRequest; +}; +// + //---------------------------------------------------------------------------- // MAIN THREAD -LLImageDecodeThread::LLImageDecodeThread(bool threaded) +LLImageDecodeThread::LLImageDecodeThread(bool threaded, U32 aSubThreads) : LLQueuedThread("imagedecode", threaded) { mCreationMutex = new LLMutex(); + + // Image thread pool from CoolVL + if (aSubThreads == 0) + { + aSubThreads = boost::thread::hardware_concurrency(); + if (!aSubThreads) + aSubThreads = 4U; // Use a sane default: 4 cores + if (aSubThreads > 8U) + { + // Using number of (virtual) cores - 1 (for the main image worker + // thread) - 1 (for the viewer main loop thread), further bound to + // a maximum of 32 threads (more than that is totally useless, even + // when flying over main land with 512m draw distance). + aSubThreads = llmin(aSubThreads - 2U, 32U); + } + else if (aSubThreads > 2U) + { + // Using number of (virtual) cores - 1 (for the main image worker + // thread). + --aSubThreads; + } + } + else if (aSubThreads == 1) // Disable if only 1 + aSubThreads = 0; + + s_ChildThreads = aSubThreads; + for (U32 i = 0; i < aSubThreads; ++i) + { + std::stringstream strm; + strm << "imagedecodethread" << (i + 1); + + mThreadPool.push_back(std::make_shared< PoolWorkerThread>(strm.str())); + mThreadPool[i]->start(); + } + // } //virtual @@ -48,14 +135,22 @@ LLImageDecodeThread::~LLImageDecodeThread() // virtual S32 LLImageDecodeThread::update(F32 max_time_ms) { + FSZoneC(tracy::Color::Blue); // instrument image decodes LLMutexLock lock(mCreationMutex); + // instrument image decodes + { + FSZoneC(tracy::Color::Blue1); + // for (creation_list_t::iterator iter = mCreationList.begin(); iter != mCreationList.end(); ++iter) { creation_info& info = *iter; + // ImageRequest* req = new ImageRequest(info.handle, info.image, + // info.priority, info.discard, info.needs_aux, + // info.responder); ImageRequest* req = new ImageRequest(info.handle, info.image, - info.priority, info.discard, info.needs_aux, - info.responder); + info.priority, info.discard, info.needs_aux, + info.responder, this); bool res = addRequest(req); if (!res) @@ -65,16 +160,49 @@ S32 LLImageDecodeThread::update(F32 max_time_ms) } } mCreationList.clear(); + // instrument image decodes + } + { + FSZoneC(tracy::Color::Blue2); + // S32 res = LLQueuedThread::update(max_time_ms); + // FSPlot("img_decode_pending", (int64_t)res); // instrument image decodes return res; + } // instrument image decodes } LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(LLImageFormatted* image, U32 priority, S32 discard, BOOL needs_aux, Responder* responder) { - LLMutexLock lock(mCreationMutex); + FSZoneC(tracy::Color::Orange); // instrument the image decode pipeline + // De-couple texture threading from mainloop + // LLMutexLock lock(mCreationMutex); + // handle_t handle = generateHandle(); + // mCreationList.push_back(creation_info(handle, image, priority, discard, needs_aux, responder)); handle_t handle = generateHandle(); - mCreationList.push_back(creation_info(handle, image, priority, discard, needs_aux, responder)); + // If we have a thread pool dispatch this directly. + // Note: addRequest could cause the handling to take place on the fetch thread, this is unlikely to be an issue. + // if this is an actual problem we move the fallback to here and place the unfulfilled request into the legacy queue + if (s_ChildThreads > 0) + { + FSZoneNC("DecodeDecoupled", tracy::Color::Orange); // instrument the image decode pipeline + ImageRequest* req = new ImageRequest(handle, image, + priority, discard, needs_aux, + responder, this); + bool res = addRequest(req); + if (!res) + { + LL_WARNS() << "Decode request not added because we are exiting." << LL_ENDL; + return 0; + } + } + else + { + FSZoneNC("DecodeQueued", tracy::Color::Orange); // instrument the image decode pipeline + LLMutexLock lock(mCreationMutex); + mCreationList.push_back(creation_info(handle, image, priority, discard, needs_aux, responder)); + } + // return handle; } @@ -95,15 +223,21 @@ LLImageDecodeThread::Responder::~Responder() LLImageDecodeThread::ImageRequest::ImageRequest(handle_t handle, LLImageFormatted* image, U32 priority, S32 discard, BOOL needs_aux, - LLImageDecodeThread::Responder* responder) + LLImageDecodeThread::Responder* responder, + LLImageDecodeThread *aQueue) : LLQueuedThread::QueuedRequest(handle, priority, FLAG_AUTO_COMPLETE), mFormattedImage(image), mDiscardLevel(discard), mNeedsAux(needs_aux), mDecodedRaw(FALSE), mDecodedAux(FALSE), - mResponder(responder) + mResponder(responder), + mQueue( aQueue ) // Image thread pool from CoolVL { + // Image thread pool from CoolVL + if (s_ChildThreads > 0) + mFlags |= FLAG_ASYNC; + // } LLImageDecodeThread::ImageRequest::~ImageRequest() @@ -119,10 +253,34 @@ LLImageDecodeThread::ImageRequest::~ImageRequest() // Returns true when done, whether or not decode was successful. bool LLImageDecodeThread::ImageRequest::processRequest() { - const F32 decode_time_slice = .1f; + // Image thread pool from CoolVL + + // If not async, decode using this thread + if ((mFlags & FLAG_ASYNC) == 0) + return processRequestIntern(); + + // Try to dispatch to a new thread, if this isn't possible decode on this thread + if (!mQueue->enqueRequest(this)) + return processRequestIntern(); + return true; + // +} + +bool LLImageDecodeThread::ImageRequest::processRequestIntern() +{ + // allow longer timeout for async and add instrumentation + // const F32 decode_time_slice = .1f; + FSZoneC(tracy::Color::DarkOrange); + F32 decode_time_slice = .1f; + if(mFlags & FLAG_ASYNC) + { + decode_time_slice = 10.0f;// long time out as this is not an issue with async + } + // bool done = true; if (!mDecodedRaw && mFormattedImage.notNull()) { + FSZoneC(tracy::Color::DarkOrange1); // instrument the image decode pipeline // Decode primary channels if (mDecodedImageRaw.isNull()) { @@ -161,6 +319,7 @@ bool LLImageDecodeThread::ImageRequest::processRequest() } if (done && mNeedsAux && !mDecodedAux && mFormattedImage.notNull()) { + FSZoneC(tracy::Color::DarkOrange2); // instrument the image decode pipeline // Decode aux channel if (!mDecodedImageAux) { @@ -171,7 +330,21 @@ bool LLImageDecodeThread::ImageRequest::processRequest() done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms mDecodedAux = done && mDecodedImageAux->getData(); } - + // report timeout on async thread (which leads to worker abort errors) + if(!done) + { + LL_WARNS("ImageDecode") << "Image decoding failed to complete with time slice=" << decode_time_slice << LL_ENDL; + } + // + // Image thread pool from CoolVL + if (mFlags & FLAG_ASYNC) + { + setStatus(STATUS_COMPLETE); + finishRequest(true); + // always autocomplete + mQueue->completeRequest(mHashKey); + } + // return done; } @@ -191,3 +364,16 @@ bool LLImageDecodeThread::ImageRequest::tut_isOK() { return mResponder.notNull(); } + +bool LLImageDecodeThread::enqueRequest(ImageRequest * req) +{ + for (auto &pThread : mThreadPool) + { + if (!pThread->isBusy()) + { + if( pThread->setRequest(req) ) + return true; + } + } + return false; +} diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h index 1bfb0ddfd3..6104413700 100644 --- a/indra/llimage/llimageworker.h +++ b/indra/llimage/llimageworker.h @@ -31,6 +31,9 @@ #include "llpointer.h" #include "llworkerthread.h" + // Image thread pool +class PoolWorkerThread; + class LLImageDecodeThread : public LLQueuedThread { public: @@ -50,9 +53,10 @@ public: public: ImageRequest(handle_t handle, LLImageFormatted* image, U32 priority, S32 discard, BOOL needs_aux, - LLImageDecodeThread::Responder* responder); + LLImageDecodeThread::Responder* responder, LLImageDecodeThread *aQueue); /*virtual*/ bool processRequest(); + bool processRequestIntern(); /*virtual*/ void finishRequest(bool completed); // Used by unit tests to check the consitency of the request instance @@ -66,13 +70,18 @@ public: // output LLPointer mDecodedImageRaw; LLPointer mDecodedImageAux; + LLImageDecodeThread * mQueue; // Image thread pool from CoolVL BOOL mDecodedRaw; BOOL mDecodedAux; LLPointer mResponder; }; public: - LLImageDecodeThread(bool threaded = true); + // Image thread pool from CoolVL + //LLImageDecodeThread(bool threaded = true); + LLImageDecodeThread(bool threaded = true, U32 aSubThreads = 0 ); + // + virtual ~LLImageDecodeThread(); handle_t decodeImage(LLImageFormatted* image, @@ -99,6 +108,11 @@ private: typedef std::list creation_list_t; creation_list_t mCreationList; LLMutex* mCreationMutex; + + // Image thread pool from CoolVL + std::vector< std::shared_ptr< PoolWorkerThread > > mThreadPool; + bool enqueRequest(ImageRequest*); + // }; #endif diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 78d1e0313b..f46bcacb64 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -25,13 +25,16 @@ */ #include "linden_common.h" +#include "fstelemetry.h" // instrument image decodes #include "llimagej2coj.h" +#define OPENJPEG2 // this is defined so that we get static linking. #include "openjpeg.h" +#ifndef OPENJPEG2 #include "cio.h" +#endif #include "event.h" -#define OPENJPEG2 #include "lltimer.h" @@ -177,9 +180,13 @@ std::string LLImageJ2COJ::getEngineInfo() const + opj_version(); #elif defined OPJ_PACKAGE_VERSION return std::string("OpenJPEG: " OPJ_PACKAGE_VERSION ", Runtime: ") + opj_version(); +#else +#ifdef OPENJPEG2 + return llformat("OpenJPEG: %i.%i.%i, Runtime: %s", OPJ_VERSION_MAJOR, OPJ_VERSION_MINOR, OPJ_VERSION_BUILD, opj_version()); #else return std::string("OpenJPEG Runtime: ") + opj_version(); #endif +#endif } // Return string from message, eliminating final \n if present @@ -252,10 +259,11 @@ bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int block bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { // texture comment metadata reader + FSZone; // instrument image decodes U8* c_data = base.getData(); S32 c_size = base.getDataSize(); S32 position = 0; - + while (position < 1024 && position < (c_size - 7)) // the comment field should be in the first 1024 bytes. { if (c_data[position] == 0xff && c_data[position + 1] == 0x64) diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index 300a60c551..e1e7863cca 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -32,7 +32,7 @@ #include "llpointer.h" #include "llmath.h" #include "llkdumem.h" - +#include "fstelemetry.h" // instrument image decodes #define kdu_xxxx "kdu_block_coding.h" #include "include_kdu_xxxx.h" @@ -287,6 +287,7 @@ void transfer_bytes(kdu_byte *dest, kdu_line_buf &src, int gap, int precision); // as well, when that still existed, with keep_codestream true and MODE_FAST. void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode) { + FSZone; // instrument image decodes S32 data_size = base.getDataSize(); S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); @@ -436,6 +437,7 @@ bool LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int bloc // decodeImpl() usage matters for production. bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level, int* region) { + FSZone; // instrument image decodes base.resetLastError(); // *FIX: kdu calls our callback function if there's an error, and then bombs. @@ -519,6 +521,7 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco // Returns true to mean done, whether successful or not. bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { + FSZone; // instrument image decodes ECodeStreamMode mode = MODE_FAST; LLTimer decode_timer; diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index eda2d0ba68..9a278c580b 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::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 // for htonl -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #elif LL_DARWIN # include diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h index 085757dcbc..8154a6358f 100644 --- a/indra/llmessage/llregionhandle.h +++ b/indra/llmessage/llregionhandle.h @@ -39,6 +39,29 @@ inline U64 to_region_handle(const U32 x_origin, const U32 y_origin) return region_handle; } +// FIRE-30534 Overload that takes explicit region origin and width to improve Var Region identification. +inline U64 to_region_handle(const LLVector3d& pos_global, const LLVector3d& agent_region_origin, const F32 width) +{ + U32 global_x { static_cast( pos_global.mdV[VX] ) }; + U32 global_y { static_cast( pos_global.mdV[VY] ) }; + + U32 agent_region_origin_x { static_cast( agent_region_origin.mdV[VX] ) }; + U32 agent_region_origin_y { static_cast( agent_region_origin.mdV[VY] ) }; + + if( agent_region_origin_x < global_x && ( agent_region_origin_x + width ) > global_x && + agent_region_origin_y < global_y && ( agent_region_origin_y + width ) > global_y ) + { + // target is local to current region we can make a more informed guess + return to_region_handle( agent_region_origin_x, agent_region_origin_y ); + } + // fallback to legacy 256m tile-based guess and let the region server / map work it out. + global_x -= global_x % 256; + global_y -= global_y % 256; + + return to_region_handle( global_x, global_y ); +} +// + inline U64 to_region_handle(const LLVector3d& pos_global) { U32 global_x = (U32)pos_global.mdV[VX]; diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index c476bdd242..345075fd3d 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -35,10 +35,6 @@ #include #endif -#if LL_SOLARIS -#include -#endif - #if LL_WINDOWS #include "winsock2.h" // htons etc. #endif diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index a1bfc4edd9..a219ac1450 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -28,8 +28,6 @@ #include "llmaterial.h" -#include "../llrender/llglheaders.h" - /** * Materials cap parameters */ @@ -107,8 +105,6 @@ LLMaterial::LLMaterial() , mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT) , mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY) , mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) - , mDiffuseFormatPrimary(GL_RGBA) - , mDiffuseBaked(false) , mAlphaMaskCutoff(0) { } @@ -315,20 +311,6 @@ void LLMaterial::setEnvironmentIntensity(U8 intensity) mEnvironmentIntensity = intensity; } -U8 LLMaterial::getDiffuseAlphaModeRender() const -{ - if (mDiffuseBaked - || mDiffuseFormatPrimary == GL_RGBA - || mDiffuseFormatPrimary == GL_ALPHA) - { - return mDiffuseAlphaMode; - } - else - { - return DIFFUSE_ALPHA_MODE_NONE; - } -} - U8 LLMaterial::getDiffuseAlphaMode() const { return mDiffuseAlphaMode; @@ -339,26 +321,6 @@ void LLMaterial::setDiffuseAlphaMode(U8 alpha_mode) mDiffuseAlphaMode = alpha_mode; } -U32 LLMaterial::getDiffuseFormatPrimary() const -{ - return mDiffuseFormatPrimary; -} - -void LLMaterial::setDiffuseFormatPrimary(U32 format_primary) -{ - mDiffuseFormatPrimary = format_primary; -} - -bool LLMaterial::getIsDiffuseBaked() const -{ - return mDiffuseBaked; -} - -void LLMaterial::setDiffuseBaked(bool baked) -{ - mDiffuseBaked = baked; -} - U8 LLMaterial::getAlphaMaskCutoff() const { return mAlphaMaskCutoff; @@ -475,7 +437,7 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode) } else { - ret = getDiffuseAlphaModeRender(); + ret = getDiffuseAlphaMode(); } llassert(ret < SHADER_COUNT); diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index 1207917568..d58b7ee812 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -115,17 +115,8 @@ public: void setSpecularLightExponent(U8 exponent); U8 getEnvironmentIntensity() const; void setEnvironmentIntensity(U8 intensity); - - // getDiffuseAlphaModeRender takes into account if image supports alpha - // and returns value apropriate for render - // getDiffuseAlphaMode() returns value as is - U8 getDiffuseAlphaModeRender() const; U8 getDiffuseAlphaMode() const; void setDiffuseAlphaMode(U8 alpha_mode); - U32 getDiffuseFormatPrimary() const; - void setDiffuseFormatPrimary(U32 format_primary); - bool getIsDiffuseBaked() const; - void setDiffuseBaked(bool baked); U8 getAlphaMaskCutoff() const; void setAlphaMaskCutoff(U8 cutoff); @@ -156,8 +147,6 @@ protected: U8 mSpecularLightExponent; U8 mEnvironmentIntensity; U8 mDiffuseAlphaMode; - U32 mDiffuseFormatPrimary; // value from texture, LLGLenum, is not included in fromLLSD/asLLSD - bool mDiffuseBaked; // is not included in fromLLSD/asLLSD U8 mAlphaMaskCutoff; }; diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index a2596335c2..ef008e0a81 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1220,7 +1220,13 @@ bool LLModel::isMaterialListSubset( LLModel* ref ) { int refCnt = ref->mMaterialList.size(); int modelCnt = mMaterialList.size(); - + // FIRE-30965 Cleanup braindead mesh parsing error handlers + if(modelCnt > refCnt) + { + // this model cannot be a strict subset if it has more materials than the reference + return FALSE; + } + // for (U32 src = 0; src < modelCnt; ++src) { bool foundRef = false; @@ -1264,77 +1270,80 @@ bool LLModel::needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt ) return changed; } -bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt ) -{ - //Is this a subset? - //LODs cannot currently add new materials, e.g. - //1. ref = a,b,c lod1 = d,e => This is not permitted - //2. ref = a,b,c lod1 = c => This would be permitted +// FIRE-30965 Improve mesh upload error handling +// function moved to llmodelpreview +// bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt ) +// { +// //Is this a subset? +// //LODs cannot currently add new materials, e.g. +// //1. ref = a,b,c lod1 = d,e => This is not permitted +// //2. ref = a,b,c lod1 = c => This would be permitted - bool isASubset = isMaterialListSubset( ref ); - if ( !isASubset ) - { - LL_INFOS("MESHSKININFO")<<"Material of model is not a subset of reference."< ref->mMaterialList.size()) - { - LL_INFOS("MESHSKININFO") << "Material of model has more materials than a reference." << LL_ENDL; - // We passed isMaterialListSubset, so materials are a subset, but subset isn't supposed to be - // larger than original and if we keep going, reordering will cause a crash - return false; - } +// if (mMaterialList.size() > ref->mMaterialList.size()) +// { +// LL_INFOS("MESHSKININFO") << "Material of model has more materials than a reference." << LL_ENDL; +// // We passed isMaterialListSubset, so materials are a subset, but subset isn't supposed to be +// // larger than original and if we keep going, reordering will cause a crash +// return false; +// } - std::map index_map; +// std::map index_map; - //build a map of material slot names to face indexes - bool reorder = false; +// //build a map of material slot names to face indexes +// bool reorder = false; - std::set base_mat; - std::set cur_mat; +// std::set base_mat; +// std::set cur_mat; - for (U32 i = 0; i < mMaterialList.size(); i++) - { - index_map[ref->mMaterialList[i]] = i; - //if any material name does not match reference, we need to reorder - reorder |= ref->mMaterialList[i] != mMaterialList[i]; - base_mat.insert(ref->mMaterialList[i]); - cur_mat.insert(mMaterialList[i]); - } +// for (U32 i = 0; i < mMaterialList.size(); i++) +// { +// index_map[ref->mMaterialList[i]] = i; +// //if any material name does not match reference, we need to reorder +// reorder |= ref->mMaterialList[i] != mMaterialList[i]; +// base_mat.insert(ref->mMaterialList[i]); +// cur_mat.insert(mMaterialList[i]); +// } - if (reorder && (base_mat == cur_mat)) //don't reorder if material name sets don't match - { - std::vector new_face_list; - new_face_list.resize(mMaterialList.size()); +// if (reorder && (base_mat == cur_mat)) //don't reorder if material name sets don't match +// { +// std::vector new_face_list; +// new_face_list.resize(mMaterialList.size()); - std::vector new_material_list; - new_material_list.resize(mMaterialList.size()); +// std::vector new_material_list; +// new_material_list.resize(mMaterialList.size()); - //rebuild face list so materials have the same order - //as the reference model - for (U32 i = 0; i < mMaterialList.size(); ++i) - { - U32 ref_idx = index_map[mMaterialList[i]]; +// //rebuild face list so materials have the same order +// //as the reference model +// for (U32 i = 0; i < mMaterialList.size(); ++i) +// { +// U32 ref_idx = index_map[mMaterialList[i]]; - if (i < mVolumeFaces.size()) - { - new_face_list[ref_idx] = mVolumeFaces[i]; - } - new_material_list[ref_idx] = mMaterialList[i]; - } +// if (i < mVolumeFaces.size()) +// { +// new_face_list[ref_idx] = mVolumeFaces[i]; +// } +// new_material_list[ref_idx] = mMaterialList[i]; +// } - llassert(new_material_list == ref->mMaterialList); +// llassert(new_material_list == ref->mMaterialList); - mVolumeFaces = new_face_list; +// mVolumeFaces = new_face_list; - //override material list with reference model ordering - mMaterialList = ref->mMaterialList; - } +// //override material list with reference model ordering +// mMaterialList = ref->mMaterialList; +// } - return true; -} +// return true; +// } +// bool LLModel::loadSkinInfo(LLSD& header, std::istream &is) { diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index c2a5389b6c..d77a13f145 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -187,7 +187,7 @@ public: //reorder face list based on mMaterialList in this and reference so //order matches that of reference (material ordering touchup) - bool matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt ); + // bool matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt ); // FIRE-30965 error handling improvements (function relocated) bool isMaterialListSubset( LLModel* ref ); bool needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt ); diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index a67c39252c..20278dcdb5 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -87,7 +87,7 @@ public: DONE, WARNING_BIND_SHAPE_ORIENTATION, ERROR_PARSING, //basically loading failed - ERROR_MATERIALS, + ERROR_MATERIALS_NOT_A_SUBSET, // FIRE-30965 - better error differentiation ERROR_PASSWORD_REQUIRED, ERROR_NEED_MORE_MEMORY, ERROR_INVALID_FILE, @@ -95,6 +95,8 @@ public: ERROR_INVALID_PARAMETERS, ERROR_OUT_OF_RANGE, ERROR_FILE_VERSION_INVALID, + ERROR_LOD_MODEL_MISMATCH, // clean up and improve error reporting + ERROR_HIGH_LOD_MODEL_MISSING, // clean up and improve error reporting ERROR_MODEL // this error should always be last in this list, error code is passed as ERROR_MODEL+error_code } eLoadState; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 45a11f1b85..7277717206 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -151,7 +151,7 @@ LLMatrix4 gGLObliqueProjectionInverse; std::list 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), @@ -859,10 +857,6 @@ bool LLGLManager::initGL() stop_glerror(); - setToDebugGPU(); - - stop_glerror(); - initGLStates(); stop_glerror(); @@ -870,17 +864,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) @@ -1037,7 +1020,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; @@ -1172,7 +1154,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. @@ -1242,7 +1224,7 @@ void LLGLManager::initExtensions() if (strchr(blacklist,'u')) mHasDepthClamp = FALSE; } -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX if (!mHasMultitexture) { @@ -1320,7 +1302,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) { @@ -1419,7 +1401,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) @@ -2780,8 +2762,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 f1b63b9f28..9aa8b704be 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -152,9 +152,6 @@ public: // Misc extensions BOOL mHasSeparateSpecularColor; - //whether this GPU is in the debug list. - BOOL mDebugGPU; - S32 mDriverVersionMajor; S32 mDriverVersionMinor; S32 mDriverVersionRelease; @@ -188,7 +185,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 6fcc99a78e..27adc67d68 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 d436173886..d2a398316f 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; @@ -400,16 +404,28 @@ BOOL LLGLSLShader::createShader(std::vector * 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 >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -493,11 +509,36 @@ BOOL LLGLSLShader::createShader(std::vector * 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; } @@ -514,6 +555,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; } @@ -530,6 +574,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 975160ee72..8241152b6e 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -874,11 +874,10 @@ void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) } } else -// #endif // Colour space and shader fixes for BUG-228586 (Rye) { glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); } -#endif // Colour space and shader fixes for BUG-228586 (Rye) +#endif } LLLightState::LLLightState(S32 index) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 1deef703ff..5d4d41fc45 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -617,13 +617,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()) @@ -972,55 +970,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 518cba001f..23485a2fe8 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -36,234 +36,237 @@ 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, + // 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, - GLOW_MAX_EXTRACT_ALPHA, - GLOW_LUM_WEIGHTS, - GLOW_WARMTH_WEIGHTS, - GLOW_WARMTH_AMOUNT, - GLOW_STRENGTH, - GLOW_DELTA, + 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, - EMISSIVE_BRIGHTNESS, + MINIMUM_ALPHA, // "minimum_alpha" + EMISSIVE_BRIGHTNESS, // "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, + 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, - FXAA_RCP_SCREEN_RES, - FXAA_RCP_FRAME_OPT, - FXAA_RCP_FRAME_OPT2, + 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, - DOF_BLUR_CONSTANT, - DOF_TAN_PIXEL_ANGLE, - DOF_MAGNIFICATION, - DOF_MAX_COF, - DOF_RES_SCALE, - DOF_WIDTH, - DOF_HEIGHT, + 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, - 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, - -// Import Vignette from Exodus - EXO_RENDER_VIGNETTE, - EXO_RENDER_SCREEN, -// Import Vignette from Exodus + 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" - 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, -// [RLVa:KB] - @setsphere - RLV_EFFECT_MODE, - RLV_EFFECT_PARAM1, - RLV_EFFECT_PARAM2, - RLV_EFFECT_PARAM3, - RLV_EFFECT_PARAM4, - RLV_EFFECT_PARAM5, -// [/RLVa:KB] + AVATAR_MATRIX, // "matrixPalette" + AVATAR_TRANSLATION, // "translationPalette" - AVATAR_WIND, - AVATAR_SINWAVE, - AVATAR_GRAVITY, + // Import Vignette from Exodus + EXO_RENDER_VIGNETTE, // "exo_vignette" + EXO_RENDER_SCREEN, // "exo_screen" + // Import Vignette from Exodus - TERRAIN_DETAIL0, - TERRAIN_DETAIL1, - TERRAIN_DETAIL2, - TERRAIN_DETAIL3, - TERRAIN_ALPHARAMP, - - SHINY_ORIGIN, - DISPLAY_GAMMA, + 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" - INSCATTER_RT, - SUN_SIZE, - FOG_COLOR, + WL_CAMPOSLOCAL, // "camPosLocal" + + // [RLVa:KB] - @setsphere + RLV_EFFECT_MODE, // "rlvEffectMode" + RLV_EFFECT_PARAM1, // "rlvEffectParam1" + RLV_EFFECT_PARAM2, // "rlvEffectParam2" + RLV_EFFECT_PARAM3, // "rlvEffectParam3" + RLV_EFFECT_PARAM4, // "rlvEffectParam4" + RLV_EFFECT_PARAM5, // "rlvEffectParam5" + // [/RLVa:KB] + + 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, + 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, - MOISTURE_LEVEL, - DROPLET_RADIUS, - ICE_LEVEL, - RAINBOW_MAP, - HALO_MAP, + 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, // "moon_brightness" - CLOUD_VARIANCE, + CLOUD_VARIANCE, // "cloud_variance" - SH_INPUT_L1R, - SH_INPUT_L1G, - SH_INPUT_L1B, + SH_INPUT_L1R, // "sh_input_r" + SH_INPUT_L1G, // "sh_input_g" + SH_INPUT_L1B, // "sh_input_b" - SUN_MOON_GLOW_FACTOR, - WATER_EDGE_FACTOR, - SUN_UP_FACTOR, - MOONLIGHT_COLOR, - END_RESERVED_UNIFORMS - } eGLSLReservedUniforms; + 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 273c3cd066..9ef3d93daf 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -157,9 +157,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 @@ -167,24 +166,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< hop:// protocol> //#define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))" -#define APP_HEADER_REGEX "(((hop|x-grid-location-info)://[-\\w\\.\\:\\@]+/app)|((hop|secondlife|inworldz|iw):///app))" +#define APP_HEADER_REGEX "(((hop|x-grid-location-info)://[-\\w\\.\\:\\@]+/app)|((hop|secondlife):///app))" // // Utility functions @@ -354,9 +354,8 @@ std::string LLUrlEntryHTTPNoProtocol::getTooltip(const std::string &url) const LLUrlEntryInvalidSLURL::LLUrlEntryInvalidSLURL() : LLUrlEntryBase() { - // Inworldz special - //mPattern = boost::regex("(http://(maps.secondlife.com|slurl.com)/secondlife/|secondlife://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", - mPattern = boost::regex("(https?://(maps.secondlife.com|slurl.com)/secondlife/|(secondlife|inworldz|iw)://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", + // remove legacy Inworldz URI support. restore previous with addition of https + mPattern = boost::regex("(https?://(maps.secondlife.com|slurl.com)/secondlife/|secondlife://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_http.xml"; mTooltip = LLTrans::getString("TooltipHttpUrl"); @@ -1099,7 +1098,7 @@ LLUrlEntryObjectIM::LLUrlEntryObjectIM() { // hop:// protocol; Ansa: Stop at first space so we can use it in notifications! //mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\?\\S*\\w", - mPattern = boost::regex("(hop|secondlife|inworldz|iw):///app/objectim/[\\da-f-]+\?[^ \t\r\n\v\f]*", + mPattern = boost::regex("(hop|secondlife):///app/objectim/[\\da-f-]+\?[^ \t\r\n\v\f]*", // boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_objectim.xml"; @@ -1228,9 +1227,7 @@ void LLUrlEntryParcel::processParcelInfo(const LLParcelData& parcel_data) // LLUrlEntryPlace::LLUrlEntryPlace() { - // Inworldz special - //mPattern = boost::regex("((hop://[-\\w\\.\\:\\@]+/)|((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://)))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?", // - mPattern = boost::regex("((hop://[-\\w\\.\\:\\@]+/)|((x-grid-location-info://[-\\w\\.]+/region/)|((secondlife|inworldz|iw)://)))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?", // + mPattern = boost::regex("((hop://[-\\w\\.\\:\\@]+/)|((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://)))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?", // boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_slurl.xml"; mTooltip = LLTrans::getString("TooltipSLURL"); @@ -1413,7 +1410,7 @@ std::string LLUrlEntryTeleport::getLocation(const std::string &url) const /// FSUrlEntryWear::FSUrlEntryWear() { - mPattern = boost::regex("(hop|secondlife|inworldz|iw):///app/wear_folder/\\S+", + mPattern = boost::regex("(hop|secondlife):///app/wear_folder/\\S+", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_slapp.xml"; mTooltip = LLTrans::getString("TooltipFSUrlEntryWear"); @@ -1431,7 +1428,7 @@ std::string FSUrlEntryWear::getLabel(const std::string &url, const LLUrlLabelCal // LLUrlEntrySL::LLUrlEntrySL() { - mPattern = boost::regex("(hop|secondlife|inworldz|iw)://(\\w+)?(:\\d+)?/\\S+", // + mPattern = boost::regex("(hop|secondlife)://(\\w+)?(:\\d+)?/\\S+", // boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_slapp.xml"; mTooltip = LLTrans::getString("TooltipSLAPP"); @@ -1449,7 +1446,7 @@ std::string LLUrlEntrySL::getLabel(const std::string &url, const LLUrlLabelCallb /// FSHelpDebugUrlEntrySL::FSHelpDebugUrlEntrySL() { - mPattern = boost::regex("(hop|secondlife|inworldz|iw):///app/fshelp/showdebug/\\S+", + mPattern = boost::regex("(hop|secondlife):///app/fshelp/showdebug/\\S+", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_slapp.xml"; mTooltip = LLTrans::getString("TooltipFSHelpDebugSLUrl"); @@ -1468,7 +1465,7 @@ std::string FSHelpDebugUrlEntrySL::getLabel(const std::string &url, const LLUrlL // LLUrlEntrySLLabel::LLUrlEntrySLLabel() { - mPattern = boost::regex("\\[(hop|secondlife|inworldz|iw)://\\S+[ \t]+[^\\]]+\\]", // + mPattern = boost::regex("\\[(hop|secondlife)://\\S+[ \t]+[^\\]]+\\]", // boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_slapp.xml"; mTooltip = LLTrans::getString("TooltipSLAPP"); diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 52b48017ee..c6c9eff376 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -51,14 +51,14 @@ 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 # include # include # include -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX extern BOOL gDebugWindowProc; @@ -332,12 +332,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' @@ -418,7 +412,6 @@ static int x11_detect_VRAM_kb() } } return rtn; -#endif // LL_SOLARIS } #endif // LL_X11 @@ -507,27 +500,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? @@ -705,25 +681,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", @@ -2547,7 +2511,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) @@ -2626,7 +2590,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) { @@ -2645,7 +2609,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 42f282ae45..d2d24bb730 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -748,6 +748,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 @@ -1517,6 +1548,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO S32 swap_method = 0; S32 cur_format = 0; +const S32 max_format = (S32)num_formats - 1; GLint swap_query = WGL_SWAP_METHOD_ARB; // SL-14705 Fix name tags showing in front of objects with AMD GPUs. @@ -1529,7 +1561,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO { break; } - else if (cur_format >= (S32)(num_formats - 1)) + else if (cur_format >= max_format) { cur_format = 0; break; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c5e837b6c9..25f98792c3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -698,6 +698,7 @@ set(viewer_SOURCE_FILES llsyntaxid.cpp llsyswellitem.cpp llsyswellwindow.cpp + lltelemetry.cpp llteleporthistory.cpp llteleporthistorystorage.cpp lltextureatlas.cpp diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 427dc381ad..e786022da5 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -6.4.19 +6.4.20 diff --git a/indra/newview/app_settings/graphic_preset_controls.xml b/indra/newview/app_settings/graphic_preset_controls.xml index 303463aa3c..8ecfbc38ee 100644 --- a/indra/newview/app_settings/graphic_preset_controls.xml +++ b/indra/newview/app_settings/graphic_preset_controls.xml @@ -7,7 +7,6 @@ CameraFocusTransitionTime CameraFNumber FramePerSecondLimit - FSAllowWaterDistortionOcclusion FSDynamicTextureMemory FSDynamicTextureMemoryCacheReserve FSDynamicTextureMemoryGPUReserve diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3793235013..a4fd32d451 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -166,17 +166,6 @@ Backup 0 - OpensimPrefsAddGrid - - Comment - Transient string for adding new grids in Preferences > Opensim - Persist - 0 - Type - String - Value - - FSShowDummyAVsinRadar Comment @@ -2919,7 +2908,7 @@ Value 23 - EnableCacheDebugInfo + EnableDiskCacheDebugInfo Comment When set, display additional cache debugging information @@ -2933,7 +2922,7 @@ DiskCachePercentOfTotal Comment - The percent of total cache size (defined by CacheSize) to use for the disk cache + The percent of total cache size (defined by CacheSize) to use for the disk cache (UNUSED) Persist 1 Type @@ -2952,6 +2941,17 @@ Value cache + FSDiskCacheSize + + Comment + Controls amount of hard drive space reserved for local asset caching in MB + Persist + 1 + Type + U32 + Value + 2048 + CacheLocation Comment @@ -2988,7 +2988,7 @@ CacheSize Comment - Controls amount of hard drive space reserved for local file caching in MB + Controls amount of hard drive space reserved for local texture caching in MB Persist 1 Type @@ -9007,7 +9007,7 @@ Value 1 - MemoryFailurePreventionEnabled + MemoryFailurePreventionEnabled Comment If set, the viewer will try to throttle memory allocations when memory is low (32bit systems only) @@ -9388,6 +9388,17 @@ Value salt_and_pepper.jpg + FSPhysicsPresetUser1 + + Comment + full system path to a user provided physics mesh (DAE). + Persist + 1 + Type + String + Value + + MigrateCacheDirectory Comment @@ -11978,7 +11989,7 @@ Change of this parameter will affect the layout of buttons in notification toast Type F32 Value - 0.03 + 0.1 RenderDebugPipeline @@ -25562,17 +25573,6 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 - FSAllowWaterDistortionOcclusion - - Comment - If allowed, object occlusion setting will be restored for generating the water reflection distortion. This was allowed pre-EEP and got disabled for EEP. While generating is more exact without occlusion, it can cause a huge performance impact. - Persist - 1 - Type - Boolean - Value - 0 - FSDynamicTextureMemory Comment @@ -25661,5 +25661,38 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSImageDecodeThreads + + Comment + Amount of threads to use for image decoding. 0 = autodetect, 1 = 0ff, >1 number of threads. Needs restart + Persist + 1 + Type + U32 + Value + 1 + FSAutoUnmuteSounds + + Comment + If Sound Effects are muted, unmute on TP. Default (false) + Persist + 1 + Type + Boolean + Value + 0 + + FSAutoUnmuteAmbient + + Comment + If Ambient sounds are muted, unmute on TP. Default (false) + Persist + 1 + Type + Boolean + Value + 0 + + 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 28eea92691..eb6e56e718 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -40,7 +40,8 @@ uniform sampler2D specularMap; VARYING vec2 vary_texcoord0; -vec3 linear_to_srgb(vec3 cl);// Colour space and shader fixes for BUG-228586 (Rye) +vec3 linear_to_srgb(vec3 c); + void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); @@ -53,7 +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);// Colour space and shader fixes for BUG-228586 (Rye) + 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 a18f6e7ac0..390acaca26 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -405,8 +405,8 @@ void main() vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0, 0, 0); - final_specular.rgb = srgb_to_linear(final_specular.rgb);// Colour space and shader fixes for BUG-228586 (Rye) - + 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 70e19267ab..26405ac1f7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -73,10 +73,8 @@ void main() vec3 norm = getNorm(frag.xy); vec4 spec = texture2DRect(specularRect, frag.xy); - // spec.rgb = srgb_to_linear(spec.rgb);// Colour space and shader fixes for BUG-228586 (Rye) vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; - // diff.rgb = srgb_to_linear(diff.rgb);// Colour space and shader fixes for BUG-228586 (Rye) - + 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 7e14565eea..511ff81701 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -187,12 +187,7 @@ void main() vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; -// Colour space and shader fixes for BUG-228586 (Rye) - // // 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 f062bf8fcd..a8fa7b7115 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -92,7 +92,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); // Colour space and shader fixes for BUG-228586 (Rye) float fa = falloff+1.0; float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); @@ -129,7 +128,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 f24fca77d5..5a49a9da3c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -91,7 +91,7 @@ void main() vec4 diffuse = texture2DRect(diffuseRect, tc); //convert to gamma space - diffuse.rgb = linear_to_srgb(diffuse.rgb);// Colour space and shader fixes for BUG-228586 (Rye) uniform sampler2DRect depthMap; + 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/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 4bb588335a..3945160db6 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -25,6 +25,7 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; +uniform vec4 ambient_color; // add ambient color to preview shader uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; @@ -87,7 +88,7 @@ void main() vec3 norm = normalize(normal_matrix * normal); - vec4 col = vec4(0,0,0,1); + vec4 col = ambient_color; // add ambient color to preview shader // Collect normal lights (need to be divided by two, as we later multiply by 2) col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); 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 getPositionEye() -{ - return vary_PositionEye; -} +vec3 getSunlitColor() { return vec3(0, 0, 0); } +vec3 getAmblitColor() { return vec3(0, 0, 0); } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } + +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() +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; } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } +void setAdditiveColor(vec3 v) { vary_AdditiveColor = v; } + +vec3 getAtmosAttenuation() { return atmos_attenuation; } +void setAtmosAttenuation(vec3 v) { - return vary_PositionEye; + atmos_attenuation = v; + vary_AtmosAttenuation = v; } -void setPositionEye(vec3 v) -{ - vary_PositionEye = 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 e67c1041ee..1b7a1cc6ec 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -191,12 +191,7 @@ void main() float da = dot(norm, lv); vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; - // Colour space and shader fixes for BUG-228586 - // removing comments as colour space change - // // 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); vec3 dlit = vec3(0, 0, 0); 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 34a0ad2126..7700d16007 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -87,12 +87,9 @@ void main() float light_gamma = 1.0 / 1.3; da = pow(da, light_gamma); - vec4 diffuse = texture2DRect(diffuseRect, tc); - // Colour space and shader fixes for BUG-228586 (Rye) - // convert to gamma space - diffuse.rgb = linear_to_srgb(diffuse.rgb); - // - 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 bcf4e14382..774f537821 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -188,10 +188,8 @@ void main() lv = proj_origin-pos.xyz; lv = normalize(lv); float da = dot(norm, lv); - // Colour space and shader fixes for BUG-228586 (Rye) - // 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/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 04098fad54..7181c9dddd 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -938,8 +938,8 @@ bool cmd_line_chat(const std::string& revised_text, EChatType type, bool from_ge { region_name = LLWeb::escapeURL(revised_text.substr(command.length() + 1)); LLVector3d agentPos = gAgent.getPositionGlobal(); - agent_x = ll_round((F32)fmod(agentPos.mdV[VX], (F64)REGION_WIDTH_METERS)); - agent_y = ll_round((F32)fmod(agentPos.mdV[VY], (F64)REGION_WIDTH_METERS)); + agent_x = ll_round((F32)agentPos.mdV[VX]); + agent_y = ll_round((F32)agentPos.mdV[VY]); agent_z = ll_round((F32)agentPos.mdV[VZ]); if (!sFSCmdLineMapToKeepPos) { diff --git a/indra/newview/fs_resources/cube_phys.dae b/indra/newview/fs_resources/cube_phys.dae new file mode 100644 index 0000000000..80a92cb38c --- /dev/null +++ b/indra/newview/fs_resources/cube_phys.dae @@ -0,0 +1,74 @@ + + + + + Avastar User + Avastar 2-0-10 on Blender 2.78 (sub 0) + + 2017-02-03T17:31:59 + 2017-02-03T17:31:59 + + Z_UP + + + + + + + + + + -0.4 -0.4 -0.4 -0.4 -0.4 0.4 -0.4 0.4 -0.4 -0.4 0.4 0.4 0.4 -0.4 -0.4 0.4 -0.4 0.4 0.4 0.4 -0.4 0.4 0.4 0.4 + + + + + + + + + + -1 -0 0 0 1 0 1 -0 0 0 -1 0 0 0 -1 0 -0 1 + + + + + + + + + + + + + + + 4 4 4 4 4 4 +

0 0 1 0 3 0 2 0 2 1 3 1 7 1 6 1 6 2 7 2 5 2 4 2 4 3 5 3 1 3 0 3 2 4 6 4 4 4 0 4 7 5 3 5 1 5 5 5

+
+
+ + + 1 + + +
+
+ + + + + 5.93563 6.77334 -14.9673 + 0 0 1 0 + 0 1 0 0 + 1 0 0 0 + 1 1 1 + + + + + + + +
+ diff --git a/indra/newview/fs_resources/hex_phys.dae b/indra/newview/fs_resources/hex_phys.dae new file mode 100644 index 0000000000..21d05cca6f --- /dev/null +++ b/indra/newview/fs_resources/hex_phys.dae @@ -0,0 +1,70 @@ + + + + + Blender User + Blender 2.80.43 commit date:2019-01-29, commit time:22:41, hash:a1ae04d15a9f + + 2019-02-05T14:28:24 + 2019-02-05T14:28:24 + + Z_UP + + + + + + + 0 1 -1 0 1 1 0.8660255 0.5 -1 0.8660255 0.5 1 0.8660254 -0.5000001 -1 0.8660254 -0.5000001 1 0 -1 -1 0 -1 1 -0.8660255 -0.4999999 -1 -0.8660255 -0.4999999 1 -0.8660255 0.4999999 -1 -0.8660255 0.4999999 1 + + + + + + + + + + 0.5 0.8660255 0 1 0 0 0.5 -0.8660255 0 -0.5000001 -0.8660253 0 0 0 1 -1 0 0 -0.5000001 0.8660255 0 0 0 -1 1 -1.19209e-7 0 0.5 -0.8660255 0 -0.5000001 -0.8660254 0 0 0 1 1.37651e-7 0 1 0 0 1 1.37651e-7 0 -1 1.37651e-7 0 -1 + + + + + + + + + + 1 1 0.8333333 0.5 1 0.5 0.8333333 1 0.6666666 0.5 0.8333333 0.5 0.6666666 1 0.5 0.5 0.6666666 0.5 0.5 1 0.3333333 0.5 0.5 0.5 0.25 0.49 0.04215389 0.13 0.4578461 0.1299999 0.3333333 1 0.1666666 0.5 0.3333333 0.5 0.1666666 1 0 0.5 0.1666666 0.5 0.5421539 0.13 0.5421539 0.37 0.9578461 0.37 1 1 0.8333333 1 0.8333333 0.5 0.8333333 1 0.6666666 1 0.6666666 0.5 0.6666666 1 0.5 1 0.5 0.5 0.5 1 0.3333333 1 0.3333333 0.5 0.4578461 0.1299999 0.4578461 0.37 0.25 0.49 0.25 0.49 0.04215389 0.37 0.04215389 0.13 0.04215389 0.13 0.25 0.00999999 0.4578461 0.1299999 0.3333333 1 0.1666666 1 0.1666666 0.5 0.1666666 1 0 1 0 0.5 0.5421539 0.37 0.75 0.49 0.9578461 0.37 0.9578461 0.37 0.9578461 0.1299999 0.75 0.00999999 0.75 0.00999999 0.5421539 0.13 0.9578461 0.37 + + + + + + + + + + + + + + + 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 +

1 0 0 2 0 1 0 0 2 3 1 3 4 1 4 2 1 5 5 2 6 6 2 7 4 2 8 7 3 9 8 3 10 6 3 11 1 4 12 9 4 13 5 4 14 9 5 15 10 5 16 8 5 17 11 6 18 0 6 19 10 6 20 8 7 21 10 7 22 2 7 23 1 0 24 3 0 25 2 0 26 3 8 27 5 8 28 4 8 29 5 9 30 7 9 31 6 9 32 7 10 33 9 10 34 8 10 35 5 11 36 3 11 37 1 11 38 1 12 39 11 12 40 9 12 41 9 13 42 7 13 43 5 13 44 9 5 45 11 5 46 10 5 47 11 6 48 1 6 49 0 6 50 10 14 51 0 14 52 2 14 53 2 15 54 4 15 55 6 15 56 6 7 57 8 7 58 2 7 59

+
+
+
+
+ + + + 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 + + + + + + + +
\ No newline at end of file diff --git a/indra/newview/fsfloatercontacts.cpp b/indra/newview/fsfloatercontacts.cpp index ba91a8ebb6..e9fc95e531 100644 --- a/indra/newview/fsfloatercontacts.cpp +++ b/indra/newview/fsfloatercontacts.cpp @@ -72,6 +72,7 @@ FSFloaterContacts::FSFloaterContacts(const LLSD& seed) mFriendsList(NULL), mGroupList(NULL), mFriendFilter(NULL), + mGroupFilter(NULL), mFriendFilterSubString(LLStringUtil::null), mFriendFilterSubStringOrig(LLStringUtil::null), mAllowRightsChange(true), @@ -153,7 +154,10 @@ BOOL FSFloaterContacts::postBuild() mGroupsTab->childSetAction("titles_btn", boost::bind(&FSFloaterContacts::onGroupTitlesButtonClicked, this)); mGroupsTab->childSetAction("invite_btn", boost::bind(&FSFloaterContacts::onGroupInviteButtonClicked, this)); mGroupsTab->setDefaultBtn("chat_btn"); - + + mGroupFilter = mGroupsTab->getChild("group_filter_input"); + mGroupFilter->setCommitCallback(boost::bind(&FSFloaterContacts::onGroupFilterEdit, this, _2)); + mRlvBehaviorCallbackConnection = gRlvHandler.setBehaviourCallback(boost::bind(&FSFloaterContacts::updateRlvRestrictions, this, _1)); gSavedSettings.getControl("FSFriendListFullNameFormat")->getSignal()->connect(boost::bind(&FSFloaterContacts::onDisplayNameChanged, this)); @@ -195,10 +199,18 @@ BOOL FSFloaterContacts::tick() BOOL FSFloaterContacts::handleKeyHere(KEY key, MASK mask) { - if (FSCommon::isFilterEditorKeyCombo(key, mask) && getActiveTabName() == FRIENDS_TAB_NAME && gSavedSettings.getBOOL("FSContactListShowSearch")) + if (FSCommon::isFilterEditorKeyCombo(key, mask)) { - mFriendFilter->setFocus(TRUE); - return TRUE; + if (getActiveTabName() == FRIENDS_TAB_NAME && gSavedSettings.getBOOL("FSContactListShowSearch")) + { + mFriendFilter->setFocus(TRUE); + return TRUE; + } + else if (getActiveTabName() == GROUP_TAB_NAME) + { + mGroupFilter->setFocus(TRUE); + return true; + } } if (mask == MASK_CONTROL && key == 'W' && getHost()) @@ -1357,4 +1369,9 @@ void FSFloaterContacts::resetFriendFilter() mFriendFilter->setText(LLStringUtil::null); onFriendFilterEdit(""); } + +void FSFloaterContacts::onGroupFilterEdit(const std::string& search_string) +{ + mGroupList->setNameFilter(search_string); +} // EOF diff --git a/indra/newview/fsfloatercontacts.h b/indra/newview/fsfloatercontacts.h index 398de020e9..36246d7c4f 100644 --- a/indra/newview/fsfloatercontacts.h +++ b/indra/newview/fsfloatercontacts.h @@ -120,6 +120,7 @@ private: EAcceptance* accept, std::string& tooltip_msg); void onFriendFilterEdit(const std::string& search_string); + void onGroupFilterEdit(const std::string& search_string); // friend buttons void onViewProfileButtonClicked(); @@ -128,7 +129,6 @@ private: void onPayButtonClicked(); void onDeleteFriendButtonClicked(); void onAddFriendWizButtonClicked(LLUICtrl* ctrl); - void onContactSetsButtonClicked(); void onMapButtonClicked(); // group buttons @@ -144,6 +144,7 @@ private: LLTabContainer* mTabContainer; LLFilterEditor* mFriendFilter; + LLFilterEditor* mGroupFilter; LLPanel* mFriendsTab; FSScrollListCtrl* mFriendsList; LLPanel* mGroupsTab; diff --git a/indra/newview/fsfloatergrouptitles.cpp b/indra/newview/fsfloatergrouptitles.cpp index 30c8cab800..25e5ec8788 100644 --- a/indra/newview/fsfloatergrouptitles.cpp +++ b/indra/newview/fsfloatergrouptitles.cpp @@ -27,6 +27,8 @@ #include "llviewerprecompiledheaders.h" #include "fsfloatergrouptitles.h" +#include "fscommon.h" +#include "llfiltereditor.h" #include "llgroupactions.h" #include "llscrolllistctrl.h" #include "lltrans.h" @@ -34,7 +36,7 @@ ///////////////////////////////////////////////////// // FSGroupTitlesObserver class // -FSGroupTitlesObserver::FSGroupTitlesObserver(const LLGroupData& group_data, FSFloaterGroupTitles* parent) : +FSGroupTitlesObserver::FSGroupTitlesObserver(const LLGroupData& group_data, LLHandle parent) : LLGroupMgrObserver(group_data.mID), mGroupData(group_data), mParent(parent) @@ -49,9 +51,9 @@ FSGroupTitlesObserver::~FSGroupTitlesObserver() void FSGroupTitlesObserver::changed(LLGroupChange gc) { - if (mParent) + if (!mParent.isDead()) { - mParent->processGroupTitleResults(mGroupData); + mParent.get()->processGroupTitleResults(mGroupData); } } @@ -60,7 +62,9 @@ void FSGroupTitlesObserver::changed(LLGroupChange gc) // FSGroupTitles class // FSFloaterGroupTitles::FSFloaterGroupTitles(const LLSD& key) : - LLFloater(key) + LLFloater(key), + mFilterSubString(LLStringUtil::null), + mFilterSubStringOrig(LLStringUtil::null) { // Register observer and event listener LLGroupMgr::getInstance()->addObserver(this); @@ -85,20 +89,41 @@ BOOL FSFloaterGroupTitles::postBuild() mRefreshButton = getChild("btnRefresh"); mInfoButton = getChild("btnInfo"); mTitleList = getChild("title_list"); + mFilterEditor = getChild("filter_input"); mActivateButton->setCommitCallback(boost::bind(&FSFloaterGroupTitles::activateGroupTitle, this)); mRefreshButton->setCommitCallback(boost::bind(&FSFloaterGroupTitles::refreshGroupTitles, this)); mInfoButton->setCommitCallback(boost::bind(&FSFloaterGroupTitles::openGroupInfo, this)); mTitleList->setDoubleClickCallback(boost::bind(&FSFloaterGroupTitles::activateGroupTitle, this)); mTitleList->setCommitCallback(boost::bind(&FSFloaterGroupTitles::selectedTitleChanged, this)); + mFilterEditor->setCommitCallback(boost::bind(&FSFloaterGroupTitles::onFilterEdit, this, _2)); mTitleList->sortByColumn("title_sort_column", TRUE); + mTitleList->setFilterColumn(0); refreshGroupTitles(); return TRUE; } +void FSFloaterGroupTitles::onOpen(const LLSD& key) +{ + LLFloater::onOpen(key); + + mTitleList->setFocus(TRUE); +} + +BOOL FSFloaterGroupTitles::handleKeyHere(KEY key, MASK mask) +{ + if (FSCommon::isFilterEditorKeyCombo(key, mask)) + { + mFilterEditor->setFocus(TRUE); + return true; + } + + return LLFloater::handleKeyHere(key, mask); +} + void FSFloaterGroupTitles::changed(LLGroupChange gc) { switch (gc) @@ -231,7 +256,7 @@ void FSFloaterGroupTitles::refreshGroupTitles() for (std::vector::iterator it = gAgent.mGroups.begin(); it != gAgent.mGroups.end(); ++it) { LLGroupData& group_data = *it; - FSGroupTitlesObserver* roleObserver = new FSGroupTitlesObserver(group_data, this); + FSGroupTitlesObserver* roleObserver = new FSGroupTitlesObserver(group_data, getDerivedHandle()); mGroupTitleObserverMap[group_data.mID] = roleObserver; LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_data.mID); } @@ -256,3 +281,22 @@ void FSFloaterGroupTitles::openGroupInfo() LLGroupActions::show(group_id); } } + +void FSFloaterGroupTitles::onFilterEdit(const std::string& search_string) +{ + mFilterSubStringOrig = search_string; + LLStringUtil::trimHead(mFilterSubStringOrig); + // Searches are case-insensitive + std::string search_upper = mFilterSubStringOrig; + LLStringUtil::toUpper(search_upper); + + if (mFilterSubString == search_upper) + { + return; + } + + mFilterSubString = search_upper; + + // Apply new filter. + mTitleList->setFilterString(mFilterSubStringOrig); +} diff --git a/indra/newview/fsfloatergrouptitles.h b/indra/newview/fsfloatergrouptitles.h index 24e42111f6..1cb0d5acbb 100644 --- a/indra/newview/fsfloatergrouptitles.h +++ b/indra/newview/fsfloatergrouptitles.h @@ -33,20 +33,21 @@ #include "llgroupmgr.h" class FSFloaterGroupTitles; +class LLFilterEditor; class LLScrollListCtrl; class FSGroupTitlesObserver : LLGroupMgrObserver { public: - FSGroupTitlesObserver(const LLGroupData& group_data, FSFloaterGroupTitles* parent); + FSGroupTitlesObserver(const LLGroupData& group_data, LLHandle parent); virtual ~FSGroupTitlesObserver(); virtual void changed(LLGroupChange gc); protected: - FSFloaterGroupTitles* mParent; - LLGroupData mGroupData; + LLHandle mParent; + LLGroupData mGroupData; }; class FSFloaterGroupTitles : public LLFloater, public LLGroupMgrObserver, public LLOldEvents::LLSimpleListener @@ -57,6 +58,9 @@ public: virtual ~FSFloaterGroupTitles(); /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool hasAccelerators() const { return true; } virtual void changed(LLGroupChange gc); bool handleEvent(LLPointer event, const LLSD& userdata); // called on agent group list changes @@ -73,11 +77,16 @@ private: void activateGroupTitle(); void selectedTitleChanged(); void openGroupInfo(); + void onFilterEdit(const std::string& search_string); LLButton* mActivateButton; LLButton* mRefreshButton; LLButton* mInfoButton; LLScrollListCtrl* mTitleList; + LLFilterEditor* mFilterEditor; + + std::string mFilterSubString; + std::string mFilterSubStringOrig; typedef std::map observer_map_t; observer_map_t mGroupTitleObserverMap; diff --git a/indra/newview/fsfloaterplacedetails.cpp b/indra/newview/fsfloaterplacedetails.cpp index a21eff9f73..ed459a5d81 100644 --- a/indra/newview/fsfloaterplacedetails.cpp +++ b/indra/newview/fsfloaterplacedetails.cpp @@ -50,6 +50,7 @@ #include "llpanelplaceprofile.h" #include "llpanellandmarkinfo.h" #include "llparcel.h" +#include "llregionhandle.h" // Var region support #include "llteleporthistorystorage.h" #include "llviewercontrol.h" #include "llviewermessage.h" @@ -355,7 +356,15 @@ void FSFloaterPlaceDetails::onOpen(const LLSD& key) key["z"].asReal()); mPanelPlaceInfo->setParcelDetailLoadedCallback(boost::bind(&FSFloaterPlaceDetails::processParcelDetails, this, _1)); - mPanelPlaceInfo->displayParcelInfo(LLUUID(), mGlobalPos); + if(key.has("ox")) + { + auto region_handle = to_region_handle(key["ox"].asInteger(), key["oy"].asInteger()); + mPanelPlaceInfo->displayParcelInfo(LLUUID(), region_handle, mGlobalPos); + } + else + { + mPanelPlaceInfo->displayParcelInfo(LLUUID(), mGlobalPos); + } } updateVerbs(); diff --git a/indra/newview/fsgridhandler.cpp b/indra/newview/fsgridhandler.cpp index 392132f27c..aa5e69fa5b 100644 --- a/indra/newview/fsgridhandler.cpp +++ b/indra/newview/fsgridhandler.cpp @@ -29,6 +29,7 @@ #include "llviewerprecompiledheaders.h" +#include "llcommandhandler.h" #include "lllogininstance.h" // to check if logged in yet #include "llnotifications.h" #include "llnotificationsutil.h" @@ -36,6 +37,7 @@ #include "llviewercontrol.h" #include "llsdserialize.h" #include "llsecapi.h" +#include "llstartup.h" #include "lltrans.h" #include "llweb.h" @@ -48,6 +50,7 @@ #include "llstartup.h" #include "fscorehttputil.h" +#include "fspanellogin.h" #include "lfsimfeaturehandler.h" // void gridDownloadError( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState ) @@ -819,7 +822,6 @@ void LLGridManager::addGrid(GridEntry* grid_entry, AddState state) if (list_changed) { mGridListChangedSignal(true); - mGridListChangedSignal.disconnect_all_slots(); } } } @@ -841,7 +843,6 @@ void LLGridManager::addGrid(GridEntry* grid_entry, AddState state) if (FAIL == state) { mGridListChangedSignal(false); - mGridListChangedSignal.disconnect_all_slots(); } if (grid_entry) @@ -1384,10 +1385,6 @@ std::string LLGridManager::getAppSLURLBase(const std::string& grid) { ret = mGridList[grid][GRID_APP_SLURL_BASE].asString(); } - else if (grid == INWORLDZ_URI) - { - ret = "inworldz:///app"; - } else { std::string app_base; @@ -1422,3 +1419,61 @@ std::string LLGridManager::getAppSLURLBase(const std::string& grid) LL_DEBUGS("GridManager") << "App slurl base: " << ret << " - grid = " << grid << LL_ENDL; return ret; } + +class FSGridManagerCommandHandler : public LLCommandHandler +{ +public: + // not allowed from outside the app + FSGridManagerCommandHandler() : LLCommandHandler("gridmanager", UNTRUSTED_THROTTLE), + mDownloadConnection() + { } + + ~FSGridManagerCommandHandler() + { + if (mDownloadConnection.connected()) + { + mDownloadConnection.disconnect(); + } + } + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + if (params.size() < 2) + { + return false; + } + + if (params[0].asString() == "addgrid") + { + std::string login_uri = LLURI::unescape(params[1].asString()); + mDownloadConnection = LLGridManager::instance().addGridListChangedCallback(boost::bind(&FSGridManagerCommandHandler::handleGridDownloadComplete, this, _1)); + LLGridManager::instance().addGrid(login_uri); + return true; + } + + return false; + } + +private: + boost::signals2::connection mDownloadConnection; + + void handleGridDownloadComplete(bool success) + { + if (mDownloadConnection.connected()) + { + mDownloadConnection.disconnect(); + } + + if (success) + { + LLGridManager::getInstance()->saveGridList(); + if (LLStartUp::getStartupState() <= STATE_LOGIN_WAIT) + { + FSPanelLogin::updateServer(); + } + } + } +}; + +// Creating the object registers with the dispatcher. +FSGridManagerCommandHandler gFSGridManagerCommandHandler; diff --git a/indra/newview/fspanellogin.cpp b/indra/newview/fspanellogin.cpp index ab9da81de5..ca6387f036 100644 --- a/indra/newview/fspanellogin.cpp +++ b/indra/newview/fspanellogin.cpp @@ -184,7 +184,8 @@ FSPanelLogin::FSPanelLogin(const LLRect &rect, mPasswordLength(0), mLocationLength(0), mShowFavorites(false), - mInitialized(false) + mInitialized(false), + mGridListChangedCallbackConnection() { setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); @@ -387,6 +388,11 @@ void FSPanelLogin::addFavoritesToStartLocation() FSPanelLogin::~FSPanelLogin() { + if (mGridListChangedCallbackConnection.connected()) + { + mGridListChangedCallbackConnection.disconnect(); + } + FSPanelLogin::sInstance = NULL; // Controls having keyboard focus by default @@ -1113,14 +1119,18 @@ void FSPanelLogin::onSelectServer() LLComboBox* server_combo = getChild("server_combo"); LLSD server_combo_val = server_combo->getSelectedValue(); #if OPENSIM && !SINGLEGRID - LL_INFOS("AppInit") << "grid "<<(!server_combo_val.isUndefined()?server_combo_val.asString():server_combo->getValue().asString())<< LL_ENDL; + LL_INFOS("AppInit") << "grid " << (!server_combo_val.isUndefined() ? server_combo_val.asString() : server_combo->getValue().asString()) << LL_ENDL; if (server_combo_val.isUndefined() && sPendingNewGridURI.empty()) { sPendingNewGridURI = server_combo->getValue().asString(); LLStringUtil::trim(sPendingNewGridURI); - LL_INFOS("AppInit") << "requesting unknown grid "<< sPendingNewGridURI << LL_ENDL; + LL_INFOS("AppInit") << "requesting unknown grid " << sPendingNewGridURI << LL_ENDL; // Previously unknown gridname was entered - LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&FSPanelLogin::gridListChanged, this, _1)); + if (mGridListChangedCallbackConnection.connected()) + { + mGridListChangedCallbackConnection.disconnect(); + } + mGridListChangedCallbackConnection = LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&FSPanelLogin::gridListChanged, this, _1)); LLGridManager::getInstance()->addGrid(sPendingNewGridURI); } else @@ -1452,6 +1462,11 @@ std::string FSPanelLogin::credentialName() void FSPanelLogin::gridListChanged(bool success) { + if (mGridListChangedCallbackConnection.connected()) + { + mGridListChangedCallbackConnection.disconnect(); + } + updateServer(); sPendingNewGridURI.clear(); // success or fail we clear the pending URI as we will not get another callback. } diff --git a/indra/newview/fspanellogin.h b/indra/newview/fspanellogin.h index 098cf9335f..ffe0b288f3 100644 --- a/indra/newview/fspanellogin.h +++ b/indra/newview/fspanellogin.h @@ -114,6 +114,8 @@ private: static std::string credentialName(); private: + boost::signals2::connection mGridListChangedCallbackConnection; + void updateLoginButtons(); void (*mCallback)(S32 option, void *userdata); diff --git a/indra/newview/fsslurl.cpp b/indra/newview/fsslurl.cpp index 22ff350b22..86e7b9794e 100644 --- a/indra/newview/fsslurl.cpp +++ b/indra/newview/fsslurl.cpp @@ -59,11 +59,6 @@ const char* LLSLURL::SLURL_REGION_PATH = "region"; const char* LLSLURL::SIM_LOCATION_HOME = "home"; const char* LLSLURL::SIM_LOCATION_LAST = "last"; -// Inworldz special -const char* LLSLURL::SLURL_INWORLDZ_SCHEME = "inworldz"; -const char* LLSLURL::SLURL_IW_SCHEME = "iw"; -const char* LLSLURL::PLACES_INWORLDZ_COM = "places.inworldz.com"; - // resolve a simstring from a slurl LLSLURL::LLSLURL(const std::string& slurl) : mHypergrid(false) @@ -244,55 +239,6 @@ LLSLURL::LLSLURL(const std::string& slurl) path_array.insert(0, slurl_uri.hostNameAndPort()); } } - else if (slurl_uri.scheme() == LLSLURL::SLURL_INWORLDZ_SCHEME || - slurl_uri.scheme() == LLSLURL::SLURL_IW_SCHEME) - { - LL_DEBUGS("SLURL") << "inworldz scheme" << LL_ENDL; - - mGrid = INWORLDZ_URI; - - if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH) - { - // it's in the form iw:///(app) - // so parse the grid name to derive the grid ID - if (!slurl_uri.hostNameAndPort().empty()) - { - LL_DEBUGS("SLURL") << "(inworldz|iw):///app" << LL_ENDL; - - mGrid = LLGridManager::getInstance()->getGridByProbing(slurl_uri.hostNameAndPort()); - if (mGrid.empty()) - { - mGrid = LLGridManager::getInstance()->getGridByProbing(slurl_uri.hostName()); - } - } - else if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH) - { - LL_DEBUGS("SLURL") << "(inworldz|iw):///app" << LL_ENDL; - - // for app style slurls, where no grid name is specified, assume the currently - // selected or logged in grid. - mGrid = LLGridManager::getInstance()->getGridId(); - } - - if (mGrid.empty() && LLStartUp::getStartupState() == STATE_STARTED) - { - // we couldn't find the grid in the grid manager, so bail - LL_WARNS("SLURL")<<"unable to find grid"< or /app/, so it must be iw:// - // therefore the hostname will be the region name, and it's a location type - mType = LOCATION; - // 'normalize' it so the region name is in fact the head of the path_array - path_array.insert(0, slurl_uri.hostName()); - } - } else if((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME) || (slurl_uri.scheme() == LLSLURL::SLURL_HTTPS_SCHEME) || (slurl_uri.scheme() == LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME) @@ -309,13 +255,6 @@ LLSLURL::LLSLURL(const std::string& slurl) else mGrid = default_grid; } - // places.inworldz.com isn't your regular everyday slurl - else if (slurl_uri.hostName() == LLSLURL::PLACES_INWORLDZ_COM) - { - // likewise, places.inworldz.com implies inworldz and a location - mGrid = INWORLDZ_URI; - mType = LOCATION; - } else { LL_DEBUGS("SLURL") << "slurl style Standalone" << LL_ENDL; @@ -402,7 +341,7 @@ LLSLURL::LLSLURL(const std::string& slurl) LL_DEBUGS("SLURL") << "It's a location hop" << LL_ENDL; mType = LOCATION; } - else if (slurl_uri.hostName() != LLSLURL::PLACES_INWORLDZ_COM) + else { LL_DEBUGS("SLURL") << "Not a valid https/http/x-grid-location-info slurl " << slurl << LL_ENDL; // not a valid https/http/x-grid-location-info slurl, so it'll likely just be a URL @@ -530,29 +469,46 @@ LLSLURL::LLSLURL(const std::string& region, const LLVector3& position, bool hype *this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, position); } +// FIRE-30768: SLURL's don't work in VarRegions // create a slurl from a global position -LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid) -: mHypergrid(hypergrid) -{ +//LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid) +//: mHypergrid(hypergrid) +//{ // Aurora-sim var region teleports //*this = LLSLURL(grid, // region, LLVector3(global_position.mdV[VX], // global_position.mdV[VY], // global_position.mdV[VZ])); - S32 x = ll_round( (F32)fmod( (F32)global_position.mdV[VX], (F32)REGION_WIDTH_METERS ) ); - S32 y = ll_round( (F32)fmod( (F32)global_position.mdV[VY], (F32)REGION_WIDTH_METERS ) ); - S32 z = ll_round( (F32)global_position.mdV[VZ] ); +// S32 x = ll_round( (F32)fmod( (F32)global_position.mdV[VX], (F32)REGION_WIDTH_METERS ) ); +// S32 y = ll_round( (F32)fmod( (F32)global_position.mdV[VY], (F32)REGION_WIDTH_METERS ) ); +// S32 z = ll_round( (F32)global_position.mdV[VZ] ); - *this = LLSLURL(grid, region, LLVector3(x, y, z)); +// *this = LLSLURL(grid, region, LLVector3(x, y, z)); // +//} +// +// create a slurl from a global position +//LLSLURL::LLSLURL(const std::string& region, const LLVector3d& global_position, bool hypergrid) +//: mHypergrid(hypergrid) +//{ +// *this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, global_position); +//} + +// create a slurl from a global position +LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid) + : mHypergrid(hypergrid) +{ + LLVector3 local_position = LLVector3(global_position - region_origin); + *this = LLSLURL(grid, region, local_position); } // create a slurl from a global position -LLSLURL::LLSLURL(const std::string& region, const LLVector3d& global_position, bool hypergrid) -: mHypergrid(hypergrid) +LLSLURL::LLSLURL(const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid) + : mHypergrid(hypergrid) { - *this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, global_position); + *this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, region_origin, global_position); } +// LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb) : mHypergrid(false) diff --git a/indra/newview/fsslurl.h b/indra/newview/fsslurl.h index e01764190b..a3bd8e495b 100644 --- a/indra/newview/fsslurl.h +++ b/indra/newview/fsslurl.h @@ -52,11 +52,6 @@ public: static const char* SIM_LOCATION_LAST; static const char* SLURL_APP_PATH; static const char* SLURL_REGION_PATH; - - // Inworldz special - static const char* SLURL_INWORLDZ_SCHEME; - static const char* SLURL_IW_SCHEME; - static const char* PLACES_INWORLDZ_COM; enum SLURL_TYPE { @@ -73,8 +68,12 @@ public: LLSLURL(const std::string& grid, const std::string& region, bool hypergrid = false); LLSLURL(const std::string& region, const LLVector3& position, bool hypergrid = false); LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position, bool hypergrid = false); - LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid = false); - LLSLURL(const std::string& region, const LLVector3d& global_position, bool hypergrid = false); +// FIRE-30768: SLURL's don't work in VarRegions (patch from Oren) + //LLSLURL(const std::string& region, const LLVector3d& global_position, bool hypergrid = false); + //LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid = false); + LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid = false); + LLSLURL(const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid = false); +// LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb); LLSLURL(const LLSD& path_array, bool from_app); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c6cf280a20..4663146c92 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4586,7 +4586,19 @@ bool LLAgent::teleportBridgeLocal(LLVector3& pos_local) bool LLAgent::teleportBridgeGlobal(const LLVector3d& pos_global) { - U64 region_handle = to_region_handle(pos_global); + // FIRE-30534 VarRegion fixes + // U64 region_handle = to_region_handle(pos_global); + U64 region_handle{}; + auto regionp = getRegion(); + if(regionp) + { + region_handle = to_region_handle(pos_global, regionp->getOriginGlobal(), regionp->getWidth()); + } + else + { + region_handle = to_region_handle(pos_global); + } + // LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle)); return teleportBridgeLocal(pos_local); @@ -5064,23 +5076,83 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global) { return; } + // FIRE-30534 Var Region tp / map locaton fixes +// U64 handle = to_region_handle(pos_global); +// bool isLocal = (regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])); +// LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle); +// if(regionp && info) +// { +// LLVector3d region_origin = info->getGlobalOrigin(); +// LLVector3 pos_local( +// (F32)(pos_global.mdV[VX] - region_origin.mdV[VX]), +// (F32)(pos_global.mdV[VY] - region_origin.mdV[VY]), +// (F32)(pos_global.mdV[VZ])); +// // Aurora-sim var region teleports +// //teleportRequest(handle, pos_local); +// teleportRequest(info->getHandle(), pos_local); +// // +// } +// else if(regionp && teleportCore(isLocal)) +// { +// // send the message +// LLMessageSystem* msg = gMessageSystem; +// msg->newMessageFast(_PREHASH_TeleportLocationRequest); +// msg->nextBlockFast(_PREHASH_AgentData); +// msg->addUUIDFast(_PREHASH_AgentID, getID()); +// msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - U64 handle = to_region_handle(pos_global); - bool isLocal = (regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])); - LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle); - if(regionp && info) +// msg->nextBlockFast(_PREHASH_Info); +// // FIRE-17262: Wrong local teleports on a large opensim region (apparently need to divide by grid unit size) +// F32 width = REGION_WIDTH_METERS;// regionp->getWidth(); +// LLVector3 pos(fmod((F32)pos_global.mdV[VX], width), +// fmod((F32)pos_global.mdV[VY], width), +// (F32)pos_global.mdV[VZ]); +// F32 region_x = (F32)(pos_global.mdV[VX]); +// F32 region_y = (F32)(pos_global.mdV[VY]); +// U64 region_handle = to_region_handle_global(region_x, region_y); +// msg->addU64Fast(_PREHASH_RegionHandle, region_handle); +// msg->addVector3Fast(_PREHASH_Position, pos); +// pos.mV[VX] += 1; +// msg->addVector3Fast(_PREHASH_LookAt, pos); + +// LL_WARNS("Teleport") << "Sending deprecated(?) TeleportLocationRequest." +// << " pos_global " << pos_global +// << " region_x " << region_x +// << " region_y " << region_y +// << " region_handle " << region_handle +// << LL_ENDL; + +// sendReliableMessage(); + auto region_origin { regionp->getOriginGlobal() }; + LLVector3 pos_local{}; + U64 handle { to_region_handle(pos_global, region_origin, regionp->getWidth()) }; + bool is_local { regionp->getHandle() == handle }; + if(is_local) { - LLVector3d region_origin = info->getGlobalOrigin(); - LLVector3 pos_local( + pos_local.set( (F32)(pos_global.mdV[VX] - region_origin.mdV[VX]), (F32)(pos_global.mdV[VY] - region_origin.mdV[VY]), (F32)(pos_global.mdV[VZ])); -// Aurora-sim var region teleports - //teleportRequest(handle, pos_local); - teleportRequest(info->getHandle(), pos_local); -// + LL_INFOS("Teleport") << "Local in-region TP:" + << " pos_global " << pos_global + << " region " << region_origin + << " local " << pos_local + << " region_handle " << handle + << LL_ENDL; } - else if(regionp && teleportCore(isLocal)) + else + { + // determine non-local region location as best we can using global coords + // In SL we have uniform region size. This is normal. + // In opensim the handle will resolve to a 256m quantised world tile which the server maps back to a region + // it "should" also compensate for the local coords. Handle has been "correctly" determined already so we use global % 256 + static const auto width{LLWorld::getInstance()->getRegionWidthInMeters()}; + pos_local.set( fmod((F32)pos_global.mdV[VX], width), + fmod((F32)pos_global.mdV[VY], width), + (F32)pos_global.mdV[VZ] ); + } + + if(teleportCore(is_local)) // Rather a pointless if as teleportCore currently always returns true { // send the message LLMessageSystem* msg = gMessageSystem; @@ -5090,30 +5162,23 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global) msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); msg->nextBlockFast(_PREHASH_Info); - // FIRE-17262: Wrong local teleports on a large opensim region (apparently need to divide by grid unit size) - F32 width = REGION_WIDTH_METERS;// regionp->getWidth(); - LLVector3 pos(fmod((F32)pos_global.mdV[VX], width), - fmod((F32)pos_global.mdV[VY], width), - (F32)pos_global.mdV[VZ]); - F32 region_x = (F32)(pos_global.mdV[VX]); - F32 region_y = (F32)(pos_global.mdV[VY]); - U64 region_handle = to_region_handle_global(region_x, region_y); - msg->addU64Fast(_PREHASH_RegionHandle, region_handle); - msg->addVector3Fast(_PREHASH_Position, pos); - pos.mV[VX] += 1; - msg->addVector3Fast(_PREHASH_LookAt, pos); - - LL_WARNS("Teleport") << "Sending deprecated(?) TeleportLocationRequest." - << " pos_global " << pos_global - << " region_x " << region_x - << " region_y " << region_y - << " region_handle " << region_handle - << LL_ENDL; + msg->addU64Fast(_PREHASH_RegionHandle, handle); + msg->addVector3Fast(_PREHASH_Position, pos_local); + pos_local.mV[VX] += 1; + msg->addVector3Fast(_PREHASH_LookAt, pos_local); sendReliableMessage(); + LL_INFOS("Teleport") << "Sending deprecated TeleportLocationRequest." + << " pos_global " << pos_global + << " region coord (" << (pos_global.mdV[VX] - pos_local.mV[VX]) + << "," << (pos_global.mdV[VY] - pos_local.mV[VY]) + << " pos_local " << pos_local + << ") region_handle " << handle + << LL_ENDL; + // } // Client LSL Bridge - if (FSLSLBridge::instance().canUseBridge() && isLocal) + if (FSLSLBridge::instance().canUseBridge() && is_local) { teleportBridgeGlobal(pos_global); } @@ -5154,6 +5219,37 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global, const LLVe //} // [RLVa:KB] - Checked: RLVa-2.0.0 +// FIRE-30534 VarRegion TP fixes +// void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global, const LLVector3& look_at) +// { +// mbTeleportKeepsLookAt = look_at.isExactlyZero(); + +// if(!gAgentCamera.isfollowCamLocked()) +// { +// gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction +// } + +// U64 region_handle = to_region_handle(pos_global); +// // Aurora-sim var region teleports +// LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle); +// if (simInfo) +// { +// region_handle = simInfo->getHandle(); +// } +// // +// LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle)); +// teleportRequest(region_handle, pos_local, look_at); + +// // Client LSL Bridge +// if (FSLSLBridge::instance().canUseBridge()) +// { +// if (region_handle == to_region_handle(getPositionGlobal())) +// { +// teleportBridgeLocal(pos_local); +// } +// } +// // +// } void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global, const LLVector3& look_at) { mbTeleportKeepsLookAt = look_at.isExactlyZero(); @@ -5163,28 +5259,34 @@ void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global, const LL gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction } - U64 region_handle = to_region_handle(pos_global); -// Aurora-sim var region teleports - LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle); - if (simInfo) + U64 region_handle{}; + auto regionp = getRegion(); + if(regionp) { - region_handle = simInfo->getHandle(); + region_handle = to_region_handle(pos_global, regionp->getOriginGlobal(), regionp->getWidth()); } -// - LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle)); - teleportRequest(region_handle, pos_local, look_at); + else + { + region_handle = to_region_handle(pos_global); + } +// Beq Note: if region_handle was obtained to the nearest 256m tile map lookup might give us a better result. + + LLVector3 pos_within_target_region = (LLVector3)(pos_global - from_region_handle(region_handle)); + teleportRequest(region_handle, pos_within_target_region, look_at); // Client LSL Bridge - if (FSLSLBridge::instance().canUseBridge()) + if ( FSLSLBridge::instance().canUseBridge() ) { - if (region_handle == to_region_handle(getPositionGlobal())) + // refresh regionp + regionp = getRegion(); + if( regionp && ( region_handle == regionp->getHandle() ) ) { - teleportBridgeLocal(pos_local); + teleportBridgeLocal(pos_within_target_region); } } // } - +// LLAgent::ETeleportState LLAgent::getTeleportState() const { return (mTeleportRequest && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) ? diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp index 065087cea6..d8541bf9d3 100644 --- a/indra/newview/llagentui.cpp +++ b/indra/newview/llagentui.cpp @@ -72,7 +72,10 @@ void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/) else #endif // - return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal()); + // FIRE-30768: SLURL's don't work in VarRegions + //return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal()); + return_slurl = LLSLURL(regionp->getName(), regionp->getOriginGlobal(), gAgent.getPositionGlobal()); + // } slurl = return_slurl; } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fa190721bd..dd217c2003 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" @@ -285,9 +286,9 @@ #include "fstelemetry.h" // Tracy profiler support -#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 @@ -735,6 +736,7 @@ LLAppViewer* LLAppViewer::sInstance = NULL; LLTextureCache* LLAppViewer::sTextureCache = NULL; LLImageDecodeThread* LLAppViewer::sImageDecodeThread = NULL; LLTextureFetch* LLAppViewer::sTextureFetch = NULL; +FSPurgeDiskCacheThread* LLAppViewer::sPurgeDiskCacheThread = NULL; // Regular disk cache cleanup std::string getRuntime() { @@ -1288,6 +1290,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()) { @@ -1527,55 +1569,13 @@ 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") ; // Enable low memory checks on 32bit builds #if ADDRESS_SIZE == 64 max_heap_size_gb = F32Gigabytes(128); - enable_mem_failure_prevention = FALSE; #endif // - 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 ; - - // Enable low memory checks on 32bit builds - //if(!gGLManager.mDebugGPU) - //{ - // return ; - //} -#if ADDRESS_SIZE == 32 - static LLCachedControl mem_failure_prevention(gSavedSettings, "MemoryFailurePreventionEnabled"); - if (!mem_failure_prevention) -#endif - { - 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) - { - // Causes spammy log output - //LLMemory::logMemoryInfo() ; - } + LLMemory::initMaxHeapSizeGB(max_heap_size_gb); } static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages"); @@ -1683,9 +1683,6 @@ bool LLAppViewer::doFrame() //clear call stack records LL_CLEAR_CALLSTACKS(); - //check memory availability information - checkMemory() ; - { // MaxFPS Viewer-Chui merge error // Check if we need to restore rendering masks. @@ -1882,8 +1879,13 @@ bool LLAppViewer::doFrame() S32 work_pending = 0; S32 io_pending = 0; F32 max_time = llmin(gFrameIntervalSeconds.value() *10.f, 1.f); - + // instrument image decodes + { + FSZoneN("updateTextureThreads"); + // FSPlot("max_time_ms",max_time); + // work_pending += updateTextureThreads(max_time); + } // instrument image decodes { LL_RECORD_BLOCK_TIME(FTM_LFS); @@ -1967,6 +1969,8 @@ bool LLAppViewer::doFrame() LL_INFOS() << "Exiting main_loop" << LL_ENDL; } FSFrameMark; // Tracy support delineate Frame + LLPROFILE_UPDATE(); + return ! LLApp::isRunning(); } @@ -2442,6 +2446,7 @@ bool LLAppViewer::cleanup() sTextureFetch->shutdown(); sTextureCache->shutdown(); sImageDecodeThread->shutdown(); + sPurgeDiskCacheThread->shutdown(); // Regular disk cache cleanup sTextureFetch->shutDownTextureCacheThread() ; sTextureFetch->shutDownImageDecodeThread() ; @@ -2464,6 +2469,10 @@ bool LLAppViewer::cleanup() sImageDecodeThread = NULL; delete mFastTimerLogThread; mFastTimerLogThread = NULL; + // Regular disk cache cleanup + delete sPurgeDiskCacheThread; + sPurgeDiskCacheThread = NULL; + // if (LLFastTimerView::sAnalyzePerformance) { @@ -2577,13 +2586,18 @@ bool LLAppViewer::initThreads() LLLFSThread::initClass(enable_threads && false); + // Image thread pool from CoolVL + U32 imageThreads = gSavedSettings.getU32("FSImageDecodeThreads"); + // + // Image decoding - LLAppViewer::sImageDecodeThread = new LLImageDecodeThread(enable_threads && true); + LLAppViewer::sImageDecodeThread = new LLImageDecodeThread(enable_threads && true, imageThreads); LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true); LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), sImageDecodeThread, enable_threads && true, app_metrics_qa_mode); + LLAppViewer::sPurgeDiskCacheThread = new FSPurgeDiskCacheThread(); // Regular disk cache cleanup if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog) { @@ -3818,6 +3832,7 @@ LLSD LLAppViewer::getViewerInfo() const // CPU info["CPU"] = gSysCPU.getCPUString(); info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits()); + info["CONCURRENCY"] = LLSD::Integer((S32)boost::thread::hardware_concurrency()); // Add hardware concurrency to info // Moved hack adjustment to Windows memory size into llsys.cpp info["OS_VERSION"] = LLOSInfo::instance().getOSString(); info["GRAPHICS_CARD_VENDOR"] = ll_safe_string((const char*)(glGetString(GL_VENDOR))); @@ -4959,11 +4974,16 @@ bool LLAppViewer::initCache() // note that the maximum size of this cache is defined as a percentage of the // total cache size - the 'CacheSize' pref - for all caches. - const unsigned int cache_total_size_mb = gSavedSettings.getU32("CacheSize"); - const double disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal"); - const unsigned int disk_cache_mb = cache_total_size_mb * disk_cache_percent / 100; - const unsigned int disk_cache_bytes = disk_cache_mb * 1024 * 1024; - const bool enable_cache_debug_info = gSavedSettings.getBOOL("EnableCacheDebugInfo"); + // Better asset cache size control + //const unsigned int cache_total_size_mb = gSavedSettings.getU32("CacheSize"); + //const double disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal"); + //const unsigned int disk_cache_mb = cache_total_size_mb * disk_cache_percent / 100; + const unsigned int disk_cache_mb = gSavedSettings.getU32("FSDiskCacheSize"); + // + // Fix integer overflow + //const unsigned int disk_cache_bytes = disk_cache_mb * 1024 * 1024; + const uintmax_t disk_cache_bytes = disk_cache_mb * 1024 * 1024; + const bool enable_cache_debug_info = gSavedSettings.getBOOL("EnableDiskCacheDebugInfo"); // Don't ignore cache path for asset cache; Moved further down until cache path has been set correctly //const std::string cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name); //LLDiskCache::initParamSingleton(cache_dir, disk_cache_bytes, enable_cache_debug_info); @@ -5059,6 +5079,8 @@ bool LLAppViewer::initCache() LLDiskCache::getInstance()->purge(); } } + // Regular disk cache cleanup + LLAppViewer::getPurgeDiskCacheThread()->start(); // FIRE-13066 if (mPurgeTextures && !read_only) diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 400c4b494a..861150bae2 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -59,6 +59,7 @@ class LLTextureFetch; class LLWatchdogTimeout; class LLViewerJoystick; class LLViewerRegion; // +class FSPurgeDiskCacheThread; // Regular disk cache cleanup extern LLTrace::BlockTimerStatHandle FTM_FRAME; @@ -118,6 +119,7 @@ public: static LLTextureCache* getTextureCache() { return sTextureCache; } static LLImageDecodeThread* getImageDecodeThread() { return sImageDecodeThread; } static LLTextureFetch* getTextureFetch() { return sTextureFetch; } + static FSPurgeDiskCacheThread* getPurgeDiskCacheThread() { return sPurgeDiskCacheThread; } // Regular disk cache cleanup static U32 getTextureCacheVersion() ; static U32 getObjectCacheVersion() ; @@ -252,7 +254,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. @@ -307,6 +308,7 @@ private: static LLTextureCache* sTextureCache; static LLImageDecodeThread* sImageDecodeThread; static LLTextureFetch* sTextureFetch; + static FSPurgeDiskCacheThread* sPurgeDiskCacheThread; // Regular disk cache cleanup S32 mNumSessions; @@ -341,8 +343,6 @@ private: // Get rid of unused LLAllocator //LLAllocator mAlloc; - LLFrameTimer mMemCheckTimer; - // llcorehttp library init/shutdown helper LLAppCoreHttp mAppCoreHttp; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 588e63cb42..e961871908 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -75,10 +75,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; @@ -356,8 +352,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 @@ -417,9 +411,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(); @@ -454,7 +445,6 @@ bool LLAppViewerLinux::beingDebugged() } return debugged == yes; -#endif } void LLAppViewerLinux::initLoggingAndGetLastDuration() diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a6dfe33fcf..b71db0a423 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -382,7 +382,7 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const for (iter = mChildren.begin(); iter != mChildren.end(); iter++) { participant = dynamic_cast(*iter); - if (participant->hasSameValue(participant_id)) + if (participant && participant->hasSameValue(participant_id)) { break; } @@ -493,7 +493,7 @@ const bool LLConversationItemSession::getTime(F64& time) const { participant = dynamic_cast(*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/llconversationview.cpp b/indra/newview/llconversationview.cpp index 456fb699c7..d0fc9766c5 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -698,10 +698,13 @@ void LLConversationViewParticipant::refresh() { // Refresh the participant view from its model data LLConversationItemParticipant* participant_model = dynamic_cast(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/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 5cd6dda542..68d5c53b80 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -920,33 +920,16 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) //if (volume->getAvatar() && volume->getAvatar()->isControlAvatar()) if (volume->getAvatar()) { - // BUG-227041 Fix bad camera position calc forces LOD0 display on non-rigged attachments - // TODO: (maybe) Fixing this proved another bug, Rigged mesh attachments have the distance calcualted here then ignored. - // TODO: A further fix might be to remove this entirely in favour of calcLOD, waiting on Vir/Oz to reply. - // 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); - // 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 - // << " box " << av_box[0] << "," << av_box[1] - // << " -> dist " << mDistanceWRTCamera - // << LL_ENDL; const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents(); - LLVector3 cam_pos_from_agent = LLViewerCamera::getInstance()->getOrigin(); - LLVector3 cam_to_box_offset = point_to_box_offset(cam_pos_from_agent, 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_from_agent - << " box " << av_box[0] << "," << av_box[1] - << " -> dist " << mDistanceWRTCamera - << LL_ENDL; - // + << " pos (ignored) " << pos + << " cam pos " << cam_pos_from_agent + << " box " << av_box[0] << "," << av_box[1] + << " -> dist " << mDistanceWRTCamera + << LL_ENDL; mVObjp->updateLOD(); return; } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 9e3e45e4ab..64fae234b8 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -2317,7 +2317,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (mat) { - switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaModeRender())) + switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaMode())) { case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: { @@ -2460,7 +2460,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) sVertexProgram->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0], col.mV[1], col.mV[2], spec); sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env); - if (mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { F32 cutoff = mat->getAlphaMaskCutoff()/255.f; sVertexProgram->setMinimumAlpha(cutoff); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 8a540f7b59..9ea165dd21 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); @@ -340,6 +341,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) @@ -358,6 +361,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 @@ -608,7 +613,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) if (gPipeline.canUseWindLightShaders()) { renderSkyHazeDeferred(origin, camHeightLocal); - renderStarsDeferred(); + renderStarsDeferred(origin); renderHeavenlyBodies(); renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader); } @@ -627,7 +632,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 a292c21556..86c598f70a 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 ); @@ -215,7 +208,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/llface.cpp b/indra/newview/llface.cpp index 333c417c7f..316951c316 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1242,7 +1242,7 @@ bool LLFace::canRenderAsMask() } LLMaterial* mat = te->getMaterialParams(); - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) { return false; } @@ -1515,7 +1515,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { - if (!mat || mat->getDiffuseAlphaModeRender() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { shiny_in_alpha = true; } diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index cdc91b30e7..8a8d2b39cb 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -765,12 +765,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 db95618bd0..be62f7b3a9 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 @@ -1026,7 +1026,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, } //END LL_DARWIN -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # if LL_GTK @@ -1652,4 +1652,4 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) return FALSE; } -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index e8be5a402c..8c414ecde9 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -679,7 +679,10 @@ void LLFloaterExperienceProfile::onClickLocation() if(region) { LLTextBox* child = getChild(EDIT TF_SLURL); - mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString(); + // FIRE-30768: SLURL's don't work in VarRegions (Patch from Oren) + //mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString(); + mLocationSLURL = LLSLURL(region->getName(), region->getOriginGlobal(), gAgent.getPositionGlobal()).getSLURLString(); + // child->setText(mLocationSLURL); onFieldChanged(); } diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 5395f517a3..ea82165ad5 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -63,7 +63,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 @@ -430,8 +432,11 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate() while (current_participant_model != end_participant_model) { LLConversationItemParticipant* participant_model = dynamic_cast(*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++; } @@ -478,8 +483,11 @@ void LLFloaterIMContainer::idleUpdate() while (current_participant_model != end_participant_model) { LLConversationItemParticipant* participant_model = dynamic_cast(*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++; } @@ -512,20 +520,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 &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; } @@ -1847,6 +1884,8 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c // 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 38590666c1..31b551e3e4 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -231,9 +231,10 @@ private: conversations_widgets_map mConversationsWidgets; LLConversationViewModel mConversationViewModel; LLFolderView* mConversationsRoot; - LLEventStream mConversationsEventStream; + LLEventStream mConversationsEventStream; - std::deque mConversationEventQueue; + typedef std::map > conversations_items_deque; + conversations_items_deque mConversationEventQueue; LLTimer mParticipantRefreshTimer; }; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 065d41d019..1d2b587d3f 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -499,7 +499,10 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant() while (current_participant_model != end_participant_model) { LLConversationItem* participant_model = dynamic_cast(*current_participant_model); - addConversationViewParticipant(participant_model); + if (participant_model) + { + addConversationViewParticipant(participant_model); + } current_participant_model++; } } diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 48913cc91e..ebc9e2be22 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -45,6 +45,11 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" +// FIRE-14344 - Add button preview and allow for more than 6 axes +#include "llspinctrl.h" +#include "lliconctrl.h" +// + #if LL_WINDOWS && !LL_MESA_HEADLESS // Require DirectInput version 8 #define DIRECTINPUT_VERSION 0x0800 @@ -52,18 +57,20 @@ #include #endif -// FIRE-14344 - show joystick buttons -const std::string JOYSTICK_BUTTON_ON ( "\xE2\xAC\xA4" ); // U+2B24 BLACK LARGE CIRCLE -const std::string JOYSTICK_BUTTON_OFF( "\xE2\x97\xAF" ); // U+25EF WHITE LARGE CIRCLE -// - static LLTrace::SampleStatHandle<> sJoystickAxis0("Joystick axis 0"), sJoystickAxis1("Joystick axis 1"), sJoystickAxis2("Joystick axis 2"), sJoystickAxis3("Joystick axis 3"), sJoystickAxis4("Joystick axis 4"), - sJoystickAxis5("Joystick axis 5"); -static LLTrace::SampleStatHandle<>* sJoystickAxes[6] = +// FIRE-14344 - Add button preview and allow for more than 6 axes +// sJoystickAxis5("Joystick axis 5"); +// static LLTrace::SampleStatHandle<>* sJoystickAxes[6] = + sJoystickAxis5("Joystick axis 5"), + sJoystickAxis6("Joystick axis 6"), + sJoystickAxis7("Joystick axis 7"); + +static LLTrace::SampleStatHandle<>* sJoystickAxes[MAX_JOYSTICK_AXES] = +// { &sJoystickAxis0, &sJoystickAxis1, @@ -71,6 +78,11 @@ static LLTrace::SampleStatHandle<>* sJoystickAxes[6] = &sJoystickAxis3, &sJoystickAxis4, &sJoystickAxis5 +// FIRE-14344 - Add button preview and allow for more than 6 axes + , + &sJoystickAxis6, + &sJoystickAxis7 +// }; #if LL_WINDOWS && !LL_MESA_HEADLESS @@ -100,6 +112,12 @@ LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) : LLFloater(data), mHasDeviceList(false) { + // FIRE-14344 - Add button preview and allow for more than 6 axes + mAxisStatsBar = new LLStatBar*[MAX_JOYSTICK_AXES]; + mAxisViews = new LLStatView*[MAX_JOYSTICK_AXES]; + mButtonsLights = new LLIconCtrl*[MAX_JOYSTICK_BUTTONS]; + // + if (!LLViewerJoystick::getInstance()->isJoystickInitialized()) { LLViewerJoystick::getInstance()->init(false); @@ -125,7 +143,9 @@ void LLFloaterJoystick::draw() } // - for (U32 i = 0; i < 6; i++) + // FIRE-14344 - Add button preview and allow for more than 6 axes + // for (U32 i = 0; i < 6; i++) + for (U32 i = 0; i < joystick->getNumOfJoystickAxes(); i++) { F32 value = joystick->getJoystickAxis(i); // FIRE-14344 - using the frame interval seems to break the graphs @@ -143,21 +163,19 @@ void LLFloaterJoystick::draw() } } - // FIRE-14344 - show joystick buttons - std::string buttons; - for (U32 i = 0; i < 16; i++) + // FIRE-14344 - Add button preview and allow for more than 6 axes + if (mJoystickEnabled) { - U32 value = joystick->getJoystickButton(i); - if (value == 0) + // dim = button present but not pushed, white = button currently pushed + const LLColor4& bright = LLUIColorTable::instance().getColor("White").get(); + const LLColor4& dim = LLUIColorTable::instance().getColor("Gray").get(); + + for (U32 i = 0; i < joystick->getNumOfJoystickButtons(); i++) { - buttons += JOYSTICK_BUTTON_OFF; - } - else - { - buttons += JOYSTICK_BUTTON_ON; + U32 value = joystick->getJoystickButton(i); + mButtonsLights[i]->setColor(value ? bright : dim); } } - mJoystickButtons->setText(buttons); // LLFloater::draw(); @@ -168,12 +186,14 @@ BOOL LLFloaterJoystick::postBuild() center(); // Micro Save on calls to gSavedSettings //F32 range = gSavedSettings.getBOOL("Cursor3D") ? 128.f : 2.f; - // FIRE-14344 - use 1.f for the graph ranges instead of 128.f : 2.f to get better resolution - + // FIRE-14344 - use 0.5f for the graph ranges instead of 128.f : 2.f to get better autoscaling - // needs testing with an actual absolute pointer device if the range scales in a useful way when // not starting at 128.f - F32 range = 1.f; + F32 range = 0.5f; - for (U32 i = 0; i < 6; i++) + // FIRE-14344 - Add button preview and allow for more than 6 axes + // for (U32 i = 0; i < 6; i++) + for (U32 i = 0; i < MAX_JOYSTICK_AXES; i++) { std::string stat_name(llformat("Joystick axis %d", i)); std::string axisname = llformat("axis%d", i); @@ -183,8 +203,23 @@ BOOL LLFloaterJoystick::postBuild() mAxisStatsBar[i]->setStat(stat_name); mAxisStatsBar[i]->setRange(-range, range); } + // FIRE-14344 - cache axis view widgets for faster lookup later + mAxisViews[i] = getChild(llformat("axis_view_%d", i)); + + // set number of axes on spinners + LLSpinCtrl* spin; + spin = getChild(llformat("JoystickAxis%d", i)); + spin->setMaxValue(MAX_JOYSTICK_AXES - 1); + // } - + + // FIRE-14344 - Add button preview and allow for more than 6 axes + for (U32 i = 0; i < MAX_JOYSTICK_BUTTONS; i++) + { + mButtonsLights[i] = getChild(llformat("button_light_%d", i)); + } + // + mJoysticksCombo = getChild("joystick_combo"); childSetCommitCallback("joystick_combo",onCommitJoystickEnabled,this); mCheckFlycamEnabled = getChild("JoystickFlycamEnabled"); @@ -194,17 +229,20 @@ BOOL LLFloaterJoystick::postBuild() childSetAction("cancel_btn", onClickCancel, this); childSetAction("ok_btn", onClickOK, this); - // FIRE-14344 - show joystick buttons - mJoystickButtons = getChild("joystick_buttons"); - refresh(); refreshListOfDevices(); + updateAxesAndButtons(); // FIRE-14344 - Add button preview and allow for more than 6 axes return TRUE; } LLFloaterJoystick::~LLFloaterJoystick() { // Children all cleaned up by default view destructor. + + // FIRE-14344 - Add button preview and allow for more than 6 axes + delete[] mAxisStatsBar; + delete[] mButtonsLights; + delete[] mAxisViews; } @@ -462,6 +500,11 @@ void LLFloaterJoystick::onCommitJoystickEnabled(LLUICtrl*, void *joy_panel) LL_DEBUGS("Joystick") << "Selected " << device_id << " as joystick." << LL_ENDL; self->refreshListOfDevices(); + + // FIRE-14344 - Add button preview and allow for more than 6 axes + self->mJoystickEnabled = joystick_enabled; + self->updateAxesAndButtons(); + // } void LLFloaterJoystick::onClickRestoreSNDefaults(void *joy_panel) @@ -514,3 +557,32 @@ void LLFloaterJoystick::onClose(bool app_quitting) cancel(); } } + +// FIRE-14344 - Add button preview and allow for more than 6 axes +void LLFloaterJoystick::updateAxesAndButtons() +{ + U8 axes = 0; + U8 buttons = 0; + + if(mJoystickEnabled) + { + axes = LLViewerJoystick::getInstance()->getNumOfJoystickAxes(); + buttons = LLViewerJoystick::getInstance()->getNumOfJoystickButtons(); + } + + for(U8 i = 0; i < MAX_JOYSTICK_AXES; i++) + { + mAxisViews[i]->setDisplayChildren(i < axes); + mAxisViews[i]->reshape(0, 0, false); + } + + // dim = button present but not pushed, dark = button not present on this joystick + static const LLColor4& dark = LLUIColorTable::instance().getColor("DkGray").get(); + static const LLColor4& dim = LLUIColorTable::instance().getColor("Gray").get(); + + for(U8 i = 0; i < MAX_JOYSTICK_BUTTONS; i++) + { + mButtonsLights[i]->setColor(i < buttons ? dim : dark); + } +} +// diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index 5bda3a0b1e..e4fc7d92c5 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -32,6 +32,10 @@ class LLCheckBoxCtrl; class LLComboBox; +// FIRE-14344 - Add button preview and allow for more than 6 axes +class LLIconCtrl; +class LLStatView; +// class LLFloaterJoystick : public LLFloater { @@ -54,6 +58,8 @@ protected: void onClose(bool app_quitting); void onClickCloseBtn(bool app_quitting); + // FIRE-14344 - Add button preview and allow for more than 6 axes + void updateAxesAndButtons(); private: LLFloaterJoystick(const LLSD& data); @@ -96,10 +102,12 @@ private: bool mHasDeviceList; // stats view - LLStatBar* mAxisStatsBar[6]; - - // FIRE-14344 - show joystick buttons - LLTextBase* mJoystickButtons; + // FIRE-14344 - Add button preview and allow for more than 6 axes + // LLStatBar* mAxisStatsBar[6]; + LLStatBar** mAxisStatsBar; + LLIconCtrl** mButtonsLights; + LLStatView** mAxisViews; + // }; #endif diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index f24c047c25..78ab6ae055 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -864,9 +864,11 @@ void LLFloaterModelPreview::draw() if (!mModelPreview->mLoading) { - if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_MATERIALS ) + if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_MATERIALS_NOT_A_SUBSET )// Improve error reporting { - childSetTextArg("status", "[STATUS]", getString("status_material_mismatch")); + // cleanup/improve errors - this error is effectively duplicated, the unused one was actually better + // childSetTextArg("status", "[STATUS]", getString("status_material_mismatch")); + childSetTextArg("status", "[STATUS]", getString("mesh_status_invalid_material_list")); } else if ( mModelPreview->getLoadState() > LLModelLoader::ERROR_MODEL ) @@ -879,6 +881,13 @@ void LLFloaterModelPreview::draw() childSetTextArg("status", "[STATUS]", getString("status_parse_error")); toggleCalculateButton(false); } + // improve error reporting + else + if ( mModelPreview->getLoadState() == LLModelLoader::ERROR_LOD_MODEL_MISMATCH ) + { + childSetTextArg("status", "[STATUS]", getString("status_lod_model_mismatch")); + toggleCalculateButton(false); + } else if (mModelPreview->getLoadState() == LLModelLoader::WARNING_BIND_SHAPE_ORIENTATION) { @@ -998,7 +1007,7 @@ BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks); } - return TRUE; + return TRUE; } /*virtual*/ @@ -1130,8 +1139,21 @@ void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) S32 file_mode = iface->getItemCount() - 1; if (which_mode < file_mode) { - S32 which_lod = num_lods - which_mode; - sInstance->mModelPreview->setPhysicsFromLOD(which_lod); + // FIRE-30963 Support pre-defined physics shapes (initially cube) + // S32 which_lod = num_lods - which_mode; + // sInstance->mModelPreview->setPhysicsFromLOD(which_lod); + if(which_mode >= num_lods) + { + // which_mode is between the last LOD entry and file selection + // so it is a preset + sInstance->mModelPreview->setPhysicsFromPreset(which_mode-num_lods); + } + else + { + S32 which_lod = num_lods - which_mode; + sInstance->mModelPreview->setPhysicsFromLOD(which_lod); + } + // } LLModelPreview *model_preview = sInstance->mModelPreview; @@ -1379,47 +1401,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() { @@ -1430,9 +1452,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("conflicts_description"); joint_total_descr->setTextArg("[CONFLICTS]", llformat("%d", 0)); @@ -1441,34 +1463,34 @@ void LLFloaterModelPreview::clearAvatarTab() LLTextBox *joint_pos_descr = panel->getChild("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; @@ -1477,11 +1499,11 @@ 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(); // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup //LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]]; @@ -1492,60 +1514,60 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j].mName, 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) - { + { // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup //LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]]; LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j].mName]; data.mModelsNoOverrides.insert(model->getName()); } } - } - } - } + } + } + } LLPanel *panel = mTabContainer->getPanelByName("rigging_panel"); LLScrollListCtrl *joints_list = panel->getChild("joints_list"); if (joints_list->isEmpty()) - { + { // Populate table - std::map joint_alias_map; + std::map 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); @@ -1553,38 +1575,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("conflicts_description"); joint_conf_descr->setTextArg("[CONFLICTS]", llformat("%d", conflicts)); joint_conf_descr->setTextArg("[JOINTS_COUNT]", llformat("%d", mJointOverrides[display_lod].size())); - } -} + } + } //----------------------------------------------------------------------------- // addStringToLogTab() @@ -1592,52 +1614,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) { @@ -1645,15 +1667,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) { @@ -1738,17 +1760,17 @@ void LLFloaterModelPreview::setCtrlLoadFromFile(S32 lod) LLComboBox* lod_combo = findChild("physics_lod_combo"); if (lod_combo) { - lod_combo->setCurrentByIndex(5); + lod_combo->setCurrentByIndex(lod_combo->getItemCount() - 1); // FIRE-30963 - better physics defaults } } else - { +{ LLComboBox* lod_combo = findChild("lod_source_" + lod_name[lod]); if (lod_combo) - { + { lod_combo->setCurrentByIndex(0); - } - } + } +} } void LLFloaterModelPreview::setStatusMessage(const std::string& msg) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d908a30123..21a58a3f01 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -6377,7 +6377,9 @@ static LLPanelInjector t_pref_opensim("panel_preferenc #ifdef OPENSIM LLPanelPreferenceOpensim::LLPanelPreferenceOpensim() : LLPanelPreference(), - mGridListControl(NULL) + mGridListControl(NULL), + mGridListChangedCallbackConnection(), + mGridAddedCallbackConnection() { mCommitCallbackRegistrar.add("Pref.ClearDebugSearchURL", boost::bind(&LLPanelPreferenceOpensim::onClickClearDebugSearchURL, this)); mCommitCallbackRegistrar.add("Pref.PickDebugSearchURL", boost::bind(&LLPanelPreferenceOpensim::onClickPickDebugSearchURL, this)); @@ -6385,7 +6387,19 @@ LLPanelPreferenceOpensim::LLPanelPreferenceOpensim() : LLPanelPreference(), mCommitCallbackRegistrar.add("Pref.ClearGrid", boost::bind(&LLPanelPreferenceOpensim::onClickClearGrid, this)); mCommitCallbackRegistrar.add("Pref.RefreshGrid", boost::bind( &LLPanelPreferenceOpensim::onClickRefreshGrid, this)); mCommitCallbackRegistrar.add("Pref.RemoveGrid", boost::bind( &LLPanelPreferenceOpensim::onClickRemoveGrid, this)); - mCommitCallbackRegistrar.add("Pref.SaveGrid", boost::bind(&LLPanelPreferenceOpensim::onClickSaveGrid, this)); +} + +LLPanelPreferenceOpensim::~LLPanelPreferenceOpensim() +{ + if (mGridListChangedCallbackConnection.connected()) + { + mGridListChangedCallbackConnection.disconnect(); + } + + if (mGridAddedCallbackConnection.connected()) + { + mGridAddedCallbackConnection.disconnect(); + } } BOOL LLPanelPreferenceOpensim::postBuild() @@ -6402,17 +6416,34 @@ BOOL LLPanelPreferenceOpensim::postBuild() mEditorGridMessage = findChild("message_edit"); mGridListControl = getChild("grid_list"); mGridListControl->setCommitCallback(boost::bind(&LLPanelPreferenceOpensim::onSelectGrid, this)); + mGridListChangedCallbackConnection = LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&LLPanelPreferenceOpensim::refreshGridList, this, _1)); refreshGridList(); return LLPanelPreference::postBuild(); } +void LLPanelPreferenceOpensim::onOpen(const LLSD& key) +{ + mCurrentGrid = LLGridManager::getInstance()->getGrid(); + + mEditorGridName->clear(); + mEditorGridURI->clear(); + mEditorLoginPage->clear(); + mEditorHelperURI->clear(); + mEditorWebsite->clear(); + mEditorSupport->clear(); + mEditorRegister->clear(); + mEditorPassword->clear(); + mEditorSearch->clear(); + mEditorGridMessage->clear(); +} + void LLPanelPreferenceOpensim::onSelectGrid() { - LLSD grid_info; + LLSD grid_info; std::string grid = mGridListControl->getSelectedValue(); LLGridManager::getInstance()->getGridData(grid, grid_info); - + mEditorGridName->setText(grid_info[GRID_LABEL_VALUE].asString()); mEditorGridURI->setText(grid_info[GRID_LOGIN_URI_VALUE][0].asString()); mEditorLoginPage->setText(grid_info[GRID_LOGIN_PAGE_VALUE].asString()); @@ -6434,17 +6465,21 @@ void LLPanelPreferenceOpensim::apply() void LLPanelPreferenceOpensim::cancel() { LLGridManager::getInstance()->resetGrids(); + LLGridManager::getInstance()->setGridChoice(mCurrentGrid); FSPanelLogin::updateServer(); } void LLPanelPreferenceOpensim::onClickAddGrid() { - - std::string new_grid = gSavedSettings.getString("OpensimPrefsAddGrid"); + std::string new_grid = getChild("add_grid")->getText(); if (!new_grid.empty()) { getChild("grid_management_panel")->setEnabled(FALSE); + if (mGridAddedCallbackConnection.connected()) + { + mGridAddedCallbackConnection.disconnect(); + } LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&LLPanelPreferenceOpensim::addedGrid, this, _1)); LLGridManager::getInstance()->addGrid(new_grid); } @@ -6452,52 +6487,40 @@ void LLPanelPreferenceOpensim::onClickAddGrid() void LLPanelPreferenceOpensim::addedGrid(bool success) { + if (mGridAddedCallbackConnection.connected()) + { + mGridAddedCallbackConnection.disconnect(); + } + if (success) { + const std::string& new_grid = getChild("add_grid")->getText(); + + for (auto row : mGridListControl->getAllData()) + { + if (new_grid.find(row->getColumn(1)->getValue().asString()) != std::string::npos) + { + row->setSelected(TRUE); + mGridListControl->scrollToShowSelected(); + onSelectGrid(); + break; + } + } + onClickClearGrid(); } - refreshGridList(success); -} - -// TODO: Save changes to grid entries -void LLPanelPreferenceOpensim::onClickSaveGrid() -{ - LLSD grid_info; - grid_info[GRID_VALUE] = mGridListControl->getSelectedValue(); - grid_info[GRID_LABEL_VALUE] = mEditorGridName->getValue(); - grid_info[GRID_LOGIN_URI_VALUE][0] = mEditorGridURI->getValue(); - grid_info[GRID_LOGIN_PAGE_VALUE] = mEditorLoginPage->getValue(); - grid_info[GRID_HELPER_URI_VALUE] = mEditorHelperURI->getValue(); - grid_info["about"] = mEditorWebsite->getValue(); - grid_info["help"] = mEditorSupport->getValue(); - grid_info[GRID_REGISTER_NEW_ACCOUNT] = mEditorRegister->getValue(); - grid_info[GRID_FORGOT_PASSWORD] = mEditorPassword->getValue(); - grid_info["search"] = mEditorSearch->getValue(); - grid_info["message"] = mEditorGridMessage->getValue(); - - // GridEntry* grid_entry = new GridEntry; - // grid_entry->grid = grid_info; - // grid_entry->set_current = false; - - //getChild("grid_management_panel")->setEnabled(FALSE); - //LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&LLPanelPreferenceOpensim::addedGrid, this, _1)); - //LLGridManager::getInstance()->addGrid(grid_entry, LLGridManager::MANUAL); } void LLPanelPreferenceOpensim::onClickClearGrid() { - gSavedSettings.setString("OpensimPrefsAddGrid", std::string()); + getChild("add_grid")->clear(); } void LLPanelPreferenceOpensim::onClickRefreshGrid() { std::string grid = mGridListControl->getSelectedValue(); getChild("grid_management_panel")->setEnabled(FALSE); - LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&LLPanelPreferenceOpensim::refreshGridList, this, _1)); - // FIRE-13223 grid info refresh does not update properly when applied to currently active grid - // LLGridManager::getInstance()->reFetchGrid(grid); LLGridManager::getInstance()->reFetchGrid(grid, (grid == LLGridManager::getInstance()->getGrid()) ); - // } void LLPanelPreferenceOpensim::onClickRemoveGrid() @@ -6525,8 +6548,18 @@ bool LLPanelPreferenceOpensim::removeGridCB(const LLSD& notification, const LLSD { std::string grid = notification["payload"].asString(); getChild("grid_management_panel")->setEnabled(FALSE); - /*mGridListChanged =*/ LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&LLPanelPreferenceOpensim::refreshGridList, this, _1)); + mEditorGridName->clear(); + mEditorGridURI->clear(); + mEditorLoginPage->clear(); + mEditorHelperURI->clear(); + mEditorWebsite->clear(); + mEditorSupport->clear(); + mEditorRegister->clear(); + mEditorPassword->clear(); + mEditorSearch->clear(); + mEditorGridMessage->clear(); LLGridManager::getInstance()->removeGrid(grid); + FSPanelLogin::updateServer(); } return false; } @@ -6601,8 +6634,11 @@ LLPanelPreferenceOpensim::LLPanelPreferenceOpensim() : LLPanelPreference() mCommitCallbackRegistrar.add("Pref.ClearGrid", boost::bind(&no_cb)); mCommitCallbackRegistrar.add("Pref.RefreshGrid", boost::bind(&no_cb)); mCommitCallbackRegistrar.add("Pref.RemoveGrid", boost::bind(&no_cb)); - mCommitCallbackRegistrar.add("Pref.SaveGrid", boost::bind(&no_cb)); } +LLPanelPreferenceOpensim::~LLPanelPreferenceOpensim() +{ +} + #endif // diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 00591c6692..5722332a13 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -589,33 +589,36 @@ private: // class LLPanelPreferenceOpensim : public LLPanelPreference { + LOG_CLASS(LLPanelPreferenceOpensim); + public: LLPanelPreferenceOpensim(); + ~LLPanelPreferenceOpensim(); #ifdef OPENSIM -// - /*virtual*/ BOOL postBuild(); /*virtual*/ void apply(); /*virtual*/ void cancel(); protected: + boost::signals2::connection mGridListChangedCallbackConnection; + boost::signals2::connection mGridAddedCallbackConnection; + + void onOpen(const LLSD& key); + /*virtual*/ BOOL postBuild(); void onClickAddGrid(); void addedGrid(bool success); void onClickClearGrid(); void onClickRefreshGrid(); - void onClickSaveGrid(); void onClickRemoveGrid(); void onSelectGrid(); bool removeGridCB(const LLSD& notification, const LLSD& response); -// -// void onClickClearDebugSearchURL(); void onClickPickDebugSearchURL(); -// void refreshGridList(bool success = true); LLScrollListCtrl* mGridListControl; + private: LLLineEditor* mEditorGridName; LLLineEditor* mEditorGridURI; @@ -627,9 +630,9 @@ private: LLLineEditor* mEditorPassword; LLLineEditor* mEditorSearch; LLLineEditor* mEditorGridMessage; -#endif - LOG_CLASS(LLPanelPreferenceOpensim); + std::string mCurrentGrid; +#endif }; // diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 20a0ae94ce..8246f40d04 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -759,9 +759,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/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 2a2887c257..b410be19a1 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -713,10 +713,16 @@ void LLFloaterWorldMap::requestParcelInfo(const LLVector3d& pos_global) { return; } - - LLVector3 pos_region((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), - (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), - (F32)pos_global.mdV[VZ]); + // VarRegion slurl shenanigans + // agent_x = ll_round(region_pos.mV[VX]); + // agent_y = ll_round(region_pos.mV[VY]); + // agent_z = ll_round(region_pos.mV[VZ]); + // LLVector3 pos_region((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), + // (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), + // (F32)pos_global.mdV[VZ]); + auto region_origin = region->getOriginGlobal(); + auto pos_region = LLVector3(pos_global - region_origin); + // LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); @@ -1022,7 +1028,12 @@ void LLFloaterWorldMap::updateLocation() return; // invalid location } std::string sim_name; - gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name ); + // FIRE-30768: SLURL's don't work in VarRegions + //gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name ); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); + if (sim_info) + sim_name = sim_info->getName(); + // if ((status != LLTracker::TRACKING_NOTHING) && (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName)) { @@ -1055,12 +1066,16 @@ void LLFloaterWorldMap::updateLocation() childSetValue("location", RlvStrings::getString(RlvStringKeys::Hidden::Region)); } - else if (gotSimName) +// FORE-30768 Slurls in Var regions are b0rked + // else if (gotSimName) + else if (sim_info) // [/RLVa:KB] // if ( gotSimName ) { - mSLURL = LLSLURL(sim_name, pos_global); + // mSLURL = LLSLURL(sim_name, pos_global); + mSLURL = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), pos_global); } +// else { // Empty SLURL will disable the "Copy SLURL to clipboard" button mSLURL = LLSLURL(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index d3cc03914f..e8542dcaf6 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2234,6 +2234,22 @@ bool LLInventoryModel::loadSkeleton( LLFile::remove(inventory_filename); } + // also delete library cache if inventory cache is purged, so issues with EEP settings going missing + // and bridge objects not being found can be resolved + inventory_filename = getInvCacheAddres(ALEXANDRIA_LINDEN_ID); + if (LLFile::isfile(inventory_filename)) + { + LL_INFOS("LLInventoryModel") << "Purging library cache file: " << inventory_filename << LL_ENDL; + LLFile::remove(inventory_filename); + } + + inventory_filename.append(".gz"); + if (LLFile::isfile(inventory_filename)) + { + LL_INFOS("LLInventoryModel") << "Purging library cache file: " << inventory_filename << LL_ENDL; + LLFile::remove(inventory_filename); + } + LL_INFOS("LLInventoryModel") << "Clear inventory cache marker removed: " << delete_cache_marker << LL_ENDL; LLFile::remove(delete_cache_marker); } diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index 4e3f511afc..436b25ffe4 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -286,22 +286,78 @@ void LLLandmarkActions::createLandmarkHere() createLandmarkHere(landmark_name, landmark_desc, folder_id); } - -void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */) +// FIRE-30534 - changes related to var regions in opensim +void LLLandmarkActions::getSLURLfromPosGlobalAndLocal(const LLVector3d& global_pos, const LLVector3& region_pos, slurl_callback_t cb, bool escaped /* = true */) { std::string sim_name; - bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name); + LLVector3d tmp_global_pos{global_pos}; + tmp_global_pos.mdV[VX] -= region_pos.mV[VX]; + tmp_global_pos.mdV[VY] -= region_pos.mV[VY]; + tmp_global_pos.mdV[VZ] -= region_pos.mV[VZ]; + + bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(tmp_global_pos, sim_name); if (gotSimName) { - std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString(); + std::string slurl = LLSLURL(sim_name, region_pos).getSLURLString(); + cb(slurl); + return; + } + else + { + auto regionp = gAgent.getRegion(); + U64 new_region_handle{}; + if(regionp) + { + new_region_handle = to_region_handle( tmp_global_pos, regionp->getOriginGlobal(), regionp->getWidth() ); + } + else + { + new_region_handle = to_region_handle( tmp_global_pos ); + } + + LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseSLURL, + cb, + global_pos, + escaped, + _2); + + LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle, url_cb, std::string("unused"), false); + } +} +// +void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */) +{ + // FIRE-30768: SLURL's don't work in VarRegions + //std::string sim_name; + //bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name); + //if (gotSimName) + //{ + // std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString(); + + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos); + if (sim_info) + { + std::string slurl = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), global_pos).getSLURLString(); + // cb(slurl); return; } else { - U64 new_region_handle = to_region_handle(global_pos); - + // FIRE-30534 - changes related to var regions in opensim + // U64 new_region_handle = to_region_handle(global_pos); + auto regionp = gAgent.getRegion(); + U64 new_region_handle{}; + if(regionp) + { + new_region_handle = to_region_handle( global_pos, regionp->getOriginGlobal(), regionp->getWidth() ); + } + else + { + new_region_handle = to_region_handle( global_pos ); + } + // LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseSLURL, cb, global_pos, @@ -340,19 +396,34 @@ void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb, bool escaped, const std::string& url) { - std::string sim_name; +// FIRE-30768: SLURL's don't work in VarRegions +// std::string sim_name; +// std::string slurl; +// bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name); +// if (gotSimName) +// { +// // Debug... +// if (sim_name.empty()) +// { +// LL_WARNS() << "Requested sim name is empty!" << LL_ENDL; +// } +// // +// slurl = LLSLURL(sim_name, global_pos).getSLURLString(); +// } + std::string slurl; - bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name); - if (gotSimName) + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos); + if (sim_info) { // Debug... - if (sim_name.empty()) + if (sim_info->getName().empty()) { LL_WARNS() << "Requested sim name is empty!" << LL_ENDL; } // - slurl = LLSLURL(sim_name, global_pos).getSLURLString(); + slurl = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), global_pos).getSLURLString(); } +// else { slurl = ""; @@ -413,7 +484,12 @@ void LLLandmarkActions::copySLURLtoClipboard(const LLUUID& landmarkInventoryItem { LLVector3d global_pos; landmark->getGlobalPos(global_pos); - LLLandmarkActions::getSLURLfromPosGlobal(global_pos,©_slurl_to_clipboard_callback,true); + // FIRE-30534 - changes related to var regions in opensim + // LLLandmarkActions::getSLURLfromPosGlobal(global_pos,©_slurl_to_clipboard_callback,true); + LLVector3 region_pos; + region_pos = landmark->getRegionPos(); + LLLandmarkActions::getSLURLfromPosGlobalAndLocal(global_pos, region_pos, ©_slurl_to_clipboard_callback,true); + // } } diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h index 870d92811e..a153ac9403 100644 --- a/indra/newview/lllandmarkactions.h +++ b/indra/newview/lllandmarkactions.h @@ -94,6 +94,7 @@ public: * @brief Creates SLURL for given global position. */ static void getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped = true); + static void getSLURLfromPosGlobalAndLocal(const LLVector3d& global_pos, const LLVector3& region_pos, slurl_callback_t cb, bool escaped = true);// FIRE-30534 - changes related to var regions in opensim static void getRegionNameAndCoordsFromPosGlobal(const LLVector3d& global_pos, region_name_and_coords_callback_t cb); diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 821ab12537..de802f6275 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -49,6 +49,7 @@ #include "lllandmarkactions.h" #include "lllandmarklist.h" #include "llpathfindingmanager.h" +#include "llworld.h" // FIRE-30768: SLURL's don't work in VarRegions #include "llpathfindingnavmesh.h" #include "llpathfindingnavmeshstatus.h" #include "llteleporthistory.h" @@ -775,13 +776,24 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) //mFullTitile format - region_name[, parcel_name] (local_x,local_y, local_z) if (new_item_titles.insert(result->mFullTitle).second) { - LLSD value; - value["item_type"] = TELEPORT_HISTORY; - value["global_pos"] = result->mGlobalPos.getValue(); - std::string region_name = result->mTitle.substr(0, result->mTitle.find(',')); - //TODO*: add Surl to teleportitem or parse region name from title - value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString(); - add(result->getTitle(), value); + // FIRE-30768: SLURL's don't work in VarRegions + LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(result->mRegionID); + if (regionp) + { + LLSD value; + value["item_type"] = TELEPORT_HISTORY; + value["global_pos"] = result->mGlobalPos.getValue(); + std::string region_name = result->mTitle.substr(0, result->mTitle.find(',')); + //TODO*: add Surl to teleportitem or parse region name from title + //value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString(); + value["tooltip"] = LLSLURL(region_name, regionp->getOriginGlobal(), result->mGlobalPos).getSLURLString(); + add(result->getTitle(), value); + } + else + { + LL_WARNS("LocationInputCtrl") << "unable to resolve region " << result->mRegionID << LL_ENDL; + } + // } result = std::find_if(result + 1, th_items.end(), boost::bind( &LLLocationInputCtrl::findTeleportItemsByTitle, this, diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 3cbe727461..83e4fe3326 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -368,6 +368,118 @@ U32 LLModelPreview::calcResourceCost() return (U32)streaming_cost; } +// relocate from llmodel and rewrite so it does what it is meant to +// Material matching should work as the comment below states (subsets are allowed) +// prior to this a mess in multiple places meant that all LODs are forced to carry unwanted triangles for unused materials +bool LLModelPreview::matchMaterialOrder(LLModel* lod, LLModel* ref, int& refFaceCnt, int& modelFaceCnt ) +{ + //Is this a subset? + //LODs cannot currently add new materials, e.g. + //1. ref = a,b,c lod1 = d,e => This is not permitted + //2. ref = a,b,c lod1 = c => This would be permitted + + LL_INFOS("MESHSKININFO") << "In matchMaterialOrder." << LL_ENDL; + bool isASubset = lod->isMaterialListSubset( ref ); + if ( !isASubset ) + { + LL_INFOS("MESHSKININFO")<<"Material of model is not a subset of reference."<getName() << "'s materials are not a subset of the High LOD (reference) model " << ref->getName(); + LL_INFOS() << out.str() << LL_ENDL; + LLFloaterModelPreview::addStringToLog(out, true); + return false; + } + + LL_DEBUGS("MESHSKININFO") << "subset check passed." << LL_ENDL; + std::map index_map; + + //build a map of material slot names to face indexes + bool reorder = false; + auto max_lod_mats = lod->mMaterialList.size(); + + for ( U32 i = 0; i < ref->mMaterialList.size(); i++ ) + { + // create the reference map for later + index_map[ref->mMaterialList[i]] = i; + LL_DEBUGS("MESHSKININFO") << "setting reference material " << ref->mMaterialList[i] << " as index " << i << LL_ENDL; + if( i >= max_lod_mats || lod->mMaterialList[i] != ref->mMaterialList[i] ) + { + // i is already out of range of the original material sets in this LOD OR is not matching. + LL_DEBUGS("MESHSKININFO") << "mismatch at " << i << " " << ref->mMaterialList[i] + << " != " << ((i >= max_lod_mats)? "Out-of-range":lod->mMaterialList[i]) << LL_ENDL; + // we have a misalignment/ordering + // check that ref[i] is in cur and if not add a blank + U32 j{0}; + for ( ; j < max_lod_mats; j++ ) + { + if( i != j && lod->mMaterialList[j] == ref->mMaterialList[i] ) + { + LL_DEBUGS("MESHSKININFO") << "material " << ref->mMaterialList[i] + << " found at " << j << LL_ENDL; + // we found it but in the wrong place. + reorder = true; + break; + } + } + if( j >= max_lod_mats ) + { + std::ostringstream out; + out << "material " << ref->mMaterialList[i] + << " not found in lod adding placeholder"; + LL_DEBUGS("MESHSKININFO") << out.str() << LL_ENDL; + if (mImporterDebug) + { + LLFloaterModelPreview::addStringToLog(out, false); + } + // The material is not in the submesh, add a placeholder. + // this is appended to the existing data so we'll need to reorder + // Note that this placeholder will be eliminated on the writeData (upload) and replaced with + // "NoGeometry" in the LLSD + reorder = true; + LLVolumeFace face; + + face.resizeIndices(3); + face.resizeVertices(1); + face.mPositions->clear(); + face.mNormals->clear(); + face.mTexCoords->setZero(); + memset(face.mIndices, 0, sizeof(U16)*3); + lod->addFace(face); + lod->mMaterialList.push_back( ref->mMaterialList[i] ); + } + } + //if any material name does not match reference, we need to reorder + } + LL_DEBUGS("MESHSKININFO") << "finished parsing materials" << LL_ENDL; + for ( U32 i = 0; i < lod->mMaterialList.size(); i++ ) + { + LL_DEBUGS("MESHSKININFO") << "lod material " << lod->mMaterialList[i] << " has index " << i << LL_ENDL; + } + // Sanity check. We have added placeholders for any mats in ref that are not in this. + // the mat count MUST be equal now. + if (lod->mMaterialList.size() != ref->mMaterialList.size()) + { + std::ostringstream out; + out << "Material of LOD model " << lod->getName() << " has more materials than the reference " << ref->getName() << "."; + LL_INFOS("MESHSKININFO") << out.str() << LL_ENDL; + LLFloaterModelPreview::addStringToLog(out, true); + return false; + } + + + // Fix up material matching badness + // if (reorder && (base_mat == cur_mat)) //don't reorder if material name sets don't match + if ( reorder ) + { + LL_INFOS("MESHSKININFO") << "re-ordering." << LL_ENDL; + lod->sortVolumeFacesByMaterialName(); + lod->mMaterialList = ref->mMaterialList; + } + + return true; +} +// + void LLModelPreview::rebuildUploadData() { assert_main_thread(); @@ -582,7 +694,7 @@ void LLModelPreview::rebuildUploadData() if (!high_lod_model) { LLFloaterModelPreview::addStringToLog("Model " + instance.mLabel + " has no High Lod (LOD3).", true); - load_state = LLModelLoader::ERROR_MATERIALS; + load_state = LLModelLoader::ERROR_HIGH_LOD_MODEL_MISSING; // FIRE-30965 Cleanup braindead mesh parsing error handlers mFMP->childDisable("calculate_btn"); } else @@ -592,10 +704,13 @@ void LLModelPreview::rebuildUploadData() int refFaceCnt = 0; int modelFaceCnt = 0; llassert(instance.mLOD[i]); - if (instance.mLOD[i] && !instance.mLOD[i]->matchMaterialOrder(high_lod_model, refFaceCnt, modelFaceCnt)) + // Fix material matching algorithm to work as per design + // if (instance.mLOD[i] && !instance.mLOD[i]->matchMaterialOrder(high_lod_model, refFaceCnt, modelFaceCnt)) + if (instance.mLOD[i] && !matchMaterialOrder(instance.mLOD[i],high_lod_model, refFaceCnt, modelFaceCnt)) + // { LLFloaterModelPreview::addStringToLog("Model " + instance.mLabel + " has mismatching materials between lods." , true); - load_state = LLModelLoader::ERROR_MATERIALS; + load_state = LLModelLoader::ERROR_MATERIALS_NOT_A_SUBSET; // more descriptive errors mFMP->childDisable("calculate_btn"); } } @@ -644,14 +759,15 @@ void LLModelPreview::rebuildUploadData() } if (!found_model && mModel[lod][model_ind] && !mModel[lod][model_ind]->mSubmodelID) { - if (mImporterDebug) + // this is not debug, this is an important/useful error advisory + // if (mImporterDebug) { std::ostringstream out; out << "Model " << mModel[lod][model_ind]->mLabel << " was not used - mismatching lod models."; LL_INFOS() << out.str() << LL_ENDL; LLFloaterModelPreview::addStringToLog(out, true); } - load_state = LLModelLoader::ERROR_MATERIALS; + load_state = LLModelLoader::ERROR_LOD_MODEL_MISMATCH; mFMP->childDisable("calculate_btn"); } } @@ -663,7 +779,12 @@ void LLModelPreview::rebuildUploadData() // encountered issues setLoadState(load_state); } - else if (getLoadState() == LLModelLoader::ERROR_MATERIALS + // FIRE-30965 Cleanup braindead mesh parsing error handlers + // else if (getLoadState() == LLModelLoader::ERROR_MATERIALS + else if (getLoadState() == LLModelLoader::ERROR_MATERIALS_NOT_A_SUBSET + || getLoadState() == LLModelLoader::ERROR_HIGH_LOD_MODEL_MISSING + || getLoadState() == LLModelLoader::ERROR_LOD_MODEL_MISMATCH + // || getLoadState() == LLModelLoader::WARNING_BIND_SHAPE_ORIENTATION) { // This is only valid for these two error types because they are @@ -922,7 +1043,38 @@ void LLModelPreview::setPhysicsFromLOD(S32 lod) updateStatusMessages(); } } +// FIRE-30963 - better physics defaults +void LLModelPreview::setPhysicsFromPreset(S32 preset) +{ + assert_main_thread(); + mPhysicsSearchLOD = -1; + mLODFile[LLModel::LOD_PHYSICS].clear(); + mFMP->childSetValue("physics_file", mLODFile[LLModel::LOD_PHYSICS]); + mVertexBuffer[LLModel::LOD_PHYSICS].clear(); + if(preset == 1) + { + mPhysicsSearchLOD = LLModel::LOD_PHYSICS; + loadModel( gDirUtilp->getExpandedFilename(LL_PATH_FS_RESOURCES, "cube_phys.dae"), LLModel::LOD_PHYSICS); + } + else if(preset == 2) + { + mPhysicsSearchLOD = LLModel::LOD_PHYSICS; + loadModel( gDirUtilp->getExpandedFilename(LL_PATH_FS_RESOURCES, "hex_phys.dae"), LLModel::LOD_PHYSICS); + } + else if(preset == 3) + { + auto ud_physics = gSavedSettings.getString("FSPhysicsPresetUser1"); + LL_INFOS() << "Loading User defined Physics Preset [" << ud_physics << "]" << LL_ENDL; + if (ud_physics != "" && gDirUtilp->fileExists(ud_physics)) + { + // loading physics from file + mPhysicsSearchLOD = LLModel::LOD_PHYSICS; + loadModel( gDirUtilp->getExpandedFilename(LL_PATH_NONE, gDirUtilp->getDirName(ud_physics), gDirUtilp->getBaseFileName(ud_physics, false)), LLModel::LOD_PHYSICS); + } + } +} +// void LLModelPreview::clearIncompatible(S32 lod) { //Don't discard models if specified model is the physic rep @@ -1841,7 +1993,7 @@ void LLModelPreview::updateStatusMessages() LLModel* model_high_lod = instance.mLOD[LLModel::LOD_HIGH]; if (!model_high_lod) { - setLoadState(LLModelLoader::ERROR_MATERIALS); + setLoadState(LLModelLoader::ERROR_HIGH_LOD_MODEL_MISSING); // FIRE-30965 Cleanup braindead mesh parsing error handlers mFMP->childDisable("calculate_btn"); continue; } @@ -1851,7 +2003,7 @@ void LLModelPreview::updateStatusMessages() LLModel* lod_model = instance.mLOD[i]; if (!lod_model) { - setLoadState(LLModelLoader::ERROR_MATERIALS); + setLoadState(LLModelLoader::ERROR_LOD_MODEL_MISMATCH); // FIRE-30965 Cleanup braindead mesh parsing error handlers mFMP->childDisable("calculate_btn"); } else @@ -2365,10 +2517,7 @@ void LLModelPreview::updateStatusMessages() //fmp->childSetEnabled("physics_optimize", !use_hull); - // Enable mesh analysis in SL only for now - //bool enable = (phys_tris > 0 || phys_hulls > 0) && fmp->mCurRequest.empty(); - bool enable = (phys_tris > 0 || phys_hulls > 0) && fmp->mCurRequest.empty() && LLGridManager::instance().isInSecondLife(); - // + bool enable = (phys_tris > 0 || phys_hulls > 0) && fmp->mCurRequest.empty(); //enable = enable && !use_hull && fmp->childGetValue("physics_optimize").asBoolean(); //enable/disable "analysis" UI @@ -2402,13 +2551,10 @@ void LLModelPreview::updateStatusMessages() fmp->childEnable("Simplify"); } - // Enable mesh analysis in SL only for now - //if (phys_tris || phys_hulls > 0) - //{ - // fmp->childEnable("Decompose"); - //} - fmp->childSetEnabled("Decompose", (phys_tris || phys_hulls > 0) && LLGridManager::instance().isInSecondLife()); - // + if (phys_tris || phys_hulls > 0) + { + fmp->childEnable("Decompose"); + } } else { @@ -3227,6 +3373,7 @@ BOOL LLModelPreview::render() gGL.loadIdentity(); gPipeline.enableLightsPreview(); + gObjectPreviewProgram.uniform4fv(LLShaderMgr::AMBIENT, 1, LLPipeline::PreviewAmbientColor.mV); // pass ambient setting to shader LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) * LLQuaternion(mCameraYaw, LLVector3::z_axis); diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index a0e1d2b18c..2cfee9e3cb 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -139,6 +139,7 @@ public: void setTexture(U32 name) { mTextureName = name; } void setPhysicsFromLOD(S32 lod); + void setPhysicsFromPreset(S32 preset);// FIRE-30963 - better physics defaults BOOL render(); void update(); void genBuffers(S32 lod, bool skinned); @@ -199,7 +200,7 @@ public: bool mHasDegenerate; protected: - + bool matchMaterialOrder(LLModel* lod, LLModel* ref, int& refFaceCnt, int& modelFaceCnt ); // FIRE-30965 Cleanup mesh material parsing static void loadedCallback(LLModelLoader::scene& scene, LLModelLoader::model_list& model_list, S32 lod, void* opaque); static void stateChangedCallback(U32 state, void* opaque); diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index edd2d4e91b..34b5853bb9 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -672,8 +672,11 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos) */ LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY, gAgent.getPosAgentFromGlobal(global_agent_pos)); - std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString()); - + // FIRE-30768: SLURL's don't work in VarRegions + //std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString()); + std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), gAgent.getRegion()->getOriginGlobal(), global_agent_pos).getSLURLString()); + // + LLLocationHistoryItem item (location, global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location //Touch it, if it is at list already, add new location otherwise @@ -760,7 +763,10 @@ void LLNavigationBar::onRegionNameResponse( LLVector3d region_pos = from_region_handle(region_handle); LLVector3d global_pos = region_pos + (LLVector3d) local_coords; - LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << LL_ENDL; + // FIRE-30768: SLURL's don't work in VarRegions + //LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << LL_ENDL; + LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, region_pos, global_pos).getSLURLString() << LL_ENDL; + // gAgent.teleportViaLocation(global_pos); } else if (gSavedSettings.getBOOL("SearchFromAddressBar")) diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 452d92a1a3..fb9eca1e7a 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -173,7 +173,7 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id, mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), (F32)pos_global.mdV[VZ]); - + LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) @@ -186,6 +186,29 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id, mDescEditor->setText(getString("server_update_text")); } } +// FIRE-30768, FIRE-30534 more OS Var region fixups +void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id, + const U64 region_handle, + const LLVector3d& pos_global) +{ + auto region_origin = from_region_handle(region_handle); + mPosRegion.setVec(LLVector3(pos_global - region_origin)); + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + return; + LLSD body; + std::string url = region->getCapability("RemoteParcelRequest"); + if (!url.empty()) + { + LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url, + region_id, mPosRegion, pos_global, getObserverHandle()); + } + else + { + mDescEditor->setText(getString("server_update_text")); + } +} +// // virtual void LLPanelPlaceInfo::setErrorStatus(S32 status, const std::string& reason) diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h index 10b6c8a1bc..fe9b26cbb9 100644 --- a/indra/newview/llpanelplaceinfo.h +++ b/indra/newview/llpanelplaceinfo.h @@ -85,6 +85,11 @@ public: // Sends a request to the server. void displayParcelInfo(const LLUUID& region_id, const LLVector3d& pos_global); + // FIRE-30768, FIRE-30534 more OS Var region fixups + void displayParcelInfo(const LLUUID& region_id, + const U64 region_handle, + const LLVector3d& pos_global); + // /*virtual*/ void setErrorStatus(S32 status, const std::string& reason); diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 91d51d6594..ae4078f5a3 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -410,9 +410,14 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, parcel_data.name = parcel->getName(); parcel_data.sim_name = region->getName(); parcel_data.snapshot_id = parcel->getSnapshotID(); - mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), - (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), - (F32)pos_global.mdV[VZ]); + // FIRE-30768, FIRE-30534 more OS Var region fixups + // mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), + // (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), + // (F32)pos_global.mdV[VZ]); + auto region_origin = region->getOriginGlobal(); + mPosRegion.setVec(LLVector3(pos_global - region_origin)); + LL_DEBUGS("SLURL") << "LM INFO: global " << pos_global << " region_orig " << region_origin << " pos_region " << mPosRegion << LL_ENDL; + // parcel_data.global_x = pos_global.mdV[VX]; parcel_data.global_y = pos_global.mdV[VY]; parcel_data.global_z = pos_global.mdV[VZ]; diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 04045d555d..8294158870 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -34,6 +34,7 @@ #include "llinventory.h" #include "lllandmark.h" #include "llparcel.h" +#include "llregionhandle.h" // Var region support #include "llcombobox.h" #include "llfiltereditor.h" @@ -486,6 +487,14 @@ void LLPanelPlaces::onOpen(const LLSD& key) mPosGlobal = LLVector3d(key["x"].asReal(), key["y"].asReal(), key["z"].asReal()); + // Var region support + if(key.has("ox")) + { + auto region_handle = to_region_handle(key["ox"].asInteger(), key["oy"].asInteger()); + mPlaceProfile->displayParcelInfo(LLUUID(), region_handle, mPosGlobal); + } + else + // mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); } diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp index 9644b7518e..34a36b186e 100644 --- a/indra/newview/llpanelplacestab.cpp +++ b/indra/newview/llpanelplacestab.cpp @@ -60,14 +60,20 @@ void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos, const LLUUID& snapshot_id, bool teleport) { - std::string sim_name; - bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( landmark_global_pos, sim_name ); + // FIRE-30768: SLURL's don't work in VarRegions + //std::string sim_name; + //bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( landmark_global_pos, sim_name ); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(landmark_global_pos); std::string sl_url; - if ( gotSimName ) + //if ( gotSimName ) + if (sim_info) { - sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString(); + //sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString(); + sl_url = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), landmark_global_pos).getSLURLString(); } + // + else { sl_url = ""; diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 29accdb074..b9a27dc799 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -235,4 +235,28 @@ void LLPreviewAnim::onClose(bool app_quitting) // } // } //} + +// virtual +void LLPreviewAnim::refreshFromItem() +{ + LLPreview::refreshFromItem(); + + const LLInventoryItem* item = getItem(); + if (item) + { + pMotion = gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation + + if (pMotion) + { + LLTextBox* stats_box_left = getChild("AdvancedStatsLeft"); + LLTextBox* stats_box_right = getChild("AdvancedStatsRight"); + stats_box_left->setTextArg("[PRIORITY]", llformat("%d", pMotion->getPriority())); + stats_box_left->setTextArg("[DURATION]", llformat("%.2f", pMotion->getDuration())); + stats_box_left->setTextArg("[IS_LOOP]", (pMotion->getLoop() ? LLTrans::getString("PermYes") : LLTrans::getString("PermNo"))); + stats_box_right->setTextArg("[EASE_IN]", llformat("%.2f", pMotion->getEaseInDuration())); + stats_box_right->setTextArg("[EASE_OUT]", llformat("%.2f", pMotion->getEaseOutDuration())); + stats_box_right->setTextArg("[NUM_JOINTS]", llformat("%d", pMotion->getNumJointMotions())); + } + } +} // diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index df5ad99187..7ce6cfc371 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -45,6 +45,7 @@ public: void play(const LLSD& param); // Improved animation preview //void showAdvanced(); + /*virtual*/ void refreshFromItem(); protected: diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 821d3d647c..9251c38d3c 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -464,9 +464,9 @@ void LLProgressView::initLogos() const S32 default_pad = 15; S32 icon_width; -#if defined(LL_FMODSTUDIO) || defined(LL_HAVOK) +//#if defined(LL_FMODSTUDIO) || defined(LL_HAVOK) // FIRE-30937: Always needed S32 icon_height; -#endif // defined(LL_FMODSTUDIO) || defined(LL_HAVOK) +//#endif // defined(LL_FMODSTUDIO) || defined(LL_HAVOK) // FIRE-30937: Always needed // We don't know final screen rect yet, so we can't precalculate position fully LLTextBox *logos_label = getChild("logos_lbl"); diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index 055ccd5818..85540c580f 100644 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -189,6 +189,7 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url, LLSD bodyData; + LL_DEBUGS("ParcelRequest") << "Remote Parcel Request for " << regionId << "local: " << posRegion << "remote: " << posGlobal << LL_ENDL;// FIRE-30534 - changes related to var regions in opensim bodyData["location"] = ll_sd_from_vector3(posRegion); if (!regionId.isNull()) { @@ -196,6 +197,7 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url, } if (!posGlobal.isExactlyZero()) { + // Note: leave this to_region_handle at 256 grid cell resolution, let OpenSim Server resolve U64 regionHandle = to_region_handle(posGlobal); bodyData["region_handle"] = ll_sd_from_U64(regionHandle); } diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp index f9b0dc241d..1d75ecd4eb 100644 --- a/indra/newview/llslurl.cpp +++ b/indra/newview/llslurl.cpp @@ -353,6 +353,7 @@ LLSLURL::LLSLURL(const std::string& region, // create a slurl from a global position LLSLURL::LLSLURL(const std::string& grid, const std::string& region, + const LLVector3d& , // FIRE-30768: SLURL's don't work in VarRegions *unused param in SL builds* const LLVector3d& global_position) { *this = LLSLURL(LLGridManager::getInstance()->getGridId(grid), @@ -363,10 +364,17 @@ LLSLURL::LLSLURL(const std::string& grid, // create a slurl from a global position LLSLURL::LLSLURL(const std::string& region, + const LLVector3d& region_origin, // FIRE-30768: SLURL's don't work in VarRegions const LLVector3d& global_position) { - *this = LLSLURL(LLGridManager::getInstance()->getGridId(), - region, global_position); + // FIRE-30768: SLURL's don't work in VarRegions + // *this = LLSLURL(LLGridManager::getInstance()->getGridId(), + // region, global_position); + *this = LLSLURL(LLGridManager::getInstance()->getGridId(), + region, + region_origin, + global_position); + // } LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb) diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h index d722852ba3..fd0db1837c 100644 --- a/indra/newview/llslurl.h +++ b/indra/newview/llslurl.h @@ -71,8 +71,12 @@ public: LLSLURL(const std::string& grid, const std::string& region); LLSLURL(const std::string& region, const LLVector3& position); LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position); - LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position); - LLSLURL(const std::string& region, const LLVector3d& global_position); + // FIRE-30768: SLURL's don't work in VarRegions + // LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position); + // LLSLURL(const std::string& region, const LLVector3d& global_position); + LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position); + LLSLURL(const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position); + // LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb); SLURL_TYPE getType() const { return mType; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index d32172a58e..2aef348685 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -950,6 +950,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion) releaseOcclusionQueryObjectNames(); } + for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i) { LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); @@ -2270,138 +2271,100 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) } } -void renderNormals(LLDrawable* drawablep) +void renderNormals(LLDrawable *drawablep) { - LLVertexBuffer::unbind(); - // FIX and improve renderNormals debug - static LLCachedControl showSelectedOnly(*LLUI::getInstance()->mSettingGroups["config"], "OnlyShowSelectedNormals"); - // - LLVOVolume* vol = drawablep->getVOVolume(); - if (vol) - { - // FIX and improve renderNormals debug - if(showSelectedOnly && !drawablep->getVObj()->isSelected()) - { - drawablep->getVObj()->setDebugText(""); - return; - } - // - LLVolume* volume = vol->getVolume(); - gGL.pushMatrix(); - gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix); - - // FIX and improve renderNormals debug - // LLMatrix3 mat_norm {vol->getRelativeXformInvTrans()}; - LLMatrix3 scale_inverse; - auto scale = drawablep->getScale(); - // We need something like an inverse transpose, however - // we do not use the object rotation as it will be applied in the world transform - // but we do need to apply the inverse scale^2(1) as the world transform does a scale too. - // transpose of a scale only matrix is a lot of nothing, so skip it. - scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / scale.mV[VX], - LLVector3(0.0, 1.0, 0.0) / scale.mV[VY], - LLVector3(0.0, 0.0, 1.0) / scale.mV[VZ]); - LLMatrix4a inv_scale_mat; - inv_scale_mat.loadu(scale_inverse); - LLMatrix3 mat_norm = scale_inverse * scale_inverse; - LLMatrix4a invtranspose; - invtranspose.loadu(mat_norm); - // + if (!drawablep->isVisible()) + return; - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLVertexBuffer::unbind(); - // FIX and improve renderNormals debug - // LLVector4a scale(gSavedSettings.getF32("RenderDebugNormalScale")); - static LLCachedControl hairlen(*LLUI::getInstance()->mSettingGroups["config"], "RenderDebugNormalScale"); + LLVOVolume *vol = drawablep->getVOVolume(); - LLSelectNode* selectionNode = nullptr; - auto face_select = LLSelectMgr::getInstance()->getTEMode(); - if(showSelectedOnly) - { - auto objp = drawablep->getVObj(); - if(!objp) - { - return; - } - objp->setDebugText( - llformat( - "obj scale = <%.3f,%.3f,%.3f>", - scale.mV[VX],scale.mV[VY],scale.mV[VZ])); - if(face_select) - { - LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); - selectionNode = sel.get()->findNode(objp); - } - } - // + if (vol) + { + // FIX and improve renderNormals debug + static LLCachedControl showSelectedOnly(gSavedSettings, "OnlyShowSelectedNormals"); + if(showSelectedOnly && !drawablep->getVObj()->isSelected()) + { + drawablep->getVObj()->setDebugText(""); + return; + } + // - for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) - { - // FIX and improve renderNormals debug - if(face_select && !selectionNode->isTESelected(i)) - { - continue; - } - // - const LLVolumeFace& face = volume->getVolumeFace(i); + LLVolume *volume = vol->getVolume(); - // FIX and improve renderNormals debug - gGL.begin(LLRender::LINES); - gGL.diffuseColor4f(1,1,0,1); // Yellow normals - // - for (S32 j = 0; j < face.mNumVertices; ++j) - { - // FIX and improve renderNormals debug - // 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.vertex3fv(face.mPositions[j].getF32ptr()); - // gGL.vertex3fv(p.getF32ptr()); - // } - LLVector4a n,ni,p; - n = face.mNormals[j]; - invtranspose.affineTransform(n, ni); - ni.normalize3fast(); - n.setMul(ni, (F32)hairlen); - inv_scale_mat.affineTransform(n, ni); // overcompensate for the fact we draw "through" the model transform - p.setAdd(face.mPositions[j], ni); - gGL.vertex3fv(face.mPositions[j].getF32ptr()); - gGL.vertex3fv(p.getF32ptr()); - } - gGL.flush(); - if (face.mTangents) - { - // gGL.begin(LLRender::LINES); - gGL.diffuseColor4f(0,0,1,1); // blue tangents. - for (S32 j = 0; j < face.mNumVertices; ++j) - { - LLVector4a t,ti,p; - t = face.mTangents[j]; - // invtranspose.affineTransform(t, ti); - t.mul((F32)hairlen); - inv_scale_mat.affineTransform(t, ti); // overcompensate for the fact we draw "through" the model transform - p.setAdd(face.mPositions[j], ti); - 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 7dfda2cada..eafee1aa74 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -179,6 +179,7 @@ #include "pipeline.h" #include "llappviewer.h" #include "llfasttimerview.h" +#include "lltelemetry.h" #include "llfloatermap.h" #include "llweb.h" #include "llvoiceclient.h" @@ -802,6 +803,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//app_settings. std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml"); @@ -3878,6 +3881,16 @@ void LLStartUp::setStartSLURL(const LLSLURL& slurl) gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_LAST); break; } + // Support adding grids via SLURL +#if OPENSIM && !SINGLEGRID + case LLSLURL::APP: + if (slurl.getAppCmd() == "gridmanager") + { + LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), "clicked", NULL, false); + break; + } +#endif + // default: LLGridManager::getInstance()->setGridChoice(slurl.getGrid()); break; 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 + + #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/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index abd6e31d67..2930c46bcc 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -283,9 +283,12 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& #endif // OPENSIM // - LLVector3d global_pos = from_region_handle(region_handle); - global_pos += LLVector3d(slurl.getPosition()); - + // make Var Regions work + // LLVector3d global_pos = from_region_handle(region_handle); + // global_pos += LLVector3d(slurl.getPosition()); + LLVector3d origin_pos = from_region_handle(region_handle); + LLVector3d global_pos{origin_pos + LLVector3d(slurl.getPosition())}; + // if (teleport) { gAgent.teleportViaLocation(global_pos); @@ -302,6 +305,10 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& key["x"] = global_pos.mdV[VX]; key["y"] = global_pos.mdV[VY]; key["z"] = global_pos.mdV[VZ]; + // support Var regions + key["ox"] = origin_pos.mdV[VX]; + key["oy"] = origin_pos.mdV[VY]; + // // FIRE-817: Separate place details floater //LLFloaterSidePanelContainer::showPanel("places", key); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 643c5b6b58..b494549e16 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -92,6 +92,7 @@ #include "fslslbridge.h" #include "fsradar.h" #include "llavataractions.h" +#include "lldiskcache.h" #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llhudtext.h" @@ -1062,6 +1063,15 @@ void handlePlayBentoIdleAnimationChanged(const LLSD& newValue) } // +// Better asset cache size control +void handleDiskCacheSizeChanged(const LLSD& newValue) +{ + const unsigned int disk_cache_mb = gSavedSettings.getU32("FSDiskCacheSize"); + const U64 disk_cache_bytes = disk_cache_mb * 1024 * 1024; + LLDiskCache::getInstance()->setMaxSizeBytes(disk_cache_bytes); +} +// + //////////////////////////////////////////////////////////////////////////// void settings_setup_listeners() @@ -1316,6 +1326,9 @@ void settings_setup_listeners() // Run Prio 0 default bento pose in the background to fix splayed hands, open mouths, etc. gSavedSettings.getControl("FSPlayDefaultBentoAnimation")->getSignal()->connect(boost::bind(&handlePlayBentoIdleAnimationChanged, _2)); + + // Better asset cache size control + gSavedSettings.getControl("FSDiskCacheSize")->getSignal()->connect(boost::bind(&handleDiskCacheSizeChanged, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index bd5a3e718e..56a65ae778 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -866,10 +866,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 0a11555e04..9653e80b53 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -143,11 +143,10 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) //---------------------------------------------------------------- for (LLJoint* j : mChildren) { -// LLAvatarJoint* joint = dynamic_cast(j); -// [SL:KB] - Patch: Viewer-OptimizationAnimesh | Checked: Catznip-6.0 + // LLViewerJoint is derived from LLAvatarJoint, + // all children of LLAvatarJoint are assumed to be LLAvatarJoint LLAvatarJoint* joint = static_cast(j); -// [/SL:KB] - F32 jointLOD = joint ? joint->getLOD() : 0; + 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 3d30e7d7d5..d2cfe2cf98 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/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 030f0b6cd2..d147560011 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -555,12 +555,16 @@ void LLViewerJoystick::updateStatus() ndof_update(mNdofDev); - for (int i=0; i<6; i++) + // FIRE-14344 - Add button preview and allow for more than 6 axes + // for (int i=0; i<6; i++) + for (int i = 0; i < MAX_JOYSTICK_AXES; i++) { mAxes[i] = (F32) mNdofDev->axes[i] / mNdofDev->axes_max; } - for (int i=0; i<16; i++) + // FIRE-14344 - Add button preview and allow for more than 6 axes + // for (int i=0; i<16; i++) + for (int i = 0; i < MAX_JOYSTICK_BUTTONS; i++) { mBtn[i] = mNdofDev->buttons[i]; } @@ -571,7 +575,9 @@ void LLViewerJoystick::updateStatus() // ----------------------------------------------------------------------------- F32 LLViewerJoystick::getJoystickAxis(U32 axis) const { - if (axis < 6) + // FIRE-14344 - Add button preview and allow for more than 6 axes + // if (axis < 6) + if (axis < MAX_JOYSTICK_AXES) { return mAxes[axis]; } @@ -581,7 +587,9 @@ F32 LLViewerJoystick::getJoystickAxis(U32 axis) const // ----------------------------------------------------------------------------- U32 LLViewerJoystick::getJoystickButton(U32 button) const { - if (button < 16) + // FIRE-14344 - Add button preview and allow for more than 6 axes + // if (button < 16) + if (button < MAX_JOYSTICK_BUTTONS) { return mBtn[button]; } @@ -1510,3 +1518,25 @@ void LLViewerJoystick::setSNDefaults() gSavedSettings.setF32("BuildFeathering", 12.f); gSavedSettings.setF32("FlycamFeathering", 5.f); } + +// FIRE-14344 - Add button preview and allow for more than 6 axes +U32 LLViewerJoystick::getNumOfJoystickAxes() const +{ +#if LIB_NDOF + // return number of axes or the maximum supported number of axes, whichever is smaller + return llmin((U32) mNdofDev->axes_count, (U32) MAX_JOYSTICK_AXES); +#else + return MAX_JOYSTICK_AXES; +#endif +} + +U32 LLViewerJoystick::getNumOfJoystickButtons() const +{ +#if LIB_NDOF + // return number of buttons or the maximum supported number of buttons, whichever is smaller + return llmin((U32) mNdofDev->btn_count, (U32) MAX_JOYSTICK_BUTTONS); +#else + return MAX_JOYSTICK_BUTTONS; +#endif +} +// diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index 782c523d4f..a6e6413b15 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -36,6 +36,14 @@ #define NDOF_HotPlugResult S32 #endif +// FIRE-14344 - Using the same numbers all over the place is a bad idea, so let's +// define them here in case we need to change them at some point. Better +// would be to have it all figured out at runtime, but a lot of the code +// expects a fixed size of options, so that needs bigger changes :/ +#define MAX_JOYSTICK_AXES 8 +#define MAX_JOYSTICK_BUTTONS 16 +// + typedef enum e_joystick_driver_state { JDS_UNINITIALIZED, @@ -93,8 +101,12 @@ protected: #endif private: - F32 mAxes[6]; - long mBtn[16]; +// FIRE-14344 - Add button preview and allow for more than 6 axes +// F32 mAxes[6]; +// long mBtn[16]; + F32 mAxes[MAX_JOYSTICK_AXES]; + long mBtn[MAX_JOYSTICK_BUTTONS]; +// EJoystickDriverState mDriverState; NDOF_Device *mNdofDev; bool mResetFlag; @@ -106,6 +118,12 @@ private: static F32 sLastDelta[7]; static F32 sDelta[7]; + +// FIRE-14344 - Add button preview and allow for more than 6 axes +public: + U32 getNumOfJoystickAxes() const; + U32 getNumOfJoystickButtons() const; +// }; #endif diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 270e342ec3..d37d84b188 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3956,6 +3956,13 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) gSavedPerAccountSettings.setBOOL("FSRenderFriendsOnly", FALSE); } // + // FIRE-30947: Auto-Unmute + if (gSavedSettings.getBOOL("MuteSounds") && gSavedSettings.getBOOL("FSAutoUnmuteSounds")) + gSavedSettings.setBOOL("MuteSounds", FALSE); + + if (gSavedSettings.getBOOL("MuteAmbient") && gSavedSettings.getBOOL("FSAutoUnmuteAmbient")) + gSavedSettings.setBOOL("MuteAmbient", FALSE); + // if (gAgent.getTeleportKeepsLookAt()) { // *NOTE: the LookAt data we get from the sim here doesn't diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 4199d5a0fe..00deddbf73 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5034,78 +5034,22 @@ void LLViewerObject::refreshBakeTexture() } } -void LLViewerObject::updateDiffuseMatParams(const U8 te, LLMaterial* mat, LLViewerTexture *imagep, bool baked_texture) -{ - // Objects getting non-alpha texture and alpha mask can result in graphical bugs, like white or red alphas. - // To resolve the issue this function provides image format to material and based on format material's - // getDiffuseAlphaModeRender() function will decide what value to provide to render - // - // Unfortunately LLMaterial has no access to diffuse image, so we have to set this data in LLViewerObject - // regardles of object being used/seen or frequency of image-updates. - mat->setDiffuseBaked(baked_texture); - - if (!baked_texture) - { - if (imagep->isMissingAsset()) - { - mat->setDiffuseFormatPrimary(0); - } - else if (0 == imagep->getPrimaryFormat()) - { - // We don't have information about this texture, wait for it - mWaitingTextureInfo.insert(uuid_material_mmap_t::value_type(imagep->getID(), material_info(LLRender::DIFFUSE_MAP, te))); - // Temporary assume RGBA image - mat->setDiffuseFormatPrimary(GL_RGBA); - } - else - { - mat->setDiffuseFormatPrimary(imagep->getPrimaryFormat()); - } - } -} - -S32 LLViewerObject::setDiffuseImageAndParams(const U8 te, LLViewerTexture *imagep) -{ - LLUUID new_id = imagep->getID(); - S32 retval = LLPrimitive::setTETexture(te, new_id); - - LLTextureEntry* tep = getTE(te); - LLUUID old_image_id = tep->getID(); - - LLViewerTexture* baked_texture = getBakedTextureForMagicId(new_id); - mTEImages[te] = baked_texture ? baked_texture : imagep; - updateAvatarMeshVisibility(new_id, old_image_id); - - LLMaterial* mat = tep->getMaterialParams(); - if (mat) - { - // Don't update format from texture (and don't shedule one) if material has no alpha mode set, - // just assume RGBA format, format will get updated with setTEMaterialParams call if mode changes - if (mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - { - bool baked = baked_texture != NULL; - updateDiffuseMatParams(te, mat, imagep, baked); - } - else - { - mat->setDiffuseFormatPrimary(GL_RGBA); - } - } - - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - - return retval; -} - void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) { if (mTEImages[te] != imagep) { - setDiffuseImageAndParams(te, imagep); + LLUUID old_image_id = getTE(te) ? getTE(te)->getID() : LLUUID::null; + + LLPrimitive::setTETexture(te, imagep->getID()); + + LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); + mTEImages[te] = baked_texture ? baked_texture : imagep; + updateAvatarMeshVisibility(imagep->getID(), old_image_id); + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } } @@ -5117,7 +5061,15 @@ S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) if (uuid != getTEref(te).getID() || uuid == LLUUID::null) { - retval = setDiffuseImageAndParams(te, image); + retval = LLPrimitive::setTETexture(te, uuid); + LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); + mTEImages[te] = baked_texture ? baked_texture : image; + updateAvatarMeshVisibility(uuid,old_image_id); + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } return retval; } @@ -5412,29 +5364,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return 0; } - if (pMaterialParams.notNull() - && pMaterialParams->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - { - // Don't update if no alpha is set. If alpha changes, this function will run again, - // no point in sheduling additional texture callbacks (in updateDiffuseMatParams) - LLTextureEntry* tex_entry = getTE(te); - bool is_baked = tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID()); - - LLViewerTexture *img_diffuse = getTEImage(te); - llassert(NULL != img_diffuse); - - if (NULL != img_diffuse) - { - // Will modify alpha mask provided to renderer to fit image - updateDiffuseMatParams(te, pMaterialParams.get(), img_diffuse, is_baked); - } - else - { - LLMaterial *mat = pMaterialParams.get(); // to avoid const - mat->setDiffuseFormatPrimary(0); - } - } - retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); LL_DEBUGS("Material") << "Changing material params for te " << (S32)te << ", object " << mID @@ -5447,84 +5376,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return retval; } -bool LLViewerObject::notifyAboutCreatingTexture(LLViewerTexture *texture) -{ - // Confirmation about texture creation, check wait-list - // and make changes, or return false - - std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); - - bool refresh_materials = false; - - // RGB textures without alpha channels won't work right with alpha, - // we provide format to material for material to decide when to drop alpha - for (uuid_material_mmap_t::iterator range_it = range.first; range_it != range.second; ++range_it) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.notNull() - && LLRender::DIFFUSE_MAP == range_it->second.map) - { - U32 format = texture->getPrimaryFormat(); - if (format != cur_material->getDiffuseFormatPrimary()) - { - cur_material->setDiffuseFormatPrimary(format); - refresh_materials = true; - } - } - } //for - - if (refresh_materials) - { - LLViewerObject::refreshMaterials(); - } - - //clear wait-list - mWaitingTextureInfo.erase(range.first, range.second); - - return refresh_materials; -} - -bool LLViewerObject::notifyAboutMissingAsset(LLViewerTexture *texture) -{ - // When waiting information about texture it turned out to be missing. - // Confirm the state, update values accordingly - std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); - if (range.first == range.second) return false; - - bool refresh_materials = false; - - for (uuid_material_mmap_t::iterator range_it = range.first; range_it != range.second; ++range_it) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.isNull()) - continue; - - if (range_it->second.map == LLRender::DIFFUSE_MAP) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.notNull() - && LLRender::DIFFUSE_MAP == range_it->second.map) - { - if (0 != cur_material->getDiffuseFormatPrimary()) - { - cur_material->setDiffuseFormatPrimary(0); - refresh_materials = true; - } - } - } - } //for - - if (refresh_materials) - { - LLViewerObject::refreshMaterials(); - } - - //clear wait-list - mWaitingTextureInfo.erase(range.first, range.second); - - return refresh_materials; -} - void LLViewerObject::refreshMaterials() { setChanged(TEXTURE); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 26aaf0a73c..07498bec2b 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -787,12 +787,7 @@ protected: void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy); void deleteParticleSource(); void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id); - - // Helper function to modify alpha mask provided to render according to image (ex: RGB image will drop alpha mask) - void updateDiffuseMatParams(const U8 te, LLMaterial* mat, LLViewerTexture *imagep, bool baked_texture); - // Shared part of code from setTEImage and setTETextureCore - S32 setDiffuseImageAndParams(const U8 te, LLViewerTexture *imagep); - + private: void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string void deleteTEImages(); // correctly deletes list of images @@ -925,28 +920,11 @@ public: LLJointRiggingInfoTab mJointRiggingInfoTab; - bool notifyAboutCreatingTexture(LLViewerTexture *texture); - bool notifyAboutMissingAsset(LLViewerTexture *texture); - private: LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory. EObjectUpdateType mLastUpdateType; BOOL mLastUpdateCached; - struct material_info - { - LLRender::eTexIndex map; - U8 te; - - material_info(LLRender::eTexIndex map_, U8 te_) - : map(map_) - , te(te_) - {} - }; - - typedef std::multimap uuid_material_mmap_t; - uuid_material_mmap_t mWaitingTextureInfo; - RegionCrossExtrapolate mExtrap; // improved extrapolator // export diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 3ca714fd46..525387af51 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -3219,7 +3219,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() if (success) { - gObjectPreviewProgram.mName = "Simple Shader"; + gObjectPreviewProgram.mName = "Preview Shader"; // update preview shader name gObjectPreviewProgram.mFeatures.calculatesLighting = false; gObjectPreviewProgram.mFeatures.calculatesAtmospherics = false; gObjectPreviewProgram.mFeatures.hasGamma = false; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e9aa0d5f48..9ae5579698 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3476,13 +3476,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 af40c6bc0c..e62ace2c50 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -342,6 +342,99 @@ RecordToChatConsole::RecordToChatConsole(): mRecorder->showMultiline(true); } +//////////////////////////////////////////////////////////////////////////// +// +// 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 @@ -364,7 +457,11 @@ private: typedef std::vector 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)); @@ -407,11 +504,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")) @@ -770,42 +878,35 @@ public: static LLCachedControl debugShowRenderMatrices(gSavedSettings, "DebugShowRenderMatrices"); if (debugShowRenderMatrices) { - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); - ypos += y_inc; + char camera_lines[8][32]; + memset(camera_lines, ' ', sizeof(camera_lines)); - 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; - - 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 // - //static LLCachedControl debugShowColor(gSavedSettings, "DebugShowColor"); + //if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport) static LLCachedControl debugShowColor(gSavedSettings, "DebugShowColor"); - if (debugShowColor && !LLRender::sNsightDebugSupport) // + if (debugShowColor && !LLRender::sNsightDebugSupport) { U8 color[4]; LLCoordGL coord = gViewerWindow->getCurrentMouse(); @@ -836,6 +937,7 @@ public: ypos += y_inc; } // + // only display these messages if we are actually rendering beacons at this moment // Always show the beacon text regardless if the floater is visible // ...and if we want to see it @@ -987,6 +1089,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) { @@ -995,7 +1109,6 @@ public: LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); } - mLineList.clear(); } }; @@ -1908,8 +2021,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" @@ -5929,10 +6042,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/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6446fff6ab..e4738865cf 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -360,7 +360,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. diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index f0372dd5fe..fd8db12c65 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/llvovolume.cpp b/indra/newview/llvovolume.cpp index 56a34f7099..cc8b2980da 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2487,11 +2487,243 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) return res; } +bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture) +{ //Ok, here we have confirmation about texture creation, check our wait-list + //and make changes, or return false + + std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); + + typedef std::map map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + + //here we just interesting in DIFFUSE_MAP only! + if(NULL != cur_material.get() && LLRender::DIFFUSE_MAP == range_it->second.map && GL_RGBA != texture->getPrimaryFormat()) + { //ok let's check the diffuse mode + switch(cur_material->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //uups... we have non 32 bit texture with LLMaterial::DIFFUSE_ALPHA_MODE_* => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + + } break; + } //switch + } //if + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + +bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture) +{ //Ok, here if we wait information about texture and it's missing + //then depending from the texture map (diffuse, normal, or specular) + //make changes in material and confirm it. If not return false. + std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); + if(range.first == range.second) return false; + + typedef std::map map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + if (cur_material.isNull()) + continue; + + switch(range_it->second.map) + { + case LLRender::DIFFUSE_MAP: + { + if(LLMaterial::DIFFUSE_ALPHA_MODE_NONE != cur_material->getDiffuseAlphaMode()) + { //missing texture + !LLMaterial::DIFFUSE_ALPHA_MODE_NONE => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } break; + case LLRender::NORMAL_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setNormalID(LLUUID::null); + } break; + case LLRender::SPECULAR_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setSpecularID(LLUUID::null); + } break; + case LLRender::NUM_TEXTURE_CHANNELS: + //nothing to do, make compiler happy + break; + } //switch + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { - S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + LLMaterialPtr pMaterial = const_cast(pMaterialParams); - LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res + if(pMaterialParams) + { //check all of them according to material settings + + LLViewerTexture *img_diffuse = getTEImage(te); + LLViewerTexture *img_normal = getTENormalMap(te); + LLViewerTexture *img_specular = getTESpecularMap(te); + + llassert(NULL != img_diffuse); + + LLMaterialPtr new_material = NULL; + + //diffuse + if(NULL != img_diffuse) + { //guard + if(0 == img_diffuse->getPrimaryFormat() && !img_diffuse->isMissingAsset()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(img_diffuse->getID(), material_info(LLRender::DIFFUSE_MAP, te))); + } + else + { + bool bSetDiffuseNone = false; + if(img_diffuse->isMissingAsset()) + { + bSetDiffuseNone = true; + } + else + { + switch(pMaterialParams->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //all of them modes available only for 32 bit textures + LLTextureEntry* tex_entry = getTE(te); + bool bIsBakedImageId = false; + if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID())) + { + bIsBakedImageId = true; + } + if (GL_RGBA != img_diffuse->getPrimaryFormat() && !bIsBakedImageId) + { + bSetDiffuseNone = true; + } + } break; + } + } //else + + + if(bSetDiffuseNone) + { //upps... we should substitute this material with LLMaterial::DIFFUSE_ALPHA_MODE_NONE + new_material = new LLMaterial(pMaterialParams->asLLSD()); + new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } + } + + //normal + if(LLUUID::null != pMaterialParams->getNormalID()) + { + if(img_normal && img_normal->isMissingAsset() && img_normal->getID() == pMaterialParams->getNormalID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setNormalID(LLUUID::null); + } + else if(NULL == img_normal || 0 == img_normal->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getNormalID(), material_info(LLRender::NORMAL_MAP,te))); + } + + } + + + //specular + if(LLUUID::null != pMaterialParams->getSpecularID()) + { + if(img_specular && img_specular->isMissingAsset() && img_specular->getID() == pMaterialParams->getSpecularID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setSpecularID(LLUUID::null); + } + else if(NULL == img_specular || 0 == img_specular->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getSpecularID(), material_info(LLRender::SPECULAR_MAP, te))); + } + } + + if(new_material) { + pMaterial = new_material; + LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial); + } + } + + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial); + + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; setChanged(ALL_CHANGED); @@ -4601,7 +4833,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& LLMaterial* mat = te->getMaterialParams(); if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE @@ -5280,7 +5512,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, } draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f); - draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaModeRender(); + draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); } else @@ -5683,7 +5915,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (mat && LLPipeline::sRenderDeferred) { - U8 alpha_mode = mat->getDiffuseAlphaModeRender(); + U8 alpha_mode = mat->getDiffuseAlphaMode(); bool is_alpha = type == LLDrawPool::POOL_ALPHA && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND || @@ -5712,7 +5944,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) else if (mat) { bool is_alpha = type == LLDrawPool::POOL_ALPHA; - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; @@ -6624,7 +6856,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace bool can_be_shiny = true; if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; } @@ -6646,7 +6878,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace // if (te->getFullbright()) { - if (mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { if (opaque) { @@ -6731,7 +6963,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } else if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)); @@ -6830,7 +7062,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } else if (fullbright || bake_sunlight) { //fullbright - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); } @@ -6852,7 +7084,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace else { //all around simple llassert(mask & LLVertexBuffer::MAP_NORMAL); - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { //material alpha mask can be respected in non-deferred registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK); } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index a046589f04..4c68bbdd54 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -450,6 +450,26 @@ protected: static S32 sNumLODChanges; friend class LLVolumeImplFlexible; + +public: + bool notifyAboutCreatingTexture(LLViewerTexture *texture); + bool notifyAboutMissingAsset(LLViewerTexture *texture); + +private: + struct material_info + { + LLRender::eTexIndex map; + U8 te; + + material_info(LLRender::eTexIndex map_, U8 te_) + : map(map_) + , te(te_) + {} + }; + + typedef std::multimap mmap_UUID_MAP_t; + mmap_UUID_MAP_t mWaitingTextureInfo; + }; #endif // LL_LLVOVOLUME_H diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 04e3461513..d5ac9c1f4a 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -380,6 +380,7 @@ LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle) if(x >= checkRegionX && x < (checkRegionX + info->mSizeX) && y >= checkRegionY && y < (checkRegionY + info->mSizeY)) { + LL_DEBUGS("WorldMap") << "VarRegion match for map tile (" << x << "," << y << ") in " << info->mSizeX << "x" << info->mSizeY << " region at (" << checkRegionX << "," << checkRegionY << ")" << LL_ENDL;// FIRE-30534 - changes related to var regions in opensim return info; } // Aurora Sim @@ -466,7 +467,7 @@ bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, U16 x_size, U16 y_size, else { U64 handle = to_region_handle(x_world, y_world); - //LL_INFOS("WorldMap") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL; + LL_DEBUGS("WorldMap") << "Map sim : " << name << ", ID : " << image_id.getString() << ", HANDLE : " << handle << LL_ENDL;// FIRE-30534 - changes related to var regions in opensim // Insert the region in the region map of the world map // Loading the LLSimInfo object with what we got and insert it in the map LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f73674fe0f..ad0db03658 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -137,6 +137,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 @@ -366,7 +376,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; @@ -784,26 +793,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 - // Disable annoying notification - //LLNotification::Params params("LowMemory"); - //LLNotifications::instance().add(params); - // - - //release some memory. - } - } -} - void LLPipeline::requestResizeScreenTexture() { gResizeScreenTexture = TRUE; @@ -1816,7 +1805,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima if (alpha && mat) { - switch (mat->getDiffuseAlphaModeRender()) + switch (mat->getDiffuseAlphaMode()) { case 1: alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool. @@ -9582,30 +9571,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]; @@ -9619,32 +9607,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(); @@ -9657,9 +9647,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(); @@ -9667,10 +9657,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(); @@ -9680,110 +9670,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(); - } - - 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 (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); - } + renderGeom(camera, TRUE); + } gPipeline.popRenderTypeMask(); - mWaterRef.flush(); - } - glCullFace(GL_BACK); + 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); + } + } + } + + 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); gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); - + gGL.popMatrix(); + set_current_modelview(saved_modelview); - } + } //LLPipeline::sUseOcclusion = occlusion; - // Add option to allow object occlusion for water distortion generation - static LLCachedControl fsAllowWaterDistortionOcclusion(gSavedSettings, "FSAllowWaterDistortionOcclusion"); - LLPipeline::sUseOcclusion = fsAllowWaterDistortionOcclusion ? occlusion : 0; - // - 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); @@ -9795,66 +9802,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 570ed5e6a9..d9c8aaef29 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& restoreList ); @@ -611,7 +607,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/ansastorm/xui/en/panel_fs_contacts_friends.xml b/indra/newview/skins/ansastorm/xui/en/panel_fs_contacts_friends.xml index da1944551b..41e157e9e0 100644 --- a/indra/newview/skins/ansastorm/xui/en/panel_fs_contacts_friends.xml +++ b/indra/newview/skins/ansastorm/xui/en/panel_fs_contacts_friends.xml @@ -113,7 +113,7 @@ - Cache size ([http://wiki.firestormviewer.org/cache need a suggestion?]): + Texture Cache Size ([http://wiki.firestormviewer.org/cache need a suggestion?]): MB + + Asset Cache Size: + + + + MB +