diff options
39 files changed, 453 insertions, 774 deletions
diff --git a/.clang-format b/.clang-format index 90124fb04b..f5a49845d0 100644 --- a/.clang-format +++ b/.clang-format @@ -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 diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp index 18c64282f1..7d62bb3a04 100644 --- a/indra/llappearance/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -34,7 +34,6 @@ #include "llpolymorph.h" #include "llwearable.h" #include "llfasttimer.h" -#include "llcallstack.h" #include "llpolyskeletaldistortion.h" @@ -204,11 +203,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); } diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index c2a10d969f..f31aa5d4c9 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -32,7 +32,6 @@ #include "lljoint.h" #include "llmath.h" -#include "llcallstack.h" #include <boost/algorithm/string.hpp> S32 LLJoint::sNumUpdates = 0; @@ -342,7 +341,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; } @@ -350,12 +348,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()) { @@ -879,7 +872,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; } @@ -887,12 +879,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(); diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index c4041f0c79..437b8d0168 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -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 diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp deleted file mode 100644 index c0be4f598e..0000000000 --- a/indra/llcommon/llcallstack.cpp +++ /dev/null @@ -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); -} diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h deleted file mode 100644 index ad10a9dbf7..0000000000 --- a/indra/llcommon/llcallstack.h +++ /dev/null @@ -1,87 +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); - -#define dumpStack(tag) \ - LL_DEBUGS(tag) << "STACK:\n" \ - << "====================\n" \ - << LLCallStack() \ - << "====================" \ - << LL_ENDL; diff --git a/indra/llinventory/llpermissionsflags.h b/indra/llinventory/llpermissionsflags.h index aaf1fd3afb..0ab4de0ab2 100644 --- a/indra/llinventory/llpermissionsflags.h +++ b/indra/llinventory/llpermissionsflags.h @@ -37,48 +37,48 @@ 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 // 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 diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 644476460c..c5d6076b98 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -1126,8 +1126,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. diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index be69b997da..4f5e13765a 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -125,27 +125,25 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us mImage->setHasMipMaps(use_mips); bind(0); + free_cur_tex_image(); U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F; - U32 mip = 0; - - free_cur_tex_image(); - - while (resolution >= 1) + 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); diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index 46c2e89797..ee9cfd0719 100644 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -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. diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 058afa0cf2..d5f7949051 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -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; - } + 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; + } - 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]; - } + 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; } - pixformat = GL_RGBA; - intformat = GL_RGBA8; + 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 lum = ((U8*)pixels)[i * 2 + 0]; - U8 alpha = ((U8*)pixels)[i * 2 + 1]; + 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]; + } - U8* pix = (U8*)&scratch[i]; - pix[0] = pix[1] = pix[2] = lum; - pix[3] = alpha; + pixels = scratch.get(); } - } - 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++) + 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) { - U8 lum = ((U8*)pixels)[i]; + 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; + } - 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 @@ -2370,11 +2422,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 { @@ -2428,10 +2480,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) { diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 5073701c30..a8b94bd5b0 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -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); @@ -203,7 +203,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); diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index f700201ace..21a0820d32 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -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]; diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 346a7e3aa1..e0eaaa0bbc 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -7.1.10 +7.1.11 diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 739975eab4..7bd5206453 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -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); } diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 01a29f71a0..bc412214c7 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -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); }; diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index cb1439b403..b4d14e22f3 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -327,8 +327,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(); @@ -347,22 +348,16 @@ void LLDrawPoolAlpha::renderAlphaHighlight() bool rigged = (params.mAvatar != nullptr); gHighlightProgram.bind(rigged); - 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; + if (!uploadMatrixPalette(params.mAvatar, params.mSkinInfo, lastAvatar, lastMeshId, skipLastSkin)) + { // failed to upload matrix palette, skip rendering + continue; } } + gGL.diffuseColor4f(1, 0, 0, 1); LLRenderPass::applyModelMatrix(params); params.mVertexBuffer->setBuffer(); params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); @@ -526,25 +521,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); } } @@ -553,19 +543,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); @@ -581,9 +567,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; @@ -776,20 +763,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(¶ms, (mat != nullptr)); @@ -912,26 +888,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; -} diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h index 0abe001714..25044beda0 100644 --- a/indra/newview/lldrawpoolalpha.h +++ b/indra/newview/lldrawpoolalpha.h @@ -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; diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 7289e95b6e..bf593bff07 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -558,8 +558,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; ) { @@ -572,13 +573,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 { @@ -974,8 +972,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 @@ -993,17 +992,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); diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index bbc93c2af9..e7ec2022d2 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -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; } } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 4dec4d5641..8a6596eb1c 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -828,11 +828,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) { @@ -851,21 +846,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); diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 557b3f27c5..97e0d01b52 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -368,8 +368,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" @@ -551,23 +549,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) diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index 7bc54cf3da..a442099ad1 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -159,8 +159,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(); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 2621ce576c..00e7dae657 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -302,6 +302,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"); @@ -434,16 +435,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 @@ -466,6 +485,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(); @@ -1040,6 +1078,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(); } diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 6dd8e62482..bee5c8c2c4 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -198,6 +198,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); @@ -216,6 +221,8 @@ private: */ void reshapeChatLayoutPanel(); + void onCallButtonClicked(); + void onInputEditorClicked(); void onEmojiRecentPanelToggleBtnClicked(); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 9711729498..08605f7cf4 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1017,7 +1017,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) setDescriptionText(avatar_data->about_text); - mSecondLifePic->setValue(avatar_data->image_id); + mSecondLifePic->setValue(avatar_data->image_id); if (getSelfProfile()) { @@ -1052,7 +1052,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; @@ -1117,7 +1117,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; @@ -1165,10 +1165,10 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) } else { - std::string register_date = getString("age_format"); - LLSD args_age; + std::string register_date = getString("age_format"); + LLSD args_age; args_age["[AGE]"] = LLDateUtil::ageFromDate(avatar_data->born_on, LLDate::now()); - LLStringUtil::format(register_date, args_age); + LLStringUtil::format(register_date, args_age); userAgeCtrl->setValue(register_date); } @@ -1247,7 +1247,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(); @@ -1328,7 +1328,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; @@ -1611,12 +1611,12 @@ void LLPanelProfileSecondLife::onShowInSearchCallback() if (value == mAllowPublish) return; - mAllowPublish = value; + mAllowPublish = value; saveAgentUserInfoCoro("allow_publish", value); - } +} void LLPanelProfileSecondLife::onHideAgeCallback() - { +{ bool value = mHideAgeCombo->getValue().asInteger(); if (value == mHideAge) return; @@ -1642,7 +1642,7 @@ void LLPanelProfileSecondLife::onDiscardDescriptionChanges() void LLPanelProfileSecondLife::onShowAgentPermissionsDialog() { - LLFloater *floater = mFloaterPermissionsHandle.get(); + LLFloater* floater = mFloaterPermissionsHandle.get(); if (!floater) { LLFloater* parent_floater = gFloaterView->getParentFloater(this); @@ -1670,7 +1670,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture() return; } - LLFloater *floater = mFloaterProfileTextureHandle.get(); + LLFloater* floater = mFloaterProfileTextureHandle.get(); if (!floater) { LLFloater* parent_floater = gFloaterView->getParentFloater(this); @@ -1765,43 +1765,47 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id) if (mSecondLifePic->getImageAssetId() == id) return; - std::function<void(bool)> callback = [id](bool result) + std::function<void(bool)> callback = [id](bool result) + { + if (result) { - if (result) - { - LLAvatarIconIDCache::getInstance()->add(gAgentID, id); + LLAvatarIconIDCache::getInstance()->add(gAgentID, id); // Should trigger callbacks in icon controls (or request Legacy) - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); - } - }; + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); + } + }; if (!saveAgentUserInfoCoro("sl_image_id", id, callback)) return; mSecondLifePic->setValue(id); - LLFloater *floater = mFloaterProfileTextureHandle.get(); - if (floater) + LLFloater* floater = mFloaterProfileTextureHandle.get(); + if (floater) + { + LLFloaterProfileTexture* texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); + if (texture_view) { - LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); - if (id == LLUUID::null) + if (id.isNull()) { texture_view->resetAsset(); } else { - texture_view->loadAsset(id); + texture_view->loadAsset(id); } } } +} ////////////////////////////////////////////////////////////////////////// // LLPanelProfileWeb LLPanelProfileWeb::LLPanelProfileWeb() : LLPanelProfileTab() - , mWebBrowser(NULL) + , mWebBrowser(nullptr) , mAvatarNameCacheConnection() + , mFirstNavigate(false) { } diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 3526004071..f083747bfe 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -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); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index b1f80e48af..e517d009f5 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -29,7 +29,6 @@ #include "llspatialpartition.h" #include "llappviewer.h" -#include "llcallstack.h" #include "lltexturecache.h" #include "lltexturefetch.h" #include "llimageworker.h" @@ -755,14 +754,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; } } @@ -1676,8 +1667,9 @@ void renderOctree(LLSpatialGroup* group) glLineWidth(1.f); 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) { @@ -1706,15 +1698,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++) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 7cefa21125..b32b80331a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -28,7 +28,6 @@ #include "llappviewer.h" #include "llstartup.h" -#include "llcallstack.h" #if LL_WINDOWS # include <process.h> // _spawnl() diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index ca3386948d..bda53f66eb 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -525,9 +525,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; @@ -579,7 +579,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); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a2abd1d930..5d33db591a 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -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" @@ -151,7 +150,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; @@ -1165,7 +1163,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. diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 435bd60917..9e1d86faac 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -68,7 +68,6 @@ #include "u64.h" #include "llviewertexturelist.h" #include "lldatapacker.h" -#include "llcallstack.h" #ifdef LL_USESYSTEMLIBS #include <zlib.h> #else @@ -245,7 +244,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); @@ -362,7 +360,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) { @@ -557,7 +554,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) { @@ -635,7 +631,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) { @@ -729,7 +724,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; @@ -1305,7 +1299,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); @@ -1857,7 +1850,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) @@ -1893,7 +1885,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) diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ac64c47abe..115db57a06 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -81,7 +81,6 @@ #include "llcoros.h" #include "lleventcoro.h" #include "llcorehttputil.h" -#include "llcallstack.h" #include "llsettingsdaycycle.h" #include <boost/regex.hpp> @@ -2716,7 +2715,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(); @@ -2725,7 +2723,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); @@ -2738,7 +2735,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 diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index eab564a856..4922df6738 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -497,11 +497,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; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 09375a6930..e638e5b8c3 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -109,7 +109,6 @@ #include "llsdutil.h" #include "llscenemonitor.h" #include "llsdserialize.h" -#include "llcallstack.h" #include "llrendersphere.h" #include "llskinningutil.h" @@ -2666,8 +2665,6 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) mNeedsExtentUpdate = ((thisFrame + mID.mData[0]) % upd_freq == 0); } - LLScopedContextString str("avatar_idle_update " + getFullname()); - checkTextureLoading() ; // force immediate pixel area update on avatars using last frames data (before drawable or camera updates) @@ -4689,10 +4686,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) @@ -6358,8 +6351,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); @@ -6390,10 +6381,7 @@ void LLVOAvatar::clearAttachmentOverrides() //----------------------------------------------------------------------------- void LLVOAvatar::rebuildAttachmentOverrides() { - LLScopedContextString str("rebuildAttachmentOverrides " + getFullname()); - LL_DEBUGS("AnimatedObjects") << "rebuilding" << LL_ENDL; - dumpStack("AnimatedObjectsStack"); clearAttachmentOverrides(); @@ -6441,10 +6429,7 @@ void LLVOAvatar::rebuildAttachmentOverrides() // ----------------------------------------------------------------------------- void LLVOAvatar::updateAttachmentOverrides() { - LLScopedContextString str("updateAttachmentOverrides " + getFullname()); - LL_DEBUGS("AnimatedObjects") << "updating" << LL_ENDL; - dumpStack("AnimatedObjectsStack"); std::set<LLUUID> meshes_seen; @@ -6573,15 +6558,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) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 00a7325db2..49859bb585 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -59,7 +59,6 @@ #include "llsdutil.h" #include "llstartup.h" #include "llsdserialize.h" -#include "llcallstack.h" #include "llcorehttputil.h" #include "lluiusage.h" diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index eb1cd00940..55769f567b 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -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; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7a7d88327b..dcaf85b894 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -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" @@ -357,7 +356,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) @@ -1448,7 +1446,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 { @@ -1459,11 +1456,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; } } @@ -1473,7 +1468,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; } } @@ -1554,13 +1548,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; @@ -1760,11 +1747,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(); @@ -1788,10 +1770,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]; @@ -5655,8 +5633,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) // apply any pending material overrides gGLTFMaterialList.applyQueuedOverrides(vobj); - std::string vobj_name = llformat("Vol%p", vobj); - bool is_mesh = vobj->isMesh(); if (is_mesh) { @@ -5681,24 +5657,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) group->mSurfaceArea += volume->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]); } - - F32 est_tris = vobj->getEstTrianglesMax(); - vobj->updateControlAvatar(); - 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; - llassert_always(vobj); vobj->updateTextureVirtualSize(true); vobj->preRebuild(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 98fdb68222..5bc880ea44 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6624,8 +6624,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); @@ -6649,7 +6655,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 { @@ -6657,14 +6663,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 |