# Conflicts:
#	indra/llcommon/llcallstack.h
#	indra/newview/lldrawpoolalpha.cpp
#	indra/newview/llpanelprofile.cpp
#	indra/newview/llviewerobject.cpp
#	indra/newview/llvoavatar.cpp
#	indra/newview/llvovolume.cpp
master
Ansariel 2024-08-23 13:47:48 +02:00
commit 4a438dcfd4
39 changed files with 442 additions and 779 deletions

View File

@ -2,7 +2,7 @@
# clang-format version 10.0.0+
Language: Cpp
# BasedOnStyle: Microsoft
AccessModifierOffset: -2
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
@ -15,14 +15,14 @@ AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortLambdasOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
@ -67,7 +67,7 @@ IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
@ -91,9 +91,9 @@ PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
@ -102,8 +102,8 @@ SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false

View File

@ -34,7 +34,6 @@
#include "llpolymorph.h"
#include "llwearable.h"
#include "llfasttimer.h"
#include "llcallstack.h"
#include "llpolyskeletaldistortion.h"
@ -206,11 +205,6 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
// needed?
// joint->storeScaleForReset( newScale );
// BENTO for detailed stack tracing of params.
std::stringstream ostr;
ostr << "LLPolySkeletalDistortion::apply, id " << getID() << " " << getName() << " effective wt " << effective_weight << " last wt " << mLastWeight << " scaleDelta " << scaleDelta << " offset " << offset;
LLScopedContextString str(ostr.str());
joint->setScale(newScale, true);
}

View File

@ -32,7 +32,6 @@
#include "lljoint.h"
#include "llmath.h"
#include "llcallstack.h"
#include <boost/algorithm/string.hpp>
//<FS:ND> Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
@ -363,7 +362,6 @@ void LLJoint::setPosition( const LLVector3& requested_pos, bool apply_attachment
{
if (pos != active_override && do_debug_joint(getName()))
{
LLScopedContextString str("setPosition");
LL_DEBUGS("Avatar") << " joint " << getName() << " requested_pos " << requested_pos
<< " overriden by attachment " << active_override << LL_ENDL;
}
@ -371,12 +369,7 @@ void LLJoint::setPosition( const LLVector3& requested_pos, bool apply_attachment
}
if ((pos != getPosition()) && do_debug_joint(getName()))
{
LLScopedContextString str("setPosition");
LLCallStack cs;
LLContextStatus con_status;
LL_DEBUGS("Avatar") << " joint " << getName() << " set pos " << pos << LL_ENDL;
LL_DEBUGS("Avatar") << "CONTEXT:\n" << "====================\n" << con_status << "====================" << LL_ENDL;
LL_DEBUGS("Avatar") << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL;
}
if (pos != getPosition())
{
@ -900,7 +893,6 @@ void LLJoint::setScale( const LLVector3& requested_scale, bool apply_attachment_
{
if (scale != active_override && do_debug_joint(getName()))
{
LLScopedContextString str("setScale");
LL_DEBUGS("Avatar") << " joint " << getName() << " requested_scale " << requested_scale
<< " overriden by attachment " << active_override << LL_ENDL;
}
@ -908,12 +900,7 @@ void LLJoint::setScale( const LLVector3& requested_scale, bool apply_attachment_
}
if ((mXform.getScale() != scale) && do_debug_joint(getName()))
{
LLScopedContextString str("setScale");
LLCallStack cs;
LLContextStatus con_status;
LL_DEBUGS("Avatar") << " joint " << getName() << " set scale " << scale << LL_ENDL;
LL_DEBUGS("Avatar") << "CONTEXT:\n" << "====================\n" << con_status << LL_ENDL;
LL_DEBUGS("Avatar") << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL;
}
mXform.setScale(scale);
touch();

View File

@ -26,7 +26,6 @@ set(llcommon_SOURCE_FILES
llbase64.cpp
llbitpack.cpp
llcallbacklist.cpp
llcallstack.cpp
llcleanup.cpp
llcommon.cpp
llcommonutils.cpp
@ -134,7 +133,6 @@ set(llcommon_HEADER_FILES
llbitpack.h
llboost.h
llcallbacklist.h
llcallstack.h
llcleanup.h
llcommon.h
llcommonutils.h

View File

@ -1,188 +0,0 @@
/**
* @file llcallstack.cpp
* @brief run-time extraction of the current callstack
*
* $LicenseInfo:firstyear=2016&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2016, 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 "llcommon.h"
#include "llcallstack.h"
#include "StackWalker.h"
#include "llthreadlocalstorage.h"
#if LL_WINDOWS
class LLCallStackImpl: public StackWalker
{
public:
LLCallStackImpl():
StackWalker(false,0) // non-verbose, options = 0
{
}
~LLCallStackImpl()
{
}
void getStack(std::vector<std::string>& stack, S32 skip_count=0, bool verbose=false)
{
m_stack.clear();
ShowCallstack(verbose);
// Skip the first few lines because they're just bookkeeping for LLCallStack,
// plus any additional lines requested to skip.
S32 first_line = skip_count + 3;
for (S32 i=first_line; i<m_stack.size(); ++i)
{
stack.push_back(m_stack[i]);
}
}
protected:
virtual void OnOutput(LPCSTR szText)
{
m_stack.push_back(szText);
}
std::vector<std::string> m_stack;
};
#else
// Stub - not implemented currently on other platforms.
class LLCallStackImpl
{
public:
LLCallStackImpl() {}
~LLCallStackImpl() {}
void getStack(std::vector<std::string>& stack, S32 skip_count=0, bool verbose=false)
{
stack.clear();
}
};
#endif
LLCallStackImpl *LLCallStack::s_impl = NULL;
LLCallStack::LLCallStack(S32 skip_count, bool verbose):
m_skipCount(skip_count),
m_verbose(verbose)
{
if (!s_impl)
{
s_impl = new LLCallStackImpl;
}
LLTimer t;
s_impl->getStack(m_strings, m_skipCount, m_verbose);
}
bool LLCallStack::contains(const std::string& str)
{
for (const std::string& src_str : m_strings)
{
if (src_str.find(str) != std::string::npos)
{
return true;
}
}
return false;
}
std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
for (const std::string& str : call_stack.m_strings)
{
s << str;
}
#else
s << "UNAVAILABLE IN RELEASE";
#endif
return s;
}
LLContextStrings::LLContextStrings()
{
}
// static
LLContextStrings* LLContextStrings::getThreadLocalInstance()
{
LLContextStrings *cons = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance();
if (!cons)
{
LLThreadLocalSingletonPointer<LLContextStrings>::setInstance(new LLContextStrings);
}
return LLThreadLocalSingletonPointer<LLContextStrings>::getInstance();
}
// static
void LLContextStrings::addContextString(const std::string& str)
{
LLContextStrings *cons = getThreadLocalInstance();
//LL_INFOS() << "CTX " << (S32)cons << " ADD " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL;
cons->m_contextStrings[str]++;
}
// static
void LLContextStrings::removeContextString(const std::string& str)
{
LLContextStrings *cons = getThreadLocalInstance();
cons->m_contextStrings[str]--;
//LL_INFOS() << "CTX " << (S32)cons << " REMOVE " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL;
if (cons->m_contextStrings[str] == 0)
{
cons->m_contextStrings.erase(str);
}
}
// static
bool LLContextStrings::contains(const std::string& str)
{
const std::map<std::string,S32>& strings =
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
for (const std::map<std::string,S32>::value_type& str_pair : strings)
{
if (str_pair.first.find(str) != std::string::npos)
{
return true;
}
}
return false;
}
// static
void LLContextStrings::output(std::ostream& os)
{
const std::map<std::string,S32>& strings =
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
for (const std::map<std::string,S32>::value_type& str_pair : strings)
{
os << str_pair.first << "[" << str_pair.second << "]" << "\n";
}
}
// static
std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status)
{
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->output(s);
return s;
}
bool LLContextStatus::contains(const std::string& str)
{
return LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->contains(str);
}

View File

@ -1,93 +0,0 @@
/**
* @file llcallstack.h
* @brief run-time extraction of the current callstack
*
* $LicenseInfo:firstyear=2016&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2016, 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 <map>
class LLCallStackImpl;
class LLCallStack
{
public:
LLCallStack(S32 skip_count=0, bool verbose=false);
std::vector<std::string> m_strings;
bool m_verbose;
bool contains(const std::string& str);
private:
static LLCallStackImpl *s_impl;
S32 m_skipCount;
};
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack);
class LLContextStrings
{
public:
LLContextStrings();
static void addContextString(const std::string& str);
static void removeContextString(const std::string& str);
static void output(std::ostream& os);
static LLContextStrings* getThreadLocalInstance();
static bool contains(const std::string& str);
private:
std::map<std::string,S32> m_contextStrings;
};
class LLScopedContextString
{
public:
LLScopedContextString(const std::string& str):
m_str(str)
{
LLContextStrings::addContextString(m_str);
}
~LLScopedContextString()
{
LLContextStrings::removeContextString(m_str);
}
private:
std::string m_str;
};
// Mostly exists as a class to hook an ostream override to.
struct LLContextStatus
{
bool contains(const std::string& str);
};
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status);
// <FS:Ansariel> Restore this: Don't need this in actual relase builds
#ifdef LL_RELEASE_FOR_DOWNLOAD
#define dumpStack(tag)
#else
#define dumpStack(tag) \
LL_DEBUGS(tag) << "STACK:\n" \
<< "====================\n" \
<< LLCallStack() \
<< "====================" \
<< LL_ENDL;
#endif
// </FS:Ansariel>

View File

@ -37,52 +37,52 @@ typedef U32 PermissionBit;
// Do you have permission to transfer ownership of the object or
// item. Fair use rules dictate that if you cannot copy, you can
// always transfer.
const PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000
constexpr PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000
// objects, scale or change textures
// parcels, allow building on it
const PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000
constexpr PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000
// objects, allow copy
const PermissionBit PERM_COPY = (1 << 15); // 0x00008000
constexpr PermissionBit PERM_COPY = (1 << 15); // 0x00008000
// <FS:CR> OpenSim export permission
const PermissionBit PERM_EXPORT = (1 << 16); // 0x00010000
// </FS:CR>
// parcels, allow entry, deprecated
//const PermissionBit PERM_ENTER = (1 << 16); // 0x00010000
//constexpr PermissionBit PERM_ENTER = (1 << 16); // 0x00010000
// parcels, allow terraform, deprecated
//const PermissionBit PERM_TERRAFORM = (1 << 17); // 0x00020000
//constexpr PermissionBit PERM_TERRAFORM = (1 << 17); // 0x00020000
// NOTA BENE: This flag is NO LONGER USED!!! However, it is possible that some
// objects in the universe have it set so DON"T USE IT going forward.
//const PermissionBit PERM_OWNER_DEBIT = (1 << 18); // 0x00040000
//constexpr PermissionBit PERM_OWNER_DEBIT = (1 << 18); // 0x00040000
// objects, can grab/translate/rotate
const PermissionBit PERM_MOVE = (1 << 19); // 0x00080000
constexpr PermissionBit PERM_MOVE = (1 << 19); // 0x00080000
// parcels, avatars take damage, deprecated
//const PermissionBit PERM_DAMAGE = (1 << 20); // 0x00100000
// don't use bit 31 -- printf/scanf with "%x" assume signed numbers
const PermissionBit PERM_RESERVED = ((U32)1) << 31;
constexpr PermissionBit PERM_RESERVED = ((U32)1) << 31;
const PermissionMask PERM_NONE = 0x00000000;
const PermissionMask PERM_ALL = 0x7FFFFFFF;
//const PermissionMask PERM_ALL_PARCEL = PERM_MODIFY | PERM_ENTER | PERM_TERRAFORM | PERM_DAMAGE;
const PermissionMask PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
constexpr PermissionMask PERM_NONE = 0x00000000;
constexpr PermissionMask PERM_ALL = 0x7FFFFFFF;
//constexpr PermissionMask PERM_ALL_PARCEL = PERM_MODIFY | PERM_ENTER | PERM_TERRAFORM | PERM_DAMAGE;
constexpr PermissionMask PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
// Useful stuff for transmission.
// Which permissions field are we trying to change?
const U8 PERM_BASE = 0x01;
constexpr U8 PERM_BASE = 0x01;
// TODO: Add another PERM_OWNER operation type for allowOperationBy DK 04/03/06
const U8 PERM_OWNER = 0x02;
const U8 PERM_GROUP = 0x04;
const U8 PERM_EVERYONE = 0x08;
const U8 PERM_NEXT_OWNER = 0x10;
constexpr U8 PERM_OWNER = 0x02;
constexpr U8 PERM_GROUP = 0x04;
constexpr U8 PERM_EVERYONE = 0x08;
constexpr U8 PERM_NEXT_OWNER = 0x10;
// This is just a quickie debugging key
// no modify: PERM_ALL & ~PERM_MODIFY = 0x7fffbfff

View File

@ -1139,8 +1139,6 @@ namespace
{
const size_t size(sizeof(T));
LL_DEBUGS("TEXTUREENTRY") << "Request to read items of size " << size << " with swizzle " << type << " froum buffer sized " << (source_end - source) << LL_ENDL;
if ((source + size + 1) > source_end)
{
// we add 1 above to take into account the byte that we know must follow the value.

View File

@ -125,27 +125,25 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
mImage->setHasMipMaps(use_mips);
bind(0);
U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F;
U32 mip = 0;
free_cur_tex_image();
while (resolution >= 1)
U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F;
U32 mip = 0;
U32 mip_resolution = resolution;
while (mip_resolution >= 1)
{
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, mip, format, resolution, resolution, count * 6, 0,
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, mip, format, mip_resolution, mip_resolution, count * 6, 0,
GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
if (!use_mips)
{
break;
}
resolution /= 2;
mip_resolution /= 2;
++mip;
}
alloc_tex_image(resolution * 6, resolution, format);
alloc_tex_image(resolution, resolution, format, count * 6);
mImage->setAddressMode(LLTexUnit::TAM_CLAMP);

View File

@ -117,7 +117,7 @@ bool LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp
}
// Make corresponding GL image.
mImageGLVec[bitmap_idx].push_back(new LLImageGL(image_raw, false));
mImageGLVec[bitmap_idx].push_back(new LLImageGL(image_raw, false, false));
LLImageGL* image_gl = getImageGL(bitmap_type, bitmap_num);
// Start at beginning of the new image.

View File

@ -67,11 +67,12 @@ static U64 sTextureBytes = 0;
// track a texture alloc on the currently bound texture.
// asserts that no currently tracked alloc exists
void LLImageGLMemory::alloc_tex_image(U32 width, U32 height, U32 pixformat)
void LLImageGLMemory::alloc_tex_image(U32 width, U32 height, U32 intformat, U32 count)
{
U32 texUnit = gGL.getCurrentTexUnitIndex();
U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture();
U64 size = LLImageGL::dataFormatBytes(pixformat, width, height);
U64 size = LLImageGL::dataFormatBytes(intformat, width, height);
size *= count;
llassert(size >= 0);
@ -276,6 +277,15 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
{
switch (dataformat)
{
case GL_COMPRESSED_RED: return 8;
case GL_COMPRESSED_RG: return 16;
case GL_COMPRESSED_RGB: return 24;
case GL_COMPRESSED_SRGB: return 32;
case GL_COMPRESSED_RGBA: return 32;
case GL_COMPRESSED_SRGB_ALPHA: return 32;
case GL_COMPRESSED_LUMINANCE: return 8;
case GL_COMPRESSED_LUMINANCE_ALPHA: return 16;
case GL_COMPRESSED_ALPHA: return 8;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return 4;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return 4;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return 8;
@ -283,17 +293,27 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return 8;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return 8;
case GL_LUMINANCE: return 8;
case GL_LUMINANCE8: return 8;
case GL_ALPHA: return 8;
case GL_ALPHA8: return 8;
case GL_RED: return 8;
case GL_R8: return 8;
case GL_COLOR_INDEX: return 8;
case GL_LUMINANCE_ALPHA: return 16;
case GL_LUMINANCE8_ALPHA8: return 16;
case GL_RG: return 16;
case GL_RG8: return 16;
case GL_RGB: return 24;
case GL_SRGB: return 24;
case GL_RGB8: return 24;
case GL_RGBA: return 32;
case GL_RGBA8: return 32;
case GL_SRGB_ALPHA: return 32;
case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac
case GL_DEPTH_COMPONENT: return 24;
case GL_DEPTH_COMPONENT24: return 24;
case GL_R16F: return 16;
case GL_RG16F: return 32;
case GL_RGB16F: return 48;
case GL_RGBA16F: return 64;
default:
@ -340,6 +360,7 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat)
case GL_RED: return 1;
case GL_COLOR_INDEX: return 1;
case GL_LUMINANCE_ALPHA: return 2;
case GL_RG: return 2;
case GL_RGB: return 3;
case GL_SRGB: return 3;
case GL_RGBA: return 4;
@ -407,29 +428,29 @@ bool LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, b
//----------------------------------------------------------------------------
LLImageGL::LLImageGL(bool usemipmaps)
LLImageGL::LLImageGL(bool usemipmaps/* = true*/, bool allow_compression/* = true*/)
: mSaveData(0), mExternalTexture(false)
{
init(usemipmaps);
init(usemipmaps, allow_compression);
setSize(0, 0, 0);
sImageList.insert(this);
sCount++;
}
LLImageGL::LLImageGL(U32 width, U32 height, U8 components, bool usemipmaps)
LLImageGL::LLImageGL(U32 width, U32 height, U8 components, bool usemipmaps/* = true*/, bool allow_compression/* = true*/)
: mSaveData(0), mExternalTexture(false)
{
llassert( components <= 4 );
init(usemipmaps);
init(usemipmaps, allow_compression);
setSize(width, height, components);
sImageList.insert(this);
sCount++;
}
LLImageGL::LLImageGL(const LLImageRaw* imageraw, bool usemipmaps)
LLImageGL::LLImageGL(const LLImageRaw* imageraw, bool usemipmaps/* = true*/, bool allow_compression/* = true*/)
: mSaveData(0), mExternalTexture(false)
{
init(usemipmaps);
init(usemipmaps, allow_compression);
setSize(0, 0, 0);
sImageList.insert(this);
sCount++;
@ -446,7 +467,7 @@ LLImageGL::LLImageGL(
LLGLenum formatType,
LLTexUnit::eTextureAddressMode addressMode)
{
init(false);
init(false, true);
mTexName = texName;
mTarget = target;
mComponents = components;
@ -468,7 +489,7 @@ LLImageGL::~LLImageGL()
}
}
void LLImageGL::init(bool usemipmaps)
void LLImageGL::init(bool usemipmaps, bool allow_compression)
{
#if LL_IMAGEGL_THREAD_CHECK
mActiveThread = LLThread::currentID();
@ -498,7 +519,7 @@ void LLImageGL::init(bool usemipmaps)
mHeight = 0;
mCurrentDiscardLevel = -1;
mAllowCompression = true;
mAllowCompression = allow_compression;
mTarget = GL_TEXTURE_2D;
mBindTarget = LLTexUnit::TT_TEXTURE;
@ -1226,90 +1247,122 @@ void LLImageGL::deleteTextures(S32 numTextures, const U32 *textures)
void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void* pixels, bool allow_compression)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
bool use_scratch = false;
U32* scratch = NULL;
std::unique_ptr<U32[]> scratch;
if (LLRender::sGLCoreProfile)
{
if (pixformat == GL_ALPHA && pixtype == GL_UNSIGNED_BYTE)
{ //GL_ALPHA is deprecated, convert to RGBA
if (pixels != nullptr)
{
use_scratch = true;
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++)
{
U8* pix = (U8*)&scratch[i];
pix[0] = pix[1] = pix[2] = 0;
pix[3] = ((U8*)pixels)[i];
}
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
if (gGLManager.mGLVersion >= 3.29f)
{
if (pixformat == GL_ALPHA)
{ //GL_ALPHA is deprecated, convert to RGBA
const GLint mask[] = { GL_ZERO, GL_ZERO, GL_ZERO, GL_RED };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask);
pixformat = GL_RED;
intformat = GL_R8;
}
pixformat = GL_RGBA;
intformat = GL_RGBA8;
if (pixformat == GL_LUMINANCE)
{ //GL_LUMINANCE is deprecated, convert to GL_RGBA
const GLint mask[] = { GL_RED, GL_RED, GL_RED, GL_ONE };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask);
pixformat = GL_RED;
intformat = GL_R8;
}
if (pixformat == GL_LUMINANCE_ALPHA)
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
const GLint mask[] = { GL_RED, GL_RED, GL_RED, GL_GREEN };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask);
pixformat = GL_RG;
intformat = GL_RG8;
}
}
if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE)
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
if (pixels != nullptr)
{
use_scratch = true;
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
else
{
if (pixformat == GL_ALPHA && pixtype == GL_UNSIGNED_BYTE)
{ //GL_ALPHA is deprecated, convert to RGBA
if (pixels != nullptr)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
scratch.reset(new(std::nothrow) U32[width * height]);
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++)
{
U8* pix = (U8*)&scratch[i];
pix[0] = pix[1] = pix[2] = 0;
pix[3] = ((U8*)pixels)[i];
}
pixels = scratch.get();
}
U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++)
{
U8 lum = ((U8*)pixels)[i * 2 + 0];
U8 alpha = ((U8*)pixels)[i * 2 + 1];
U8* pix = (U8*)&scratch[i];
pix[0] = pix[1] = pix[2] = lum;
pix[3] = alpha;
}
pixformat = GL_RGBA;
intformat = GL_RGBA8;
}
pixformat = GL_RGBA;
intformat = GL_RGBA8;
}
if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE)
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGB
if (pixels != nullptr)
{
use_scratch = true;
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE)
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
if (pixels != nullptr)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
scratch.reset(new(std::nothrow) U32[width * height]);
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++)
{
U8 lum = ((U8*)pixels)[i * 2 + 0];
U8 alpha = ((U8*)pixels)[i * 2 + 1];
U8* pix = (U8*)&scratch[i];
pix[0] = pix[1] = pix[2] = lum;
pix[3] = alpha;
}
pixels = scratch.get();
}
U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++)
{
U8 lum = ((U8*)pixels)[i];
U8* pix = (U8*)&scratch[i];
pix[0] = pix[1] = pix[2] = lum;
pix[3] = 255;
}
pixformat = GL_RGBA;
intformat = GL_RGBA8;
}
if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE)
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGB
if (pixels != nullptr)
{
scratch.reset(new(std::nothrow) U32[width * height]);
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++)
{
U8 lum = ((U8*)pixels)[i];
U8* pix = (U8*)&scratch[i];
pix[0] = pix[1] = pix[2] = lum;
pix[3] = 255;
}
pixels = scratch.get();
}
pixformat = GL_RGBA;
intformat = GL_RGB8;
}
pixformat = GL_RGBA;
intformat = GL_RGB8;
}
}
@ -1318,6 +1371,14 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
{
switch (intformat)
{
case GL_RED:
case GL_R8:
intformat = GL_COMPRESSED_RED;
break;
case GL_RG:
case GL_RG8:
intformat = GL_COMPRESSED_RG;
break;
case GL_RGB:
case GL_RGB8:
intformat = GL_COMPRESSED_RGB;
@ -1346,12 +1407,8 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
case GL_ALPHA8:
intformat = GL_COMPRESSED_ALPHA;
break;
case GL_RED:
case GL_R8:
intformat = GL_COMPRESSED_RED;
break;
default:
LL_WARNS() << "Could not compress format: " << std::hex << intformat << LL_ENDL;
LL_WARNS() << "Could not compress format: " << std::hex << intformat << std::dec << LL_ENDL;
break;
}
}
@ -1367,7 +1424,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
if (!use_sub_image)
{
LL_PROFILE_ZONE_NAMED("glTexImage2D alloc + copy");
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, use_scratch ? scratch : pixels);
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, pixels);
}
else
{
@ -1377,21 +1434,16 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, nullptr);
}
U8* src = (U8*)(use_scratch ? scratch : pixels);
U8* src = (U8*)(pixels);
if (src)
{
LL_PROFILE_ZONE_NAMED("glTexImage2D copy");
sub_image_lines(target, miplevel, 0, 0, width, height, pixformat, pixtype, src, width);
}
}
alloc_tex_image(width, height, pixformat);
alloc_tex_image(width, height, intformat, 1);
}
stop_glerror();
if (use_scratch)
{
delete[] scratch;
}
}
//create an empty GL texture: just create a texture name
@ -2373,11 +2425,11 @@ bool LLImageGL::scaleDown(S32 desired_discard)
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, temp_texname, true);
{
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glTexImage2D");
glTexImage2D(mTarget, 0, mFormatPrimary, desired_width, desired_height, 0, mFormatPrimary, mFormatType, NULL);
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, NULL);
}
// account for new texture getting created
alloc_tex_image(desired_width, desired_height, mFormatPrimary);
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
// Use render-to-texture to scale down the texture
{
@ -2431,10 +2483,10 @@ bool LLImageGL::scaleDown(S32 desired_discard)
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, sScratchPBO);
glTexImage2D(mTarget, 0, mFormatPrimary, desired_width, desired_height, 0, mFormatPrimary, mFormatType, nullptr);
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, nullptr);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
alloc_tex_image(desired_width, desired_height, mFormatPrimary);
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
if (mHasMipMaps)
{

View File

@ -50,7 +50,7 @@ class LLWindow;
namespace LLImageGLMemory
{
void alloc_tex_image(U32 width, U32 height, U32 pixformat);
void alloc_tex_image(U32 width, U32 height, U32 intformat, U32 count);
void free_tex_image(U32 texName);
void free_tex_images(U32 count, const U32* texNames);
void free_cur_tex_image();
@ -101,9 +101,9 @@ public:
static bool create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, bool usemipmaps = true);
public:
LLImageGL(bool usemipmaps = true);
LLImageGL(U32 width, U32 height, U8 components, bool usemipmaps = true);
LLImageGL(const LLImageRaw* imageraw, bool usemipmaps = true);
LLImageGL(bool usemipmaps = true, bool allow_compression = true);
LLImageGL(U32 width, U32 height, U8 components, bool usemipmaps = true, bool allow_compression = true);
LLImageGL(const LLImageRaw* imageraw, bool usemipmaps = true, bool allow_compression = true);
// For wrapping textures created via GL elsewhere with our API only. Use with caution.
LLImageGL(LLGLuint mTexName, U32 components, LLGLenum target, LLGLint formatInternal, LLGLenum formatPrimary, LLGLenum formatType, LLTexUnit::eTextureAddressMode addressMode);
@ -206,7 +206,7 @@ public:
LLGLenum getTexTarget()const { return mTarget; }
void init(bool usemipmaps);
void init(bool usemipmaps, bool allow_compression);
virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors
void setNeedsAlphaAndPickMask(bool need_mask);

View File

@ -475,12 +475,10 @@ void LLRenderTarget::clear(U32 mask_in)
U32 LLRenderTarget::getTexture(U32 attachment) const
{
if (attachment > mTex.size()-1)
{
LL_ERRS() << "Invalid attachment index." << LL_ENDL;
}
if (mTex.empty())
if (attachment >= mTex.size())
{
LL_WARNS() << "Invalid attachment index " << attachment << " for size " << mTex.size() << LL_ENDL;
llassert(false);
return 0;
}
return mTex[attachment];

View File

@ -1 +1 @@
7.1.10
7.1.11

View File

@ -407,22 +407,19 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, bool textu
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
{
LLDrawInfo* pparams = *k;
if (pparams)
{
if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)
if (uploadMatrixPalette(pparams->mAvatar, pparams->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
uploadMatrixPalette(*pparams);
lastAvatar = pparams->mAvatar;
lastMeshId = pparams->mSkinInfo->mHash;
pushBatch(*pparams, texture);
}
pushBatch(*pparams, texture);
}
}
}
@ -468,8 +465,9 @@ void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures
if (texture)
{
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
@ -477,14 +475,10 @@ void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures
LLDrawInfo* pparams = *i;
LLCullResult::increment_iterator(i, end);
if (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash))
if (uploadMatrixPalette(pparams->mAvatar, pparams->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
uploadMatrixPalette(*pparams);
lastAvatar = pparams->mAvatar;
lastMeshId = pparams->mSkinInfo->mHash;
pushBatch(*pparams, texture, batch_textures);
}
pushBatch(*pparams, texture, batch_textures);
}
}
else
@ -496,8 +490,9 @@ void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures
void LLRenderPass::pushUntexturedRiggedBatches(U32 type)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
@ -505,14 +500,10 @@ void LLRenderPass::pushUntexturedRiggedBatches(U32 type)
LLDrawInfo* pparams = *i;
LLCullResult::increment_iterator(i, end);
if (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash))
if (uploadMatrixPalette(pparams->mAvatar, pparams->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
uploadMatrixPalette(*pparams);
lastAvatar = pparams->mAvatar;
lastMeshId = pparams->mSkinInfo->mHash;
pushUntexturedBatch(*pparams);
}
pushUntexturedBatch(*pparams);
}
}
@ -533,8 +524,9 @@ void LLRenderPass::pushMaskBatches(U32 type, bool texture, bool batch_textures)
void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_textures)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
@ -545,23 +537,12 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_text
llassert(pparams);
if (LLGLSLShader::sCurBoundShaderPtr)
{
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
}
else
{
gGL.flush();
}
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)
if (uploadMatrixPalette(pparams->mAvatar, pparams->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
uploadMatrixPalette(*pparams);
lastAvatar = pparams->mAvatar;
lastMeshId = pparams->mSkinInfo->mHash;
pushBatch(*pparams, texture, batch_textures);
}
pushBatch(*pparams, texture, batch_textures);
}
}
@ -667,6 +648,8 @@ bool LLRenderPass::uploadMatrixPalette(LLDrawInfo& params)
//static
bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
if (!avatar)
{
return false;
@ -688,6 +671,81 @@ bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinI
return true;
}
// Returns true if rendering should proceed
//static
bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo, const LLVOAvatar*& lastAvatar, U64& lastMeshId, bool& skipLastSkin)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
llassert(skinInfo);
llassert(LLGLSLShader::sCurBoundShaderPtr);
if (!avatar)
{
return false;
}
if (avatar == lastAvatar && skinInfo->mHash == lastMeshId)
{
return !skipLastSkin;
}
const LLVOAvatar::MatrixPaletteCache& mpc = avatar->updateSkinInfoMatrixPalette(skinInfo);
U32 count = static_cast<U32>(mpc.mMatrixPalette.size());
// skipLastSkin -> skin info not loaded yet, don't render
skipLastSkin = !bool(count);
lastAvatar = avatar;
lastMeshId = skinInfo->mHash;
if (!skipLastSkin)
{
LLGLSLShader::sCurBoundShaderPtr->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
count,
false,
(GLfloat*)&(mpc.mGLMp[0]));
}
return !skipLastSkin;
}
// Returns true if rendering should proceed
//static
bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo, const LLVOAvatar*& lastAvatar, U64& lastMeshId, const LLGLSLShader*& lastAvatarShader, bool& skipLastSkin)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
llassert(skinInfo);
llassert(LLGLSLShader::sCurBoundShaderPtr);
if (!avatar)
{
return false;
}
if (avatar == lastAvatar && skinInfo->mHash == lastMeshId && lastAvatarShader == LLGLSLShader::sCurBoundShaderPtr)
{
return !skipLastSkin;
}
const LLVOAvatar::MatrixPaletteCache& mpc = avatar->updateSkinInfoMatrixPalette(skinInfo);
U32 count = static_cast<U32>(mpc.mMatrixPalette.size());
// skipLastSkin -> skin info not loaded yet, don't render
skipLastSkin = !bool(count);
lastAvatar = avatar;
lastMeshId = skinInfo->mHash;
lastAvatarShader = LLGLSLShader::sCurBoundShaderPtr;
if (!skipLastSkin)
{
LLGLSLShader::sCurBoundShaderPtr->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
count,
false,
(GLfloat*)&(mpc.mGLMp[0]));
}
return !skipLastSkin;
}
void setup_texture_matrix(LLDrawInfo& params)
{
if (params.mTextureMatrix)
@ -717,7 +775,7 @@ void LLRenderPass::pushGLTFBatches(U32 type, bool textured)
}
else
{
pushRiggedGLTFBatches(type);
pushUntexturedGLTFBatches(type);
}
}
@ -801,8 +859,9 @@ void LLRenderPass::pushRiggedGLTFBatches(U32 type, bool textured)
void LLRenderPass::pushRiggedGLTFBatches(U32 type)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
@ -812,15 +871,16 @@ void LLRenderPass::pushRiggedGLTFBatches(U32 type)
LLDrawInfo& params = **i;
LLCullResult::increment_iterator(i, end);
pushRiggedGLTFBatch(params, lastAvatar, lastMeshId);
pushRiggedGLTFBatch(params, lastAvatar, lastMeshId, skipLastSkin);
}
}
void LLRenderPass::pushUntexturedRiggedGLTFBatches(U32 type)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
@ -830,34 +890,26 @@ void LLRenderPass::pushUntexturedRiggedGLTFBatches(U32 type)
LLDrawInfo& params = **i;
LLCullResult::increment_iterator(i, end);
pushUntexturedRiggedGLTFBatch(params, lastAvatar, lastMeshId);
pushUntexturedRiggedGLTFBatch(params, lastAvatar, lastMeshId, skipLastSkin);
}
}
// static
void LLRenderPass::pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId)
void LLRenderPass::pushRiggedGLTFBatch(LLDrawInfo& params, const LLVOAvatar*& lastAvatar, U64& lastMeshId, bool& skipLastSkin)
{
if (params.mAvatar.notNull() && (lastAvatar != params.mAvatar || lastMeshId != params.mSkinInfo->mHash))
if (uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
uploadMatrixPalette(params);
lastAvatar = params.mAvatar;
lastMeshId = params.mSkinInfo->mHash;
pushGLTFBatch(params);
}
pushGLTFBatch(params);
}
// static
void LLRenderPass::pushUntexturedRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId)
void LLRenderPass::pushUntexturedRiggedGLTFBatch(LLDrawInfo& params, const LLVOAvatar*& lastAvatar, U64& lastMeshId, bool& skipLastSkin)
{
if (params.mAvatar.notNull() && (lastAvatar != params.mAvatar || lastMeshId != params.mSkinInfo->mHash))
if (uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
uploadMatrixPalette(params);
lastAvatar = params.mAvatar;
lastMeshId = params.mSkinInfo->mHash;
pushUntexturedGLTFBatch(params);
}
pushUntexturedGLTFBatch(params);
}

View File

@ -38,6 +38,7 @@ class LLViewerFetchedTexture;
class LLSpatialGroup;
class LLDrawInfo;
class LLVOAvatar;
class LLGLSLShader;
class LLMeshSkinInfo;
class LLDrawPool
@ -375,9 +376,9 @@ public:
// push a single GLTF draw call
static void pushGLTFBatch(LLDrawInfo& params);
static void pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId);
static void pushRiggedGLTFBatch(LLDrawInfo& params, const LLVOAvatar*& lastAvatar, U64& lastMeshId, bool& skipLastSkin);
static void pushUntexturedGLTFBatch(LLDrawInfo& params);
static void pushUntexturedRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId);
static void pushUntexturedRiggedGLTFBatch(LLDrawInfo& params, const LLVOAvatar*& lastAvatar, U64& lastMeshId, bool& skipLastSkin);
void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
void pushRiggedMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
@ -386,6 +387,8 @@ public:
void pushBumpBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
static bool uploadMatrixPalette(LLDrawInfo& params);
static bool uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo);
static bool uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo, const LLVOAvatar*& lastAvatar, U64& lastMeshId, bool& skipLastSkin);
static bool uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo, const LLVOAvatar*& lastAvatar, U64& lastMeshId, const LLGLSLShader*& lastAvatarShader, bool& skipLastSkin);
virtual void renderGroup(LLSpatialGroup* group, U32 type, bool texture = true);
virtual void renderRiggedGroup(LLSpatialGroup* group, U32 type, bool texture = true);
};

View File

@ -333,8 +333,9 @@ void LLDrawPoolAlpha::renderAlphaHighlight()
{
for (int pass = 0; pass < 2; ++pass)
{ //two passes, one rigged and one not
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
LLCullResult::sg_iterator begin = pass == 0 ? gPipeline.beginAlphaGroups() : gPipeline.beginRiggedAlphaGroups();
LLCullResult::sg_iterator end = pass == 0 ? gPipeline.endAlphaGroups() : gPipeline.endRiggedAlphaGroups();
@ -353,6 +354,15 @@ void LLDrawPoolAlpha::renderAlphaHighlight()
bool rigged = (params.mAvatar != nullptr);
gHighlightProgram.bind(rigged);
if (rigged)
{
if (!uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{ // failed to upload matrix palette, skip rendering
continue;
}
}
// <FS:Beq> FIRE-32132 et al. Allow rigged mesh transparency highlights to be toggled
if (rigged && !sShowDebugAlphaRigged)
{
@ -367,21 +377,6 @@ void LLDrawPoolAlpha::renderAlphaHighlight()
else // NB dangling else to drop through to "normal behaviour"
// </FS:Beq>
gGL.diffuseColor4f(1, 0, 0, 1);
if (rigged)
{
if (lastAvatar != params.mAvatar ||
lastMeshId != params.mSkinInfo->mHash)
{
if (!uploadMatrixPalette(params))
{
continue;
}
lastAvatar = params.mAvatar;
lastMeshId = params.mSkinInfo->mHash;
}
}
LLRenderPass::applyModelMatrix(params);
params.mVertexBuffer->setBuffer();
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
@ -545,25 +540,20 @@ void LLDrawPoolAlpha::renderRiggedEmissives(std::vector<LLDrawInfo*>& emissives)
shader->bind();
shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, 1.f);
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
for (LLDrawInfo* draw : emissives)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("Emissives");
bool tex_setup = TexSetup(draw, false);
if (lastAvatar != draw->mAvatar || lastMeshId != draw->mSkinInfo->mHash)
if (uploadMatrixPalette(draw->mAvatar, draw->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
if (!uploadMatrixPalette(*draw))
{ // failed to upload matrix palette, skip rendering
continue;
}
lastAvatar = draw->mAvatar;
lastMeshId = draw->mSkinInfo->mHash;
bool tex_setup = TexSetup(draw, false);
drawEmissive(draw);
RestoreTexSetup(tex_setup);
}
drawEmissive(draw);
RestoreTexSetup(tex_setup);
}
}
@ -572,19 +562,15 @@ void LLDrawPoolAlpha::renderRiggedPbrEmissives(std::vector<LLDrawInfo*>& emissiv
LLGLDepthTest depth(GL_TRUE, GL_FALSE); //disable depth writes since "emissive" is additive so sorting doesn't matter
pbr_emissive_shader->bind(true);
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
for (LLDrawInfo* draw : emissives)
{
if (lastAvatar != draw->mAvatar || lastMeshId != draw->mSkinInfo->mHash)
{
if (!uploadMatrixPalette(*draw))
{ // failed to upload matrix palette, skip rendering
continue;
}
lastAvatar = draw->mAvatar;
lastMeshId = draw->mSkinInfo->mHash;
if (!uploadMatrixPalette(draw->mAvatar, draw->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{ // failed to upload matrix palette, skip rendering
continue;
}
LLGLDisable cull_face(draw->mGLTFMaterial->mDoubleSided ? GL_CULL_FACE : 0);
@ -600,9 +586,10 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
bool initialized_lighting = false;
bool light_enabled = true;
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
LLGLSLShader* lastAvatarShader = nullptr;
const LLGLSLShader* lastAvatarShader = nullptr;
bool skipLastSkin = false;
LLCullResult::sg_iterator begin;
LLCullResult::sg_iterator end;
@ -804,20 +791,9 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
}
}
if (params.mAvatar != nullptr)
if (params.mAvatar && !uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, lastAvatarShader, skipLastSkin))
{
if (lastAvatar != params.mAvatar ||
lastMeshId != params.mSkinInfo->mHash ||
lastAvatarShader != LLGLSLShader::sCurBoundShaderPtr)
{
if (!uploadMatrixPalette(params))
{
continue;
}
lastAvatar = params.mAvatar;
lastMeshId = params.mSkinInfo->mHash;
lastAvatarShader = LLGLSLShader::sCurBoundShaderPtr;
}
continue;
}
bool tex_setup = TexSetup(&params, (mat != nullptr));
@ -940,26 +916,3 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
gPipeline.enableLightsDynamic();
}
}
bool LLDrawPoolAlpha::uploadMatrixPalette(const LLDrawInfo& params)
{
if (params.mAvatar.isNull())
{
return false;
}
const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar.get()->updateSkinInfoMatrixPalette(params.mSkinInfo);
U32 count = static_cast<U32>(mpc.mMatrixPalette.size());
if (count == 0)
{
//skin info not loaded yet, don't render
return false;
}
LLGLSLShader::sCurBoundShaderPtr->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
count,
false,
(GLfloat*)&(mpc.mGLMp[0]));
return true;
}

View File

@ -66,7 +66,6 @@ public:
void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, bool texture = true);
void renderAlpha(U32 mask, bool depth_only = false, bool rigged = false);
void renderAlphaHighlight();
bool uploadMatrixPalette(const LLDrawInfo& params);
static bool sShowDebugAlpha;
static bool sShowDebugAlphaRigged;

View File

@ -561,8 +561,9 @@ void LLDrawPoolBump::renderDeferred(S32 pass)
LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
LLVOAvatar* avatar = nullptr;
U64 skin = 0;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
{
@ -575,13 +576,10 @@ void LLDrawPoolBump::renderDeferred(S32 pass)
if (rigged)
{
if (avatar != params.mAvatar || skin != params.mSkinInfo->mHash)
if (uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
uploadMatrixPalette(params);
avatar = params.mAvatar;
skin = params.mSkinInfo->mHash;
pushBumpBatch(params, true, false);
}
pushBumpBatch(params, true, false);
}
else
{
@ -981,8 +979,9 @@ void LLBumpImageList::onSourceUpdated(LLViewerTexture* src, EBumpEffect bump_cod
void LLDrawPoolBump::pushBumpBatches(U32 type)
{
LLVOAvatar* avatar = nullptr;
U64 skin = 0;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
if (mRigged)
{ // nudge type enum and include skinweights for rigged pass
@ -1000,17 +999,9 @@ void LLDrawPoolBump::pushBumpBatches(U32 type)
{
if (mRigged)
{
if (avatar != params.mAvatar || skin != params.mSkinInfo->mHash)
if (!uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
if (uploadMatrixPalette(params))
{
avatar = params.mAvatar;
skin = params.mSkinInfo->mHash;
}
else
{
continue;
}
continue;
}
}
pushBumpBatch(params, false);

View File

@ -183,7 +183,9 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
glUniform4fv(specular, 1, lastSpecular.mV);
}
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
{
@ -245,23 +247,11 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
}
// upload matrix palette to shader
if (rigged && params.mAvatar.notNull())
if (rigged)
{
if (params.mAvatar != lastAvatar)
if (!uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar->updateSkinInfoMatrixPalette(params.mSkinInfo);
U32 count = static_cast<U32>(mpc.mMatrixPalette.size());
if (count == 0)
{
//skin info not loaded yet, don't render
return;
}
mShader->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
count,
false,
(GLfloat*)&(mpc.mGLMp[0]));
continue;
}
}

View File

@ -854,11 +854,6 @@ bool LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
const LLVolumeFace &face = volume.getVolumeFace(f);
LL_DEBUGS("RiggedBox") << "updating extents for face " << f
<< " starting extents " << mExtents[0] << ", " << mExtents[1]
<< " starting vf extents " << face.mExtents[0] << ", " << face.mExtents[1]
<< " num verts " << face.mNumVertices << LL_ENDL;
// MAINT-8264 - stray vertices, especially in low LODs, cause bounding box errors.
if (face.mNumVertices < 3)
{
@ -877,21 +872,14 @@ bool LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
matMulBoundBox(mat_vert, face.mExtents, mExtents);
LL_DEBUGS("RiggedBox") << "updated extents for face " << f
<< " bbox gave extents " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
if (!mDrawablep->isActive())
{ // Shift position for region
LLVector4a offset;
offset.load3(mDrawablep->getRegion()->getOriginAgent().mV);
mExtents[0].add(offset);
mExtents[1].add(offset);
LL_DEBUGS("RiggedBox") << "updating extents for face " << f
<< " not active, added offset " << offset << LL_ENDL;
}
LL_DEBUGS("RiggedBox") << "updated extents for face " << f
<< " to " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
LLVector4a t;
t.setAdd(mExtents[0],mExtents[1]);
t.mul(0.5f);

View File

@ -426,8 +426,6 @@ bool LLFloaterIMSession::postBuild()
add_btn->setEnabled(isInviteAllowed());
add_btn->setClickedCallback(boost::bind(&LLFloaterIMSession::onAddButtonClicked, this));
childSetAction("voice_call_btn", boost::bind(&LLFloaterIMSession::onCallButtonClicked, this));
LLVoiceClient::addObserver(this);
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
@ -609,23 +607,6 @@ void LLFloaterIMSession::boundVoiceChannel()
}
}
void LLFloaterIMSession::onCallButtonClicked()
{
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
if (voice_channel)
{
bool is_call_active = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED;
if (is_call_active)
{
gIMMgr->endCall(mSessionID);
}
else
{
gIMMgr->startCall(mSessionID);
}
}
}
void LLFloaterIMSession::onChange(EStatusType status, const LLSD& channelInfo, bool proximal)
{
if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL)

View File

@ -161,8 +161,6 @@ private:
void sendParticipantsAddedNotification(const uuid_vec_t& uuids);
bool canAddSelectedToChat(const uuid_vec_t& uuids);
void onCallButtonClicked();
void onVoiceChannelChanged(const LLUUID &session_id);
void boundVoiceChannel();

View File

@ -304,6 +304,7 @@ bool LLFloaterIMSessionTab::postBuild()
mGearBtn = getChild<LLButton>("gear_btn");
mAddBtn = getChild<LLButton>("add_btn");
mVoiceButton = getChild<LLButton>("voice_call_btn");
mVoiceButton->setClickedCallback([this](LLUICtrl*, const LLSD&) { onCallButtonClicked(); });
mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
mRightPartPanel = getChild<LLLayoutPanel>("right_part_holder");
@ -436,16 +437,34 @@ void LLFloaterIMSessionTab::draw()
void LLFloaterIMSessionTab::enableDisableCallBtn()
{
if (LLVoiceClient::instanceExists() && mVoiceButton)
if (!mVoiceButton)
return;
bool enable = false;
if (mSessionID.notNull() && mSession && mSession->mSessionInitialized && mSession->mCallBackEnabled)
{
mVoiceButton->setEnabled(
mSessionID.notNull()
&& mSession
&& mSession->mSessionInitialized
&& LLVoiceClient::getInstance()->voiceEnabled()
&& LLVoiceClient::getInstance()->isVoiceWorking()
&& mSession->mCallBackEnabled);
if (mVoiceButtonHangUpMode)
{
// We allow to hang up from any state
enable = true;
}
else
{
// We allow to start call from this state only
if (mSession->mVoiceChannel->getState() == LLVoiceChannel::STATE_NO_CHANNEL_INFO &&
LLVoiceClient::instanceExists())
{
LLVoiceClient* client = LLVoiceClient::getInstance();
if (client->voiceEnabled() && client->isVoiceWorking())
{
enable = true;
}
}
}
}
mVoiceButton->setEnabled(enable);
}
// virtual
@ -468,6 +487,25 @@ void LLFloaterIMSessionTab::onFocusLost()
super::onFocusLost();
}
void LLFloaterIMSessionTab::onCallButtonClicked()
{
if (mVoiceButtonHangUpMode)
{
// We allow to hang up from any state
gIMMgr->endCall(mSessionID);
}
else
{
LLVoiceChannel::EState channel_state = mSession && mSession->mVoiceChannel ?
mSession->mVoiceChannel->getState() : LLVoiceChannel::STATE_NO_CHANNEL_INFO;
// We allow to start call from this state only
if (channel_state == LLVoiceChannel::STATE_NO_CHANNEL_INFO)
{
gIMMgr->startCall(mSessionID);
}
}
}
void LLFloaterIMSessionTab::onInputEditorClicked()
{
LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
@ -1042,6 +1080,7 @@ void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive)
{
mVoiceButton->setImageOverlay(callIsActive? getString("call_btn_stop") : getString("call_btn_start"));
mVoiceButton->setToolTip(callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip"));
mVoiceButtonHangUpMode = callIsActive;
enableDisableCallBtn();
}

View File

@ -200,6 +200,11 @@ protected:
LLButton* mAddBtn;
LLButton* mVoiceButton;
// Since mVoiceButton can work in one of two modes, "Start call" or "Hang up",
// (with different images and tooltips depending on the currently chosen mode)
// we should track the mode we're currently using to react on click accordingly
bool mVoiceButtonHangUpMode { false };
private:
// Handling selection and contextual menu
void doToSelected(const LLSD& userdata);
@ -218,6 +223,8 @@ private:
*/
void reshapeChatLayoutPanel();
void onCallButtonClicked();
void onInputEditorClicked();
void onEmojiRecentPanelToggleBtnClicked();

View File

@ -1445,7 +1445,7 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data
std::string caption_text = getString("CaptionTextAcctInfo", args);
getChild<LLUICtrl>("account_info")->setValue(caption_text);
const S32 LINDEN_EMPLOYEE_INDEX = 3;
constexpr S32 LINDEN_EMPLOYEE_INDEX = 3;
LLDate sl_release;
sl_release.fromYMDHMS(2003, 6, 23, 0, 0, 0);
std::string customer_lower = avatar_data->customer_type;
@ -1539,7 +1539,7 @@ void LLPanelProfileSecondLife::fillRightsData()
// If true - we are viewing friend's profile, enable check boxes and set values.
if (relation)
{
S32 rights = relation->getRightsGrantedTo();
const S32 rights = relation->getRightsGrantedTo();
bool can_see_online = LLRelationship::GRANT_ONLINE_STATUS & rights;
bool can_see_on_map = LLRelationship::GRANT_MAP_LOCATION & rights;
bool can_edit_objects = LLRelationship::GRANT_MODIFY_OBJECTS & rights;
@ -1720,7 +1720,7 @@ void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id)
void LLPanelProfileSecondLife::updateOnlineStatus()
{
const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
if (relationship != NULL)
if (relationship)
{
// For friend let check if he allowed me to see his status
bool online = relationship->isOnline();
@ -1897,7 +1897,7 @@ void LLProfileImagePicker::notify(const std::vector<std::string>& filenames)
// generate a temp texture file for coroutine
std::string temp_file = gDirUtilp->getTempFilename();
U32 codec = LLImageBase::getCodecFromExtension(gDirUtilp->getExtension(file_path));
const S32 MAX_DIM = 256;
constexpr S32 MAX_DIM = 256;
if (!LLViewerTextureList::createUploadFile(file_path, temp_file, codec, MAX_DIM))
{
LLSD notif_args;
@ -2305,7 +2305,7 @@ void LLPanelProfileSecondLife::onDiscardDescriptionChanges()
void LLPanelProfileSecondLife::onShowAgentPermissionsDialog()
{
LLFloater *floater = mFloaterPermissionsHandle.get();
LLFloater* floater = mFloaterPermissionsHandle.get();
if (!floater)
{
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
@ -2333,7 +2333,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture()
return;
}
LLFloater *floater = mFloaterProfileTextureHandle.get();
LLFloater* floater = mFloaterProfileTextureHandle.get();
if (!floater)
{
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
@ -2525,8 +2525,9 @@ void LLPanelProfileSecondLife::updateRlvRestrictions(ERlvBehaviour behavior)
LLPanelProfileWeb::LLPanelProfileWeb()
: LLPanelProfileTab()
, mWebBrowser(NULL)
, mWebBrowser(nullptr)
, mAvatarNameCacheConnection()
, mFirstNavigate(false)
{
}

View File

@ -80,6 +80,9 @@ void load_exr(const std::string& filename)
gGL.getTexUnit(0)->bind(gEXRImage);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, width, height, 0, GL_RGBA, GL_FLOAT, out);
LLImageGLMemory::alloc_tex_image(width, height, GL_RGB16F, 1);
free(out); // release memory of image data
glGenerateMipmap(GL_TEXTURE_2D);

View File

@ -29,7 +29,6 @@
#include "llspatialpartition.h"
#include "llappviewer.h"
#include "llcallstack.h"
#include "lltexturecache.h"
#include "lltexturefetch.h"
#include "llimageworker.h"
@ -763,14 +762,6 @@ bool LLSpatialGroup::changeLOD()
if (fabsf(ratio) >= getSpatialPartition()->mSlopRatio)
{
LL_DEBUGS("RiggedBox") << "changeLOD true because of ratio compare "
<< fabsf(ratio) << " " << getSpatialPartition()->mSlopRatio << LL_ENDL;
LL_DEBUGS("RiggedBox") << "sg " << this << "\nmDistance " << mDistance
<< " mLastUpdateDistance " << mLastUpdateDistance
<< " mRadius " << mRadius
<< " fab ratio " << fabsf(ratio)
<< " slop " << getSpatialPartition()->mSlopRatio << LL_ENDL;
return true;
}
}
@ -1699,8 +1690,9 @@ void renderOctree(LLSpatialGroup* group)
gGL.setLineWidth(1.f); // <FS> Line width OGL core profile fix by Rye Mutt
gGL.flush();
LLVOAvatar* lastAvatar = nullptr;
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin = false;
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
{
@ -1729,15 +1721,9 @@ void renderOctree(LLSpatialGroup* group)
{
gGL.pushMatrix();
gGL.loadMatrix(gGLModelView);
if (lastAvatar != face->mAvatar ||
lastMeshId != face->mSkinInfo->mHash)
if (!LLRenderPass::uploadMatrixPalette(face->mAvatar, face->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
if (!LLRenderPass::uploadMatrixPalette(face->mAvatar, face->mSkinInfo))
{
continue;
}
lastAvatar = face->mAvatar;
lastMeshId = face->mSkinInfo->mHash;
continue;
}
}
for (S32 j = 0; j < drawable->getNumFaces(); j++)

View File

@ -28,7 +28,6 @@
#include "llappviewer.h"
#include "llstartup.h"
#include "llcallstack.h"
#if LL_WINDOWS
# include <process.h> // _spawnl()

View File

@ -550,9 +550,9 @@ void LLGLTexMemBar::draw()
F64 raw_image_bytes_MB = raw_image_bytes / (1024.0 * 1024.0);
F64 saved_raw_image_bytes_MB = saved_raw_image_bytes / (1024.0 * 1024.0);
F64 aux_raw_image_bytes_MB = aux_raw_image_bytes / (1024.0 * 1024.0);
F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 1024.0 * 1.3333f; // add 33% for mipmaps
F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 1024.0;
F64 render_bytes_alloc = LLRenderTarget::sBytesAllocated / 1024.0 / 1024.0;
F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0;
F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 512.0;
F64 render_bytes_alloc = LLRenderTarget::sBytesAllocated / 1024.0 / 512.0;
//----------------------------------------------------------------------------
LLGLSUIDefault gls_ui;
@ -664,7 +664,7 @@ void LLGLTexMemBar::draw()
texture_bytes_alloc,
vertex_bytes_alloc,
render_bytes_alloc,
texture_bytes_alloc+vertex_bytes_alloc+render_bytes_alloc);
texture_bytes_alloc+vertex_bytes_alloc);
LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height * 6,
text_color, LLFontGL::LEFT, LLFontGL::TOP);

View File

@ -103,7 +103,6 @@
#include "llfloaterperms.h"
#include "llvocache.h"
#include "llcleanup.h"
#include "llcallstack.h"
#include "llmeshrepository.h"
#include "llgltfmateriallist.h"
#include "llgl.h"
@ -164,7 +163,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
{
LL_PROFILE_ZONE_SCOPED;
//LL_DEBUGS("ObjectUpdate") << "creating " << id << LL_ENDL;
//dumpStack("ObjectUpdateStack");
LLViewerObject *res = NULL;
@ -1219,7 +1217,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
LL_DEBUGS_ONCE("SceneLoadTiming") << "Received viewer object data" << LL_ENDL;
LL_DEBUGS("ObjectUpdate") << " mesgsys " << mesgsys << " dp " << dp << " id " << getID() << " update_type " << (S32) update_type << LL_ENDL;
dumpStack("ObjectUpdateStack");
// The new OBJECTDATA_FIELD_SIZE_124, OBJECTDATA_FIELD_SIZE_140, OBJECTDATA_FIELD_SIZE_80
// and OBJECTDATA_FIELD_SIZE_64 lengths should be supported in the existing cases below.

View File

@ -68,7 +68,6 @@
#include "u64.h"
#include "llviewertexturelist.h"
#include "lldatapacker.h"
#include "llcallstack.h"
#ifdef LL_USESYSTEMLIBS
#include <zlib.h>
#else
@ -261,7 +260,6 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
// ignore returned flags
LL_DEBUGS("ObjectUpdate") << "uuid " << objectp->mID << " calling processUpdateMessage "
<< objectp << " just_created " << just_created << " from_cache " << from_cache << " msg " << msg << LL_ENDL;
dumpStack("ObjectUpdateStack");
objectp->processUpdateMessage(msg, user_data, i, update_type, dpp);
@ -410,7 +408,6 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry*
objectp = createObjectFromCache(pcode, regionp, fullid, entry->getLocalID());
LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " created objectp " << objectp << LL_ENDL;
dumpStack("ObjectUpdateStack");
if (!objectp)
{
@ -605,7 +602,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " objectp " << objectp
<< " update_cache " << (S32) update_cache << " compressed " << compressed
<< " update_type " << update_type << LL_ENDL;
dumpStack("ObjectUpdateStack");
if(update_cache)
{
@ -697,7 +693,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender());
LL_DEBUGS("ObjectUpdate") << "creating object " << fullid << " result " << objectp << LL_ENDL;
dumpStack("ObjectUpdateStack");
if (!objectp)
{
@ -795,7 +790,6 @@ void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys,
mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
LL_DEBUGS("ObjectUpdate") << "got probe for id " << id << " crc " << crc << LL_ENDL;
dumpStack("ObjectUpdateStack");
// Lookup data packer and add this id to cache miss lists if necessary.
U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE;
@ -1482,7 +1476,6 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
// Remove from object map so noone can look it up.
LL_DEBUGS("ObjectUpdate") << " dereferencing id " << objectp->mID << LL_ENDL;
dumpStack("ObjectUpdateStack");
mUUIDObjectMap.erase(objectp->mID);
@ -2163,7 +2156,6 @@ LLViewerObject *LLViewerObjectList::createObjectFromCache(const LLPCode pcode, L
llassert_always(uuid.notNull());
LL_DEBUGS("ObjectUpdate") << "creating " << uuid << " local_id " << local_id << LL_ENDL;
dumpStack("ObjectUpdateStack");
LLViewerObject *objectp = LLViewerObject::createObject(uuid, pcode, regionp);
if (!objectp)
@ -2213,7 +2205,6 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
}
LL_DEBUGS("ObjectUpdate") << "createObject creating " << fullid << LL_ENDL;
dumpStack("ObjectUpdateStack");
LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp);
if (!objectp)

View File

@ -82,7 +82,6 @@
#include "llcoros.h"
#include "lleventcoro.h"
#include "llcorehttputil.h"
#include "llcallstack.h"
#include "llsettingsdaycycle.h"
#include <boost/regex.hpp>
@ -2921,7 +2920,6 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB
if (entry->getCRC() == crc)
{
LL_DEBUGS("AnimatedObjects") << " got dupe for local_id " << local_id << LL_ENDL;
dumpStack("AnimatedObjectsStack");
// Record a hit
entry->recordDupe();
@ -2930,7 +2928,6 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB
else //CRC changed
{
LL_DEBUGS("AnimatedObjects") << " got update for local_id " << local_id << LL_ENDL;
dumpStack("AnimatedObjectsStack");
// Update the cache entry
entry->updateEntry(crc, dp);
@ -2943,7 +2940,6 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB
else
{
LL_DEBUGS("AnimatedObjects") << " got first notification for local_id " << local_id << LL_ENDL;
dumpStack("AnimatedObjectsStack");
// we haven't seen this object before
// Create new entry and add to map

View File

@ -511,11 +511,10 @@ void LLViewerTexture::updateClass()
F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0;
F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 512.0;
F64 render_bytes_alloc = LLRenderTarget::sBytesAllocated / 1024.0 / 512.0;
// get an estimate of how much video memory we're using
// NOTE: our metrics miss about half the vram we use, so this biases high but turns out to typically be within 5% of the real number
F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc + render_bytes_alloc);
F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc);
F32 budget = max_vram_budget == 0 ? (F32)gGLManager.mVRAM : (F32)max_vram_budget;

View File

@ -115,7 +115,6 @@
#include "llsdutil.h"
#include "llscenemonitor.h"
#include "llsdserialize.h"
#include "llcallstack.h"
#include "llrendersphere.h"
#include "llskinningutil.h"
@ -2822,8 +2821,6 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
mNeedsExtentUpdate = ((thisFrame + mID.mData[0]) % upd_freq == 0);
}
// LLScopedContextString str("avatar_idle_update " + getFullname()); // <FS:Beq> remove unused scoped string
checkTextureLoading() ;
// force immediate pixel area update on avatars using last frames data (before drawable or camera updates)
@ -5331,10 +5328,6 @@ bool LLVOAvatar::updateCharacter(LLAgent &agent)
is_attachment = cav && cav->mRootVolp && cav->mRootVolp->isAttachment(); // For attached animated objects
}
LLScopedContextString str("updateCharacter " + getFullname() + " is_control_avatar "
+ boost::lexical_cast<std::string>(is_control_avatar)
+ " is_attachment " + boost::lexical_cast<std::string>(is_attachment));
// For fading out the names above heads, only let the timer
// run if we're visible.
if (mDrawable.notNull() && !visible)
@ -7144,8 +7137,6 @@ bool LLVOAvatar::jointIsRiggedTo(const LLJoint *joint) const
void LLVOAvatar::clearAttachmentOverrides()
{
LLScopedContextString str("clearAttachmentOverrides " + getFullname());
for (S32 i=0; i<LL_CHARACTER_MAX_ANIMATED_JOINTS; i++)
{
LLJoint *pJoint = getJoint(i);
@ -7176,10 +7167,7 @@ void LLVOAvatar::clearAttachmentOverrides()
//-----------------------------------------------------------------------------
void LLVOAvatar::rebuildAttachmentOverrides()
{
LLScopedContextString str("rebuildAttachmentOverrides " + getFullname());
LL_DEBUGS("AnimatedObjects") << "rebuilding" << LL_ENDL;
dumpStack("AnimatedObjectsStack");
clearAttachmentOverrides();
@ -7227,10 +7215,7 @@ void LLVOAvatar::rebuildAttachmentOverrides()
// -----------------------------------------------------------------------------
void LLVOAvatar::updateAttachmentOverrides()
{
LLScopedContextString str("updateAttachmentOverrides " + getFullname());
LL_DEBUGS("AnimatedObjects") << "updating" << LL_ENDL;
dumpStack("AnimatedObjectsStack");
std::set<LLUUID> meshes_seen;
@ -7359,15 +7344,12 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL
return;
}
LLScopedContextString str("addAttachmentOverridesForObject " + getFullname());
if (getOverallAppearance() != AOA_NORMAL)
{
return;
}
LL_DEBUGS("AnimatedObjects") << "adding" << LL_ENDL;
dumpStack("AnimatedObjectsStack");
// Process all children
if (recursive)

View File

@ -59,7 +59,6 @@
#include "llsdutil.h"
#include "llstartup.h"
#include "llsdserialize.h"
#include "llcallstack.h"
#include "llcorehttputil.h"
#include "lluiusage.h"

View File

@ -328,6 +328,16 @@ void LLVoiceChannel::setState(EState state)
void LLVoiceChannel::doSetState(const EState& new_state)
{
LL_DEBUGS("Voice") << "session '" << mSessionName << "' state " << mState << ", new_state " << new_state << ": "
<< (new_state == STATE_ERROR ? "ERROR" :
new_state == STATE_HUNG_UP ? "HUNG_UP" :
new_state == STATE_READY ? "READY" :
new_state == STATE_CALL_STARTED ? "CALL_STARTED" :
new_state == STATE_RINGING ? "RINGING" :
new_state == STATE_CONNECTED ? "CONNECTED" :
"NO_INFO")
<< LL_ENDL;
EState old_state = mState;
mState = new_state;

View File

@ -85,7 +85,6 @@
#include "llanimationstates.h"
#include "llinventorytype.h"
#include "llviewerinventory.h"
#include "llcallstack.h"
#include "llsculptidsize.h"
#include "llavatarappearancedefines.h"
#include "llgltfmateriallist.h"
@ -387,7 +386,6 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
sculpt_type = sculpt_params->getSculptType();
LL_DEBUGS("ObjectUpdate") << "uuid " << mID << " set sculpt_id " << sculpt_id << LL_ENDL;
dumpStack("ObjectUpdateStack");
}
if (!dp)
@ -1605,7 +1603,6 @@ bool LLVOVolume::calcLOD()
const LLVector3* box = avatar->getLastAnimExtents();
LLVector3 diag = box[1] - box[0];
radius = diag.magVec() * 0.5f;
LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL;
}
else
{
@ -1616,11 +1613,9 @@ bool LLVOVolume::calcLOD()
const LLVector3* box = avatar->getLastAnimExtents();
LLVector3 diag = box[1] - box[0];
radius = diag.magVec(); // preserve old BinRadius behavior - 2x off
LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL;
}
if (distance <= 0.f || radius <= 0.f)
{
LL_DEBUGS("DynamicBox","CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL;
return false;
}
}
@ -1630,7 +1625,6 @@ bool LLVOVolume::calcLOD()
radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length();
if (distance <= 0.f || radius <= 0.f)
{
LL_DEBUGS("DynamicBox","CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL;
return false;
}
}
@ -1718,13 +1712,6 @@ bool LLVOVolume::calcLOD()
if (cur_detail != mLOD)
{
LL_DEBUGS("DynamicBox","CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD
<< " distance " << distance << " radius " << radius << " rampDist " << rampDist
<< " drawable rigged? " << (mDrawable ? (S32) mDrawable->isState(LLDrawable::RIGGED) : (S32) -1)
<< " mRiggedVolume " << (void*)getRiggedVolume()
<< " distanceWRTCamera " << (mDrawable ? mDrawable->mDistanceWRTCamera : -1.f)
<< LL_ENDL;
mAppAngle = ll_round((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
mLOD = cur_detail;
@ -1938,11 +1925,6 @@ bool LLVOVolume::genBBoxes(bool force_global, bool should_update_octree_bounds)
bool any_valid_boxes = false;
if (getRiggedVolume())
{
LL_DEBUGS("RiggedBox") << "rebuilding box, volume face count " << getVolume()->getNumVolumeFaces() << " drawable face count " << mDrawable->getNumFaces() << LL_ENDL;
}
// There's no guarantee that getVolume()->getNumFaces() == mDrawable->getNumFaces()
for (S32 i = 0;
i < getVolume()->getNumVolumeFaces() && i < mDrawable->getNumFaces() && i < getNumTEs();
@ -1971,10 +1953,6 @@ bool LLVOVolume::genBBoxes(bool force_global, bool should_update_octree_bounds)
}
if (rebuild)
{
if (getRiggedVolume())
{
LL_DEBUGS("RiggedBox") << "rebuilding box, face " << i << " extents " << face->mExtents[0] << ", " << face->mExtents[1] << LL_ENDL;
}
if (!any_valid_boxes)
{
min = face->mExtents[0];
@ -5954,11 +5932,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
// apply any pending material overrides
gGLTFMaterialList.applyQueuedOverrides(vobj);
//<FS:Beq> Stop doing stupid stuff we don;t need to.
// Moving this inside a debug enabled check
// std::string vobj_name = llformat("Vol%p", vobj);
//</FS:Beq>
bool is_mesh = vobj->isMesh();
if (is_mesh)
{
@ -5982,32 +5955,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
const LLVector3& scale = vobj->getScale();
group->mSurfaceArea += volume->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
}
//<FS:Beq> Stop doing stupid stuff we don;t need on the critical path
//F32 est_tris = vobj->getEstTrianglesMax();
vobj->updateControlAvatar();
#if 0
std::string vobj_name = llformat("Vol%p", vobj);
F32 est_tris = vobj->getEstTrianglesMax();
LL_DEBUGS("AnimatedObjectsLinkset") << vobj_name << " rebuilding, isAttachment: " << (U32) vobj->isAttachment()
<< " is_mesh " << is_mesh
<< " est_tris " << est_tris
<< " is_animated " << vobj->isAnimatedObject()
<< " can_animate " << vobj->canBeAnimatedObject()
<< " cav " << vobj->getControlAvatar()
<< " lod " << vobj->getLOD()
<< " drawable rigged " << (drawablep->isState(LLDrawable::RIGGED))
<< " drawable state " << drawablep->getState()
<< " playing " << (U32) (vobj->getControlAvatar() ? vobj->getControlAvatar()->mPlaying : false)
<< " frame " << LLFrameTimer::getFrameCount()
<< LL_ENDL;
#endif
//<FS:Beq> Pointless. We already checked this and have used it.
//llassert_always(vobj);
// <FS:AO> Z's protection auto-derender code
if (enableVolumeSAPProtection())
{

View File

@ -6780,8 +6780,14 @@ void LLPipeline::renderAlphaObjects(bool rigged)
S32 sun_up = LLEnvironment::instance().getIsSunUp() ? 1 : 0;
U32 target_width = LLRenderTarget::sCurResX;
U32 type = LLRenderPass::PASS_ALPHA;
LLVOAvatar* lastAvatar = nullptr;
// for gDeferredShadowAlphaMaskProgram
const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
bool skipLastSkin;
// for gDeferredShadowGLTFAlphaBlendProgram
const LLVOAvatar* lastAvatarGLTF = nullptr;
U64 lastMeshIdGLTF = 0;
bool skipLastSkinGLTF;
auto* begin = gPipeline.beginRenderMap(type);
auto* end = gPipeline.endRenderMap(type);
@ -6805,7 +6811,7 @@ void LLPipeline::renderAlphaObjects(bool rigged)
LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up);
LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF);
LLRenderPass::pushRiggedGLTFBatch(*pparams, lastAvatar, lastMeshId);
LLRenderPass::pushRiggedGLTFBatch(*pparams, lastAvatarGLTF, lastMeshIdGLTF, skipLastSkinGLTF);
}
else
{
@ -6813,14 +6819,10 @@ void LLPipeline::renderAlphaObjects(bool rigged)
LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_up);
LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(ALPHA_BLEND_CUTOFF);
if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)
if (mSimplePool->uploadMatrixPalette(pparams->mAvatar, pparams->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
mSimplePool->uploadMatrixPalette(*pparams);
lastAvatar = pparams->mAvatar;
lastMeshId = pparams->mSkinInfo->mHash;
mSimplePool->pushBatch(*pparams, true, true);
}
mSimplePool->pushBatch(*pparams, true, true);
}
}
else