Merge branch 'master' into DRTVWR-516-maint
commit
fef6c1f51e
|
|
@ -266,6 +266,7 @@ Benjamin Bigdipper
|
||||||
Beq Janus
|
Beq Janus
|
||||||
BUG-227094
|
BUG-227094
|
||||||
SL-10288
|
SL-10288
|
||||||
|
SL-11300
|
||||||
SL-13583
|
SL-13583
|
||||||
SL-14766
|
SL-14766
|
||||||
SL-14927
|
SL-14927
|
||||||
|
|
@ -1356,6 +1357,12 @@ Sovereign Engineer
|
||||||
SL-11079
|
SL-11079
|
||||||
OPEN-343
|
OPEN-343
|
||||||
SL-11625
|
SL-11625
|
||||||
|
SL-14705
|
||||||
|
SL-14706
|
||||||
|
SL-14707
|
||||||
|
SL-14731
|
||||||
|
SL-14732
|
||||||
|
SL-15096
|
||||||
SpacedOut Frye
|
SpacedOut Frye
|
||||||
VWR-34
|
VWR-34
|
||||||
VWR-45
|
VWR-45
|
||||||
|
|
|
||||||
|
|
@ -1 +1,3 @@
|
||||||
12
|
euclid 5/29/2020
|
||||||
|
euclid 7/23/2020
|
||||||
|
euclid 4/29/2021
|
||||||
|
|
@ -103,7 +103,7 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
|
||||||
for (joints_t::iterator iter = mChildren.begin();
|
for (joints_t::iterator iter = mChildren.begin();
|
||||||
iter != mChildren.end(); ++iter)
|
iter != mChildren.end(); ++iter)
|
||||||
{
|
{
|
||||||
LLAvatarJoint* joint = (LLAvatarJoint*)(*iter);
|
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||||
joint->setValid(valid, TRUE);
|
joint->setValid(valid, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -136,7 +136,7 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
|
||||||
for (joints_t::iterator iter = mChildren.begin();
|
for (joints_t::iterator iter = mChildren.begin();
|
||||||
iter != mChildren.end(); ++iter)
|
iter != mChildren.end(); ++iter)
|
||||||
{
|
{
|
||||||
LLAvatarJoint* joint = (LLAvatarJoint*)(*iter);
|
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||||
joint->setVisible(visible, recursive);
|
joint->setVisible(visible, recursive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ void LLAvatarJoint::updateJointGeometry()
|
||||||
for (joints_t::iterator iter = mChildren.begin();
|
for (joints_t::iterator iter = mChildren.begin();
|
||||||
iter != mChildren.end(); ++iter)
|
iter != mChildren.end(); ++iter)
|
||||||
{
|
{
|
||||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter);
|
||||||
joint->updateJointGeometry();
|
joint->updateJointGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef LL_LLAPR_H
|
#ifndef LL_LLAPR_H
|
||||||
#define LL_LLAPR_H
|
#define LL_LLAPR_H
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
#include <sys/param.h> // Need PATH_MAX in APR headers...
|
#include <sys/param.h> // Need PATH_MAX in APR headers...
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
#include "lltimer.h"
|
#include "lltimer.h"
|
||||||
#elif LL_LINUX || LL_SOLARIS
|
#elif LL_LINUX
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include "lltimer.h"
|
#include "lltimer.h"
|
||||||
|
|
@ -64,7 +64,7 @@ bool BlockTimer::sLog = false;
|
||||||
std::string BlockTimer::sLogName = "";
|
std::string BlockTimer::sLogName = "";
|
||||||
bool BlockTimer::sMetricLog = false;
|
bool BlockTimer::sMetricLog = false;
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution
|
U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution
|
||||||
#else
|
#else
|
||||||
U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution
|
U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution
|
||||||
|
|
@ -151,12 +151,12 @@ void BlockTimer::setLogLock(LLMutex* lock)
|
||||||
|
|
||||||
|
|
||||||
//static
|
//static
|
||||||
#if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
|
#if (LL_DARWIN || LL_LINUX) && !(defined(__i386__) || defined(__amd64__))
|
||||||
U64 BlockTimer::countsPerSecond()
|
U64 BlockTimer::countsPerSecond()
|
||||||
{
|
{
|
||||||
return sClockResolution;
|
return sClockResolution;
|
||||||
}
|
}
|
||||||
#else // windows or x86-mac or x86-linux or x86-solaris
|
#else // windows or x86-mac or x86-linux
|
||||||
U64 BlockTimer::countsPerSecond()
|
U64 BlockTimer::countsPerSecond()
|
||||||
{
|
{
|
||||||
#if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS
|
#if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,9 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
|
#if (LL_LINUX) && !(defined(__i386__) || defined(__amd64__))
|
||||||
//
|
//
|
||||||
// Linux and Solaris implementation of CPU clock - non-x86.
|
// Linux implementation of CPU clock - non-x86.
|
||||||
// This is accurate but SLOW! Only use out of desperation.
|
// This is accurate but SLOW! Only use out of desperation.
|
||||||
//
|
//
|
||||||
// Try to use the MONOTONIC clock if available, this is a constant time counter
|
// Try to use the MONOTONIC clock if available, this is a constant time counter
|
||||||
|
|
@ -153,12 +153,12 @@ public:
|
||||||
return (U32)(getCPUClockCount64() >> 8);
|
return (U32)(getCPUClockCount64() >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
|
#endif // (LL_LINUX) && !(defined(__i386__) || defined(__amd64__))
|
||||||
|
|
||||||
|
|
||||||
#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__))
|
#if (LL_LINUX || LL_DARWIN) && (defined(__i386__) || defined(__amd64__))
|
||||||
//
|
//
|
||||||
// Mac+Linux+Solaris FAST x86 implementation of CPU clock
|
// Mac+Linux FAST x86 implementation of CPU clock
|
||||||
static U32 getCPUClockCount32()
|
static U32 getCPUClockCount32()
|
||||||
{
|
{
|
||||||
U32 low(0),high(0);
|
U32 low(0),high(0);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <mach/task.h>
|
# include <mach/task.h>
|
||||||
# include <mach/mach_init.h>
|
# include <mach/mach_init.h>
|
||||||
#elif LL_LINUX || LL_SOLARIS
|
#elif LL_LINUX
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -55,7 +55,6 @@ static LLTrace::SampleStatHandle<F64Megabytes> sVirtualMem("virtual_mem", "virtu
|
||||||
U32Kilobytes LLMemory::sAllocatedMemInKB(0);
|
U32Kilobytes LLMemory::sAllocatedMemInKB(0);
|
||||||
U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0);
|
U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0);
|
||||||
U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX);
|
U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX);
|
||||||
BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE;
|
|
||||||
|
|
||||||
void ll_assert_aligned_func(uintptr_t ptr,U32 alignment)
|
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
|
//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);
|
sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size);
|
||||||
sEnableMemoryFailurePrevention = prevent_heap_failure ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
|
|
@ -158,56 +156,6 @@ void LLMemory::logMemoryInfo(BOOL update)
|
||||||
LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ;
|
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
|
//static
|
||||||
U32Kilobytes LLMemory::getAvailableMemKB()
|
U32Kilobytes LLMemory::getAvailableMemKB()
|
||||||
{
|
{
|
||||||
|
|
@ -309,35 +257,6 @@ U64 LLMemory::getCurrentRSS()
|
||||||
return rss;
|
return rss;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif LL_SOLARIS
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#define _STRUCTURED_PROC 1
|
|
||||||
#include <sys/procfs.h>
|
|
||||||
|
|
||||||
U64 LLMemory::getCurrentRSS()
|
|
||||||
{
|
|
||||||
char path [LL_MAX_PATH]; /* Flawfinder: ignore */
|
|
||||||
|
|
||||||
sprintf(path, "/proc/%d/psinfo", (int)getpid());
|
|
||||||
int proc_fd = -1;
|
|
||||||
if((proc_fd = open(path, O_RDONLY)) == -1){
|
|
||||||
LL_WARNS() << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << LL_ENDL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
psinfo_t proc_psinfo;
|
|
||||||
if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){
|
|
||||||
LL_WARNS() << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << LL_ENDL;
|
|
||||||
close(proc_fd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
close(proc_fd);
|
|
||||||
|
|
||||||
return((U64)proc_psinfo.pr_rssize * 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
U64 LLMemory::getCurrentRSS()
|
U64 LLMemory::getCurrentRSS()
|
||||||
|
|
|
||||||
|
|
@ -344,10 +344,9 @@ public:
|
||||||
// Return value is zero if not known.
|
// Return value is zero if not known.
|
||||||
static U64 getCurrentRSS();
|
static U64 getCurrentRSS();
|
||||||
static void* tryToAlloc(void* address, U32 size);
|
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 updateMemoryInfo() ;
|
||||||
static void logMemoryInfo(BOOL update = FALSE);
|
static void logMemoryInfo(BOOL update = FALSE);
|
||||||
static bool isMemoryPoolLow();
|
|
||||||
|
|
||||||
static U32Kilobytes getAvailableMemKB() ;
|
static U32Kilobytes getAvailableMemKB() ;
|
||||||
static U32Kilobytes getMaxMemKB() ;
|
static U32Kilobytes getMaxMemKB() ;
|
||||||
|
|
@ -359,7 +358,6 @@ private:
|
||||||
static U32Kilobytes sAllocatedPageSizeInKB ;
|
static U32Kilobytes sAllocatedPageSizeInKB ;
|
||||||
|
|
||||||
static U32Kilobytes sMaxHeapSizeInKB;
|
static U32Kilobytes sMaxHeapSizeInKB;
|
||||||
static BOOL sEnableMemoryFailurePrevention;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// LLRefCount moved to llrefcount.h
|
// LLRefCount moved to llrefcount.h
|
||||||
|
|
|
||||||
|
|
@ -34,16 +34,7 @@
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif // LL_LINUX
|
#endif // LL_LINUX
|
||||||
|
|
||||||
#if LL_SOLARIS
|
#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)))
|
||||||
# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported.
|
|
||||||
# define LL_BIG_ENDIAN 1
|
|
||||||
# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed
|
|
||||||
# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API
|
|
||||||
# endif
|
|
||||||
# include <sys/isa_defs.h> // ensure we know which end is up
|
|
||||||
#endif // LL_SOLARIS
|
|
||||||
|
|
||||||
#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386)))
|
|
||||||
#define LL_LITTLE_ENDIAN 1
|
#define LL_LITTLE_ENDIAN 1
|
||||||
#else
|
#else
|
||||||
#define LL_BIG_ENDIAN 1
|
#define LL_BIG_ENDIAN 1
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <winsock2.h> // for htonl
|
# include <winsock2.h> // for htonl
|
||||||
#elif LL_LINUX || LL_SOLARIS
|
#elif LL_LINUX
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
#elif LL_DARWIN
|
#elif LL_DARWIN
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "llformat.h"
|
#include "llformat.h"
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -45,16 +45,10 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
#if LL_SOLARIS
|
|
||||||
// stricmp and strnicmp do not exist on Solaris:
|
|
||||||
#define stricmp strcasecmp
|
|
||||||
#define strnicmp strncasecmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char LL_UNKNOWN_CHAR = '?';
|
const char LL_UNKNOWN_CHAR = '?';
|
||||||
class LLSD;
|
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)
|
// Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already)
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,17 +88,6 @@ using namespace llsd;
|
||||||
# include <stdexcept>
|
# include <stdexcept>
|
||||||
const char MEMINFO_FILE[] = "/proc/meminfo";
|
const char MEMINFO_FILE[] = "/proc/meminfo";
|
||||||
# include <gnu/libc-version.h>
|
# include <gnu/libc-version.h>
|
||||||
#elif LL_SOLARIS
|
|
||||||
# include <stdio.h>
|
|
||||||
# include <unistd.h>
|
|
||||||
# include <sys/utsname.h>
|
|
||||||
# define _STRUCTURED_PROC 1
|
|
||||||
# include <sys/procfs.h>
|
|
||||||
# include <sys/types.h>
|
|
||||||
# include <sys/stat.h>
|
|
||||||
# include <fcntl.h>
|
|
||||||
# include <errno.h>
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LLCPUInfo gSysCPU;
|
LLCPUInfo gSysCPU;
|
||||||
|
|
@ -544,8 +533,6 @@ const std::string& LLOSInfo::getOSVersionString() const
|
||||||
U32 LLOSInfo::getProcessVirtualSizeKB()
|
U32 LLOSInfo::getProcessVirtualSizeKB()
|
||||||
{
|
{
|
||||||
U32 virtual_size = 0;
|
U32 virtual_size = 0;
|
||||||
#if LL_WINDOWS
|
|
||||||
#endif
|
|
||||||
#if LL_LINUX
|
#if LL_LINUX
|
||||||
# define STATUS_SIZE 2048
|
# define STATUS_SIZE 2048
|
||||||
LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
|
LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
|
||||||
|
|
@ -565,24 +552,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB()
|
||||||
}
|
}
|
||||||
fclose(status_filep);
|
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
|
#endif
|
||||||
return virtual_size;
|
return virtual_size;
|
||||||
}
|
}
|
||||||
|
|
@ -591,8 +560,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB()
|
||||||
U32 LLOSInfo::getProcessResidentSizeKB()
|
U32 LLOSInfo::getProcessResidentSizeKB()
|
||||||
{
|
{
|
||||||
U32 resident_size = 0;
|
U32 resident_size = 0;
|
||||||
#if LL_WINDOWS
|
|
||||||
#endif
|
|
||||||
#if LL_LINUX
|
#if LL_LINUX
|
||||||
LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
|
LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
|
||||||
if (status_filep != NULL)
|
if (status_filep != NULL)
|
||||||
|
|
@ -611,24 +578,6 @@ U32 LLOSInfo::getProcessResidentSizeKB()
|
||||||
}
|
}
|
||||||
fclose(status_filep);
|
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
|
#endif
|
||||||
return resident_size;
|
return resident_size;
|
||||||
}
|
}
|
||||||
|
|
@ -773,11 +722,6 @@ U32Kilobytes LLMemoryInfo::getPhysicalMemoryKB() const
|
||||||
phys = (U64)(getpagesize()) * (U64)(get_phys_pages());
|
phys = (U64)(getpagesize()) * (U64)(get_phys_pages());
|
||||||
return U64Bytes(phys);
|
return U64Bytes(phys);
|
||||||
|
|
||||||
#elif LL_SOLARIS
|
|
||||||
U64 phys = 0;
|
|
||||||
phys = (U64)(getpagesize()) * (U64)(sysconf(_SC_PHYS_PAGES));
|
|
||||||
return U64Bytes(phys);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -1066,13 +1010,6 @@ LLSD LLMemoryInfo::loadStatsMap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif LL_SOLARIS
|
|
||||||
U64 phys = 0;
|
|
||||||
|
|
||||||
phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024);
|
|
||||||
|
|
||||||
stats.add("Total Physical KB", phys);
|
|
||||||
|
|
||||||
#elif LL_LINUX
|
#elif LL_LINUX
|
||||||
std::ifstream meminfo(MEMINFO_FILE);
|
std::ifstream meminfo(MEMINFO_FILE);
|
||||||
if (meminfo.is_open())
|
if (meminfo.is_open())
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
#include "lltracethreadrecorder.h"
|
#include "lltracethreadrecorder.h"
|
||||||
#include "llexception.h"
|
#include "llexception.h"
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
# include "llwin32headerslean.h"
|
# include "llwin32headerslean.h"
|
||||||
#elif LL_LINUX || LL_SOLARIS || LL_DARWIN
|
#elif LL_LINUX || LL_DARWIN
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
#else
|
#else
|
||||||
|
|
@ -74,7 +74,7 @@ U32 micro_sleep(U64 us, U32 max_yields)
|
||||||
ms_sleep((U32)(us / 1000));
|
ms_sleep((U32)(us / 1000));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#elif LL_LINUX || LL_SOLARIS || LL_DARWIN
|
#elif LL_LINUX || LL_DARWIN
|
||||||
static void _sleep_loop(struct timespec& thiswait)
|
static void _sleep_loop(struct timespec& thiswait)
|
||||||
{
|
{
|
||||||
struct timespec nextwait;
|
struct timespec nextwait;
|
||||||
|
|
@ -187,7 +187,7 @@ F64 calc_clock_frequency()
|
||||||
#endif // LL_WINDOWS
|
#endif // LL_WINDOWS
|
||||||
|
|
||||||
|
|
||||||
#if LL_LINUX || LL_DARWIN || LL_SOLARIS
|
#if LL_LINUX || LL_DARWIN
|
||||||
// Both Linux and Mac use gettimeofday for accurate time
|
// Both Linux and Mac use gettimeofday for accurate time
|
||||||
F64 calc_clock_frequency()
|
F64 calc_clock_frequency()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#ifndef LL_TIMER_H
|
#ifndef LL_TIMER_H
|
||||||
#define LL_TIMER_H
|
#define LL_TIMER_H
|
||||||
|
|
||||||
#if LL_LINUX || LL_DARWIN || LL_SOLARIS
|
#if LL_LINUX || LL_DARWIN
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
|
||||||
|
|
@ -601,9 +601,7 @@ S32 LLUUID::getNodeID(unsigned char *node_id)
|
||||||
#define HAVE_NETINET_IN_H
|
#define HAVE_NETINET_IN_H
|
||||||
#ifdef HAVE_NETINET_IN_H
|
#ifdef HAVE_NETINET_IN_H
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#if LL_SOLARIS
|
#if !LL_DARWIN
|
||||||
#include <sys/sockio.h>
|
|
||||||
#elif !LL_DARWIN
|
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ typedef unsigned __int64 U64;
|
||||||
#else
|
#else
|
||||||
typedef long long int S64;
|
typedef long long int S64;
|
||||||
typedef long long unsigned int U64;
|
typedef long long unsigned int U64;
|
||||||
#if LL_DARWIN || LL_LINUX || LL_SOLARIS
|
#if LL_DARWIN || LL_LINUX
|
||||||
#define S64L(a) (a##LL)
|
#define S64L(a) (a##LL)
|
||||||
#define U64L(a) (a##ULL)
|
#define U64L(a) (a##ULL)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,6 @@
|
||||||
#elif (LL_LINUX && __GNUC__ <= 2)
|
#elif (LL_LINUX && __GNUC__ <= 2)
|
||||||
#define llisnan(val) isnan(val)
|
#define llisnan(val) isnan(val)
|
||||||
#define llfinite(val) isfinite(val)
|
#define llfinite(val) isfinite(val)
|
||||||
#elif LL_SOLARIS
|
|
||||||
#define llisnan(val) isnan(val)
|
|
||||||
#define llfinite(val) (val <= std::numeric_limits<double>::max())
|
|
||||||
#else
|
#else
|
||||||
#define llisnan(val) std::isnan(val)
|
#define llisnan(val) std::isnan(val)
|
||||||
#define llfinite(val) std::isfinite(val)
|
#define llfinite(val) std::isfinite(val)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <winsock2.h> // for htonl
|
# include <winsock2.h> // for htonl
|
||||||
#elif LL_LINUX || LL_SOLARIS
|
#elif LL_LINUX
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
#elif LL_DARWIN
|
#elif LL_DARWIN
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,6 @@
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LL_SOLARIS
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
#include "winsock2.h" // htons etc.
|
#include "winsock2.h" // htons etc.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
#include "llmaterial.h"
|
#include "llmaterial.h"
|
||||||
|
|
||||||
#include "../llrender/llglheaders.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Materials cap parameters
|
* Materials cap parameters
|
||||||
*/
|
*/
|
||||||
|
|
@ -107,8 +105,6 @@ LLMaterial::LLMaterial()
|
||||||
, mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT)
|
, mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT)
|
||||||
, mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY)
|
, mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY)
|
||||||
, mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
|
, mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
|
||||||
, mDiffuseFormatPrimary(GL_RGBA)
|
|
||||||
, mDiffuseBaked(false)
|
|
||||||
, mAlphaMaskCutoff(0)
|
, mAlphaMaskCutoff(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -315,20 +311,6 @@ void LLMaterial::setEnvironmentIntensity(U8 intensity)
|
||||||
mEnvironmentIntensity = 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
|
U8 LLMaterial::getDiffuseAlphaMode() const
|
||||||
{
|
{
|
||||||
return mDiffuseAlphaMode;
|
return mDiffuseAlphaMode;
|
||||||
|
|
@ -339,26 +321,6 @@ void LLMaterial::setDiffuseAlphaMode(U8 alpha_mode)
|
||||||
mDiffuseAlphaMode = 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
|
U8 LLMaterial::getAlphaMaskCutoff() const
|
||||||
{
|
{
|
||||||
return mAlphaMaskCutoff;
|
return mAlphaMaskCutoff;
|
||||||
|
|
@ -475,7 +437,7 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = getDiffuseAlphaModeRender();
|
ret = getDiffuseAlphaMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
llassert(ret < SHADER_COUNT);
|
llassert(ret < SHADER_COUNT);
|
||||||
|
|
|
||||||
|
|
@ -115,17 +115,8 @@ public:
|
||||||
void setSpecularLightExponent(U8 exponent);
|
void setSpecularLightExponent(U8 exponent);
|
||||||
U8 getEnvironmentIntensity() const;
|
U8 getEnvironmentIntensity() const;
|
||||||
void setEnvironmentIntensity(U8 intensity);
|
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;
|
U8 getDiffuseAlphaMode() const;
|
||||||
void setDiffuseAlphaMode(U8 alpha_mode);
|
void setDiffuseAlphaMode(U8 alpha_mode);
|
||||||
U32 getDiffuseFormatPrimary() const;
|
|
||||||
void setDiffuseFormatPrimary(U32 format_primary);
|
|
||||||
bool getIsDiffuseBaked() const;
|
|
||||||
void setDiffuseBaked(bool baked);
|
|
||||||
U8 getAlphaMaskCutoff() const;
|
U8 getAlphaMaskCutoff() const;
|
||||||
void setAlphaMaskCutoff(U8 cutoff);
|
void setAlphaMaskCutoff(U8 cutoff);
|
||||||
|
|
||||||
|
|
@ -156,8 +147,6 @@ protected:
|
||||||
U8 mSpecularLightExponent;
|
U8 mSpecularLightExponent;
|
||||||
U8 mEnvironmentIntensity;
|
U8 mEnvironmentIntensity;
|
||||||
U8 mDiffuseAlphaMode;
|
U8 mDiffuseAlphaMode;
|
||||||
U32 mDiffuseFormatPrimary; // value from texture, LLGLenum, is not included in fromLLSD/asLLSD
|
|
||||||
bool mDiffuseBaked; // is not included in fromLLSD/asLLSD
|
|
||||||
U8 mAlphaMaskCutoff;
|
U8 mAlphaMaskCutoff;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ LLMatrix4 gGLObliqueProjectionInverse;
|
||||||
|
|
||||||
std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
|
std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
|
||||||
|
|
||||||
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
|
#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
|
||||||
// ATI prototypes
|
// ATI prototypes
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
|
|
@ -328,7 +328,7 @@ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// vertex shader prototypes
|
// vertex shader prototypes
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;
|
PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;
|
||||||
PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL;
|
PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL;
|
||||||
PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL;
|
PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL;
|
||||||
|
|
@ -347,7 +347,7 @@ PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL;
|
||||||
PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL;
|
PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL;
|
||||||
PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL;
|
PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL;
|
||||||
PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL;
|
PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL;
|
||||||
#endif // LL_LINUX || LL_SOLARIS
|
#endif // LL_LINUX
|
||||||
PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL;
|
PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL;
|
||||||
PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL;
|
PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL;
|
||||||
PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL;
|
PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL;
|
||||||
|
|
@ -355,7 +355,7 @@ PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL;
|
||||||
PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL;
|
PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL;
|
||||||
PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL;
|
PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL;
|
||||||
PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL;
|
PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL;
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL;
|
PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL;
|
||||||
PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL;
|
PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL;
|
||||||
PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL;
|
PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL;
|
||||||
|
|
@ -393,7 +393,7 @@ PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL;
|
||||||
PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL;
|
PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL;
|
||||||
PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL;
|
PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL;
|
||||||
PFNGLISPROGRAMARBPROC glIsProgramARB = NULL;
|
PFNGLISPROGRAMARBPROC glIsProgramARB = NULL;
|
||||||
#endif // LL_LINUX || LL_SOLARIS
|
#endif // LL_LINUX
|
||||||
PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL;
|
PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL;
|
||||||
PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL;
|
PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL;
|
||||||
PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL;
|
PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL;
|
||||||
|
|
@ -471,8 +471,6 @@ LLGLManager::LLGLManager() :
|
||||||
|
|
||||||
mHasSeparateSpecularColor(FALSE),
|
mHasSeparateSpecularColor(FALSE),
|
||||||
|
|
||||||
mDebugGPU(FALSE),
|
|
||||||
|
|
||||||
mDriverVersionMajor(1),
|
mDriverVersionMajor(1),
|
||||||
mDriverVersionMinor(0),
|
mDriverVersionMinor(0),
|
||||||
mDriverVersionRelease(0),
|
mDriverVersionRelease(0),
|
||||||
|
|
@ -854,10 +852,6 @@ bool LLGLManager::initGL()
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
setToDebugGPU();
|
|
||||||
|
|
||||||
stop_glerror();
|
|
||||||
|
|
||||||
initGLStates();
|
initGLStates();
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
@ -865,17 +859,6 @@ bool LLGLManager::initGL()
|
||||||
return true;
|
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)
|
void LLGLManager::getGLInfo(LLSD& info)
|
||||||
{
|
{
|
||||||
if (gHeadlessClient)
|
if (gHeadlessClient)
|
||||||
|
|
@ -1032,7 +1015,6 @@ void LLGLManager::asLLSD(LLSD& info)
|
||||||
// Other fields
|
// Other fields
|
||||||
info["has_requirements"] = mHasRequirements;
|
info["has_requirements"] = mHasRequirements;
|
||||||
info["has_separate_specular_color"] = mHasSeparateSpecularColor;
|
info["has_separate_specular_color"] = mHasSeparateSpecularColor;
|
||||||
info["debug_gpu"] = mDebugGPU;
|
|
||||||
info["max_vertex_range"] = mGLMaxVertexRange;
|
info["max_vertex_range"] = mGLMaxVertexRange;
|
||||||
info["max_index_range"] = mGLMaxIndexRange;
|
info["max_index_range"] = mGLMaxIndexRange;
|
||||||
info["max_texture_size"] = mGLMaxTextureSize;
|
info["max_texture_size"] = mGLMaxTextureSize;
|
||||||
|
|
@ -1167,7 +1149,7 @@ void LLGLManager::initExtensions()
|
||||||
mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL;
|
LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL;
|
||||||
// Our extension support for the Linux Client is very young with some
|
// 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.
|
// potential driver gotchas, so offer a semi-secret way to turn it off.
|
||||||
|
|
@ -1237,7 +1219,7 @@ void LLGLManager::initExtensions()
|
||||||
if (strchr(blacklist,'u')) mHasDepthClamp = FALSE;
|
if (strchr(blacklist,'u')) mHasDepthClamp = FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // LL_LINUX || LL_SOLARIS
|
#endif // LL_LINUX
|
||||||
|
|
||||||
if (!mHasMultitexture)
|
if (!mHasMultitexture)
|
||||||
{
|
{
|
||||||
|
|
@ -1315,7 +1297,7 @@ void LLGLManager::initExtensions()
|
||||||
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange);
|
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange);
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize);
|
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;
|
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
|
||||||
if (mHasVertexBufferObject)
|
if (mHasVertexBufferObject)
|
||||||
{
|
{
|
||||||
|
|
@ -1414,7 +1396,7 @@ void LLGLManager::initExtensions()
|
||||||
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB");
|
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB");
|
||||||
glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB");
|
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
|
// 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");
|
glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");
|
||||||
if (!glDrawRangeElements)
|
if (!glDrawRangeElements)
|
||||||
|
|
@ -2775,8 +2757,9 @@ LLGLSPipelineBlendSkyBox::LLGLSPipelineBlendSkyBox(bool depth_test, bool depth_w
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
// Expose desired use of high-performance graphics processor to Optimus driver and to AMD driver
|
// 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"
|
extern "C"
|
||||||
{
|
{
|
||||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,9 +142,6 @@ public:
|
||||||
// Misc extensions
|
// Misc extensions
|
||||||
BOOL mHasSeparateSpecularColor;
|
BOOL mHasSeparateSpecularColor;
|
||||||
|
|
||||||
//whether this GPU is in the debug list.
|
|
||||||
BOOL mDebugGPU;
|
|
||||||
|
|
||||||
S32 mDriverVersionMajor;
|
S32 mDriverVersionMajor;
|
||||||
S32 mDriverVersionMinor;
|
S32 mDriverVersionMinor;
|
||||||
S32 mDriverVersionRelease;
|
S32 mDriverVersionRelease;
|
||||||
|
|
@ -178,7 +175,6 @@ private:
|
||||||
void initExtensions();
|
void initExtensions();
|
||||||
void initGLStates();
|
void initGLStates();
|
||||||
void initGLImages();
|
void initGLImages();
|
||||||
void setToDebugGPU();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LLGLManager gGLManager;
|
extern LLGLManager gGLManager;
|
||||||
|
|
|
||||||
|
|
@ -27,242 +27,7 @@
|
||||||
#ifndef LL_LLGLHEADERS_H
|
#ifndef LL_LLGLHEADERS_H
|
||||||
#define LL_LLGLHEADERS_H
|
#define LL_LLGLHEADERS_H
|
||||||
|
|
||||||
#if LL_SOLARIS
|
#if LL_MESA
|
||||||
# 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
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// MESA headers
|
// MESA headers
|
||||||
// quotes so we get libraries/.../GL/ version
|
// quotes so we get libraries/.../GL/ version
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@
|
||||||
#include "OpenGL/OpenGL.h"
|
#include "OpenGL/OpenGL.h"
|
||||||
#endif
|
#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
|
// Lots of STL stuff in here, using namespace std to keep things more readable
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
|
|
@ -392,16 +396,28 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
||||||
mLightHash = 0xFFFFFFFF;
|
mLightHash = 0xFFFFFFFF;
|
||||||
|
|
||||||
llassert_always(!mShaderFiles.empty());
|
llassert_always(!mShaderFiles.empty());
|
||||||
BOOL success = TRUE;
|
|
||||||
|
|
||||||
// Create program
|
// Create program
|
||||||
mProgramObject = glCreateProgramObjectARB();
|
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
|
#if LL_DARWIN
|
||||||
// work-around missing mix(vec3,vec3,bvec3)
|
// work-around missing mix(vec3,vec3,bvec3)
|
||||||
mDefines["OLD_SELECT"] = "1";
|
mDefines["OLD_SELECT"] = "1";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG_SHADER_INCLUDES
|
||||||
|
fprintf(stderr, "--- %s ---\n", mName.c_str());
|
||||||
|
#endif // DEBUG_SHADER_INCLUDES
|
||||||
|
|
||||||
//compile new source
|
//compile new source
|
||||||
vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
|
vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
|
||||||
for ( ; fileIter != mShaderFiles.end(); fileIter++ )
|
for ( ; fileIter != mShaderFiles.end(); fileIter++ )
|
||||||
|
|
@ -485,11 +501,36 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
||||||
return success;
|
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)
|
if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]);
|
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]);
|
||||||
|
#if DEBUG_SHADER_INCLUDES
|
||||||
|
dumpAttachObject("attachVertexObject", mProgramObject, object_path);
|
||||||
|
#endif // DEBUG_SHADER_INCLUDES
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -506,6 +547,9 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]);
|
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]);
|
||||||
|
#if DEBUG_SHADER_INCLUDES
|
||||||
|
dumpAttachObject("attachFragmentObject", mProgramObject, object_path);
|
||||||
|
#endif // DEBUG_SHADER_INCLUDES
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -522,6 +566,10 @@ void LLGLSLShader::attachObject(GLhandleARB object)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
glAttachObjectARB(mProgramObject, object);
|
glAttachObjectARB(mProgramObject, object);
|
||||||
|
#if DEBUG_SHADER_INCLUDES
|
||||||
|
std::string object_path("???");
|
||||||
|
dumpAttachObject("attachObject", mProgramObject, object_path);
|
||||||
|
#endif // DEBUG_SHADER_INCLUDES
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -872,10 +872,10 @@ void LLTexUnit::setTextureColorSpace(eTextureColorSpace space)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
|
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
LLLightState::LLLightState(S32 index)
|
LLLightState::LLLightState(S32 index)
|
||||||
|
|
|
||||||
|
|
@ -611,13 +611,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLenum error = GL_NO_ERROR;
|
GLenum error = GL_NO_ERROR;
|
||||||
if (gDebugGL)
|
|
||||||
|
error = glGetError();
|
||||||
|
if (error != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
error = glGetError();
|
LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << " for file: " << filename << LL_ENDL;
|
||||||
if (error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << LL_ENDL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
|
|
@ -966,55 +964,45 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||||
|
|
||||||
//create shader object
|
//create shader object
|
||||||
GLhandleARB ret = glCreateShaderObjectARB(type);
|
GLhandleARB ret = glCreateShaderObjectARB(type);
|
||||||
if (gDebugGL)
|
|
||||||
|
error = glGetError();
|
||||||
|
if (error != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
error = glGetError();
|
LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||||
if (error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << LL_ENDL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//load source
|
//load source
|
||||||
glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL);
|
glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL);
|
||||||
|
|
||||||
if (gDebugGL)
|
error = glGetError();
|
||||||
|
if (error != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
error = glGetError();
|
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||||
if (error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << LL_ENDL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//compile source
|
//compile source
|
||||||
glCompileShaderARB(ret);
|
glCompileShaderARB(ret);
|
||||||
|
|
||||||
if (gDebugGL)
|
error = glGetError();
|
||||||
|
if (error != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
error = glGetError();
|
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||||
if (error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << LL_ENDL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == GL_NO_ERROR)
|
if (error == GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
//check for errors
|
//check for errors
|
||||||
GLint success = GL_TRUE;
|
GLint success = GL_TRUE;
|
||||||
glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success);
|
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();
|
//an error occured, print log
|
||||||
if (error != GL_NO_ERROR || success == GL_FALSE)
|
LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL;
|
||||||
{
|
dumpObjectLog(ret, TRUE, open_file_name);
|
||||||
//an error occured, print log
|
dumpShaderSource(shader_code_count, shader_code_text);
|
||||||
LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL;
|
ret = 0;
|
||||||
dumpObjectLog(ret, TRUE, open_file_name);
|
|
||||||
dumpShaderSource(shader_code_count, shader_code_text);
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -36,221 +36,223 @@ public:
|
||||||
LLShaderMgr();
|
LLShaderMgr();
|
||||||
virtual ~LLShaderMgr();
|
virtual ~LLShaderMgr();
|
||||||
|
|
||||||
typedef enum
|
// clang-format off
|
||||||
{
|
typedef enum
|
||||||
MODELVIEW_MATRIX = 0,
|
{ // Shader uniform name, set in LLShaderMgr::initAttribsAndUniforms()
|
||||||
PROJECTION_MATRIX,
|
MODELVIEW_MATRIX = 0, // "modelview_matrix"
|
||||||
INVERSE_PROJECTION_MATRIX,
|
PROJECTION_MATRIX, // "projection_matrix"
|
||||||
MODELVIEW_PROJECTION_MATRIX,
|
INVERSE_PROJECTION_MATRIX, // "inv_proj"
|
||||||
INVERSE_MODELVIEW_MATRIX,
|
MODELVIEW_PROJECTION_MATRIX, // "modelview_projection_matrix"
|
||||||
NORMAL_MATRIX,
|
INVERSE_MODELVIEW_MATRIX, // "inv_modelview"
|
||||||
TEXTURE_MATRIX0,
|
NORMAL_MATRIX, // "normal_matrix"
|
||||||
TEXTURE_MATRIX1,
|
TEXTURE_MATRIX0, // "texture_matrix0"
|
||||||
TEXTURE_MATRIX2,
|
TEXTURE_MATRIX1, // "texture_matrix1"
|
||||||
TEXTURE_MATRIX3,
|
TEXTURE_MATRIX2, // "texture_matrix2"
|
||||||
OBJECT_PLANE_S,
|
TEXTURE_MATRIX3, // "texture_matrix3"
|
||||||
OBJECT_PLANE_T,
|
OBJECT_PLANE_S, // "object_plane_s"
|
||||||
VIEWPORT,
|
OBJECT_PLANE_T, // "object_plane_t"
|
||||||
LIGHT_POSITION,
|
VIEWPORT, // "viewport"
|
||||||
LIGHT_DIRECTION,
|
LIGHT_POSITION, // "light_position"
|
||||||
LIGHT_ATTENUATION,
|
LIGHT_DIRECTION, // "light_direction"
|
||||||
LIGHT_DIFFUSE,
|
LIGHT_ATTENUATION, // "light_attenuation"
|
||||||
LIGHT_AMBIENT,
|
LIGHT_DIFFUSE, // "light_diffuse"
|
||||||
MULTI_LIGHT_COUNT,
|
LIGHT_AMBIENT, // "light_ambient"
|
||||||
MULTI_LIGHT,
|
MULTI_LIGHT_COUNT, // "light_count"
|
||||||
MULTI_LIGHT_COL,
|
MULTI_LIGHT, // "light"
|
||||||
MULTI_LIGHT_FAR_Z,
|
MULTI_LIGHT_COL, // "light_col"
|
||||||
PROJECTOR_MATRIX,
|
MULTI_LIGHT_FAR_Z, // "far_z"
|
||||||
PROJECTOR_NEAR,
|
PROJECTOR_MATRIX, // "proj_mat"
|
||||||
PROJECTOR_P,
|
PROJECTOR_NEAR, // "proj_near"
|
||||||
PROJECTOR_N,
|
PROJECTOR_P, // "proj_p"
|
||||||
PROJECTOR_ORIGIN,
|
PROJECTOR_N, // "proj_n"
|
||||||
PROJECTOR_RANGE,
|
PROJECTOR_ORIGIN, // "proj_origin"
|
||||||
PROJECTOR_AMBIANCE,
|
PROJECTOR_RANGE, // "proj_range"
|
||||||
PROJECTOR_SHADOW_INDEX,
|
PROJECTOR_AMBIANCE, // "proj_ambiance"
|
||||||
PROJECTOR_SHADOW_FADE,
|
PROJECTOR_SHADOW_INDEX, // "proj_shadow_idx"
|
||||||
PROJECTOR_FOCUS,
|
PROJECTOR_SHADOW_FADE, // "shadow_fade"
|
||||||
PROJECTOR_LOD,
|
PROJECTOR_FOCUS, // "proj_focus"
|
||||||
PROJECTOR_AMBIENT_LOD,
|
PROJECTOR_LOD, // "proj_lod"
|
||||||
DIFFUSE_COLOR,
|
PROJECTOR_AMBIENT_LOD, // "proj_ambient_lod"
|
||||||
DIFFUSE_MAP,
|
DIFFUSE_COLOR, // "color"
|
||||||
ALTERNATE_DIFFUSE_MAP,
|
DIFFUSE_MAP, // "diffuseMap"
|
||||||
SPECULAR_MAP,
|
ALTERNATE_DIFFUSE_MAP, // "altDiffuseMap"
|
||||||
BUMP_MAP,
|
SPECULAR_MAP, // "specularMap"
|
||||||
BUMP_MAP2,
|
BUMP_MAP, // "bumpMap"
|
||||||
ENVIRONMENT_MAP,
|
BUMP_MAP2, // "bumpMap2"
|
||||||
CLOUD_NOISE_MAP,
|
ENVIRONMENT_MAP, // "environmentMap"
|
||||||
CLOUD_NOISE_MAP_NEXT,
|
CLOUD_NOISE_MAP, // "cloud_noise_texture"
|
||||||
FULLBRIGHT,
|
CLOUD_NOISE_MAP_NEXT, // "cloud_noise_texture_next"
|
||||||
LIGHTNORM,
|
FULLBRIGHT, // "fullbright"
|
||||||
SUNLIGHT_COLOR,
|
LIGHTNORM, // "lightnorm"
|
||||||
AMBIENT,
|
SUNLIGHT_COLOR, // "sunlight_color"
|
||||||
BLUE_HORIZON,
|
AMBIENT, // "ambient_color"
|
||||||
BLUE_DENSITY,
|
BLUE_HORIZON, // "blue_horizon"
|
||||||
HAZE_HORIZON,
|
BLUE_DENSITY, // "blue_density"
|
||||||
HAZE_DENSITY,
|
HAZE_HORIZON, // "haze_horizon"
|
||||||
CLOUD_SHADOW,
|
HAZE_DENSITY, // "haze_density"
|
||||||
DENSITY_MULTIPLIER,
|
CLOUD_SHADOW, // "cloud_shadow"
|
||||||
DISTANCE_MULTIPLIER,
|
DENSITY_MULTIPLIER, // "density_multiplier"
|
||||||
MAX_Y,
|
DISTANCE_MULTIPLIER, // "distance_multiplier"
|
||||||
GLOW,
|
MAX_Y, // "max_y"
|
||||||
CLOUD_COLOR,
|
GLOW, // "glow"
|
||||||
CLOUD_POS_DENSITY1,
|
CLOUD_COLOR, // "cloud_color"
|
||||||
CLOUD_POS_DENSITY2,
|
CLOUD_POS_DENSITY1, // "cloud_pos_density1"
|
||||||
CLOUD_SCALE,
|
CLOUD_POS_DENSITY2, // "cloud_pos_density2"
|
||||||
GAMMA,
|
CLOUD_SCALE, // "cloud_scale"
|
||||||
SCENE_LIGHT_STRENGTH,
|
GAMMA, // "gamma"
|
||||||
LIGHT_CENTER,
|
SCENE_LIGHT_STRENGTH, // "scene_light_strength"
|
||||||
LIGHT_SIZE,
|
LIGHT_CENTER, // "center"
|
||||||
LIGHT_FALLOFF,
|
LIGHT_SIZE, // "size"
|
||||||
BOX_CENTER,
|
LIGHT_FALLOFF, // "falloff"
|
||||||
BOX_SIZE,
|
BOX_CENTER, // "box_center"
|
||||||
|
BOX_SIZE, // "box_size"
|
||||||
|
|
||||||
GLOW_MIN_LUMINANCE,
|
GLOW_MIN_LUMINANCE, // "minLuminance"
|
||||||
GLOW_MAX_EXTRACT_ALPHA,
|
GLOW_MAX_EXTRACT_ALPHA, // "maxExtractAlpha"
|
||||||
GLOW_LUM_WEIGHTS,
|
GLOW_LUM_WEIGHTS, // "lumWeights"
|
||||||
GLOW_WARMTH_WEIGHTS,
|
GLOW_WARMTH_WEIGHTS, // "warmthWeights"
|
||||||
GLOW_WARMTH_AMOUNT,
|
GLOW_WARMTH_AMOUNT, // "warmthAmount"
|
||||||
GLOW_STRENGTH,
|
GLOW_STRENGTH, // "glowStrength"
|
||||||
GLOW_DELTA,
|
GLOW_DELTA, // "glowDelta"
|
||||||
|
|
||||||
MINIMUM_ALPHA,
|
MINIMUM_ALPHA, // "minimum_alpha"
|
||||||
EMISSIVE_BRIGHTNESS,
|
EMISSIVE_BRIGHTNESS, // "emissive_brightness"
|
||||||
|
|
||||||
DEFERRED_SHADOW_MATRIX,
|
DEFERRED_SHADOW_MATRIX, // "shadow_matrix"
|
||||||
DEFERRED_ENV_MAT,
|
DEFERRED_ENV_MAT, // "env_mat"
|
||||||
DEFERRED_SHADOW_CLIP,
|
DEFERRED_SHADOW_CLIP, // "shadow_clip"
|
||||||
DEFERRED_SUN_WASH,
|
DEFERRED_SUN_WASH, // "sun_wash"
|
||||||
DEFERRED_SHADOW_NOISE,
|
DEFERRED_SHADOW_NOISE, // "shadow_noise"
|
||||||
DEFERRED_BLUR_SIZE,
|
DEFERRED_BLUR_SIZE, // "blur_size"
|
||||||
DEFERRED_SSAO_RADIUS,
|
DEFERRED_SSAO_RADIUS, // "ssao_radius"
|
||||||
DEFERRED_SSAO_MAX_RADIUS,
|
DEFERRED_SSAO_MAX_RADIUS, // "ssao_max_radius"
|
||||||
DEFERRED_SSAO_FACTOR,
|
DEFERRED_SSAO_FACTOR, // "ssao_factor"
|
||||||
DEFERRED_SSAO_FACTOR_INV,
|
DEFERRED_SSAO_FACTOR_INV, // "ssao_factor_inv"
|
||||||
DEFERRED_SSAO_EFFECT_MAT,
|
DEFERRED_SSAO_EFFECT_MAT, // "ssao_effect_mat"
|
||||||
DEFERRED_SCREEN_RES,
|
DEFERRED_SCREEN_RES, // "screen_res"
|
||||||
DEFERRED_NEAR_CLIP,
|
DEFERRED_NEAR_CLIP, // "near_clip"
|
||||||
DEFERRED_SHADOW_OFFSET,
|
DEFERRED_SHADOW_OFFSET, // "shadow_offset"
|
||||||
DEFERRED_SHADOW_BIAS,
|
DEFERRED_SHADOW_BIAS, // "shadow_bias"
|
||||||
DEFERRED_SPOT_SHADOW_BIAS,
|
DEFERRED_SPOT_SHADOW_BIAS, // "spot_shadow_bias"
|
||||||
DEFERRED_SPOT_SHADOW_OFFSET,
|
DEFERRED_SPOT_SHADOW_OFFSET, // "spot_shadow_offset"
|
||||||
DEFERRED_SUN_DIR,
|
DEFERRED_SUN_DIR, // "sun_dir"
|
||||||
DEFERRED_MOON_DIR,
|
DEFERRED_MOON_DIR, // "moon_dir"
|
||||||
DEFERRED_SHADOW_RES,
|
DEFERRED_SHADOW_RES, // "shadow_res"
|
||||||
DEFERRED_PROJ_SHADOW_RES,
|
DEFERRED_PROJ_SHADOW_RES, // "proj_shadow_res"
|
||||||
DEFERRED_DEPTH_CUTOFF,
|
DEFERRED_DEPTH_CUTOFF, // "depth_cutoff"
|
||||||
DEFERRED_NORM_CUTOFF,
|
DEFERRED_NORM_CUTOFF, // "norm_cutoff"
|
||||||
DEFERRED_SHADOW_TARGET_WIDTH,
|
DEFERRED_SHADOW_TARGET_WIDTH, // "shadow_target_width"
|
||||||
|
|
||||||
FXAA_TC_SCALE,
|
FXAA_TC_SCALE, // "tc_scale"
|
||||||
FXAA_RCP_SCREEN_RES,
|
FXAA_RCP_SCREEN_RES, // "rcp_screen_res"
|
||||||
FXAA_RCP_FRAME_OPT,
|
FXAA_RCP_FRAME_OPT, // "rcp_frame_opt"
|
||||||
FXAA_RCP_FRAME_OPT2,
|
FXAA_RCP_FRAME_OPT2, // "rcp_frame_opt2"
|
||||||
|
|
||||||
DOF_FOCAL_DISTANCE,
|
DOF_FOCAL_DISTANCE, // "focal_distance"
|
||||||
DOF_BLUR_CONSTANT,
|
DOF_BLUR_CONSTANT, // "blur_constant"
|
||||||
DOF_TAN_PIXEL_ANGLE,
|
DOF_TAN_PIXEL_ANGLE, // "tan_pixel_angle"
|
||||||
DOF_MAGNIFICATION,
|
DOF_MAGNIFICATION, // "magnification"
|
||||||
DOF_MAX_COF,
|
DOF_MAX_COF, // "max_cof"
|
||||||
DOF_RES_SCALE,
|
DOF_RES_SCALE, // "res_scale"
|
||||||
DOF_WIDTH,
|
DOF_WIDTH, // "dof_width"
|
||||||
DOF_HEIGHT,
|
DOF_HEIGHT, // "dof_height"
|
||||||
|
|
||||||
DEFERRED_DEPTH,
|
DEFERRED_DEPTH, // "depthMap"
|
||||||
DEFERRED_SHADOW0,
|
DEFERRED_SHADOW0, // "shadowMap0"
|
||||||
DEFERRED_SHADOW1,
|
DEFERRED_SHADOW1, // "shadowMap1"
|
||||||
DEFERRED_SHADOW2,
|
DEFERRED_SHADOW2, // "shadowMap2"
|
||||||
DEFERRED_SHADOW3,
|
DEFERRED_SHADOW3, // "shadowMap3"
|
||||||
DEFERRED_SHADOW4,
|
DEFERRED_SHADOW4, // "shadowMap4"
|
||||||
DEFERRED_SHADOW5,
|
DEFERRED_SHADOW5, // "shadowMap5"
|
||||||
DEFERRED_NORMAL,
|
DEFERRED_NORMAL, // "normalMap"
|
||||||
DEFERRED_POSITION,
|
DEFERRED_POSITION, // "positionMap"
|
||||||
DEFERRED_DIFFUSE,
|
DEFERRED_DIFFUSE, // "diffuseRect"
|
||||||
DEFERRED_SPECULAR,
|
DEFERRED_SPECULAR, // "specularRect"
|
||||||
DEFERRED_NOISE,
|
DEFERRED_NOISE, // "noiseMap"
|
||||||
DEFERRED_LIGHTFUNC,
|
DEFERRED_LIGHTFUNC, // "lightFunc"
|
||||||
DEFERRED_LIGHT,
|
DEFERRED_LIGHT, // "lightMap"
|
||||||
DEFERRED_BLOOM,
|
DEFERRED_BLOOM, // "bloomMap"
|
||||||
DEFERRED_PROJECTION,
|
DEFERRED_PROJECTION, // "projectionMap"
|
||||||
DEFERRED_NORM_MATRIX,
|
DEFERRED_NORM_MATRIX, // "norm_mat"
|
||||||
TEXTURE_GAMMA,
|
TEXTURE_GAMMA, // "texture_gamma"
|
||||||
SPECULAR_COLOR,
|
SPECULAR_COLOR, // "specular_color"
|
||||||
ENVIRONMENT_INTENSITY,
|
ENVIRONMENT_INTENSITY, // "env_intensity"
|
||||||
|
|
||||||
AVATAR_MATRIX,
|
|
||||||
AVATAR_TRANSLATION,
|
|
||||||
|
|
||||||
WATER_SCREENTEX,
|
AVATAR_MATRIX, // "matrixPalette"
|
||||||
WATER_SCREENDEPTH,
|
AVATAR_TRANSLATION, // "translationPalette"
|
||||||
WATER_REFTEX,
|
|
||||||
WATER_EYEVEC,
|
|
||||||
WATER_TIME,
|
|
||||||
WATER_WAVE_DIR1,
|
|
||||||
WATER_WAVE_DIR2,
|
|
||||||
WATER_LIGHT_DIR,
|
|
||||||
WATER_SPECULAR,
|
|
||||||
WATER_SPECULAR_EXP,
|
|
||||||
WATER_FOGCOLOR,
|
|
||||||
WATER_FOGDENSITY,
|
|
||||||
WATER_FOGKS,
|
|
||||||
WATER_REFSCALE,
|
|
||||||
WATER_WATERHEIGHT,
|
|
||||||
WATER_WATERPLANE,
|
|
||||||
WATER_NORM_SCALE,
|
|
||||||
WATER_FRESNEL_SCALE,
|
|
||||||
WATER_FRESNEL_OFFSET,
|
|
||||||
WATER_BLUR_MULTIPLIER,
|
|
||||||
WATER_SUN_ANGLE,
|
|
||||||
WATER_SCALED_ANGLE,
|
|
||||||
WATER_SUN_ANGLE2,
|
|
||||||
|
|
||||||
WL_CAMPOSLOCAL,
|
|
||||||
|
|
||||||
AVATAR_WIND,
|
WATER_SCREENTEX, // "screenTex"
|
||||||
AVATAR_SINWAVE,
|
WATER_SCREENDEPTH, // "screenDepth"
|
||||||
AVATAR_GRAVITY,
|
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"
|
||||||
|
|
||||||
TERRAIN_DETAIL0,
|
WL_CAMPOSLOCAL, // "camPosLocal"
|
||||||
TERRAIN_DETAIL1,
|
|
||||||
TERRAIN_DETAIL2,
|
|
||||||
TERRAIN_DETAIL3,
|
|
||||||
TERRAIN_ALPHARAMP,
|
|
||||||
|
|
||||||
SHINY_ORIGIN,
|
|
||||||
DISPLAY_GAMMA,
|
|
||||||
|
|
||||||
INSCATTER_RT,
|
AVATAR_WIND, // "gWindDir"
|
||||||
SUN_SIZE,
|
AVATAR_SINWAVE, // "gSinWaveParams"
|
||||||
FOG_COLOR,
|
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
|
// precomputed textures
|
||||||
TRANSMITTANCE_TEX,
|
TRANSMITTANCE_TEX, // "transmittance_texture"
|
||||||
SCATTER_TEX,
|
SCATTER_TEX, // "scattering_texture"
|
||||||
SINGLE_MIE_SCATTER_TEX,
|
SINGLE_MIE_SCATTER_TEX, // "single_mie_scattering_texture"
|
||||||
ILLUMINANCE_TEX,
|
ILLUMINANCE_TEX, // "irradiance_texture"
|
||||||
BLEND_FACTOR,
|
BLEND_FACTOR, // "blend_factor"
|
||||||
|
|
||||||
NO_ATMO,
|
NO_ATMO, // "no_atmo"
|
||||||
MOISTURE_LEVEL,
|
MOISTURE_LEVEL, // "moisture_level"
|
||||||
DROPLET_RADIUS,
|
DROPLET_RADIUS, // "droplet_radius"
|
||||||
ICE_LEVEL,
|
ICE_LEVEL, // "ice_level"
|
||||||
RAINBOW_MAP,
|
RAINBOW_MAP, // "rainbow_map"
|
||||||
HALO_MAP,
|
HALO_MAP, // "halo_map"
|
||||||
|
|
||||||
MOON_BRIGHTNESS,
|
MOON_BRIGHTNESS, // "moon_brightness"
|
||||||
|
|
||||||
CLOUD_VARIANCE,
|
CLOUD_VARIANCE, // "cloud_variance"
|
||||||
|
|
||||||
SH_INPUT_L1R,
|
SH_INPUT_L1R, // "sh_input_r"
|
||||||
SH_INPUT_L1G,
|
SH_INPUT_L1G, // "sh_input_g"
|
||||||
SH_INPUT_L1B,
|
SH_INPUT_L1B, // "sh_input_b"
|
||||||
|
|
||||||
SUN_MOON_GLOW_FACTOR,
|
SUN_MOON_GLOW_FACTOR, // "sun_moon_glow_factor"
|
||||||
WATER_EDGE_FACTOR,
|
WATER_EDGE_FACTOR, // "water_edge"
|
||||||
SUN_UP_FACTOR,
|
SUN_UP_FACTOR, // "sun_up_factor"
|
||||||
MOONLIGHT_COLOR,
|
MOONLIGHT_COLOR, // "moonlight_color"
|
||||||
END_RESERVED_UNIFORMS
|
END_RESERVED_UNIFORMS
|
||||||
} eGLSLReservedUniforms;
|
} eGLSLReservedUniforms;
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
// singleton pattern implementation
|
// singleton pattern implementation
|
||||||
static LLShaderMgr * instance();
|
static LLShaderMgr * instance();
|
||||||
|
|
|
||||||
|
|
@ -155,9 +155,8 @@ public:
|
||||||
//get the size of a buffer with the given typemask and vertex count
|
//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
|
//fill offsets with the offset of each vertex component array into the buffer
|
||||||
// indexed by the following enum
|
// 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
|
//WARNING -- when updating these enums you MUST
|
||||||
// 1 - update LLVertexBuffer::sTypeSize
|
// 1 - update LLVertexBuffer::sTypeSize
|
||||||
// 2 - add a strider accessor
|
// 2 - add a strider accessor
|
||||||
|
|
@ -165,24 +164,28 @@ public:
|
||||||
// 4 - modify LLVertexBuffer::setupClientArray
|
// 4 - modify LLVertexBuffer::setupClientArray
|
||||||
// 5 - modify LLViewerShaderMgr::mReservedAttribs
|
// 5 - modify LLViewerShaderMgr::mReservedAttribs
|
||||||
// 6 - update LLVertexBuffer::setupVertexArray
|
// 6 - update LLVertexBuffer::setupVertexArray
|
||||||
enum {
|
|
||||||
TYPE_VERTEX = 0,
|
// clang-format off
|
||||||
TYPE_NORMAL,
|
enum { // Shader attribute name, set in LLShaderMgr::initAttribsAndUniforms()
|
||||||
TYPE_TEXCOORD0,
|
TYPE_VERTEX = 0, // "position"
|
||||||
TYPE_TEXCOORD1,
|
TYPE_NORMAL, // "normal"
|
||||||
TYPE_TEXCOORD2,
|
TYPE_TEXCOORD0, // "texcoord0"
|
||||||
TYPE_TEXCOORD3,
|
TYPE_TEXCOORD1, // "texcoord1"
|
||||||
TYPE_COLOR,
|
TYPE_TEXCOORD2, // "texcoord2"
|
||||||
TYPE_EMISSIVE,
|
TYPE_TEXCOORD3, // "texcoord3"
|
||||||
TYPE_TANGENT,
|
TYPE_COLOR, // "diffuse_color"
|
||||||
TYPE_WEIGHT,
|
TYPE_EMISSIVE, // "emissive"
|
||||||
TYPE_WEIGHT4,
|
TYPE_TANGENT, // "tangent"
|
||||||
TYPE_CLOTHWEIGHT,
|
TYPE_WEIGHT, // "weight"
|
||||||
TYPE_TEXTURE_INDEX,
|
TYPE_WEIGHT4, // "weight4"
|
||||||
TYPE_MAX, // TYPE_MAX is the size/boundary marker for attributes that go in the vertex buffer
|
TYPE_CLOTHWEIGHT, // "clothing"
|
||||||
TYPE_INDEX, // TYPE_INDEX is beyond _MAX because it lives in a separate (index) buffer
|
TYPE_TEXTURE_INDEX, // "texture_index"
|
||||||
};
|
TYPE_MAX, // TYPE_MAX is the size/boundary marker for attributes that go in the vertex buffer
|
||||||
enum {
|
TYPE_INDEX, // TYPE_INDEX is beyond _MAX because it lives in a separate (index) buffer
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
enum {
|
||||||
MAP_VERTEX = (1<<TYPE_VERTEX),
|
MAP_VERTEX = (1<<TYPE_VERTEX),
|
||||||
MAP_NORMAL = (1<<TYPE_NORMAL),
|
MAP_NORMAL = (1<<TYPE_NORMAL),
|
||||||
MAP_TEXCOORD0 = (1<<TYPE_TEXCOORD0),
|
MAP_TEXCOORD0 = (1<<TYPE_TEXCOORD0),
|
||||||
|
|
|
||||||
|
|
@ -295,9 +295,6 @@ const std::string LLLocale::SYSTEM_LOCALE("English_United States.1252");
|
||||||
#elif LL_DARWIN
|
#elif LL_DARWIN
|
||||||
const std::string LLLocale::USER_LOCALE("en_US.iso8859-1");// = LLStringUtil::null;
|
const std::string LLLocale::USER_LOCALE("en_US.iso8859-1");// = LLStringUtil::null;
|
||||||
const std::string LLLocale::SYSTEM_LOCALE("en_US.iso8859-1");
|
const std::string LLLocale::SYSTEM_LOCALE("en_US.iso8859-1");
|
||||||
#elif LL_SOLARIS
|
|
||||||
const std::string LLLocale::USER_LOCALE("en_US.ISO8859-1");
|
|
||||||
const std::string LLLocale::SYSTEM_LOCALE("C");
|
|
||||||
#else // LL_LINUX likes this
|
#else // LL_LINUX likes this
|
||||||
const std::string LLLocale::USER_LOCALE("en_US.utf8");
|
const std::string LLLocale::USER_LOCALE("en_US.utf8");
|
||||||
const std::string LLLocale::SYSTEM_LOCALE("C");
|
const std::string LLLocale::SYSTEM_LOCALE("C");
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,6 @@ LLDir_Win32 gDirUtil;
|
||||||
#elif LL_DARWIN
|
#elif LL_DARWIN
|
||||||
#include "lldir_mac.h"
|
#include "lldir_mac.h"
|
||||||
LLDir_Mac gDirUtil;
|
LLDir_Mac gDirUtil;
|
||||||
#elif LL_SOLARIS
|
|
||||||
#include "lldir_solaris.h"
|
|
||||||
LLDir_Solaris gDirUtil;
|
|
||||||
#else
|
#else
|
||||||
#include "lldir_linux.h"
|
#include "lldir_linux.h"
|
||||||
LLDir_Linux gDirUtil;
|
LLDir_Linux gDirUtil;
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,6 @@
|
||||||
#ifndef LL_LLDIR_H
|
#ifndef LL_LLDIR_H
|
||||||
#define LL_LLDIR_H
|
#define LL_LLDIR_H
|
||||||
|
|
||||||
#if LL_SOLARIS
|
|
||||||
#include <sys/param.h>
|
|
||||||
#define MAX_PATH MAXPATHLEN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// these numbers are read from settings_files.xml, so we need to be explicit
|
// these numbers are read from settings_files.xml, so we need to be explicit
|
||||||
typedef enum ELLPath
|
typedef enum ELLPath
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,266 +0,0 @@
|
||||||
/**
|
|
||||||
* @file fmodwrapper.cpp
|
|
||||||
* @brief dummy source file for building a shared library to wrap libfmod.a
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "linden_common.h"
|
|
||||||
|
|
||||||
#include "lldir_solaris.h"
|
|
||||||
#include "llerror.h"
|
|
||||||
#include "llrand.h"
|
|
||||||
#include "llstring.h"
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <glob.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#define _STRUCTURED_PROC 1
|
|
||||||
#include <sys/procfs.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
static std::string getCurrentUserHome(char* fallback)
|
|
||||||
{
|
|
||||||
// fwiw this exactly duplicates getCurrentUserHome() in lldir_linux.cpp...
|
|
||||||
// we should either derive both from LLDir_Posix or just axe Solaris.
|
|
||||||
const uid_t uid = getuid();
|
|
||||||
struct passwd *pw;
|
|
||||||
|
|
||||||
pw = getpwuid(uid);
|
|
||||||
if ((pw != NULL) && (pw->pw_dir != NULL))
|
|
||||||
{
|
|
||||||
return pw->pw_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL;
|
|
||||||
auto home_env = LLStringUtil::getoptenv("HOME");
|
|
||||||
if (home_env)
|
|
||||||
{
|
|
||||||
return *home_env;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL;
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LLDir_Solaris::LLDir_Solaris()
|
|
||||||
{
|
|
||||||
mDirDelimiter = "/";
|
|
||||||
mCurrentDirIndex = -1;
|
|
||||||
mCurrentDirCount = -1;
|
|
||||||
mDirp = NULL;
|
|
||||||
|
|
||||||
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
|
|
||||||
if (getcwd(tmp_str, LL_MAX_PATH) == NULL)
|
|
||||||
{
|
|
||||||
strcpy(tmp_str, "/tmp");
|
|
||||||
LL_WARNS() << "Could not get current directory; changing to "
|
|
||||||
<< tmp_str << LL_ENDL;
|
|
||||||
if (chdir(tmp_str) == -1)
|
|
||||||
{
|
|
||||||
LL_ERRS() << "Could not change directory to " << tmp_str << LL_ENDL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mExecutableFilename = "";
|
|
||||||
mExecutablePathAndName = "";
|
|
||||||
mExecutableDir = strdup(tmp_str);
|
|
||||||
mWorkingDir = strdup(tmp_str);
|
|
||||||
mAppRODataDir = strdup(tmp_str);
|
|
||||||
mOSUserDir = getCurrentUserHome(tmp_str);
|
|
||||||
mOSUserAppDir = "";
|
|
||||||
mLindenUserDir = "";
|
|
||||||
|
|
||||||
char path [LL_MAX_PATH]; /* Flawfinder: ignore */
|
|
||||||
|
|
||||||
sprintf(path, "/proc/%d/psinfo", (int)getpid());
|
|
||||||
int proc_fd = -1;
|
|
||||||
if((proc_fd = open(path, O_RDONLY)) == -1){
|
|
||||||
LL_WARNS() << "unable to open " << path << LL_ENDL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
psinfo_t proc_psinfo;
|
|
||||||
if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){
|
|
||||||
LL_WARNS() << "Unable to read " << path << LL_ENDL;
|
|
||||||
close(proc_fd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
close(proc_fd);
|
|
||||||
|
|
||||||
mExecutableFilename = strdup(proc_psinfo.pr_fname);
|
|
||||||
LL_INFOS() << "mExecutableFilename = [" << mExecutableFilename << "]" << LL_ENDL;
|
|
||||||
|
|
||||||
sprintf(path, "/proc/%d/path/a.out", (int)getpid());
|
|
||||||
|
|
||||||
char execpath[LL_MAX_PATH];
|
|
||||||
if(readlink(path, execpath, LL_MAX_PATH) == -1){
|
|
||||||
LL_WARNS() << "Unable to read link from " << path << LL_ENDL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *p = execpath; // nuke trash in link, if any exists
|
|
||||||
int i = 0;
|
|
||||||
while(*p != NULL && ++i < LL_MAX_PATH && isprint((int)(*p++)));
|
|
||||||
*p = NULL;
|
|
||||||
|
|
||||||
mExecutablePathAndName = strdup(execpath);
|
|
||||||
LL_INFOS() << "mExecutablePathAndName = [" << mExecutablePathAndName << "]" << LL_ENDL;
|
|
||||||
|
|
||||||
//NOTE: Why force people to cd into the package directory?
|
|
||||||
// Look for SECONDLIFE env variable and use it, if set.
|
|
||||||
|
|
||||||
auto SECONDLIFE(LLDirUtil::getoptenv("SECONDLIFE"));
|
|
||||||
if(SECONDLIFE){
|
|
||||||
mExecutableDir = add(*SECONDLIFE, "bin"); //NOTE: make sure we point at the bin
|
|
||||||
}else{
|
|
||||||
mExecutableDir = getDirName(execpath);
|
|
||||||
LL_INFOS() << "mExecutableDir = [" << mExecutableDir << "]" << LL_ENDL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLLPluginDir = add(mExecutableDir, "llplugin");
|
|
||||||
|
|
||||||
// *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something.
|
|
||||||
mTempDir = "/tmp";
|
|
||||||
}
|
|
||||||
|
|
||||||
LLDir_Solaris::~LLDir_Solaris()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
|
|
||||||
|
|
||||||
void LLDir_Solaris::initAppDirs(const std::string &app_name,
|
|
||||||
const std::string& app_read_only_data_dir)
|
|
||||||
{
|
|
||||||
// Allow override so test apps can read newview directory
|
|
||||||
if (!app_read_only_data_dir.empty())
|
|
||||||
{
|
|
||||||
mAppRODataDir = app_read_only_data_dir;
|
|
||||||
mSkinBaseDir = add(mAppRODataDir, "skins");
|
|
||||||
}
|
|
||||||
mAppName = app_name;
|
|
||||||
|
|
||||||
std::string upper_app_name(app_name);
|
|
||||||
LLStringUtil::toUpper(upper_app_name);
|
|
||||||
|
|
||||||
auto app_home_env(LLStringUtil::getoptenv(upper_app_name + "_USER_DIR"));
|
|
||||||
if (app_home_env)
|
|
||||||
{
|
|
||||||
// user has specified own userappdir i.e. $SECONDLIFE_USER_DIR
|
|
||||||
mOSUserAppDir = *app_home_env;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// traditionally on unixoids, MyApp gets ~/.myapp dir for data
|
|
||||||
mOSUserAppDir = mOSUserDir;
|
|
||||||
mOSUserAppDir += "/";
|
|
||||||
mOSUserAppDir += ".";
|
|
||||||
std::string lower_app_name(app_name);
|
|
||||||
LLStringUtil::toLower(lower_app_name);
|
|
||||||
mOSUserAppDir += lower_app_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create any directories we expect to write to.
|
|
||||||
|
|
||||||
int res = LLFile::mkdir(mOSUserAppDir);
|
|
||||||
if (res == -1)
|
|
||||||
{
|
|
||||||
LL_WARNS() << "Couldn't create app user dir " << mOSUserAppDir << LL_ENDL;
|
|
||||||
LL_WARNS() << "Default to base dir" << mOSUserDir << LL_ENDL;
|
|
||||||
mOSUserAppDir = mOSUserDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,""));
|
|
||||||
if (res == -1)
|
|
||||||
{
|
|
||||||
LL_WARNS() << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << LL_ENDL;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,""));
|
|
||||||
if (res == -1)
|
|
||||||
{
|
|
||||||
LL_WARNS() << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << LL_ENDL;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,""));
|
|
||||||
if (res == -1)
|
|
||||||
{
|
|
||||||
LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mCAFile = getExpandedFilename(LL_PATH_EXECUTABLE, "ca-bundle.crt");
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 LLDir_Solaris::countFilesInDir(const std::string &dirname, const std::string &mask)
|
|
||||||
{
|
|
||||||
U32 file_count = 0;
|
|
||||||
glob_t g;
|
|
||||||
|
|
||||||
std::string tmp_str;
|
|
||||||
tmp_str = dirname;
|
|
||||||
tmp_str += mask;
|
|
||||||
|
|
||||||
if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0)
|
|
||||||
{
|
|
||||||
file_count = g.gl_pathc;
|
|
||||||
|
|
||||||
globfree(&g);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (file_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string LLDir_Solaris::getCurPath()
|
|
||||||
{
|
|
||||||
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
|
|
||||||
if (getcwd(tmp_str, LL_MAX_PATH) == NULL)
|
|
||||||
{
|
|
||||||
LL_WARNS() << "Could not get current directory" << LL_ENDL;
|
|
||||||
tmp_str[0] = '\0';
|
|
||||||
}
|
|
||||||
return tmp_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool LLDir_Solaris::fileExists(const std::string &filename) const
|
|
||||||
{
|
|
||||||
struct stat stat_data;
|
|
||||||
// Check the age of the file
|
|
||||||
// Now, we see if the files we've gathered are recent...
|
|
||||||
int res = stat(filename.c_str(), &stat_data);
|
|
||||||
if (!res)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
/**
|
|
||||||
* @file fmodwrapper.cpp
|
|
||||||
* @brief dummy source file for building a shared library to wrap libfmod.a
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* Copyright (C) 2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation;
|
|
||||||
* version 2.1 of the License only.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
|
||||||
* $/LicenseInfo$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !LL_SOLARIS
|
|
||||||
#error This header must not be included when compiling for any target other than Solaris. Consider including lldir.h instead.
|
|
||||||
#endif // !LL_SOLARIS
|
|
||||||
|
|
||||||
#ifndef LL_LLDIR_SOLARIS_H
|
|
||||||
#define LL_LLDIR_SOLARIS_H
|
|
||||||
|
|
||||||
#include "lldir.h"
|
|
||||||
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
class LLDir_Solaris : public LLDir
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LLDir_Solaris();
|
|
||||||
virtual ~LLDir_Solaris();
|
|
||||||
|
|
||||||
/*virtual*/ void initAppDirs(const std::string &app_name,
|
|
||||||
const std::string& app_read_only_data_dir);
|
|
||||||
|
|
||||||
virtual std::string getCurPath();
|
|
||||||
virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask);
|
|
||||||
/*virtual*/ bool fileExists(const std::string &filename) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
DIR *mDirp;
|
|
||||||
int mCurrentDirIndex;
|
|
||||||
int mCurrentDirCount;
|
|
||||||
std::string mCurrentDir;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LL_LLDIR_SOLARIS_H
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,10 +33,6 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
#include <share.h>
|
#include <share.h>
|
||||||
#elif LL_SOLARIS
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#else
|
#else
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2146,12 +2142,6 @@ LLFILE *LLVFS::openAndLock(const std::string& filename, const char* mode, BOOL r
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
// first test the lock in a non-destructive way
|
// first test the lock in a non-destructive way
|
||||||
#if LL_SOLARIS
|
|
||||||
struct flock fl;
|
|
||||||
fl.l_whence = SEEK_SET;
|
|
||||||
fl.l_start = 0;
|
|
||||||
fl.l_len = 1;
|
|
||||||
#else // !LL_SOLARIS
|
|
||||||
if (strchr(mode, 'w') != NULL)
|
if (strchr(mode, 'w') != NULL)
|
||||||
{
|
{
|
||||||
fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
|
fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
|
||||||
|
|
@ -2167,19 +2157,13 @@ LLFILE *LLVFS::openAndLock(const std::string& filename, const char* mode, BOOL r
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // !LL_SOLARIS
|
|
||||||
|
|
||||||
// now actually open the file for use
|
// now actually open the file for use
|
||||||
fp = LLFile::fopen(filename, mode); /* Flawfinder: ignore */
|
fp = LLFile::fopen(filename, mode); /* Flawfinder: ignore */
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
fd = fileno(fp);
|
fd = fileno(fp);
|
||||||
#if LL_SOLARIS
|
|
||||||
fl.l_type = read_lock ? F_RDLCK : F_WRLCK;
|
|
||||||
if (fcntl(fd, F_SETLK, &fl) == -1)
|
|
||||||
#else
|
|
||||||
if (flock(fd, (read_lock ? LOCK_SH : LOCK_EX) | LOCK_NB) == -1)
|
if (flock(fd, (read_lock ? LOCK_SH : LOCK_EX) | LOCK_NB) == -1)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
|
@ -2207,14 +2191,6 @@ void LLVFS::unlockAndClose(LLFILE *fp)
|
||||||
flock(fd, LOCK_UN);
|
flock(fd, LOCK_UN);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
#if LL_SOLARIS
|
|
||||||
struct flock fl;
|
|
||||||
fl.l_whence = SEEK_SET;
|
|
||||||
fl.l_start = 0;
|
|
||||||
fl.l_len = 1;
|
|
||||||
fl.l_type = F_UNLCK;
|
|
||||||
fcntl(fileno(fp), F_SETLK, &fl);
|
|
||||||
#endif
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,13 +51,13 @@ extern "C" {
|
||||||
# include "fontconfig/fontconfig.h"
|
# include "fontconfig/fontconfig.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
// not necessarily available on random SDL platforms, so #if LL_LINUX
|
// not necessarily available on random SDL platforms, so #if LL_LINUX
|
||||||
// for execv(), waitpid(), fork()
|
// for execv(), waitpid(), fork()
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/wait.h>
|
# include <sys/wait.h>
|
||||||
#endif // LL_LINUX || LL_SOLARIS
|
#endif // LL_LINUX
|
||||||
|
|
||||||
extern BOOL gDebugWindowProc;
|
extern BOOL gDebugWindowProc;
|
||||||
|
|
||||||
|
|
@ -323,12 +323,6 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
|
||||||
|
|
||||||
static int x11_detect_VRAM_kb()
|
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 x_log_location("/var/log/");
|
||||||
std::string fname;
|
std::string fname;
|
||||||
int rtn = 0; // 'could not detect'
|
int rtn = 0; // 'could not detect'
|
||||||
|
|
@ -409,7 +403,6 @@ static int x11_detect_VRAM_kb()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rtn;
|
return rtn;
|
||||||
#endif // LL_SOLARIS
|
|
||||||
}
|
}
|
||||||
#endif // LL_X11
|
#endif // LL_X11
|
||||||
|
|
||||||
|
|
@ -484,27 +477,10 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8);
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_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.
|
// We need stencil support for a few (minor) things.
|
||||||
if (!getenv("LL_GL_NO_STENCIL"))
|
if (!getenv("LL_GL_NO_STENCIL"))
|
||||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
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);
|
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, (bits <= 16) ? 1 : 8);
|
||||||
|
|
||||||
// *FIX: try to toggle vsync here?
|
// *FIX: try to toggle vsync here?
|
||||||
|
|
@ -682,25 +658,13 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
|
||||||
// fixme: actually, it's REALLY important for picking that we get at
|
// 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
|
// least 8 bits each of red,green,blue. Alpha we can be a bit more
|
||||||
// relaxed about if we have to.
|
// 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)
|
if (colorBits < 32)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
setupFailure(
|
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"
|
"Second Life requires True Color (32-bit) to run in a window.\n"
|
||||||
"Please go to Control Panels -> Display -> Settings and\n"
|
"Please go to Control Panels -> Display -> Settings and\n"
|
||||||
"set the screen to 32-bit color.\n"
|
"set the screen to 32-bit color.\n"
|
||||||
#endif
|
|
||||||
"Alternately, if you choose to run fullscreen, Second Life\n"
|
"Alternately, if you choose to run fullscreen, Second Life\n"
|
||||||
"will automatically adjust the screen each time it runs.",
|
"will automatically adjust the screen each time it runs.",
|
||||||
"Error",
|
"Error",
|
||||||
|
|
@ -2503,7 +2467,7 @@ BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
|
||||||
}
|
}
|
||||||
#endif // LL_GTK
|
#endif // LL_GTK
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
// extracted from spawnWebBrowser for clarity and to eliminate
|
// extracted from spawnWebBrowser for clarity and to eliminate
|
||||||
// compiler confusion regarding close(int fd) vs. LLWindow::close()
|
// compiler confusion regarding close(int fd) vs. LLWindow::close()
|
||||||
void exec_cmd(const std::string& cmd, const std::string& arg)
|
void exec_cmd(const std::string& cmd, const std::string& arg)
|
||||||
|
|
@ -2559,7 +2523,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||||
|
|
||||||
LL_INFOS() << "spawn_web_browser: " << escaped_url << LL_ENDL;
|
LL_INFOS() << "spawn_web_browser: " << escaped_url << LL_ENDL;
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
# if LL_X11
|
# if LL_X11
|
||||||
if (mSDL_Display)
|
if (mSDL_Display)
|
||||||
{
|
{
|
||||||
|
|
@ -2578,7 +2542,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||||
cmd += "launch_url.sh";
|
cmd += "launch_url.sh";
|
||||||
arg = escaped_url;
|
arg = escaped_url;
|
||||||
exec_cmd(cmd, arg);
|
exec_cmd(cmd, arg);
|
||||||
#endif // LL_LINUX || LL_SOLARIS
|
#endif // LL_LINUX
|
||||||
|
|
||||||
LL_INFOS() << "spawn_web_browser returning." << LL_ENDL;
|
LL_INFOS() << "spawn_web_browser returning." << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -483,7 +483,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
|
||||||
memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp));
|
memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp));
|
||||||
mCustomGammaSet = FALSE;
|
mCustomGammaSet = FALSE;
|
||||||
mWindowHandle = NULL;
|
mWindowHandle = NULL;
|
||||||
|
|
||||||
if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0))
|
if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0))
|
||||||
{
|
{
|
||||||
mMouseVanish = TRUE;
|
mMouseVanish = TRUE;
|
||||||
|
|
@ -746,6 +746,37 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
|
||||||
// TrackMouseEvent( &track_mouse_event );
|
// 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
|
// Create GL drawing context
|
||||||
|
|
@ -1271,22 +1302,22 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
||||||
{
|
{
|
||||||
// Looks like ChoosePixelFormat can crash in case of faulty driver
|
// Looks like ChoosePixelFormat can crash in case of faulty driver
|
||||||
if (!(pixel_format = SafeChoosePixelFormat(mhDC, &pfd)))
|
if (!(pixel_format = SafeChoosePixelFormat(mhDC, &pfd)))
|
||||||
{
|
{
|
||||||
LL_WARNS("Window") << "ChoosePixelFormat failed, code: " << GetLastError() << LL_ENDL;
|
LL_WARNS("Window") << "ChoosePixelFormat failed, code: " << GetLastError() << LL_ENDL;
|
||||||
OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"),
|
OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"),
|
||||||
mCallbacks->translateString("MBError"), OSMB_OK);
|
mCallbacks->translateString("MBError"), OSMB_OK);
|
||||||
close();
|
close();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
LOG_UNHANDLED_EXCEPTION("ChoosePixelFormat");
|
LOG_UNHANDLED_EXCEPTION("ChoosePixelFormat");
|
||||||
OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"),
|
OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"),
|
||||||
mCallbacks->translateString("MBError"), OSMB_OK);
|
mCallbacks->translateString("MBError"), OSMB_OK);
|
||||||
close();
|
close();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LL_INFOS("Window") << "Pixel format chosen." << LL_ENDL ;
|
LL_INFOS("Window") << "Pixel format chosen." << LL_ENDL ;
|
||||||
|
|
||||||
|
|
@ -1513,21 +1544,27 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
||||||
LL_INFOS("Window") << "pixel formats done." << LL_ENDL ;
|
LL_INFOS("Window") << "pixel formats done." << LL_ENDL ;
|
||||||
|
|
||||||
S32 swap_method = 0;
|
S32 swap_method = 0;
|
||||||
S32 cur_format = num_formats-1;
|
S32 cur_format = 0;
|
||||||
|
const S32 max_format = (S32)num_formats - 1;
|
||||||
GLint swap_query = WGL_SWAP_METHOD_ARB;
|
GLint swap_query = WGL_SWAP_METHOD_ARB;
|
||||||
|
|
||||||
BOOL found_format = FALSE;
|
// SL-14705 Fix name tags showing in front of objects with AMD GPUs.
|
||||||
|
// On AMD hardware we need to iterate from the first pixel format to the end.
|
||||||
while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
|
// Spec:
|
||||||
|
// https://www.khronos.org/registry/OpenGL/extensions/ARB/WGL_ARB_pixel_format.txt
|
||||||
|
while (wglGetPixelFormatAttribivARB(mhDC, pixel_formats[cur_format], 0, 1, &swap_query, &swap_method))
|
||||||
{
|
{
|
||||||
if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0)
|
if (swap_method == WGL_SWAP_UNDEFINED_ARB)
|
||||||
{
|
{
|
||||||
found_format = TRUE;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else if (cur_format >= max_format)
|
||||||
{
|
{
|
||||||
--cur_format;
|
cur_format = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++cur_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixel_format = pixel_formats[cur_format];
|
pixel_format = pixel_formats[cur_format];
|
||||||
|
|
|
||||||
|
|
@ -584,6 +584,7 @@ set(viewer_SOURCE_FILES
|
||||||
llsyntaxid.cpp
|
llsyntaxid.cpp
|
||||||
llsyswellitem.cpp
|
llsyswellitem.cpp
|
||||||
llsyswellwindow.cpp
|
llsyswellwindow.cpp
|
||||||
|
lltelemetry.cpp
|
||||||
llteleporthistory.cpp
|
llteleporthistory.cpp
|
||||||
llteleporthistorystorage.cpp
|
llteleporthistorystorage.cpp
|
||||||
lltextureatlas.cpp
|
lltextureatlas.cpp
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
6.4.19
|
6.4.20
|
||||||
|
|
|
||||||
|
|
@ -6586,7 +6586,7 @@
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>MemoryFailurePreventionEnabled</key>
|
<key>MemoryFailurePreventionEnabled</key> <!-- deprecated, only used for obsolete-in-2020 Intel 965 Express GPU -->
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
<string>If set, the viewer will quit to avoid crash when memory failure happens</string>
|
<string>If set, the viewer will quit to avoid crash when memory failure happens</string>
|
||||||
|
|
@ -9113,7 +9113,7 @@
|
||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>F32</string>
|
<string>F32</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>0.03</real>
|
<real>0.1</real>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderDebugPipeline</key>
|
<key>RenderDebugPipeline</key>
|
||||||
<map>
|
<map>
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* @file WLCloudsV.glsl
|
* @file WLCloudsV.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2005, Linden Research, Inc.
|
* Copyright (C) 2005, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation;
|
* License as published by the Free Software Foundation;
|
||||||
* version 2.1 of the License only.
|
* version 2.1 of the License only.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0;
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Output parameters
|
// Output parameters
|
||||||
VARYING vec4 vary_CloudColorSun;
|
VARYING vec4 vary_CloudColorSun;
|
||||||
VARYING vec4 vary_CloudColorAmbient;
|
VARYING vec4 vary_CloudColorAmbient;
|
||||||
VARYING float vary_CloudDensity;
|
VARYING float vary_CloudDensity;
|
||||||
|
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
VARYING vec2 vary_texcoord1;
|
VARYING vec2 vary_texcoord1;
|
||||||
VARYING vec2 vary_texcoord2;
|
VARYING vec2 vary_texcoord2;
|
||||||
VARYING vec2 vary_texcoord3;
|
VARYING vec2 vary_texcoord3;
|
||||||
VARYING float altitude_blend_factor;
|
VARYING float altitude_blend_factor;
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
uniform vec3 camPosLocal;
|
uniform vec3 camPosLocal;
|
||||||
|
|
||||||
uniform vec4 lightnorm;
|
uniform vec4 lightnorm;
|
||||||
uniform vec4 sunlight_color;
|
uniform vec4 sunlight_color;
|
||||||
uniform vec4 moonlight_color;
|
uniform vec4 moonlight_color;
|
||||||
uniform int sun_up_factor;
|
uniform int sun_up_factor;
|
||||||
uniform vec4 ambient_color;
|
uniform vec4 ambient_color;
|
||||||
uniform vec4 blue_horizon;
|
uniform vec4 blue_horizon;
|
||||||
uniform vec4 blue_density;
|
uniform vec4 blue_density;
|
||||||
uniform float haze_horizon;
|
uniform float haze_horizon;
|
||||||
uniform float haze_density;
|
uniform float haze_density;
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ uniform float cloud_shadow;
|
||||||
uniform float density_multiplier;
|
uniform float density_multiplier;
|
||||||
uniform float max_y;
|
uniform float max_y;
|
||||||
|
|
||||||
uniform vec4 glow;
|
uniform vec4 glow;
|
||||||
uniform float sun_moon_glow_factor;
|
uniform float sun_moon_glow_factor;
|
||||||
|
|
||||||
uniform vec4 cloud_color;
|
uniform vec4 cloud_color;
|
||||||
|
|
@ -75,53 +75,53 @@ uniform float cloud_scale;
|
||||||
// indra\newview\llsettingsvo.cpp
|
// indra\newview\llsettingsvo.cpp
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// World / view / projection
|
// World / view / projection
|
||||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
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
|
// 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 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial
|
||||||
|
|
||||||
vary_texcoord0.xy -= 0.5;
|
vary_texcoord0.xy -= 0.5;
|
||||||
vary_texcoord0.xy /= cloud_scale;
|
vary_texcoord0.xy /= cloud_scale;
|
||||||
vary_texcoord0.xy += 0.5;
|
vary_texcoord0.xy += 0.5;
|
||||||
|
|
||||||
vary_texcoord1 = vary_texcoord0;
|
vary_texcoord1 = vary_texcoord0;
|
||||||
vary_texcoord1.x += lightnorm.x * 0.0125;
|
vary_texcoord1.x += lightnorm.x * 0.0125;
|
||||||
vary_texcoord1.y += lightnorm.z * 0.0125;
|
vary_texcoord1.y += lightnorm.z * 0.0125;
|
||||||
|
|
||||||
vary_texcoord2 = vary_texcoord0 * 16.;
|
vary_texcoord2 = vary_texcoord0 * 16.;
|
||||||
vary_texcoord3 = vary_texcoord1 * 16.;
|
vary_texcoord3 = vary_texcoord1 * 16.;
|
||||||
|
|
||||||
// Get relative position
|
// Get relative position
|
||||||
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
|
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);
|
altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0);
|
||||||
|
|
||||||
// Set altitude
|
// Set altitude
|
||||||
if (rel_pos.y > 0)
|
if (rel_pos.y > 0)
|
||||||
{
|
{
|
||||||
rel_pos *= (max_y / rel_pos.y);
|
rel_pos *= (max_y / rel_pos.y);
|
||||||
}
|
}
|
||||||
if (rel_pos.y < 0)
|
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);
|
rel_pos *= (-32000. / rel_pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can normalize then
|
// Can normalize then
|
||||||
vec3 rel_pos_norm = normalize(rel_pos);
|
vec3 rel_pos_norm = normalize(rel_pos);
|
||||||
float rel_pos_len = length(rel_pos);
|
float rel_pos_len = length(rel_pos);
|
||||||
|
|
||||||
// Initialize temp variables
|
// Initialize temp variables
|
||||||
vec4 sunlight = sunlight_color;
|
vec4 sunlight = sunlight_color;
|
||||||
vec4 light_atten;
|
vec4 light_atten;
|
||||||
|
|
||||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||||
// this is used later for sunlight modulation at various altitudes
|
// this is used later for sunlight modulation at various altitudes
|
||||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
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 combined_haze = abs(blue_density) + vec4(abs(haze_density));
|
||||||
vec4 blue_weight = blue_density / combined_haze;
|
vec4 blue_weight = blue_density / combined_haze;
|
||||||
vec4 haze_weight = haze_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);
|
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
|
||||||
sunlight *= exp(-light_atten * off_axis);
|
sunlight *= exp(-light_atten * off_axis);
|
||||||
|
|
||||||
// Distance
|
// Distance
|
||||||
float density_dist = rel_pos_len * density_multiplier;
|
float density_dist = rel_pos_len * density_multiplier;
|
||||||
|
|
||||||
// Transparency (-> combined_haze)
|
// Transparency (-> combined_haze)
|
||||||
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
|
// 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);
|
combined_haze = exp(-combined_haze * density_dist);
|
||||||
|
|
||||||
// Compute haze glow
|
// Compute haze glow
|
||||||
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
|
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 is 0 at the sun and increases away from sun
|
||||||
haze_glow = max(haze_glow, .001);
|
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;
|
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);
|
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;
|
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
|
// 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);
|
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
|
||||||
|
|
||||||
// Increase ambient when there are more clouds
|
// Increase ambient when there are more clouds
|
||||||
vec4 tmpAmbient = ambient_color;
|
vec4 tmpAmbient = ambient_color;
|
||||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||||
|
|
||||||
// Dim sunlight by cloud shadow percentage
|
// Dim sunlight by cloud shadow percentage
|
||||||
sunlight *= (1. - cloud_shadow);
|
sunlight *= (1. - cloud_shadow);
|
||||||
|
|
||||||
// Haze color below cloud
|
// Haze color below cloud
|
||||||
vec4 additiveColorBelowCloud =
|
vec4 additiveColorBelowCloud =
|
||||||
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
|
(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.);
|
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
|
||||||
sunlight *= exp(-light_atten * off_axis);
|
sunlight *= exp(-light_atten * off_axis);
|
||||||
|
|
||||||
// Cloud color out
|
// Cloud color out
|
||||||
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
|
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
|
||||||
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
||||||
|
|
||||||
// Attenuate cloud color by atmosphere
|
// Attenuate cloud color by atmosphere
|
||||||
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
||||||
vary_CloudColorSun *= combined_haze;
|
vary_CloudColorSun *= combined_haze;
|
||||||
vary_CloudColorAmbient *= combined_haze;
|
vary_CloudColorAmbient *= combined_haze;
|
||||||
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
|
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
|
||||||
|
|
||||||
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
||||||
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
||||||
|
|
||||||
// Combine these to minimize register use
|
// Combine these to minimize register use
|
||||||
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
||||||
|
|
||||||
// needs this to compile on mac
|
// needs this to compile on mac
|
||||||
// vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
//vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||||
|
|
||||||
// END CLOUDS
|
// END CLOUDS
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,28 +64,27 @@ void main()
|
||||||
#else
|
#else
|
||||||
vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
|
vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
color.rgb *= vertex_color.rgb;
|
color.rgb *= vertex_color.rgb;
|
||||||
|
|
||||||
// SL-9632 HUDs are affected by Atmosphere
|
// SL-9632 HUDs are affected by Atmosphere
|
||||||
if (no_atmo == 0)
|
if (no_atmo == 0)
|
||||||
{
|
{
|
||||||
vec3 sunlit;
|
vec3 sunlit;
|
||||||
vec3 amblit;
|
vec3 amblit;
|
||||||
vec3 additive;
|
vec3 additive;
|
||||||
vec3 atten;
|
vec3 atten;
|
||||||
vec3 pos = vary_position.xyz/vary_position.w;
|
vec3 pos = vary_position.xyz/vary_position.w;
|
||||||
|
|
||||||
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false);
|
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false);
|
||||||
|
|
||||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
||||||
float env_intensity = vertex_color.a;
|
float env_intensity = vertex_color.a;
|
||||||
|
|
||||||
//color.rgb = srgb_to_linear(color.rgb);
|
//color.rgb = srgb_to_linear(color.rgb);
|
||||||
color.rgb = mix(color.rgb, envColor.rgb, env_intensity);
|
color.rgb = mix(color.rgb, envColor.rgb, env_intensity);
|
||||||
|
color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten);
|
||||||
color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten);
|
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ uniform sampler2D specularMap;
|
||||||
|
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
|
vec3 linear_to_srgb(vec3 c);
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
|
vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||||
|
|
@ -52,6 +54,7 @@ void main()
|
||||||
vec4 norm = texture2D(normalMap, vary_texcoord0.xy);
|
vec4 norm = texture2D(normalMap, vary_texcoord0.xy);
|
||||||
vec4 spec = texture2D(specularMap, vary_texcoord0.xy);
|
vec4 spec = texture2D(specularMap, vary_texcoord0.xy);
|
||||||
|
|
||||||
|
col.rgb = linear_to_srgb(col.rgb);
|
||||||
frag_data[0] = vec4(col.rgb, 0.0);
|
frag_data[0] = vec4(col.rgb, 0.0);
|
||||||
frag_data[1] = spec;
|
frag_data[1] = spec;
|
||||||
frag_data[2] = vec4(norm.xy,0,0);
|
frag_data[2] = vec4(norm.xy,0,0);
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,8 @@ void main()
|
||||||
|
|
||||||
vec3 light = vec3(0, 0, 0);
|
vec3 light = vec3(0, 0, 0);
|
||||||
|
|
||||||
|
final_specular.rgb = srgb_to_linear(final_specular.rgb); // SL-14035
|
||||||
|
|
||||||
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w );
|
#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)
|
LIGHT_LOOP(1)
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,7 @@ void main()
|
||||||
vec3 norm = getNorm(frag.xy);
|
vec3 norm = getNorm(frag.xy);
|
||||||
|
|
||||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||||
spec.rgb = srgb_to_linear(spec.rgb);
|
|
||||||
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||||
diff.rgb = srgb_to_linear(diff.rgb);
|
|
||||||
|
|
||||||
float noise = texture2D(noiseMap, frag.xy / 128.0).b;
|
float noise = texture2D(noiseMap, frag.xy / 128.0).b;
|
||||||
vec3 npos = normalize(-pos);
|
vec3 npos = normalize(-pos);
|
||||||
|
|
|
||||||
|
|
@ -182,10 +182,6 @@ void main()
|
||||||
|
|
||||||
|
|
||||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||||
// SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space.
|
|
||||||
// We can't switch to linear here unless we do it everywhere*
|
|
||||||
// *gbuffer is sRGB, convert to linear whenever sampling from it
|
|
||||||
diff_tex.rgb = srgb_to_linear(diff_tex.rgb);
|
|
||||||
|
|
||||||
vec3 dlit = vec3(0, 0, 0);
|
vec3 dlit = vec3(0, 0, 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,6 @@ void main()
|
||||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||||
|
|
||||||
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
|
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||||
col.rgb = srgb_to_linear(col.rgb);
|
|
||||||
|
|
||||||
float fa = falloff+1.0;
|
float fa = falloff+1.0;
|
||||||
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||||
|
|
@ -127,7 +126,7 @@ void main()
|
||||||
{
|
{
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
//col.rgb = vec3(0);
|
|
||||||
frag_color.rgb = col;
|
frag_color.rgb = col;
|
||||||
frag_color.a = 0.0;
|
frag_color.a = 0.0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ void main()
|
||||||
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
||||||
|
|
||||||
//convert to gamma space
|
//convert to gamma space
|
||||||
//diffuse.rgb = linear_to_srgb(diffuse.rgb);
|
diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035
|
||||||
|
|
||||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||||
vec3 color = vec3(0);
|
vec3 color = vec3(0);
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,6 @@ void main()
|
||||||
vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy);
|
vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy);
|
||||||
vec4 c = mix(sunDiscA, sunDiscB, blend_factor);
|
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 = fullbrightAtmosTransport(c.rgb);
|
||||||
c.rgb = fullbrightScaleSoftClip(c.rgb);
|
c.rgb = fullbrightScaleSoftClip(c.rgb);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,15 +48,15 @@ void fullbright_shiny_lighting()
|
||||||
{
|
{
|
||||||
vec4 color = diffuseLookup(vary_texcoord0.xy);
|
vec4 color = diffuseLookup(vary_texcoord0.xy);
|
||||||
color.rgb *= vertex_color.rgb;
|
color.rgb *= vertex_color.rgb;
|
||||||
|
|
||||||
// SL-9632 HUDs are affected by Atmosphere
|
// SL-9632 HUDs are affected by Atmosphere
|
||||||
if (no_atmo == 0)
|
if (no_atmo == 0)
|
||||||
{
|
{
|
||||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
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 = 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 = fullbrightShinyAtmosTransport(color.rgb);
|
||||||
color.rgb = fullbrightScaleSoftClip(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.
|
// NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects.
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,37 @@
|
||||||
/**
|
/**
|
||||||
* @file class1\windlight\atmosphericVarsF.glsl
|
* @file class1\windlight\atmosphericVarsF.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2007, Linden Research, Inc.
|
* Copyright (C) 2007, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation;
|
* License as published by the Free Software Foundation;
|
||||||
* version 2.1 of the License only.
|
* version 2.1 of the License only.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
vec3 getPositionEye()
|
VARYING vec3 vary_AdditiveColor;
|
||||||
{
|
VARYING vec3 vary_AtmosAttenuation;
|
||||||
return vec3(0,0,0);
|
|
||||||
}
|
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); }
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,56 @@
|
||||||
/**
|
/**
|
||||||
* @file class1\windlight\atmosphericVarsV.glsl
|
* @file class1\windlight\atmosphericVarsV.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2007, Linden Research, Inc.
|
* Copyright (C) 2007, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation;
|
* License as published by the Free Software Foundation;
|
||||||
* version 2.1 of the License only.
|
* version 2.1 of the License only.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/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; }
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,38 @@
|
||||||
/**
|
/**
|
||||||
* @file class1\windlight\atmosphericVarsWaterF.glsl
|
* @file class1\windlight\atmosphericVarsWaterF.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2007, Linden Research, Inc.
|
* Copyright (C) 2007, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation;
|
* License as published by the Free Software Foundation;
|
||||||
* version 2.1 of the License only.
|
* version 2.1 of the License only.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
VARYING vec3 vary_PositionEye;
|
VARYING vec3 vary_PositionEye;
|
||||||
|
VARYING vec3 vary_AdditiveColor;
|
||||||
|
VARYING vec3 vary_AtmosAttenuation;
|
||||||
|
|
||||||
vec3 getPositionEye()
|
vec3 getSunlitColor() { return vec3(0, 0, 0); }
|
||||||
{
|
|
||||||
return vary_PositionEye;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
vec3 getAmblitColor() { return vec3(0, 0, 0); }
|
||||||
|
|
||||||
|
vec3 getAdditiveColor() { return vary_AdditiveColor; }
|
||||||
|
|
||||||
|
vec3 getAtmosAttenuation() { return vary_AtmosAttenuation; }
|
||||||
|
|
||||||
|
vec3 getPositionEye() { return vary_PositionEye; }
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,51 @@
|
||||||
/**
|
/**
|
||||||
* @file class1\windlight\atmosphericVarsWaterV.glsl
|
* @file class1\windlight\atmosphericVarsWaterV.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2007, Linden Research, Inc.
|
* Copyright (C) 2007, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation;
|
* License as published by the Free Software Foundation;
|
||||||
* version 2.1 of the License only.
|
* version 2.1 of the License only.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
VARYING vec3 vary_PositionEye;
|
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)
|
vec3 getPositionEye() { return vary_PositionEye; }
|
||||||
{
|
void setPositionEye(vec3 v) { vary_PositionEye = v; }
|
||||||
vary_PositionEye = v;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ void main()
|
||||||
// SL-9806 stars poke through
|
// SL-9806 stars poke through
|
||||||
// c.a *= sun_fade;
|
// c.a *= sun_fade;
|
||||||
|
|
||||||
c.rgb = pow(c.rgb, vec3(0.7f));
|
|
||||||
c.rgb = fullbrightAtmosTransport(c.rgb);
|
c.rgb = fullbrightAtmosTransport(c.rgb);
|
||||||
c.rgb = fullbrightScaleSoftClip(c.rgb);
|
c.rgb = fullbrightScaleSoftClip(c.rgb);
|
||||||
frag_color = c;
|
frag_color = c;
|
||||||
|
|
|
||||||
|
|
@ -191,10 +191,6 @@ void main()
|
||||||
float da = dot(norm, lv);
|
float da = dot(norm, lv);
|
||||||
|
|
||||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||||
// SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space.
|
|
||||||
// We can't switch to linear here unless we do it everywhere*
|
|
||||||
// *gbuffer IS sRGB, convert to linear since this shader outputs linear
|
|
||||||
diff_tex.rgb = srgb_to_linear(diff_tex.rgb);
|
|
||||||
|
|
||||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,21 @@ uniform float ice_level;
|
||||||
|
|
||||||
vec3 rainbow(float d)
|
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;
|
float rad = (droplet_radius - 5.0f) / 1024.0f;
|
||||||
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
|
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,9 @@ void main()
|
||||||
float light_gamma = 1.0 / 1.3;
|
float light_gamma = 1.0 / 1.3;
|
||||||
da = pow(da, light_gamma);
|
da = pow(da, light_gamma);
|
||||||
|
|
||||||
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
||||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
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;
|
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
|
||||||
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
|
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ void main()
|
||||||
lv = normalize(lv);
|
lv = normalize(lv);
|
||||||
float da = dot(norm, lv);
|
float da = dot(norm, lv);
|
||||||
|
|
||||||
vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb);
|
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||||
vec3 dlit = vec3(0, 0, 0);
|
vec3 dlit = vec3(0, 0, 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* @file class2\wl\atmosphericVars.glsl
|
* @file class2\wl\atmosphericVarsF.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
/*[EXTRA_CODE_HERE]*/
|
/*[EXTRA_CODE_HERE]*/
|
||||||
|
|
||||||
#ifdef DEFINE_GL_FRAGCOLOR
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
out vec4 frag_data[3];
|
out vec4 frag_color;
|
||||||
#else
|
#else
|
||||||
#define frag_data gl_FragData
|
#define frag_color gl_FragColor
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -126,8 +126,6 @@ void main()
|
||||||
color.rgb = scaleSoftClip(color.rgb);
|
color.rgb = scaleSoftClip(color.rgb);
|
||||||
|
|
||||||
/// Gamma correct for WL (soft clip effect).
|
/// Gamma correct for WL (soft clip effect).
|
||||||
frag_data[0] = vec4(color.rgb, alpha1);
|
frag_color = vec4(color.rgb, alpha1);
|
||||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
|
||||||
frag_data[2] = vec4(0,0,0,1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* @file class2\wl\cloudsV.glsl
|
* @file class2\wl\cloudsV.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* Copyright (C) 2005, Linden Research, Inc.
|
* Copyright (C) 2005, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation;
|
* License as published by the Free Software Foundation;
|
||||||
* version 2.1 of the License only.
|
* version 2.1 of the License only.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0;
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Output parameters
|
// Output parameters
|
||||||
VARYING vec4 vary_CloudColorSun;
|
VARYING vec4 vary_CloudColorSun;
|
||||||
VARYING vec4 vary_CloudColorAmbient;
|
VARYING vec4 vary_CloudColorAmbient;
|
||||||
VARYING float vary_CloudDensity;
|
VARYING float vary_CloudDensity;
|
||||||
|
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
VARYING vec2 vary_texcoord1;
|
VARYING vec2 vary_texcoord1;
|
||||||
VARYING vec2 vary_texcoord2;
|
VARYING vec2 vary_texcoord2;
|
||||||
VARYING vec2 vary_texcoord3;
|
VARYING vec2 vary_texcoord3;
|
||||||
VARYING float altitude_blend_factor;
|
VARYING float altitude_blend_factor;
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
uniform vec3 camPosLocal;
|
uniform vec3 camPosLocal;
|
||||||
|
|
||||||
uniform vec4 lightnorm;
|
uniform vec4 lightnorm;
|
||||||
uniform vec4 sunlight_color;
|
uniform vec4 sunlight_color;
|
||||||
uniform vec4 moonlight_color;
|
uniform vec4 moonlight_color;
|
||||||
uniform int sun_up_factor;
|
uniform int sun_up_factor;
|
||||||
uniform vec4 ambient_color;
|
uniform vec4 ambient_color;
|
||||||
uniform vec4 blue_horizon;
|
uniform vec4 blue_horizon;
|
||||||
uniform vec4 blue_density;
|
uniform vec4 blue_density;
|
||||||
uniform float haze_horizon;
|
uniform float haze_horizon;
|
||||||
uniform float haze_density;
|
uniform float haze_density;
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ uniform float cloud_shadow;
|
||||||
uniform float density_multiplier;
|
uniform float density_multiplier;
|
||||||
uniform float max_y;
|
uniform float max_y;
|
||||||
|
|
||||||
uniform vec4 glow;
|
uniform vec4 glow;
|
||||||
uniform float sun_moon_glow_factor;
|
uniform float sun_moon_glow_factor;
|
||||||
|
|
||||||
uniform vec4 cloud_color;
|
uniform vec4 cloud_color;
|
||||||
|
|
@ -75,8 +75,8 @@ uniform float cloud_scale;
|
||||||
// indra\newview\llsettingsvo.cpp
|
// indra\newview\llsettingsvo.cpp
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// World / view / projection
|
// World / view / projection
|
||||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
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
|
// 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_texcoord2 = vary_texcoord0 * 16.;
|
||||||
vary_texcoord3 = vary_texcoord1 * 16.;
|
vary_texcoord3 = vary_texcoord1 * 16.;
|
||||||
|
|
||||||
// Get relative position
|
// Get relative position
|
||||||
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
|
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
|
// 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
|
// Adj position vector to clamp altitude
|
||||||
if (rel_pos.y > 0.)
|
if (rel_pos.y > 0.)
|
||||||
{
|
{
|
||||||
rel_pos *= (max_y / rel_pos.y);
|
rel_pos *= (max_y / rel_pos.y);
|
||||||
}
|
}
|
||||||
if (rel_pos.y < 0.)
|
if (rel_pos.y < 0.)
|
||||||
{
|
{
|
||||||
rel_pos *= (-32000. / rel_pos.y);
|
rel_pos *= (-32000. / rel_pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can normalize then
|
// Can normalize then
|
||||||
vec3 rel_pos_norm = normalize(rel_pos);
|
vec3 rel_pos_norm = normalize(rel_pos);
|
||||||
float rel_pos_len = length(rel_pos);
|
float rel_pos_len = length(rel_pos);
|
||||||
|
|
||||||
// Initialize temp variables
|
// Initialize temp variables
|
||||||
vec4 sunlight = sunlight_color;
|
vec4 sunlight = sunlight_color;
|
||||||
vec4 light_atten;
|
vec4 light_atten;
|
||||||
|
|
||||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||||
// this is used later for sunlight modulation at various altitudes
|
// this is used later for sunlight modulation at various altitudes
|
||||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
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 combined_haze = abs(blue_density) + vec4(abs(haze_density));
|
||||||
vec4 blue_weight = blue_density / combined_haze;
|
vec4 blue_weight = blue_density / combined_haze;
|
||||||
vec4 haze_weight = haze_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);
|
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
|
||||||
sunlight *= exp(-light_atten * off_axis);
|
sunlight *= exp(-light_atten * off_axis);
|
||||||
|
|
||||||
// Distance
|
// Distance
|
||||||
float density_dist = rel_pos_len * density_multiplier;
|
float density_dist = rel_pos_len * density_multiplier;
|
||||||
|
|
||||||
// Transparency (-> combined_haze)
|
// Transparency (-> combined_haze)
|
||||||
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
|
// 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);
|
combined_haze = exp(-combined_haze * density_dist);
|
||||||
|
|
||||||
// Compute haze glow
|
// Compute haze glow
|
||||||
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
|
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 is 0 at the sun and increases away from sun
|
||||||
haze_glow = max(haze_glow, .001);
|
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;
|
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);
|
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;
|
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
|
// 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);
|
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
|
||||||
|
|
||||||
// Increase ambient when there are more clouds
|
// Increase ambient when there are more clouds
|
||||||
vec4 tmpAmbient = ambient_color;
|
vec4 tmpAmbient = ambient_color;
|
||||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||||
|
|
||||||
// Dim sunlight by cloud shadow percentage
|
// Dim sunlight by cloud shadow percentage
|
||||||
sunlight *= (1. - cloud_shadow);
|
sunlight *= (1. - cloud_shadow);
|
||||||
|
|
||||||
// Haze color below cloud
|
// Haze color below cloud
|
||||||
vec4 additiveColorBelowCloud =
|
vec4 additiveColorBelowCloud =
|
||||||
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
|
(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.);
|
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
|
||||||
sunlight *= exp(-light_atten * off_axis);
|
sunlight *= exp(-light_atten * off_axis);
|
||||||
|
|
||||||
// Cloud color out
|
// Cloud color out
|
||||||
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
|
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
|
||||||
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
||||||
|
|
||||||
// Attenuate cloud color by atmosphere
|
// Attenuate cloud color by atmosphere
|
||||||
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
||||||
vary_CloudColorSun *= combined_haze;
|
vary_CloudColorSun *= combined_haze;
|
||||||
vary_CloudColorAmbient *= combined_haze;
|
vary_CloudColorAmbient *= combined_haze;
|
||||||
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
|
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
|
||||||
|
|
||||||
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
||||||
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
||||||
|
|
||||||
// Combine these to minimize register use
|
// Combine these to minimize register use
|
||||||
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
||||||
|
|
||||||
// needs this to compile on mac
|
// needs this to compile on mac
|
||||||
// vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
//vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||||
|
|
||||||
// END CLOUDS
|
// END CLOUDS
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
@ -56,8 +56,23 @@ vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir
|
||||||
vec3 ColorFromRadiance(vec3 radiance);
|
vec3 ColorFromRadiance(vec3 radiance);
|
||||||
vec3 rainbow(float d)
|
vec3 rainbow(float d)
|
||||||
{
|
{
|
||||||
float rad = (droplet_radius - 5.0f) / 1024.0f;
|
// d is the dot product of view and sun directions, so ranging -1.0..1.0
|
||||||
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
|
// '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)
|
vec3 halo22(float d)
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@
|
||||||
#include "llsdutil_math.h"
|
#include "llsdutil_math.h"
|
||||||
#include "lllocationhistory.h"
|
#include "lllocationhistory.h"
|
||||||
#include "llfasttimerview.h"
|
#include "llfasttimerview.h"
|
||||||
|
#include "lltelemetry.h"
|
||||||
#include "llvector4a.h"
|
#include "llvector4a.h"
|
||||||
#include "llviewermenufile.h"
|
#include "llviewermenufile.h"
|
||||||
#include "llvoicechannel.h"
|
#include "llvoicechannel.h"
|
||||||
|
|
@ -256,9 +257,9 @@
|
||||||
// define a self-registering event API object
|
// define a self-registering event API object
|
||||||
#include "llappviewerlistener.h"
|
#include "llappviewerlistener.h"
|
||||||
|
|
||||||
#if (LL_LINUX || LL_SOLARIS) && LL_GTK
|
#if LL_LINUX && LL_GTK
|
||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
#endif // (LL_LINUX || LL_SOLARIS) && LL_GTK
|
#endif // (LL_LINUX) && LL_GTK
|
||||||
|
|
||||||
#if LL_MSVC
|
#if LL_MSVC
|
||||||
// disable boost::lexical_cast warning
|
// disable boost::lexical_cast warning
|
||||||
|
|
@ -1087,6 +1088,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 LL_WINDOWS
|
||||||
if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())
|
if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())
|
||||||
{
|
{
|
||||||
|
|
@ -1311,39 +1352,8 @@ void LLAppViewer::initMaxHeapSize()
|
||||||
|
|
||||||
//F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ;
|
//F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ;
|
||||||
F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ;
|
F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ;
|
||||||
BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ;
|
|
||||||
|
|
||||||
LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ;
|
LLMemory::initMaxHeapSizeGB(max_heap_size_gb);
|
||||||
}
|
|
||||||
|
|
||||||
void LLAppViewer::checkMemory()
|
|
||||||
{
|
|
||||||
const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second
|
|
||||||
//const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds
|
|
||||||
//static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ;
|
|
||||||
|
|
||||||
if(!gGLManager.mDebugGPU)
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32())
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
mMemCheckTimer.reset() ;
|
|
||||||
|
|
||||||
//update the availability of memory
|
|
||||||
LLMemory::updateMemoryInfo() ;
|
|
||||||
|
|
||||||
bool is_low = LLMemory::isMemoryPoolLow() ;
|
|
||||||
|
|
||||||
LLPipeline::throttleNewMemoryAllocation(is_low) ;
|
|
||||||
|
|
||||||
if(is_low)
|
|
||||||
{
|
|
||||||
LLMemory::logMemoryInfo() ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages");
|
static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages");
|
||||||
|
|
@ -1422,9 +1432,6 @@ bool LLAppViewer::doFrame()
|
||||||
//clear call stack records
|
//clear call stack records
|
||||||
LL_CLEAR_CALLSTACKS();
|
LL_CLEAR_CALLSTACKS();
|
||||||
|
|
||||||
//check memory availability information
|
|
||||||
checkMemory() ;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
pingMainloopTimeout("Main:MiscNativeWindowEvents");
|
pingMainloopTimeout("Main:MiscNativeWindowEvents");
|
||||||
|
|
||||||
|
|
@ -1659,6 +1666,8 @@ bool LLAppViewer::doFrame()
|
||||||
LL_INFOS() << "Exiting main_loop" << LL_ENDL;
|
LL_INFOS() << "Exiting main_loop" << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLPROFILE_UPDATE();
|
||||||
|
|
||||||
return ! LLApp::isRunning();
|
return ! LLApp::isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,6 @@ private:
|
||||||
bool initConfiguration(); // Initialize settings from the command line/config file.
|
bool initConfiguration(); // Initialize settings from the command line/config file.
|
||||||
void initStrings(); // Initialize LLTrans machinery
|
void initStrings(); // Initialize LLTrans machinery
|
||||||
bool initCache(); // Initialize local client cache.
|
bool initCache(); // Initialize local client cache.
|
||||||
void checkMemory() ;
|
|
||||||
|
|
||||||
// We have switched locations of both Mac and Windows cache, make sure
|
// We have switched locations of both Mac and Windows cache, make sure
|
||||||
// files migrate and old cache is cleared out.
|
// files migrate and old cache is cleared out.
|
||||||
|
|
@ -317,8 +316,6 @@ private:
|
||||||
|
|
||||||
LLAllocator mAlloc;
|
LLAllocator mAlloc;
|
||||||
|
|
||||||
LLFrameTimer mMemCheckTimer;
|
|
||||||
|
|
||||||
// llcorehttp library init/shutdown helper
|
// llcorehttp library init/shutdown helper
|
||||||
LLAppCoreHttp mAppCoreHttp;
|
LLAppCoreHttp mAppCoreHttp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,6 @@ static void exceptionTerminateHandler()
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
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;
|
gArgC = argc;
|
||||||
gArgV = argv;
|
gArgV = argv;
|
||||||
|
|
||||||
|
|
@ -336,8 +332,6 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
|
||||||
cmd += gDirUtilp->getDirDelimiter();
|
cmd += gDirUtilp->getDirDelimiter();
|
||||||
#if LL_LINUX
|
#if LL_LINUX
|
||||||
cmd += "linux-crash-logger.bin";
|
cmd += "linux-crash-logger.bin";
|
||||||
#elif LL_SOLARIS
|
|
||||||
cmd += "solaris-crash-logger";
|
|
||||||
#else
|
#else
|
||||||
# error Unknown platform
|
# error Unknown platform
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -394,9 +388,6 @@ bool LLAppViewerLinux::beingDebugged()
|
||||||
{
|
{
|
||||||
static enum {unknown, no, yes} debugged = unknown;
|
static enum {unknown, no, yes} debugged = unknown;
|
||||||
|
|
||||||
#if LL_SOLARIS
|
|
||||||
return debugged == no; // BUG: fix this for Solaris
|
|
||||||
#else
|
|
||||||
if (debugged == unknown)
|
if (debugged == unknown)
|
||||||
{
|
{
|
||||||
pid_t ppid = getppid();
|
pid_t ppid = getppid();
|
||||||
|
|
@ -431,7 +422,6 @@ bool LLAppViewerLinux::beingDebugged()
|
||||||
}
|
}
|
||||||
|
|
||||||
return debugged == yes;
|
return debugged == yes;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLAppViewerLinux::initLoggingAndGetLastDuration()
|
void LLAppViewerLinux::initLoggingAndGetLastDuration()
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
#include "llwin32headerslean.h"
|
#include "llwin32headerslean.h"
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS || LL_DARWIN
|
#if LL_LINUX || LL_DARWIN
|
||||||
# include "llfilepicker.h"
|
# include "llfilepicker.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -187,7 +187,7 @@ std::string LLDirPicker::getDirName()
|
||||||
return mFilePicker->getFirstFile();
|
return mFilePicker->getFirstFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif LL_LINUX || LL_SOLARIS
|
#elif LL_LINUX
|
||||||
|
|
||||||
LLDirPicker::LLDirPicker() :
|
LLDirPicker::LLDirPicker() :
|
||||||
mFileName(NULL),
|
mFileName(NULL),
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ private:
|
||||||
void buildDirname( void );
|
void buildDirname( void );
|
||||||
bool check_local_file_access_enabled();
|
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
|
// On Linux we just implement LLDirPicker on top of LLFilePicker
|
||||||
LLFilePicker *mFilePicker;
|
LLFilePicker *mFilePicker;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -912,22 +912,18 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
|
||||||
if (volume->getAvatar())
|
if (volume->getAvatar())
|
||||||
{
|
{
|
||||||
const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents();
|
const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents();
|
||||||
LLVector3d cam_pos = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin());
|
LLVector3 cam_pos_from_agent = LLViewerCamera::getInstance()->getOrigin();
|
||||||
LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal());
|
LLVector3 cam_to_box_offset = point_to_box_offset(cam_pos_from_agent, av_box);
|
||||||
|
|
||||||
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));
|
mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f));
|
||||||
LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname()
|
LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname()
|
||||||
<< " pos (ignored) " << pos
|
<< " pos (ignored) " << pos
|
||||||
<< " cam pos " << cam_pos
|
<< " cam pos " << cam_pos_from_agent
|
||||||
<< " cam region pos " << cam_region_pos
|
|
||||||
<< " box " << av_box[0] << "," << av_box[1]
|
<< " box " << av_box[0] << "," << av_box[1]
|
||||||
<< " -> dist " << mDistanceWRTCamera
|
<< " -> dist " << mDistanceWRTCamera
|
||||||
<< LL_ENDL;
|
<< LL_ENDL;
|
||||||
mVObjp->updateLOD();
|
mVObjp->updateLOD();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2129,7 +2129,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
|
||||||
|
|
||||||
if (mat)
|
if (mat)
|
||||||
{
|
{
|
||||||
switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaModeRender()))
|
switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaMode()))
|
||||||
{
|
{
|
||||||
case LLMaterial::DIFFUSE_ALPHA_MODE_MASK:
|
case LLMaterial::DIFFUSE_ALPHA_MODE_MASK:
|
||||||
{
|
{
|
||||||
|
|
@ -2267,7 +2267,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->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0], col.mV[1], col.mV[2], spec);
|
||||||
sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env);
|
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;
|
F32 cutoff = mat->getAlphaMaskCutoff()/255.f;
|
||||||
sVertexProgram->setMinimumAlpha(cutoff);
|
sVertexProgram->setMinimumAlpha(cutoff);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
LLGLSPipelineBlendSkyBox gls_skybox(true, false);
|
||||||
|
|
||||||
|
|
@ -266,6 +266,7 @@ void LLDrawPoolWLSky::renderStars(void) const
|
||||||
}
|
}
|
||||||
|
|
||||||
gGL.pushMatrix();
|
gGL.pushMatrix();
|
||||||
|
gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
|
||||||
gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
|
gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
|
||||||
if (LLGLSLShader::sNoFixedFunction)
|
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);
|
LLGLSPipelineBlendSkyBox gls_sky(true, false);
|
||||||
|
|
||||||
|
|
@ -337,6 +338,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const
|
||||||
gGL.getTexUnit(1)->bind(tex_b);
|
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);
|
gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
|
||||||
|
|
||||||
if (LLPipeline::sReflectionRender)
|
if (LLPipeline::sReflectionRender)
|
||||||
|
|
@ -355,6 +358,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const
|
||||||
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
|
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
|
|
||||||
gDeferredStarProgram.unbind();
|
gDeferredStarProgram.unbind();
|
||||||
|
|
||||||
|
gGL.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const
|
void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const
|
||||||
|
|
@ -601,7 +606,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
|
||||||
if (gPipeline.canUseWindLightShaders())
|
if (gPipeline.canUseWindLightShaders())
|
||||||
{
|
{
|
||||||
renderSkyHazeDeferred(origin, camHeightLocal);
|
renderSkyHazeDeferred(origin, camHeightLocal);
|
||||||
renderStarsDeferred();
|
renderStarsDeferred(origin);
|
||||||
renderHeavenlyBodies();
|
renderHeavenlyBodies();
|
||||||
renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader);
|
renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader);
|
||||||
}
|
}
|
||||||
|
|
@ -620,7 +625,7 @@ void LLDrawPoolWLSky::render(S32 pass)
|
||||||
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
|
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
|
||||||
|
|
||||||
renderSkyHaze(origin, camHeightLocal);
|
renderSkyHaze(origin, camHeightLocal);
|
||||||
renderStars();
|
renderStars(origin);
|
||||||
renderHeavenlyBodies();
|
renderHeavenlyBodies();
|
||||||
renderSkyClouds(origin, camHeightLocal, cloud_shader);
|
renderSkyClouds(origin, camHeightLocal, cloud_shader);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,8 @@ private:
|
||||||
void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const;
|
void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const;
|
||||||
void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const;
|
void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const;
|
||||||
|
|
||||||
void renderStarsDeferred(void) const;
|
void renderStarsDeferred(const LLVector3& camPosLocal) const;
|
||||||
void renderStars(void) const;
|
void renderStars(const LLVector3& camPosLocal) const;
|
||||||
void renderHeavenlyBodies();
|
void renderHeavenlyBodies();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,6 @@ LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 compon
|
||||||
{
|
{
|
||||||
llassert((1 <= components) && (components <= 4));
|
llassert((1 <= components) && (components <= 4));
|
||||||
|
|
||||||
if(gGLManager.mDebugGPU)
|
|
||||||
{
|
|
||||||
if(components == 3)
|
|
||||||
{
|
|
||||||
mComponents = 4 ; //convert to 32bits.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
generateGLTexture();
|
generateGLTexture();
|
||||||
|
|
||||||
llassert( 0 <= order && order < ORDER_COUNT );
|
llassert( 0 <= order && order < ORDER_COUNT );
|
||||||
|
|
@ -211,7 +204,7 @@ void LLViewerDynamicTexture::postRender(BOOL success)
|
||||||
BOOL LLViewerDynamicTexture::updateAllInstances()
|
BOOL LLViewerDynamicTexture::updateAllInstances()
|
||||||
{
|
{
|
||||||
sNumRenders = 0;
|
sNumRenders = 0;
|
||||||
if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled)
|
if (gGLManager.mIsDisabled)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1165,7 +1165,7 @@ bool LLFace::canRenderAsMask()
|
||||||
}
|
}
|
||||||
|
|
||||||
LLMaterial* mat = te->getMaterialParams();
|
LLMaterial* mat = te->getMaterialParams();
|
||||||
if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
|
if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1412,7 +1412,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!mat || mat->getDiffuseAlphaModeRender() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
|
if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
|
||||||
{
|
{
|
||||||
shiny_in_alpha = true;
|
shiny_in_alpha = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -755,12 +755,7 @@ void LLFeatureManager::applyBaseMasks()
|
||||||
maskFeatures("RAM256MB");
|
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)
|
if (gSysCPU.getMHz() < 1100)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
maskFeatures("CPUSlow");
|
maskFeatures("CPUSlow");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#include "llwindowsdl.h" // for some X/GTK utils to help with filepickers
|
#include "llwindowsdl.h" // for some X/GTK utils to help with filepickers
|
||||||
#endif // LL_SDL
|
#endif // LL_SDL
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX
|
||||||
#include "llhttpconstants.h" // file picker uses some of thes constants on Linux
|
#include "llhttpconstants.h" // file picker uses some of thes constants on Linux
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -939,7 +939,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,
|
||||||
}
|
}
|
||||||
//END LL_DARWIN
|
//END LL_DARWIN
|
||||||
|
|
||||||
#elif LL_LINUX || LL_SOLARIS
|
#elif LL_LINUX
|
||||||
|
|
||||||
# if LL_GTK
|
# if LL_GTK
|
||||||
|
|
||||||
|
|
@ -1504,4 +1504,4 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // LL_LINUX || LL_SOLARIS
|
#endif // LL_LINUX
|
||||||
|
|
|
||||||
|
|
@ -911,7 +911,7 @@ BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
|
||||||
{
|
{
|
||||||
LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks);
|
LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*virtual*/
|
/*virtual*/
|
||||||
|
|
@ -1292,47 +1292,47 @@ void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handl
|
||||||
void LLFloaterModelPreview::addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod)
|
void LLFloaterModelPreview::addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod)
|
||||||
{
|
{
|
||||||
if (sInstance && sInstance->hasString(message))
|
if (sInstance && sInstance->hasString(message))
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
switch (lod)
|
switch (lod)
|
||||||
{
|
{
|
||||||
case LLModel::LOD_IMPOSTOR: str = "LOD0 "; break;
|
case LLModel::LOD_IMPOSTOR: str = "LOD0 "; break;
|
||||||
case LLModel::LOD_LOW: str = "LOD1 "; break;
|
case LLModel::LOD_LOW: str = "LOD1 "; break;
|
||||||
case LLModel::LOD_MEDIUM: str = "LOD2 "; break;
|
case LLModel::LOD_MEDIUM: str = "LOD2 "; break;
|
||||||
case LLModel::LOD_PHYSICS: str = "PHYS "; break;
|
case LLModel::LOD_PHYSICS: str = "PHYS "; break;
|
||||||
case LLModel::LOD_HIGH: str = "LOD3 "; break;
|
case LLModel::LOD_HIGH: str = "LOD3 "; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLStringUtil::format_map_t args_msg;
|
LLStringUtil::format_map_t args_msg;
|
||||||
LLSD::map_const_iterator iter = args.beginMap();
|
LLSD::map_const_iterator iter = args.beginMap();
|
||||||
LLSD::map_const_iterator end = args.endMap();
|
LLSD::map_const_iterator end = args.endMap();
|
||||||
for (; iter != end; ++iter)
|
for (; iter != end; ++iter)
|
||||||
{
|
{
|
||||||
args_msg[iter->first] = iter->second.asString();
|
args_msg[iter->first] = iter->second.asString();
|
||||||
}
|
}
|
||||||
str += sInstance->getString(message, args_msg);
|
str += sInstance->getString(message, args_msg);
|
||||||
sInstance->addStringToLogTab(str, flash);
|
sInstance->addStringToLogTab(str, flash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLFloaterModelPreview::addStringToLog(const std::string& str, bool flash)
|
void LLFloaterModelPreview::addStringToLog(const std::string& str, bool flash)
|
||||||
{
|
{
|
||||||
if (sInstance)
|
if (sInstance)
|
||||||
{
|
{
|
||||||
sInstance->addStringToLogTab(str, flash);
|
sInstance->addStringToLogTab(str, flash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool flash)
|
void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool flash)
|
||||||
{
|
{
|
||||||
if (sInstance)
|
if (sInstance)
|
||||||
{
|
{
|
||||||
sInstance->addStringToLogTab(strm.str(), flash);
|
sInstance->addStringToLogTab(strm.str(), flash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterModelPreview::clearAvatarTab()
|
void LLFloaterModelPreview::clearAvatarTab()
|
||||||
{
|
{
|
||||||
|
|
@ -1343,9 +1343,9 @@ void LLFloaterModelPreview::clearAvatarTab()
|
||||||
joints_pos->deleteAllItems(); mSelectedJointName.clear();
|
joints_pos->deleteAllItems(); mSelectedJointName.clear();
|
||||||
|
|
||||||
for (U32 i = 0; i < LLModel::NUM_LODS; ++i)
|
for (U32 i = 0; i < LLModel::NUM_LODS; ++i)
|
||||||
{
|
{
|
||||||
mJointOverrides[i].clear();
|
mJointOverrides[i].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLTextBox *joint_total_descr = panel->getChild<LLTextBox>("conflicts_description");
|
LLTextBox *joint_total_descr = panel->getChild<LLTextBox>("conflicts_description");
|
||||||
joint_total_descr->setTextArg("[CONFLICTS]", llformat("%d", 0));
|
joint_total_descr->setTextArg("[CONFLICTS]", llformat("%d", 0));
|
||||||
|
|
@ -1354,34 +1354,34 @@ void LLFloaterModelPreview::clearAvatarTab()
|
||||||
|
|
||||||
LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("pos_overrides_descr");
|
LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("pos_overrides_descr");
|
||||||
joint_pos_descr->setTextArg("[JOINT]", std::string("mPelvis")); // Might be better to hide it
|
joint_pos_descr->setTextArg("[JOINT]", std::string("mPelvis")); // Might be better to hide it
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
|
void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
|
||||||
{
|
{
|
||||||
S32 display_lod = mModelPreview->mPreviewLOD;
|
S32 display_lod = mModelPreview->mPreviewLOD;
|
||||||
if (mModelPreview->mModel[display_lod].empty())
|
if (mModelPreview->mModel[display_lod].empty())
|
||||||
{
|
{
|
||||||
mSelectedJointName.clear();
|
mSelectedJointName.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Joints will be listed as long as they are listed in mAlternateBindMatrix
|
// Joints will be listed as long as they are listed in mAlternateBindMatrix
|
||||||
// even if they are for some reason identical to defaults.
|
// 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.
|
// 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())
|
if (mJointOverrides[display_lod].empty())
|
||||||
{
|
{
|
||||||
// populate map
|
// populate map
|
||||||
for (LLModelLoader::scene::iterator iter = mModelPreview->mScene[display_lod].begin(); iter != mModelPreview->mScene[display_lod].end(); ++iter)
|
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)
|
for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter)
|
||||||
{
|
{
|
||||||
LLModelInstance& instance = *model_iter;
|
LLModelInstance& instance = *model_iter;
|
||||||
LLModel* model = instance.mModel;
|
LLModel* model = instance.mModel;
|
||||||
const LLMeshSkinInfo *skin = &model->mSkinInfo;
|
const LLMeshSkinInfo *skin = &model->mSkinInfo;
|
||||||
U32 joint_count = LLSkinningUtil::getMeshJointCount(skin);
|
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
|
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)
|
if (bind_count > 0 && bind_count != joint_count)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Invalid joint overrides for model " << model->getName();
|
out << "Invalid joint overrides for model " << model->getName();
|
||||||
out << ". Amount of joints " << joint_count;
|
out << ". Amount of joints " << joint_count;
|
||||||
|
|
@ -1390,68 +1390,68 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
|
||||||
addStringToLog(out.str(), true);
|
addStringToLog(out.str(), true);
|
||||||
// Disable overrides for this model
|
// Disable overrides for this model
|
||||||
bind_count = 0;
|
bind_count = 0;
|
||||||
}
|
}
|
||||||
if (bind_count > 0)
|
if (bind_count > 0)
|
||||||
{
|
{
|
||||||
for (U32 j = 0; j < joint_count; ++j)
|
for (U32 j = 0; j < joint_count; ++j)
|
||||||
{
|
{
|
||||||
const LLVector3& joint_pos = skin->mAlternateBindMatrix[j].getTranslation();
|
const LLVector3& joint_pos = skin->mAlternateBindMatrix[j].getTranslation();
|
||||||
LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
|
LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
|
||||||
|
|
||||||
LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j], mModelPreview);
|
LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j], mModelPreview);
|
||||||
if (pJoint)
|
if (pJoint)
|
||||||
{
|
{
|
||||||
// see how voavatar uses aboveJointPosThreshold
|
// see how voavatar uses aboveJointPosThreshold
|
||||||
if (pJoint->aboveJointPosThreshold(joint_pos))
|
if (pJoint->aboveJointPosThreshold(joint_pos))
|
||||||
{
|
{
|
||||||
// valid override
|
// valid override
|
||||||
if (data.mPosOverrides.size() > 0
|
if (data.mPosOverrides.size() > 0
|
||||||
&& (data.mPosOverrides.begin()->second - joint_pos).lengthSquared() > (LL_JOINT_TRESHOLD_POS_OFFSET * LL_JOINT_TRESHOLD_POS_OFFSET))
|
&& (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
|
// File contains multiple meshes with conflicting joint offsets
|
||||||
// preview may be incorrect, upload result might wary (depends onto
|
// preview may be incorrect, upload result might wary (depends onto
|
||||||
// mesh_id that hasn't been generated yet).
|
// mesh_id that hasn't been generated yet).
|
||||||
data.mHasConflicts = true;
|
data.mHasConflicts = true;
|
||||||
}
|
}
|
||||||
data.mPosOverrides[model->getName()] = joint_pos;
|
data.mPosOverrides[model->getName()] = joint_pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// default value, it won't be accounted for by avatar
|
// default value, it won't be accounted for by avatar
|
||||||
data.mModelsNoOverrides.insert(model->getName());
|
data.mModelsNoOverrides.insert(model->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (U32 j = 0; j < joint_count; ++j)
|
for (U32 j = 0; j < joint_count; ++j)
|
||||||
{
|
{
|
||||||
LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
|
LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
|
||||||
data.mModelsNoOverrides.insert(model->getName());
|
data.mModelsNoOverrides.insert(model->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLPanel *panel = mTabContainer->getPanelByName("rigging_panel");
|
LLPanel *panel = mTabContainer->getPanelByName("rigging_panel");
|
||||||
LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
|
LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
|
||||||
|
|
||||||
if (joints_list->isEmpty())
|
if (joints_list->isEmpty())
|
||||||
{
|
{
|
||||||
// Populate table
|
// Populate table
|
||||||
|
|
||||||
std::map<std::string, std::string> joint_alias_map;
|
std::map<std::string, std::string> joint_alias_map;
|
||||||
mModelPreview->getJointAliases(joint_alias_map);
|
mModelPreview->getJointAliases(joint_alias_map);
|
||||||
|
|
||||||
S32 conflicts = 0;
|
S32 conflicts = 0;
|
||||||
joint_override_data_map_t::iterator joint_iter = mJointOverrides[display_lod].begin();
|
joint_override_data_map_t::iterator joint_iter = mJointOverrides[display_lod].begin();
|
||||||
joint_override_data_map_t::iterator joint_end = mJointOverrides[display_lod].end();
|
joint_override_data_map_t::iterator joint_end = mJointOverrides[display_lod].end();
|
||||||
while (joint_iter != joint_end)
|
while (joint_iter != joint_end)
|
||||||
{
|
{
|
||||||
const std::string& listName = joint_iter->first;
|
const std::string& listName = joint_iter->first;
|
||||||
|
|
||||||
LLScrollListItem::Params item_params;
|
LLScrollListItem::Params item_params;
|
||||||
item_params.value(listName);
|
item_params.value(listName);
|
||||||
|
|
||||||
|
|
@ -1459,38 +1459,38 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
|
||||||
cell_params.font = LLFontGL::getFontSansSerif();
|
cell_params.font = LLFontGL::getFontSansSerif();
|
||||||
cell_params.value = listName;
|
cell_params.value = listName;
|
||||||
if (joint_alias_map.find(listName) == joint_alias_map.end())
|
if (joint_alias_map.find(listName) == joint_alias_map.end())
|
||||||
{
|
{
|
||||||
// Missing names
|
// Missing names
|
||||||
cell_params.color = LLColor4::red;
|
cell_params.color = LLColor4::red;
|
||||||
}
|
}
|
||||||
if (joint_iter->second.mHasConflicts)
|
if (joint_iter->second.mHasConflicts)
|
||||||
{
|
{
|
||||||
// Conflicts
|
// Conflicts
|
||||||
cell_params.color = LLColor4::orange;
|
cell_params.color = LLColor4::orange;
|
||||||
conflicts++;
|
conflicts++;
|
||||||
}
|
}
|
||||||
if (highlight_overrides && joint_iter->second.mPosOverrides.size() > 0)
|
if (highlight_overrides && joint_iter->second.mPosOverrides.size() > 0)
|
||||||
{
|
{
|
||||||
cell_params.font.style = "BOLD";
|
cell_params.font.style = "BOLD";
|
||||||
}
|
}
|
||||||
|
|
||||||
item_params.columns.add(cell_params);
|
item_params.columns.add(cell_params);
|
||||||
|
|
||||||
joints_list->addRow(item_params, ADD_BOTTOM);
|
joints_list->addRow(item_params, ADD_BOTTOM);
|
||||||
joint_iter++;
|
joint_iter++;
|
||||||
}
|
}
|
||||||
joints_list->selectFirstItem();
|
joints_list->selectFirstItem();
|
||||||
LLScrollListItem *selected = joints_list->getFirstSelected();
|
LLScrollListItem *selected = joints_list->getFirstSelected();
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
mSelectedJointName = selected->getValue().asString();
|
mSelectedJointName = selected->getValue().asString();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLTextBox *joint_conf_descr = panel->getChild<LLTextBox>("conflicts_description");
|
LLTextBox *joint_conf_descr = panel->getChild<LLTextBox>("conflicts_description");
|
||||||
joint_conf_descr->setTextArg("[CONFLICTS]", llformat("%d", conflicts));
|
joint_conf_descr->setTextArg("[CONFLICTS]", llformat("%d", conflicts));
|
||||||
joint_conf_descr->setTextArg("[JOINTS_COUNT]", llformat("%d", mJointOverrides[display_lod].size()));
|
joint_conf_descr->setTextArg("[JOINTS_COUNT]", llformat("%d", mJointOverrides[display_lod].size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// addStringToLogTab()
|
// addStringToLogTab()
|
||||||
|
|
@ -1498,52 +1498,52 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
|
||||||
void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash)
|
void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash)
|
||||||
{
|
{
|
||||||
if (str.empty())
|
if (str.empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWString text = utf8str_to_wstring(str);
|
LLWString text = utf8str_to_wstring(str);
|
||||||
S32 add_text_len = text.length() + 1; // newline
|
S32 add_text_len = text.length() + 1; // newline
|
||||||
S32 editor_max_len = mUploadLogText->getMaxTextLength();
|
S32 editor_max_len = mUploadLogText->getMaxTextLength();
|
||||||
if (add_text_len > editor_max_len)
|
if (add_text_len > editor_max_len)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we have space for new string
|
// Make sure we have space for new string
|
||||||
S32 editor_text_len = mUploadLogText->getLength();
|
S32 editor_text_len = mUploadLogText->getLength();
|
||||||
if (editor_max_len < (editor_text_len + add_text_len)
|
if (editor_max_len < (editor_text_len + add_text_len)
|
||||||
&& mUploadLogText->getLineCount() <= 0)
|
&& mUploadLogText->getLineCount() <= 0)
|
||||||
{
|
{
|
||||||
mUploadLogText->getTextBoundingRect();// forces a reflow() to fix line count
|
mUploadLogText->getTextBoundingRect();// forces a reflow() to fix line count
|
||||||
}
|
}
|
||||||
while (editor_max_len < (editor_text_len + add_text_len))
|
while (editor_max_len < (editor_text_len + add_text_len))
|
||||||
{
|
{
|
||||||
S32 shift = mUploadLogText->removeFirstLine();
|
S32 shift = mUploadLogText->removeFirstLine();
|
||||||
if (shift > 0)
|
if (shift > 0)
|
||||||
{
|
{
|
||||||
// removed a line
|
// removed a line
|
||||||
editor_text_len -= shift;
|
editor_text_len -= shift;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//nothing to remove?
|
//nothing to remove?
|
||||||
LL_WARNS() << "Failed to clear log lines" << LL_ENDL;
|
LL_WARNS() << "Failed to clear log lines" << LL_ENDL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mUploadLogText->appendText(str, true);
|
mUploadLogText->appendText(str, true);
|
||||||
|
|
||||||
if (flash)
|
if (flash)
|
||||||
{
|
{
|
||||||
LLPanel* panel = mTabContainer->getPanelByName("logs_panel");
|
LLPanel* panel = mTabContainer->getPanelByName("logs_panel");
|
||||||
if (mTabContainer->getCurrentPanel() != panel)
|
if (mTabContainer->getCurrentPanel() != panel)
|
||||||
{
|
{
|
||||||
mTabContainer->setTabPanelFlashing(panel, true);
|
mTabContainer->setTabPanelFlashing(panel, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost)
|
void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost)
|
||||||
{
|
{
|
||||||
|
|
@ -1551,15 +1551,15 @@ void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost,
|
||||||
childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x));
|
childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x));
|
||||||
childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y));
|
childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y));
|
||||||
childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z));
|
childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterModelPreview::setPreviewLOD(S32 lod)
|
void LLFloaterModelPreview::setPreviewLOD(S32 lod)
|
||||||
{
|
{
|
||||||
if (mModelPreview)
|
if (mModelPreview)
|
||||||
{
|
{
|
||||||
mModelPreview->setPreviewLOD(lod);
|
mModelPreview->setPreviewLOD(lod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterModelPreview::onBrowseLOD(S32 lod)
|
void LLFloaterModelPreview::onBrowseLOD(S32 lod)
|
||||||
{
|
{
|
||||||
|
|
@ -1648,13 +1648,13 @@ void LLFloaterModelPreview::setCtrlLoadFromFile(S32 lod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLComboBox* lod_combo = findChild<LLComboBox>("lod_source_" + lod_name[lod]);
|
LLComboBox* lod_combo = findChild<LLComboBox>("lod_source_" + lod_name[lod]);
|
||||||
if (lod_combo)
|
if (lod_combo)
|
||||||
{
|
{
|
||||||
lod_combo->setCurrentByIndex(0);
|
lod_combo->setCurrentByIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterModelPreview::setStatusMessage(const std::string& msg)
|
void LLFloaterModelPreview::setStatusMessage(const std::string& msg)
|
||||||
|
|
|
||||||
|
|
@ -746,9 +746,6 @@ LLSD LLFloaterReporter::gatherReport()
|
||||||
const char* platform = "Mac";
|
const char* platform = "Mac";
|
||||||
#elif LL_LINUX
|
#elif LL_LINUX
|
||||||
const char* platform = "Lnx";
|
const char* platform = "Lnx";
|
||||||
#elif LL_SOLARIS
|
|
||||||
const char* platform = "Sol";
|
|
||||||
const char* short_platform = "O:S";
|
|
||||||
#else
|
#else
|
||||||
const char* platform = "???";
|
const char* platform = "???";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2253,52 +2253,91 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderNormals(LLDrawable* drawablep)
|
void renderNormals(LLDrawable *drawablep)
|
||||||
{
|
{
|
||||||
LLVertexBuffer::unbind();
|
if (!drawablep->isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
LLVOVolume* vol = drawablep->getVOVolume();
|
LLVertexBuffer::unbind();
|
||||||
if (vol)
|
|
||||||
{
|
|
||||||
LLVolume* volume = vol->getVolume();
|
|
||||||
gGL.pushMatrix();
|
|
||||||
gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix);
|
|
||||||
|
|
||||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
|
||||||
|
|
||||||
LLVector4a scale(gSavedSettings.getF32("RenderDebugNormalScale"));
|
LLVOVolume *vol = drawablep->getVOVolume();
|
||||||
|
|
||||||
for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
|
if (vol)
|
||||||
{
|
{
|
||||||
const LLVolumeFace& face = volume->getVolumeFace(i);
|
LLVolume *volume = vol->getVolume();
|
||||||
|
|
||||||
for (S32 j = 0; j < face.mNumVertices; ++j)
|
// Drawable's normals & tangents are stored in model space, i.e. before any scaling is applied.
|
||||||
{
|
//
|
||||||
gGL.begin(LLRender::LINES);
|
// SL-13490, using pos + normal to compute the 2nd vertex of a normal line segment doesn't
|
||||||
LLVector4a n,p;
|
// 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
|
||||||
n.setMul(face.mNormals[j], scale);
|
// one forward scale will be re-applied via the MVP in the vertex shader)
|
||||||
p.setAdd(face.mPositions[j], n);
|
|
||||||
|
|
||||||
gGL.diffuseColor4f(1,1,1,1);
|
|
||||||
gGL.vertex3fv(face.mPositions[j].getF32ptr());
|
|
||||||
gGL.vertex3fv(p.getF32ptr());
|
|
||||||
|
|
||||||
if (face.mTangents)
|
|
||||||
{
|
|
||||||
n.setMul(face.mTangents[j], scale);
|
|
||||||
p.setAdd(face.mPositions[j], n);
|
|
||||||
|
|
||||||
gGL.diffuseColor4f(0,1,1,1);
|
|
||||||
gGL.vertex3fv(face.mPositions[j].getF32ptr());
|
|
||||||
gGL.vertex3fv(p.getF32ptr());
|
|
||||||
}
|
|
||||||
gGL.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& scale)
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,7 @@
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
#include "llappviewer.h"
|
#include "llappviewer.h"
|
||||||
#include "llfasttimerview.h"
|
#include "llfasttimerview.h"
|
||||||
|
#include "lltelemetry.h"
|
||||||
#include "llfloatermap.h"
|
#include "llfloatermap.h"
|
||||||
#include "llweb.h"
|
#include "llweb.h"
|
||||||
#include "llvoiceclient.h"
|
#include "llvoiceclient.h"
|
||||||
|
|
@ -527,6 +528,8 @@ bool idle_startup()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
|
LLPROFILE_STARTUP();
|
||||||
|
|
||||||
// On the windows dev builds, unpackaged, the message.xml file will
|
// On the windows dev builds, unpackaged, the message.xml file will
|
||||||
// be located in indra/build-vc**/newview/<config>/app_settings.
|
// be located in indra/build-vc**/newview/<config>/app_settings.
|
||||||
std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml");
|
std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml");
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
* @file lltelemetry.h
|
||||||
|
* @brief Wrapper for Rad Game Tools Telemetry
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2020, Linden Research, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation;
|
||||||
|
* version 2.1 of the License only.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
To use:
|
||||||
|
|
||||||
|
1. Uncomment #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER below
|
||||||
|
|
||||||
|
2. Include this header file
|
||||||
|
#include "lltelemetry.h"
|
||||||
|
|
||||||
|
3. Add zones to the functions you wish to profile
|
||||||
|
void onFoo()
|
||||||
|
{
|
||||||
|
LLPROFILE_ZONE("Foo");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//#define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 1
|
||||||
|
|
||||||
|
// Default NO local telemetry profiling
|
||||||
|
#ifndef LLPROFILE_USE_RAD_TELEMETRY_PROFILER
|
||||||
|
#define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 0
|
||||||
|
#define LLPROFILE_SHUTDOWN( ...) {}
|
||||||
|
#define LLPROFILE_STARTUP( ...) {}
|
||||||
|
#define LLPROFILE_UPDATE( ...) {}
|
||||||
|
|
||||||
|
#define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b)
|
||||||
|
#define LLPROFILE_ENTER(name)
|
||||||
|
#define LLPROFILE_ENTER_FORMAT(format, ...)
|
||||||
|
#define LLPROFILE_FUNCTION
|
||||||
|
#define LLPROFILE_LEAVE()
|
||||||
|
#define LLPROFILE_THREAD_NAME(name)
|
||||||
|
#define LLPROFILE_ZONE(name)
|
||||||
|
#define LLPROFILE_ZONE_FORMAT(format, ...)
|
||||||
|
#else
|
||||||
|
#include <rad_tm.h>
|
||||||
|
|
||||||
|
#define LLPROFILE_SHUTDOWN telemetry_shutdown
|
||||||
|
#define LLPROFILE_STARTUP telemetry_startup
|
||||||
|
#define LLPROFILE_UPDATE telemetry_update
|
||||||
|
|
||||||
|
#define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) tmZoneColor(r, g, b)
|
||||||
|
#define LLPROFILE_ENTER(name) tmEnter(0, 0, name)
|
||||||
|
#define LLPROFILE_ENTER_FORMAT(format, ...) tmEnter(0, 0, format, __VA_ARGS__)
|
||||||
|
#define LLPROFILE_FUNCTION tmFunction(0, 0)
|
||||||
|
#define LLPROFILE_LEAVE() tmLeave(0)
|
||||||
|
#define LLPROFILE_THREAD_NAME(name) tmThreadName(0, 0, name)
|
||||||
|
#define LLPROFILE_ZONE(name) tmZone(0, 0, name)
|
||||||
|
#define LLPROFILE_ZONE_FORMAT(format, ...) tmZone(0, 0, format, __VA_ARGS__)
|
||||||
|
#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER
|
||||||
|
|
||||||
|
//
|
||||||
|
// exported functionality
|
||||||
|
//
|
||||||
|
|
||||||
|
extern void telemetry_startup();
|
||||||
|
extern void telemetry_shutdown();
|
||||||
|
extern void telemetry_update(); // called after every frame update
|
||||||
|
|
@ -753,10 +753,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
||||||
glViewport(0,0,512,512);
|
glViewport(0,0,512,512);
|
||||||
LLVOAvatar::updateFreezeCounter() ;
|
LLVOAvatar::updateFreezeCounter() ;
|
||||||
|
|
||||||
if(!LLPipeline::sMemAllocationThrottled)
|
LLVOAvatar::updateImpostors();
|
||||||
{
|
|
||||||
LLVOAvatar::updateImpostors();
|
|
||||||
}
|
|
||||||
|
|
||||||
set_current_projection(proj);
|
set_current_projection(proj);
|
||||||
set_current_modelview(mod);
|
set_current_modelview(mod);
|
||||||
|
|
|
||||||
|
|
@ -143,8 +143,10 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
for (LLJoint* j : mChildren)
|
for (LLJoint* j : mChildren)
|
||||||
{
|
{
|
||||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(j);
|
// LLViewerJoint is derived from LLAvatarJoint,
|
||||||
F32 jointLOD = joint ? joint->getLOD() : 0;
|
// all children of LLAvatarJoint are assumed to be LLAvatarJoint
|
||||||
|
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(j);
|
||||||
|
F32 jointLOD = joint->getLOD();
|
||||||
if (pixelArea >= jointLOD || sDisableLOD)
|
if (pixelArea >= jointLOD || sDisableLOD)
|
||||||
{
|
{
|
||||||
triangle_count += joint->render( pixelArea, TRUE, is_dummy );
|
triangle_count += joint->render( pixelArea, TRUE, is_dummy );
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
#include "m4math.h"
|
#include "m4math.h"
|
||||||
#include "llmatrix4a.h"
|
#include "llmatrix4a.h"
|
||||||
|
|
||||||
#if !LL_DARWIN && !LL_LINUX && !LL_SOLARIS
|
#if !LL_DARWIN && !LL_LINUX
|
||||||
extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB;
|
extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB;
|
||||||
extern PFNGLWEIGHTFVARBPROC glWeightfvARB;
|
extern PFNGLWEIGHTFVARBPROC glWeightfvARB;
|
||||||
extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB;
|
extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB;
|
||||||
|
|
|
||||||
|
|
@ -4880,78 +4880,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)
|
void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep)
|
||||||
{
|
{
|
||||||
if (mTEImages[te] != 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4963,7 +4907,15 @@ S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image)
|
||||||
if (uuid != getTE(te)->getID() ||
|
if (uuid != getTE(te)->getID() ||
|
||||||
uuid == LLUUID::null)
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
@ -5258,29 +5210,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri
|
||||||
return 0;
|
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);
|
retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams);
|
||||||
LL_DEBUGS("Material") << "Changing material params for te " << (S32)te
|
LL_DEBUGS("Material") << "Changing material params for te " << (S32)te
|
||||||
<< ", object " << mID
|
<< ", object " << mID
|
||||||
|
|
@ -5293,84 +5222,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLViewerObject::notifyAboutCreatingTexture(LLViewerTexture *texture)
|
|
||||||
{
|
|
||||||
// Confirmation about texture creation, check wait-list
|
|
||||||
// and make changes, or return false
|
|
||||||
|
|
||||||
std::pair<uuid_material_mmap_t::iterator, uuid_material_mmap_t::iterator> 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<uuid_material_mmap_t::iterator, uuid_material_mmap_t::iterator> 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()
|
void LLViewerObject::refreshMaterials()
|
||||||
{
|
{
|
||||||
setChanged(TEXTURE);
|
setChanged(TEXTURE);
|
||||||
|
|
|
||||||
|
|
@ -768,12 +768,7 @@ protected:
|
||||||
void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy);
|
void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy);
|
||||||
void deleteParticleSource();
|
void deleteParticleSource();
|
||||||
void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id);
|
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:
|
private:
|
||||||
void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string
|
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
|
void deleteTEImages(); // correctly deletes list of images
|
||||||
|
|
@ -906,27 +901,10 @@ public:
|
||||||
|
|
||||||
LLJointRiggingInfoTab mJointRiggingInfoTab;
|
LLJointRiggingInfoTab mJointRiggingInfoTab;
|
||||||
|
|
||||||
bool notifyAboutCreatingTexture(LLViewerTexture *texture);
|
|
||||||
bool notifyAboutMissingAsset(LLViewerTexture *texture);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory.
|
LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory.
|
||||||
EObjectUpdateType mLastUpdateType;
|
EObjectUpdateType mLastUpdateType;
|
||||||
BOOL mLastUpdateCached;
|
BOOL mLastUpdateCached;
|
||||||
|
|
||||||
struct material_info
|
|
||||||
{
|
|
||||||
LLRender::eTexIndex map;
|
|
||||||
U8 te;
|
|
||||||
|
|
||||||
material_info(LLRender::eTexIndex map_, U8 te_)
|
|
||||||
: map(map_)
|
|
||||||
, te(te_)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::multimap<LLUUID, material_info> uuid_material_mmap_t;
|
|
||||||
uuid_material_mmap_t mWaitingTextureInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
|
|
|
||||||
|
|
@ -3314,13 +3314,6 @@ void LLViewerLODTexture::processTextureStats()
|
||||||
{
|
{
|
||||||
mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel);
|
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()
|
bool LLViewerLODTexture::scaleDown()
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,99 @@ RecordToChatConsole::RecordToChatConsole():
|
||||||
mRecorder->showMultiline(true);
|
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
|
// LLDebugText
|
||||||
|
|
@ -334,7 +427,11 @@ private:
|
||||||
typedef std::vector<Line> line_list_t;
|
typedef std::vector<Line> line_list_t;
|
||||||
line_list_t mLineList;
|
line_list_t mLineList;
|
||||||
LLColor4 mTextColor;
|
LLColor4 mTextColor;
|
||||||
|
|
||||||
|
LLColor4 mBackColor;
|
||||||
|
LLRect mBackRectCamera1;
|
||||||
|
LLRect mBackRectCamera2;
|
||||||
|
|
||||||
void addText(S32 x, S32 y, const std::string &text)
|
void addText(S32 x, S32 y, const std::string &text)
|
||||||
{
|
{
|
||||||
mLineList.push_back(Line(text, x, y));
|
mLineList.push_back(Line(text, x, y));
|
||||||
|
|
@ -376,11 +473,22 @@ public:
|
||||||
mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );
|
mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );
|
||||||
|
|
||||||
// Draw stuff growing up from right lower corner of screen
|
// 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);
|
xpos = llmax(xpos, 0);
|
||||||
S32 ypos = 64;
|
S32 ypos = 64;
|
||||||
const S32 y_inc = 20;
|
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();
|
clearText();
|
||||||
|
|
||||||
if (gSavedSettings.getBOOL("DebugShowTime"))
|
if (gSavedSettings.getBOOL("DebugShowTime"))
|
||||||
|
|
@ -716,48 +824,45 @@ public:
|
||||||
}
|
}
|
||||||
if (gSavedSettings.getBOOL("DebugShowRenderMatrices"))
|
if (gSavedSettings.getBOOL("DebugShowRenderMatrices"))
|
||||||
{
|
{
|
||||||
addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15]));
|
char camera_lines[8][32];
|
||||||
ypos += y_inc;
|
memset(camera_lines, ' ', sizeof(camera_lines));
|
||||||
|
|
||||||
addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11]));
|
// Projection last column is always <0,0,-1.0001,0>
|
||||||
ypos += y_inc;
|
// Projection last row is always <0,0,-0.2>
|
||||||
|
mBackRectCamera1.mBottom = ypos - y_inc + 2;
|
||||||
addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7]));
|
MATRIX_ROW_N32_TO_STR(gGLProjection, 12,camera_lines[7]); addText(xpos, ypos, std::string(camera_lines[7])); ypos += y_inc;
|
||||||
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;
|
||||||
addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3]));
|
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;
|
||||||
ypos += y_inc;
|
|
||||||
|
|
||||||
addText(xpos, ypos, "Projection Matrix");
|
addText(xpos, ypos, "Projection Matrix");
|
||||||
ypos += y_inc;
|
ypos += y_inc;
|
||||||
|
|
||||||
|
// View last column is always <0,0,0,1>
|
||||||
addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15]));
|
MATRIX_ROW_F32_TO_STR(gGLModelView, 12,camera_lines[3]); addText(xpos, ypos, std::string(camera_lines[3])); ypos += y_inc;
|
||||||
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;
|
||||||
addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11]));
|
MATRIX_ROW_N32_TO_STR(gGLModelView, 0,camera_lines[0]); addText(xpos, ypos, std::string(camera_lines[0])); ypos += y_inc;
|
||||||
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;
|
|
||||||
|
|
||||||
addText(xpos, ypos, "View Matrix");
|
addText(xpos, ypos, "View Matrix");
|
||||||
ypos += y_inc;
|
ypos += y_inc;
|
||||||
}
|
}
|
||||||
// disable use of glReadPixels which messes up nVidia nSight graphics debugging
|
// disable use of glReadPixels which messes up nVidia nSight graphics debugging
|
||||||
if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport)
|
if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport)
|
||||||
{
|
{
|
||||||
U8 color[4];
|
U8 color[4];
|
||||||
LLCoordGL coord = gViewerWindow->getCurrentMouse();
|
LLCoordGL coord = gViewerWindow->getCurrentMouse();
|
||||||
glReadPixels(coord.mX, coord.mY, 1,1,GL_RGBA, GL_UNSIGNED_BYTE, color);
|
|
||||||
addText(xpos, ypos, llformat("%d %d %d %d", color[0], color[1], color[2], color[3]));
|
|
||||||
ypos += y_inc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// only display these messages if we are actually rendering beacons at this moment
|
// Convert x,y to raw pixel coords
|
||||||
|
S32 x_raw = llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled());
|
||||||
|
S32 y_raw = llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled());
|
||||||
|
|
||||||
|
glReadPixels(x_raw, y_raw, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
|
||||||
|
addText(xpos, ypos, llformat("Pixel <%1d, %1d> R:%1d G:%1d B:%1d A:%1d", x_raw, y_raw, color[0], color[1], color[2], color[3]));
|
||||||
|
ypos += y_inc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only display these messages if we are actually rendering beacons at this moment
|
||||||
if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons"))
|
if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons"))
|
||||||
{
|
{
|
||||||
if (LLPipeline::getRenderMOAPBeacons())
|
if (LLPipeline::getRenderMOAPBeacons())
|
||||||
|
|
@ -884,6 +989,18 @@ public:
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT);
|
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();
|
for (line_list_t::iterator iter = mLineList.begin();
|
||||||
iter != mLineList.end(); ++iter)
|
iter != mLineList.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
|
@ -892,7 +1009,6 @@ public:
|
||||||
LLFontGL::LEFT, LLFontGL::TOP,
|
LLFontGL::LEFT, LLFontGL::TOP,
|
||||||
LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE);
|
LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE);
|
||||||
}
|
}
|
||||||
mLineList.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -1800,8 +1916,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
|
||||||
ms_sleep(5000) ; //wait for 5 seconds.
|
ms_sleep(5000) ; //wait for 5 seconds.
|
||||||
|
|
||||||
LLSplashScreen::update(LLTrans::getString("ShuttingDown"));
|
LLSplashScreen::update(LLTrans::getString("ShuttingDown"));
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#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 or README-solaris.txt for further information."
|
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;
|
<< LL_ENDL;
|
||||||
#else
|
#else
|
||||||
LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
|
LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
|
||||||
|
|
@ -4736,10 +4852,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
//check if there is enough memory for the snapshot image
|
//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(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K
|
||||||
{
|
{
|
||||||
if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3))
|
if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3))
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :
|
||||||
// gMuteListp->addObserver(&mutelist_listener);
|
// gMuteListp->addObserver(&mutelist_listener);
|
||||||
|
|
||||||
|
|
||||||
#if LL_DARWIN || LL_LINUX || LL_SOLARIS
|
#if LL_DARWIN || LL_LINUX
|
||||||
// HACK: THIS DOES NOT BELONG HERE
|
// HACK: THIS DOES NOT BELONG HERE
|
||||||
// When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
|
// 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.
|
// This should cause us to ignore SIGPIPE and handle the error through proper channels.
|
||||||
|
|
|
||||||
|
|
@ -209,14 +209,7 @@ void LLSkyTex::create()
|
||||||
|
|
||||||
void LLSkyTex::createGLImage(S32 which)
|
void LLSkyTex::createGLImage(S32 which)
|
||||||
{
|
{
|
||||||
if (mIsShiny)
|
mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA);
|
||||||
{
|
|
||||||
mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTexture[which]->setExplicitFormat(GL_SRGB8_ALPHA8, GL_RGBA);
|
|
||||||
}
|
|
||||||
mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL);
|
mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL);
|
||||||
mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP);
|
mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2295,11 +2295,243 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
|
||||||
return res;
|
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<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
|
||||||
|
|
||||||
|
typedef std::map<U8, LLMaterialPtr> 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<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
|
||||||
|
if(range.first == range.second) return false;
|
||||||
|
|
||||||
|
typedef std::map<U8, LLMaterialPtr> 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 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
|
||||||
{
|
{
|
||||||
S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams);
|
LLMaterialPtr pMaterial = const_cast<LLMaterialPtr&>(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<LLVOVolume*>(this), te) ? " selected" : " not selected" )
|
<< ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )
|
||||||
<< LL_ENDL;
|
<< LL_ENDL;
|
||||||
setChanged(ALL_CHANGED);
|
setChanged(ALL_CHANGED);
|
||||||
|
|
@ -4384,7 +4616,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
|
||||||
LLMaterial* mat = te->getMaterialParams();
|
LLMaterial* mat = te->getMaterialParams();
|
||||||
if (mat)
|
if (mat)
|
||||||
{
|
{
|
||||||
U8 mode = mat->getDiffuseAlphaModeRender();
|
U8 mode = mat->getDiffuseAlphaMode();
|
||||||
|
|
||||||
if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE
|
if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE
|
||||||
|| mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE
|
|| mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE
|
||||||
|
|
@ -5030,7 +5262,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f);
|
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());
|
draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -5392,7 +5624,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||||
|
|
||||||
if (mat && LLPipeline::sRenderDeferred)
|
if (mat && LLPipeline::sRenderDeferred)
|
||||||
{
|
{
|
||||||
U8 alpha_mode = mat->getDiffuseAlphaModeRender();
|
U8 alpha_mode = mat->getDiffuseAlphaMode();
|
||||||
|
|
||||||
bool is_alpha = type == LLDrawPool::POOL_ALPHA &&
|
bool is_alpha = type == LLDrawPool::POOL_ALPHA &&
|
||||||
(alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND ||
|
(alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND ||
|
||||||
|
|
@ -5421,7 +5653,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||||
else if (mat)
|
else if (mat)
|
||||||
{
|
{
|
||||||
bool is_alpha = type == LLDrawPool::POOL_ALPHA;
|
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 ||
|
bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
|
||||||
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
|
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
|
||||||
|
|
||||||
|
|
@ -6319,7 +6551,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
||||||
bool can_be_shiny = true;
|
bool can_be_shiny = true;
|
||||||
if (mat)
|
if (mat)
|
||||||
{
|
{
|
||||||
U8 mode = mat->getDiffuseAlphaModeRender();
|
U8 mode = mat->getDiffuseAlphaMode();
|
||||||
can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
|
can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
|
||||||
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
|
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
|
||||||
}
|
}
|
||||||
|
|
@ -6341,7 +6573,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
||||||
//
|
//
|
||||||
if (te->getFullbright())
|
if (te->getFullbright())
|
||||||
{
|
{
|
||||||
if (mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
|
if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
|
||||||
{
|
{
|
||||||
if (opaque)
|
if (opaque)
|
||||||
{
|
{
|
||||||
|
|
@ -6426,7 +6658,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
||||||
}
|
}
|
||||||
else if (mat)
|
else if (mat)
|
||||||
{
|
{
|
||||||
U8 mode = mat->getDiffuseAlphaModeRender();
|
U8 mode = mat->getDiffuseAlphaMode();
|
||||||
|
|
||||||
is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND));
|
is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND));
|
||||||
|
|
||||||
|
|
@ -6525,7 +6757,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
||||||
}
|
}
|
||||||
else if (fullbright || bake_sunlight)
|
else if (fullbright || bake_sunlight)
|
||||||
{ //fullbright
|
{ //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);
|
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
|
||||||
}
|
}
|
||||||
|
|
@ -6547,7 +6779,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
||||||
else
|
else
|
||||||
{ //all around simple
|
{ //all around simple
|
||||||
llassert(mask & LLVertexBuffer::MAP_NORMAL);
|
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
|
{ //material alpha mask can be respected in non-deferred
|
||||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK);
|
registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -441,6 +441,26 @@ protected:
|
||||||
static S32 sNumLODChanges;
|
static S32 sNumLODChanges;
|
||||||
|
|
||||||
friend class LLVolumeImplFlexible;
|
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<LLUUID, material_info> mmap_UUID_MAP_t;
|
||||||
|
mmap_UUID_MAP_t mWaitingTextureInfo;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLVOVOLUME_H
|
#endif // LL_LLVOVOLUME_H
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,16 @@
|
||||||
//
|
//
|
||||||
#define MATERIALS_IN_REFLECTIONS 0
|
#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;
|
bool gShiftFrame = false;
|
||||||
|
|
||||||
//cached settings
|
//cached settings
|
||||||
|
|
@ -348,7 +358,6 @@ bool LLPipeline::sRenderFrameTest = false;
|
||||||
bool LLPipeline::sRenderAttachedLights = true;
|
bool LLPipeline::sRenderAttachedLights = true;
|
||||||
bool LLPipeline::sRenderAttachedParticles = true;
|
bool LLPipeline::sRenderAttachedParticles = true;
|
||||||
bool LLPipeline::sRenderDeferred = false;
|
bool LLPipeline::sRenderDeferred = false;
|
||||||
bool LLPipeline::sMemAllocationThrottled = false;
|
|
||||||
S32 LLPipeline::sVisibleLightCount = 0;
|
S32 LLPipeline::sVisibleLightCount = 0;
|
||||||
F32 LLPipeline::sMinRenderSize = 0.f;
|
F32 LLPipeline::sMinRenderSize = 0.f;
|
||||||
bool LLPipeline::sRenderingHUDs;
|
bool LLPipeline::sRenderingHUDs;
|
||||||
|
|
@ -718,24 +727,6 @@ void LLPipeline::destroyGL()
|
||||||
|
|
||||||
static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture");
|
static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture");
|
||||||
|
|
||||||
//static
|
|
||||||
void LLPipeline::throttleNewMemoryAllocation(bool disable)
|
|
||||||
{
|
|
||||||
if(sMemAllocationThrottled != disable)
|
|
||||||
{
|
|
||||||
sMemAllocationThrottled = disable ;
|
|
||||||
|
|
||||||
if(sMemAllocationThrottled)
|
|
||||||
{
|
|
||||||
//send out notification
|
|
||||||
LLNotification::Params params("LowMemory");
|
|
||||||
LLNotifications::instance().add(params);
|
|
||||||
|
|
||||||
//release some memory.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLPipeline::requestResizeScreenTexture()
|
void LLPipeline::requestResizeScreenTexture()
|
||||||
{
|
{
|
||||||
gResizeScreenTexture = TRUE;
|
gResizeScreenTexture = TRUE;
|
||||||
|
|
@ -1677,7 +1668,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
|
||||||
|
|
||||||
if (alpha && mat)
|
if (alpha && mat)
|
||||||
{
|
{
|
||||||
switch (mat->getDiffuseAlphaModeRender())
|
switch (mat->getDiffuseAlphaMode())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool.
|
alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool.
|
||||||
|
|
@ -9270,30 +9261,29 @@ inline float sgn(float a)
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
||||||
{
|
{
|
||||||
if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
|
if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
|
||||||
{
|
{
|
||||||
bool skip_avatar_update = false;
|
bool skip_avatar_update = false;
|
||||||
if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
|
if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
|
||||||
{
|
{
|
||||||
skip_avatar_update = true;
|
skip_avatar_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLCamera camera = camera_in;
|
|
||||||
|
|
||||||
|
LLCamera camera = camera_in;
|
||||||
camera.setFar(camera_in.getFar() * 0.75f);
|
camera.setFar(camera_in.getFar() * 0.75f);
|
||||||
|
|
||||||
bool camera_is_underwater = LLViewerCamera::getInstance()->cameraUnderWater();
|
bool camera_is_underwater = LLViewerCamera::getInstance()->cameraUnderWater();
|
||||||
|
|
||||||
LLPipeline::sReflectionRender = true;
|
LLPipeline::sReflectionRender = true;
|
||||||
|
|
||||||
gPipeline.pushRenderTypeMask();
|
gPipeline.pushRenderTypeMask();
|
||||||
|
|
||||||
glh::matrix4f saved_modelview = get_current_modelview();
|
glh::matrix4f saved_modelview = get_current_modelview();
|
||||||
glh::matrix4f saved_projection = get_current_projection();
|
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 water_height = gAgent.getRegion()->getWaterHeight();
|
||||||
F32 camera_height = camera_in.getOrigin().mV[VZ];
|
F32 camera_height = camera_in.getOrigin().mV[VZ];
|
||||||
|
|
@ -9307,32 +9297,34 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
||||||
|
|
||||||
camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point);
|
camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point);
|
||||||
|
|
||||||
//plane params
|
//plane params
|
||||||
LLPlane plane;
|
LLPlane plane;
|
||||||
LLVector3 pnorm;
|
LLVector3 pnorm;
|
||||||
S32 water_clip = 0;
|
S32 water_clip = 0;
|
||||||
if (!camera_is_underwater)
|
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);
|
plane.setVec(pnorm, -water_height);
|
||||||
water_clip = 1;
|
water_clip = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //camera is below water, clip plane points down
|
{
|
||||||
pnorm = LLVector3(0,0,-1);
|
//camera is below water, clip plane points down
|
||||||
|
pnorm = LLVector3(0,0,-1);
|
||||||
plane.setVec(pnorm, water_height);
|
plane.setVec(pnorm, water_height);
|
||||||
water_clip = -1;
|
water_clip = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 occlusion = LLPipeline::sUseOcclusion;
|
S32 occlusion = LLPipeline::sUseOcclusion;
|
||||||
|
|
||||||
//disable occlusion culling for reflection map for now
|
//disable occlusion culling for reflection map for now
|
||||||
LLPipeline::sUseOcclusion = 0;
|
LLPipeline::sUseOcclusion = 0;
|
||||||
|
|
||||||
if (!camera_is_underwater)
|
if (!camera_is_underwater)
|
||||||
{ //generate planar reflection map
|
{
|
||||||
|
//generate planar reflection map
|
||||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0;
|
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0;
|
||||||
|
|
||||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||||
gGL.pushMatrix();
|
gGL.pushMatrix();
|
||||||
|
|
@ -9345,9 +9337,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
||||||
mReflectionModelView = mat;
|
mReflectionModelView = mat;
|
||||||
|
|
||||||
set_current_modelview(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::vec3f origin(0, 0, 0);
|
||||||
glh::matrix4f inv_mat = mat.inverse();
|
glh::matrix4f inv_mat = mat.inverse();
|
||||||
|
|
@ -9355,10 +9347,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
||||||
|
|
||||||
camera.setOrigin(origin.v);
|
camera.setOrigin(origin.v);
|
||||||
|
|
||||||
glCullFace(GL_FRONT);
|
glCullFace(GL_FRONT);
|
||||||
|
|
||||||
if (LLDrawPoolWater::sNeedsReflectionUpdate)
|
if (LLDrawPoolWater::sNeedsReflectionUpdate)
|
||||||
{
|
{
|
||||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
glClearColor(0,0,0,0);
|
glClearColor(0,0,0,0);
|
||||||
mWaterRef.bindTarget();
|
mWaterRef.bindTarget();
|
||||||
|
|
@ -9368,106 +9360,127 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false);
|
||||||
mWaterRef.getViewport(gGLViewport);
|
mWaterRef.getViewport(gGLViewport);
|
||||||
|
|
||||||
//initial sky pass (no user clip plane)
|
//initial sky pass (no user clip plane)
|
||||||
{ //mask out everything but the sky
|
//mask out everything but the sky
|
||||||
gPipeline.pushRenderTypeMask();
|
gPipeline.pushRenderTypeMask();
|
||||||
gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY,
|
{
|
||||||
LLPipeline::RENDER_TYPE_WL_SKY,
|
if (reflection_detail >= WATER_REFLECT_MINIMAL)
|
||||||
LLPipeline::RENDER_TYPE_CLOUDS,
|
{
|
||||||
LLPipeline::END_RENDER_TYPES);
|
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);
|
updateCull(camera, mSky);
|
||||||
stateSort(camera, mSky);
|
stateSort(camera, mSky);
|
||||||
renderGeom(camera, TRUE);
|
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);
|
|
||||||
}
|
|
||||||
gPipeline.popRenderTypeMask();
|
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.matrixMode(LLRender::MM_MODELVIEW);
|
||||||
gGL.popMatrix();
|
gGL.popMatrix();
|
||||||
|
|
||||||
set_current_modelview(saved_modelview);
|
set_current_modelview(saved_modelview);
|
||||||
}
|
}
|
||||||
|
|
||||||
//LLPipeline::sUseOcclusion = occlusion;
|
//LLPipeline::sUseOcclusion = occlusion;
|
||||||
|
|
||||||
camera.setOrigin(camera_in.getOrigin());
|
camera.setOrigin(camera_in.getOrigin());
|
||||||
//render distortion map
|
//render distortion map
|
||||||
static bool last_update = true;
|
static bool last_update = true;
|
||||||
if (last_update)
|
if (last_update)
|
||||||
{
|
{
|
||||||
gPipeline.pushRenderTypeMask();
|
gPipeline.pushRenderTypeMask();
|
||||||
|
|
||||||
camera.setFar(camera_in.getFar());
|
camera.setFar(camera_in.getFar());
|
||||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER,
|
clearRenderTypeMask(
|
||||||
LLPipeline::RENDER_TYPE_VOIDWATER,
|
LLPipeline::RENDER_TYPE_WATER,
|
||||||
LLPipeline::RENDER_TYPE_GROUND,
|
LLPipeline::RENDER_TYPE_VOIDWATER,
|
||||||
END_RENDER_TYPES);
|
LLPipeline::RENDER_TYPE_GROUND,
|
||||||
|
END_RENDER_TYPES);
|
||||||
|
|
||||||
// intentionally inverted so that distortion map contents (objects under the water when we're above it)
|
// intentionally inverted so that distortion map contents (objects under the water when we're above it)
|
||||||
// will properly include water fog effects
|
// will properly include water fog effects
|
||||||
LLPipeline::sUnderWaterRender = !camera_is_underwater;
|
LLPipeline::sUnderWaterRender = !camera_is_underwater;
|
||||||
|
|
||||||
if (LLPipeline::sUnderWaterRender)
|
if (LLPipeline::sUnderWaterRender)
|
||||||
{
|
{
|
||||||
clearRenderTypeMask(
|
clearRenderTypeMask(
|
||||||
LLPipeline::RENDER_TYPE_GROUND,
|
LLPipeline::RENDER_TYPE_GROUND,
|
||||||
LLPipeline::RENDER_TYPE_SKY,
|
LLPipeline::RENDER_TYPE_SKY,
|
||||||
LLPipeline::RENDER_TYPE_CLOUDS,
|
LLPipeline::RENDER_TYPE_CLOUDS,
|
||||||
LLPipeline::RENDER_TYPE_WL_SKY,
|
LLPipeline::RENDER_TYPE_WL_SKY,
|
||||||
END_RENDER_TYPES);
|
END_RENDER_TYPES);
|
||||||
}
|
}
|
||||||
LLViewerCamera::updateFrustumPlanes(camera);
|
LLViewerCamera::updateFrustumPlanes(camera);
|
||||||
|
|
||||||
|
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
|
|
||||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
|
||||||
|
|
||||||
if (LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsDistortionUpdate)
|
if (LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsDistortionUpdate)
|
||||||
{
|
{
|
||||||
LLPipeline::sDistortionRender = true;
|
LLPipeline::sDistortionRender = true;
|
||||||
|
|
||||||
LLColor3 col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor();
|
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.bindTarget();
|
||||||
mWaterDis.getViewport(gGLViewport);
|
mWaterDis.getViewport(gGLViewport);
|
||||||
|
|
||||||
gGL.setColorMask(true, true);
|
gGL.setColorMask(true, true);
|
||||||
mWaterDis.clear();
|
mWaterDis.clear();
|
||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false);
|
||||||
|
|
@ -9479,66 +9492,69 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
||||||
LLPlane plane(-pnorm, water_dist);
|
LLPlane plane(-pnorm, water_dist);
|
||||||
LLGLUserClipPlane clip_plane(plane, saved_modelview, saved_projection);
|
LLGLUserClipPlane clip_plane(plane, saved_modelview, saved_projection);
|
||||||
|
|
||||||
gGL.setColorMask(true, true);
|
gGL.setColorMask(true, true);
|
||||||
mWaterDis.clear();
|
mWaterDis.clear();
|
||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false);
|
||||||
|
|
||||||
// ignore clip plane if we're underwater and viewing distortion map of objects above waterline
|
// ignore clip plane if we're underwater and viewing distortion map of objects above waterline
|
||||||
if (camera_is_underwater)
|
if (camera_is_underwater)
|
||||||
{
|
{
|
||||||
clip_plane.disable();
|
clip_plane.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCull(camera, mRefractedObjects, water_clip, &plane);
|
if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT)
|
||||||
stateSort(camera, mRefractedObjects);
|
{
|
||||||
renderGeom(camera);
|
updateCull(camera, mRefractedObjects, water_clip, &plane);
|
||||||
|
stateSort(camera, mRefractedObjects);
|
||||||
|
renderGeom(camera);
|
||||||
|
}
|
||||||
|
|
||||||
if (LLGLSLShader::sNoFixedFunction)
|
if (LLGLSLShader::sNoFixedFunction)
|
||||||
{
|
{
|
||||||
gUIProgram.bind();
|
gUIProgram.bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWorld::getInstance()->renderPropertyLines();
|
LLWorld::getInstance()->renderPropertyLines();
|
||||||
|
|
||||||
if (LLGLSLShader::sNoFixedFunction)
|
if (LLGLSLShader::sNoFixedFunction)
|
||||||
{
|
{
|
||||||
gUIProgram.unbind();
|
gUIProgram.unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
mWaterDis.flush();
|
mWaterDis.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLPipeline::sDistortionRender = false;
|
LLPipeline::sDistortionRender = false;
|
||||||
|
|
||||||
gPipeline.popRenderTypeMask();
|
gPipeline.popRenderTypeMask();
|
||||||
}
|
}
|
||||||
last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;
|
last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;
|
||||||
|
|
||||||
gPipeline.popRenderTypeMask();
|
gPipeline.popRenderTypeMask();
|
||||||
|
|
||||||
LLPipeline::sUseOcclusion = occlusion;
|
LLPipeline::sUseOcclusion = occlusion;
|
||||||
LLPipeline::sUnderWaterRender = false;
|
LLPipeline::sUnderWaterRender = false;
|
||||||
LLPipeline::sReflectionRender = false;
|
LLPipeline::sReflectionRender = false;
|
||||||
|
|
||||||
LLDrawPoolWater::sNeedsReflectionUpdate = FALSE;
|
LLDrawPoolWater::sNeedsReflectionUpdate = FALSE;
|
||||||
LLDrawPoolWater::sNeedsDistortionUpdate = FALSE;
|
LLDrawPoolWater::sNeedsDistortionUpdate = FALSE;
|
||||||
|
|
||||||
if (!LLRenderTarget::sUseFBO)
|
if (!LLRenderTarget::sUseFBO)
|
||||||
{
|
{
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||||
gViewerWindow->setup3DViewport();
|
gViewerWindow->setup3DViewport();
|
||||||
|
|
||||||
LLGLState::checkStates();
|
|
||||||
|
|
||||||
if (!skip_avatar_update)
|
LLGLState::checkStates();
|
||||||
{
|
|
||||||
gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up)
|
||||||
|
|
|
||||||
|
|
@ -414,10 +414,6 @@ public:
|
||||||
static void updateRenderDeferred();
|
static void updateRenderDeferred();
|
||||||
static void refreshCachedSettings();
|
static void refreshCachedSettings();
|
||||||
|
|
||||||
static void throttleNewMemoryAllocation(bool disable);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void addDebugBlip(const LLVector3& position, const LLColor4& color);
|
void addDebugBlip(const LLVector3& position, const LLColor4& color);
|
||||||
|
|
||||||
void hidePermanentObjects( std::vector<U32>& restoreList );
|
void hidePermanentObjects( std::vector<U32>& restoreList );
|
||||||
|
|
@ -600,7 +596,6 @@ public:
|
||||||
static bool sRenderAttachedLights;
|
static bool sRenderAttachedLights;
|
||||||
static bool sRenderAttachedParticles;
|
static bool sRenderAttachedParticles;
|
||||||
static bool sRenderDeferred;
|
static bool sRenderDeferred;
|
||||||
static bool sMemAllocationThrottled;
|
|
||||||
static S32 sVisibleLightCount;
|
static S32 sVisibleLightCount;
|
||||||
static F32 sMinRenderSize;
|
static F32 sMinRenderSize;
|
||||||
static bool sRenderingHUDs;
|
static bool sRenderingHUDs;
|
||||||
|
|
|
||||||
|
|
@ -706,6 +706,14 @@
|
||||||
top_delta="0"
|
top_delta="0"
|
||||||
name="Reflections"
|
name="Reflections"
|
||||||
width="150">
|
width="150">
|
||||||
|
<combo_box.item
|
||||||
|
label="None; opaque"
|
||||||
|
name="0"
|
||||||
|
value="-2"/>
|
||||||
|
<combo_box.item
|
||||||
|
label="None; transparent"
|
||||||
|
name="0"
|
||||||
|
value="-1"/>
|
||||||
<combo_box.item
|
<combo_box.item
|
||||||
label="Minimal"
|
label="Minimal"
|
||||||
name="0"
|
name="0"
|
||||||
|
|
|
||||||
|
|
@ -9588,6 +9588,12 @@ You do not appear to have the proper hardware requirements for [APP_NAME]. [APP_
|
||||||
If you continue to have problems, please visit the [SUPPORT_SITE].
|
If you continue to have problems, please visit the [SUPPORT_SITE].
|
||||||
</global>
|
</global>
|
||||||
|
|
||||||
|
<global name="UnsupportedIntelDriver">
|
||||||
|
The installed Intel graphics driver for [GPUNAME], version [VERSION], is significantly out of date and is known to cause excessive rates of program crashes. You are strongly advised to update to a current Intel driver
|
||||||
|
|
||||||
|
Do you want to check the Intel driver website?
|
||||||
|
</global>
|
||||||
|
|
||||||
<global name="UnsupportedCPUAmount">
|
<global name="UnsupportedCPUAmount">
|
||||||
796
|
796
|
||||||
</global>
|
</global>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue