From b1514dc19108320fa7d9ecb2879c96bcdc401605 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 2 Jun 2010 14:27:10 -0400 Subject: EXT-7504 WIP Force decloud after timeout using lower res textures Added more information into the texture debug view. --- indra/newview/lltexlayer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/lltexlayer.cpp') diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index b13f9e3898..0c3c052fe3 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -434,14 +434,14 @@ void LLTexLayerSetBuffer::readBackAndUpload() if (highest_lod) { - // Got the final LOD for the baked texture. + // Sending the final LOD for the baked texture. // All done, pause the upload timer so we know how long it took. mNeedsUpload = FALSE; mNeedsUploadTimer.pause(); } else { - // Got a lower level LOD for the baked texture. + // Sending a lower level LOD for the baked texture. // Restart the upload timer. mDebugNumLowresUploads++; mNeedsUploadTimer.unpause(); @@ -2243,9 +2243,11 @@ const std::string LLTexLayerSetBuffer::dumpTextureInfo() const const BOOL is_high_res = !mNeedsUpload; const U32 num_low_res = mDebugNumLowresUploads; const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32(); + const BOOL is_uploaded = !mUploadPending; const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet); - std::string text = llformat("[ HiRes:%d LoRes:%d Timer:%d ] %s", - is_high_res, num_low_res, upload_time, + std::string text = llformat("[ HiRes:%d LoRes:%d Uploaded:%d ] [ Timer:%d ] %s", + is_high_res, num_low_res, is_uploaded, + upload_time, local_texture_info.c_str()); return text; } -- cgit v1.2.3 From 609c389b899f3924f070dea384337bec4da0f2f4 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 2 Jun 2010 17:30:34 -0400 Subject: EXT-7526 WIP Add baked texture information to texture view EXT-7504 WIP Force decloud after timeout using lower res textures Better formatting for baked texture information. Also added exponential timeout for sending low res baked textures. --- indra/newview/lltexlayer.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/newview/lltexlayer.cpp') diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 0c3c052fe3..8798cae7ac 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -87,7 +87,7 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner, mNeedsUpdate(TRUE), mNeedsUpload(FALSE), mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates - mDebugNumLowresUploads(0), + mNumLowresUploads(0), mTexLayerSet(owner) { LLTexLayerSetBuffer::sGLByteCount += getSize(); @@ -141,12 +141,12 @@ void LLTexLayerSetBuffer::requestUpload() // If we requested a new upload but haven't even uploaded // a low res version of our last upload request, then // keep the timer ticking instead of resetting it. - if (mNeedsUpload && (mDebugNumLowresUploads == 0)) + if (mNeedsUpload && (mNumLowresUploads == 0)) { mNeedsUploadTimer.reset(); } mNeedsUpload = TRUE; - mDebugNumLowresUploads = 0; + mNumLowresUploads = 0; mUploadPending = TRUE; mNeedsUploadTimer.unpause(); } @@ -289,8 +289,12 @@ BOOL LLTexLayerSetBuffer::isReadyToUpload() const const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureTimeout"); if (texture_timeout) { + // The timeout period increases exponentially between every lowres upload in order to prevent + // spamming the server with frequent uploads. + const U32 texture_timeout_threshold = texture_timeout*pow((F32)2.0,(F32)mNumLowresUploads); + // If we hit our timeout and have textures available at even lower resolution, then upload. - const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout; + const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); if (has_lower_lod && is_upload_textures_timeout) return TRUE; } @@ -443,7 +447,7 @@ void LLTexLayerSetBuffer::readBackAndUpload() { // Sending a lower level LOD for the baked texture. // Restart the upload timer. - mDebugNumLowresUploads++; + mNumLowresUploads++; mNeedsUploadTimer.unpause(); mNeedsUploadTimer.reset(); } @@ -2241,7 +2245,7 @@ const std::string LLTexLayerSetBuffer::dumpTextureInfo() const if (!isAgentAvatarValid()) return ""; const BOOL is_high_res = !mNeedsUpload; - const U32 num_low_res = mDebugNumLowresUploads; + const U32 num_low_res = mNumLowresUploads; const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32(); const BOOL is_uploaded = !mUploadPending; const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet); -- cgit v1.2.3 From 4f95701895a07066d5b46649d720335da1b62e71 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 3 Jun 2010 14:25:32 -0400 Subject: EXT-7504 WIP Force decloud after timeout using lower res textures EXT-7626 FIXED LLTexLayer header file cleanup EXT-7628 FIXED Don't cache lower res baked textures Added more information into the texture debug view. Mangled hash when uploading lower res baked textures so they're not cached Lots of superficial cleanup on lltexlayer and associated classes. Removed some unused functions and member variables as well. --- indra/newview/lltexlayer.cpp | 88 +++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 29 deletions(-) (limited to 'indra/newview/lltexlayer.cpp') diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 8798cae7ac..2c019aa6a4 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -57,17 +57,52 @@ using namespace LLVOAvatarDefines; +class LLTexLayerInfo +{ + friend class LLTexLayer; + friend class LLTexLayerTemplate; + friend class LLTexLayerInterface; +public: + LLTexLayerInfo(); + ~LLTexLayerInfo(); + + BOOL parseXml(LLXmlTreeNode* node); + BOOL createVisualParams(LLVOAvatar *avatar); + BOOL isUserSettable() { return mLocalTexture != -1; } + S32 getLocalTexture() const { return mLocalTexture; } + BOOL getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; } + std::string getName() const { return mName; } + +private: + std::string mName; + + BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, + LLTexLayerInterface::ERenderPass mRenderPass; + + std::string mGlobalColor; + LLColor4 mFixedColor; + + S32 mLocalTexture; + std::string mStaticImageFileName; + BOOL mStaticImageIsMask; + BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask + BOOL mIsVisibilityMask; + + typedef std::vector< std::pair< std::string,BOOL > > morph_name_list_t; + morph_name_list_t mMorphNameList; + param_color_info_list_t mParamColorInfoList; + param_alpha_info_list_t mParamAlphaInfoList; +}; + //----------------------------------------------------------------------------- // LLBakedUploadData() //----------------------------------------------------------------------------- LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar, LLTexLayerSet* layerset, - const LLUUID& id, - BOOL highest_lod) : + const LLUUID& id) : mAvatar(avatar), mTexLayerSet(layerset), mID(id), - mHighestLOD(highest_lod), mStartTime(LLFrameTimer::getTotalTime()) // Record starting time { } @@ -391,14 +426,13 @@ void LLTexLayerSetBuffer::readBackAndUpload() if( valid ) { - const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); // baked_upload_data is owned by the responder and deleted after the request completes LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp, this->mTexLayerSet, - asset_id, - highest_lod); + asset_id); mUploadID = asset_id; - + const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal(); + // upload the image std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture"); @@ -435,7 +469,7 @@ void LLTexLayerSetBuffer::readBackAndUpload() LLNotificationsUtil::add("AvatarRezSelfBakeNotification",args); llinfos << "Uploading [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << llendl; } - + if (highest_lod) { // Sending the final LOD for the baked texture. @@ -977,11 +1011,11 @@ void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_ mAvatar->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex); } -BOOL LLTexLayerSet::isMorphValid() +BOOL LLTexLayerSet::isMorphValid() const { - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) { - LLTexLayerInterface* layer = *iter; + const LLTexLayerInterface* layer = *iter; if (layer && !layer->isMorphValid()) { return FALSE; @@ -1197,7 +1231,6 @@ BOOL LLTexLayerInfo::createVisualParams(LLVOAvatar *avatar) LLTexLayerInterface::LLTexLayerInterface(LLTexLayerSet* const layer_set): mTexLayerSet( layer_set ), mMorphMasksValid( FALSE ), - mStaticImageInvalid( FALSE ), mInfo(NULL), mHasMorph(FALSE) { @@ -1311,17 +1344,17 @@ void LLTexLayerInterface::invalidateMorphMasks() mMorphMasksValid = FALSE; } -LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) +LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const { LLViewerVisualParam *result = NULL; - for (param_color_list_t::iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter) + for (param_color_list_t::const_iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter) { if ((*color_iter)->getID() == index) { result = *color_iter; } } - for (param_alpha_list_t::iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter) + for (param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter) { if ((*alpha_iter)->getID() == index) { @@ -1575,7 +1608,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) return success; } -U8* LLTexLayer::getAlphaData() +const U8* LLTexLayer::getAlphaData() const { LLCRC alpha_mask_crc; const LLUUID& uuid = getUUID(); @@ -1591,7 +1624,7 @@ U8* LLTexLayer::getAlphaData() U32 cache_index = alpha_mask_crc.getCRC(); - alpha_cache_t::iterator iter2 = mAlphaCache.find(cache_index); + alpha_cache_t::const_iterator iter2 = mAlphaCache.find(cache_index); return (iter2 == mAlphaCache.end()) ? 0 : iter2->second; } @@ -1814,7 +1847,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height) { S32 size = width * height; - U8* alphaData = getAlphaData(); + const U8* alphaData = getAlphaData(); if (!alphaData && hasAlphaParams()) { LLColor4 net_color; @@ -1837,7 +1870,7 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 } } -/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask() +/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask() const { if (mLocalTextureObject) { @@ -1850,8 +1883,7 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 return FALSE; } -// private helper function -LLUUID LLTexLayer::getUUID() +LLUUID LLTexLayer::getUUID() const { LLUUID uuid; if( getInfo()->mLocalTexture != -1 ) @@ -1910,7 +1942,7 @@ LLTexLayerTemplate::~LLTexLayerTemplate() return LLTexLayerInterface::setInfo(info, wearable); } -U32 LLTexLayerTemplate::updateWearableCache() +U32 LLTexLayerTemplate::updateWearableCache() const { mWearableCache.clear(); @@ -1935,7 +1967,7 @@ U32 LLTexLayerTemplate::updateWearableCache() } return added; } -LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) +LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const { if (mWearableCache.size() <= i) { @@ -2044,7 +2076,7 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) } } -/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask() +/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask() const { U32 num_wearables = updateWearableCache(); for (U32 i = 0; i < num_wearables; i++) @@ -2068,19 +2100,17 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) //----------------------------------------------------------------------------- LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name) { - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) { LLTexLayerInterface* layer = *iter; - if (layer->getName() == name) { return layer; } } - for( layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ ) + for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ ) { LLTexLayerInterface* layer = *iter; - if (layer->getName() == name) { return layer; @@ -2125,7 +2155,7 @@ LLTexLayerStaticImageList::~LLTexLayerStaticImageList() deleteCachedImages(); } -void LLTexLayerStaticImageList::dumpByteCount() +void LLTexLayerStaticImageList::dumpByteCount() const { llinfos << "Avatar Static Textures " << "KB GL:" << (mGLBytes / 1024) << -- cgit v1.2.3 From cd6db16b6ab0c9c256caa328076c9c5a2d26af67 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 3 Jun 2010 14:56:33 -0400 Subject: Added explicit cast to U32 for texture_timeout_threshold for Linux build. --- indra/newview/lltexlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lltexlayer.cpp') diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 2c019aa6a4..fd2445cbda 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -326,7 +326,7 @@ BOOL LLTexLayerSetBuffer::isReadyToUpload() const { // The timeout period increases exponentially between every lowres upload in order to prevent // spamming the server with frequent uploads. - const U32 texture_timeout_threshold = texture_timeout*pow((F32)2.0,(F32)mNumLowresUploads); + const U32 texture_timeout_threshold = (U32)texture_timeout*pow((F32)2.0,(F32)mNumLowresUploads); // If we hit our timeout and have textures available at even lower resolution, then upload. const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; -- cgit v1.2.3 From 14fc336c3b20a7dcbc719069985a078b7bc4f041 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 3 Jun 2010 14:58:38 -0400 Subject: Added explicit cast to U32 for texture_timeout_threshold for Linux build. --- indra/newview/lltexlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lltexlayer.cpp') diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index fd2445cbda..1d74a7be8c 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -326,7 +326,7 @@ BOOL LLTexLayerSetBuffer::isReadyToUpload() const { // The timeout period increases exponentially between every lowres upload in order to prevent // spamming the server with frequent uploads. - const U32 texture_timeout_threshold = (U32)texture_timeout*pow((F32)2.0,(F32)mNumLowresUploads); + const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads); // If we hit our timeout and have textures available at even lower resolution, then upload. const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; -- cgit v1.2.3