summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatarself.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rwxr-xr-xindra/newview/llvoavatarself.cpp127
1 files changed, 60 insertions, 67 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 76ae7460eb..20ef72708c 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -43,6 +43,7 @@
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
#include "llinventoryfunctions.h"
+#include "lllocaltextureobject.h"
#include "llnotificationsutil.h"
#include "llselectmgr.h"
#include "lltoolgrab.h" // for needsRenderBeam
@@ -141,9 +142,8 @@ struct LocalTextureData
//-----------------------------------------------------------------------------
// Static Data
//-----------------------------------------------------------------------------
-S32 LLVOAvatarSelf::sScratchTexBytes = 0;
-LLMap< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames;
-LLMap< LLGLenum, F32*> LLVOAvatarSelf::sScratchTexLastBindTime;
+S32Bytes LLVOAvatarSelf::sScratchTexBytes(0);
+std::map< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames;
/*********************************************************************************
@@ -163,7 +163,7 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id,
{
mMotionController.mIsSelf = TRUE;
- lldebugs << "Marking avatar as self " << id << llendl;
+ LL_DEBUGS() << "Marking avatar as self " << id << LL_ENDL;
}
// Called periodically for diagnostics, return true when done.
@@ -195,7 +195,7 @@ void LLVOAvatarSelf::initInstance()
// adds attachment points to mScreen among other things
LLVOAvatar::initInstance();
- llinfos << "Self avatar object created. Starting timer." << llendl;
+ LL_INFOS() << "Self avatar object created. Starting timer." << LL_ENDL;
mDebugSelfLoadTimer.reset();
// clear all times to -1 for debugging
for (U32 i =0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
@@ -216,7 +216,7 @@ void LLVOAvatarSelf::initInstance()
status &= buildMenus();
if (!status)
{
- llerrs << "Unable to load user's avatar" << llendl;
+ LL_ERRS() << "Unable to load user's avatar" << LL_ENDL;
return;
}
@@ -286,7 +286,7 @@ BOOL LLVOAvatarSelf::loadAvatarSelf()
// avatar_skeleton.xml
if (!buildSkeletonSelf(sAvatarSkeletonInfo))
{
- llwarns << "avatar file: buildSkeleton() failed" << llendl;
+ LL_WARNS() << "avatar file: buildSkeleton() failed" << LL_ENDL;
return FALSE;
}
@@ -836,9 +836,9 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
// Diagnostic info
//LLVector3d pos_from_new_region = getPositionGlobal();
- //llinfos << "pos_from_old_region is " << global_pos_from_old_region
+ //LL_INFOS() << "pos_from_old_region is " << global_pos_from_old_region
// << " while pos_from_new_region is " << pos_from_new_region
- // << llendl;
+ // << LL_ENDL;
}
if (!regionp || (regionp->getHandle() != mLastRegionHandle))
@@ -846,17 +846,11 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
if (mLastRegionHandle != 0)
{
++mRegionCrossingCount;
- F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32();
- F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG);
- F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount;
- LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg);
-
- F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX);
- max = llmax(delta, max);
- LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max);
+ F64Seconds delta(mRegionCrossingTimer.getElapsedTimeF32());
+ record(LLStatViewer::REGION_CROSSING_TIME, delta);
// Diagnostics
- llinfos << "Region crossing took " << (F32)(delta * 1000.0) << " ms " << llendl;
+ LL_INFOS() << "Region crossing took " << (F32)(delta * 1000.0).value() << " ms " << LL_ENDL;
}
if (regionp)
{
@@ -940,7 +934,7 @@ void LLVOAvatarSelf::idleUpdateTractorBeam()
// virtual
void LLVOAvatarSelf::restoreMeshData()
{
- //llinfos << "Restoring" << llendl;
+ //LL_INFOS() << "Restoring" << LL_ENDL;
mMeshValid = TRUE;
updateJointLODs();
updateAttachmentVisibility(gAgentCamera.getCameraMode());
@@ -1173,7 +1167,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
// Update COF contents, don't trigger appearance update.
if (!isValid())
{
- llinfos << "removeItemLinks skipped, avatar is under destruction" << llendl;
+ LL_INFOS() << "removeItemLinks skipped, avatar is under destruction" << LL_ENDL;
}
else
{
@@ -1501,7 +1495,7 @@ void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset)
{
return;
}
- // llinfos << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << llendl;
+ // LL_INFOS() << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << LL_ENDL;
layer_set->requestUpdate();
layer_set->invalidateMorphMasks();
@@ -1644,7 +1638,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
{
if (type >= TEX_NUM_INDICES)
{
- llerrs << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << llendl;
+ LL_ERRS() << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << LL_ENDL;
return;
}
LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(type);
@@ -1657,7 +1651,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
local_tex_obj = getLocalTextureObject(type,index);
if (!local_tex_obj)
{
- llerrs << "Unable to create LocalTextureObject for wearable type & index: (" << (U32) wearable_type << ", " << index << ")" << llendl;
+ LL_ERRS() << "Unable to create LocalTextureObject for wearable type & index: (" << (U32) wearable_type << ", " << index << ")" << LL_ENDL;
return;
}
@@ -1719,7 +1713,7 @@ void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type
// virtual
void LLVOAvatarSelf::dumpLocalTextures() const
{
- llinfos << "Local Textures:" << llendl;
+ LL_INFOS() << "Local Textures:" << LL_ENDL;
/* ETextureIndex baked_equiv[] = {
TEX_UPPER_BAKED,
@@ -1743,22 +1737,22 @@ void LLVOAvatarSelf::dumpLocalTextures() const
#if LL_RELEASE_FOR_DOWNLOAD
// End users don't get to trivially see avatar texture IDs, makes textures
// easier to steal. JC
- llinfos << "LocTex " << name << ": Baked " << llendl;
+ LL_INFOS() << "LocTex " << name << ": Baked " << LL_ENDL;
#else
- llinfos << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << llendl;
+ LL_INFOS() << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << LL_ENDL;
#endif
}
else if (local_tex_obj && local_tex_obj->getImage() != NULL)
{
if (local_tex_obj->getImage()->getID() == IMG_DEFAULT_AVATAR)
{
- llinfos << "LocTex " << name << ": None" << llendl;
+ LL_INFOS() << "LocTex " << name << ": None" << LL_ENDL;
}
else
{
const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
- llinfos << "LocTex " << name << ": "
+ LL_INFOS() << "LocTex " << name << ": "
<< "Discard " << image->getDiscardLevel() << ", "
<< "(" << image->getWidth() << ", " << image->getHeight() << ") "
#if !LL_RELEASE_FOR_DOWNLOAD
@@ -1767,12 +1761,12 @@ void LLVOAvatarSelf::dumpLocalTextures() const
<< image->getID() << " "
#endif
<< "Priority: " << image->getDecodePriority()
- << llendl;
+ << LL_ENDL;
}
}
else
{
- llinfos << "LocTex " << name << ": No LLViewerTexture" << llendl;
+ LL_INFOS() << "LocTex " << name << ": No LLViewerTexture" << LL_ENDL;
}
}
}
@@ -1828,7 +1822,7 @@ void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()
{
S32 gl_bytes = 0;
gAgentAvatarp->getLocalTextureByteCount(&gl_bytes);
- llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl;
+ LL_INFOS() << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << LL_ENDL;
}
BOOL LLVOAvatarSelf::getIsCloud() const
@@ -1852,12 +1846,12 @@ BOOL LLVOAvatarSelf::getIsCloud() const
{
if (do_warn)
{
- llinfos << "Self is clouded due to missing one or more required body parts: "
+ LL_INFOS() << "Self is clouded due to missing one or more required body parts: "
<< (shape_count ? "" : "SHAPE ")
<< (hair_count ? "" : "HAIR ")
<< (eye_count ? "" : "EYES ")
<< (skin_count ? "" : "SKIN ")
- << llendl;
+ << LL_ENDL;
}
return TRUE;
}
@@ -1866,7 +1860,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const
{
if (do_warn)
{
- llinfos << "Self is clouded because of no hair texture" << llendl;
+ LL_INFOS() << "Self is clouded because of no hair texture" << LL_ENDL;
}
return TRUE;
}
@@ -1878,7 +1872,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const
{
if (do_warn)
{
- llinfos << "Self is clouded because lower textures not baked" << llendl;
+ LL_INFOS() << "Self is clouded because lower textures not baked" << LL_ENDL;
}
return TRUE;
}
@@ -1888,7 +1882,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const
{
if (do_warn)
{
- llinfos << "Self is clouded because upper textures not baked" << llendl;
+ LL_INFOS() << "Self is clouded because upper textures not baked" << LL_ENDL;
}
return TRUE;
}
@@ -1908,14 +1902,14 @@ BOOL LLVOAvatarSelf::getIsCloud() const
{
if (do_warn)
{
- llinfos << "Self is clouded because texture at index " << i
- << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << llendl;
+ LL_INFOS() << "Self is clouded because texture at index " << i
+ << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << LL_ENDL;
}
return TRUE;
}
}
- lldebugs << "Avatar de-clouded" << llendl;
+ LL_DEBUGS() << "Avatar de-clouded" << LL_ENDL;
}
return FALSE;
}
@@ -2036,7 +2030,7 @@ void LLVOAvatarSelf::dumpAllTextures() const
if (!layerset_buffer) continue;
vd_text += verboseDebugDumpLocalTextureDataInfo(layerset);
}
- LL_DEBUGS("Avatar") << vd_text << llendl;
+ LL_DEBUGS("Avatar") << vd_text << LL_ENDL;
}
const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const
@@ -2213,7 +2207,7 @@ LLSD summarize_by_buckets(std::vector<LLSD> in_records,
accum_it != accum.end(); ++accum_it)
{
LLSD out_record = accum_it->first;
- out_record["stats"] = accum_it->second.getData();
+ out_record["stats"] = accum_it->second.asLLSD();
result.append(out_record);
}
return result;
@@ -2308,7 +2302,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
// Check if the texture hasn't been baked yet.
if (!isTextureDefined(tex_index, 0))
{
- lldebugs << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << llendl;
+ LL_DEBUGS() << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << LL_ENDL;
return FALSE;
}
@@ -2327,7 +2321,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
const ETextureIndex t_index = (*iter);
LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(t_index);
U32 count = gAgentWearables.getWearableCount(wearable_type);
- lldebugs << "Checking index " << (U32) t_index << " count: " << count << llendl;
+ LL_DEBUGS() << "Checking index " << (U32) t_index << " count: " << count << LL_ENDL;
for (U32 wearable_index = 0; wearable_index < count; ++wearable_index)
{
@@ -2349,11 +2343,11 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
asset_id_matches);
BOOL can_grab = FALSE;
- lldebugs << "item count for asset " << texture_id << ": " << items.count() << llendl;
- if (items.count())
+ LL_DEBUGS() << "item count for asset " << texture_id << ": " << items.size() << LL_ENDL;
+ if (items.size())
{
// search for full permissions version
- for (S32 i = 0; i < items.count(); i++)
+ for (S32 i = 0; i < items.size(); i++)
{
LLViewerInventoryItem* itemp = items[i];
if (itemp->getIsFullPerm())
@@ -2449,11 +2443,11 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
}
const F32 final_time = mDebugSelfLoadTimer.getElapsedTimeF32();
- LL_DEBUGS("Avatar") << "REZTIME: Myself rez stats:" << llendl;
- LL_DEBUGS("Avatar") << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << llendl;
- LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << llendl;
- LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << llendl;
- LL_DEBUGS("Avatar") << "\t Load time for each texture: " << llendl;
+ LL_DEBUGS("Avatar") << "REZTIME: Myself rez stats:" << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << LL_ENDL;
+ LL_DEBUGS("Avatar") << "\t Load time for each texture: " << LL_ENDL;
for (U32 i = 0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
{
std::stringstream out;
@@ -2481,10 +2475,10 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
LL_DEBUGS("Avatar") << out.str() << LL_ENDL;
}
}
- LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << llendl;
+ LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << LL_ENDL;
for (U32 i = 0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
{
- LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << llendl;
+ LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << LL_ENDL;
}
for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
@@ -2496,7 +2490,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
if (!layerset) continue;
const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
if (!layerset_buffer) continue;
- LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl;
+ LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << LL_ENDL;
}
dumpAllTextures();
@@ -2518,7 +2512,7 @@ void LLVOAvatarSelf::reportAvatarRezTime() const
// SUNSHINE CLEANUP - not clear we need any of this, may be sufficient to request server appearance in llviewermenu.cpp:handle_rebake_textures()
void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
{
- llinfos << "TAT: forced full rebake. " << llendl;
+ LL_INFOS() << "TAT: forced full rebake. " << LL_ENDL;
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
@@ -2536,7 +2530,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
}
else
{
- llwarns << "TAT: NO LAYER SET FOR " << (S32)baked_index << llendl;
+ LL_WARNS() << "TAT: NO LAYER SET FOR " << (S32)baked_index << LL_ENDL;
}
}
@@ -2709,29 +2703,28 @@ BOOL LLVOAvatarSelf::needsRenderBeam()
// static
void LLVOAvatarSelf::deleteScratchTextures()
{
- for( LLGLuint* namep = sScratchTexNames.getFirstData();
- namep;
- namep = sScratchTexNames.getNextData() )
+ for(std::map< LLGLenum, LLGLuint*>::iterator it = sScratchTexNames.begin(), end_it = sScratchTexNames.end();
+ it != end_it;
+ ++it)
{
- LLImageGL::deleteTextures(1, (U32 *)namep );
+ LLImageGL::deleteTextures(1, (U32 *)it->second );
stop_glerror();
}
- if( sScratchTexBytes )
+ if( sScratchTexBytes.value() )
{
- lldebugs << "Clearing Scratch Textures " << (sScratchTexBytes/1024) << "KB" << llendl;
+ LL_DEBUGS() << "Clearing Scratch Textures " << (S32Kilobytes)sScratchTexBytes << LL_ENDL;
- sScratchTexNames.deleteAllData();
- sScratchTexLastBindTime.deleteAllData();
- LLImageGL::sGlobalTextureMemoryInBytes -= sScratchTexBytes;
- sScratchTexBytes = 0;
+ delete_and_clear(sScratchTexNames);
+ LLImageGL::sGlobalTextureMemory -= sScratchTexBytes;
+ sScratchTexBytes = S32Bytes(0);
}
}
// static
void LLVOAvatarSelf::dumpScratchTextureByteCount()
{
- llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl;
+ LL_INFOS() << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << LL_ENDL;
}
void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile)