summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatarself.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rw-r--r--indra/newview/llvoavatarself.cpp115
1 files changed, 26 insertions, 89 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 59883e0bb1..f063653cc5 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -66,10 +66,11 @@
#include <boost/lexical_cast.hpp>
-LLVOAvatarSelf *gAgentAvatarp = NULL;
+LLPointer<LLVOAvatarSelf> gAgentAvatarp = NULL;
+
BOOL isAgentAvatarValid()
{
- return (gAgentAvatarp &&
+ return (gAgentAvatarp.notNull() &&
(gAgentAvatarp->getRegion() != NULL) &&
(!gAgentAvatarp->isDead()));
}
@@ -365,9 +366,9 @@ BOOL LLVOAvatarSelf::buildMenus()
item_params.label = sub_piemenu_name;
}
item_params.name =(item_params.label );
- item_params.on_click.function_name = "Attachment.Detach";
+ item_params.on_click.function_name = "Attachment.DetachFromPoint";
item_params.on_click.parameter = iter->first;
- item_params.on_enable.function_name = "Attachment.EnableDetach";
+ item_params.on_enable.function_name = "Attachment.PointFilled";
item_params.on_enable.parameter = iter->first;
LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
@@ -1574,7 +1575,7 @@ void LLVOAvatarSelf::invalidateAll()
{
invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE);
}
- mDebugSelfLoadTimer.reset();
+ //mDebugSelfLoadTimer.reset();
}
//-----------------------------------------------------------------------------
@@ -1896,11 +1897,13 @@ BOOL LLVOAvatarSelf::getIsCloud()
gAgentWearables.getWearableCount(LLWearableType::WT_EYES) == 0 ||
gAgentWearables.getWearableCount(LLWearableType::WT_SKIN) == 0)
{
+ lldebugs << "No body parts" << llendl;
return TRUE;
}
if (!isTextureDefined(TEX_HAIR, 0))
{
+ lldebugs << "No hair texture" << llendl;
return TRUE;
}
@@ -1909,12 +1912,14 @@ BOOL LLVOAvatarSelf::getIsCloud()
if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) &&
(!isTextureDefined(TEX_LOWER_BAKED, 0)))
{
+ lldebugs << "Lower textures not baked" << llendl;
return TRUE;
}
if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) &&
(!isTextureDefined(TEX_UPPER_BAKED, 0)))
{
+ lldebugs << "Upper textures not baked" << llendl;
return TRUE;
}
@@ -1931,10 +1936,12 @@ BOOL LLVOAvatarSelf::getIsCloud()
const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 );
if (!baked_img || !baked_img->hasGLTexture())
{
+ lldebugs << "Texture at index " << i << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << llendl;
return TRUE;
}
}
+ lldebugs << "Avatar de-clouded" << llendl;
}
return FALSE;
}
@@ -2258,6 +2265,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
}
}
+// FIXME: This is never called. Something may be broken.
void LLVOAvatarSelf::outputRezDiagnostics() const
{
if(!gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
@@ -2315,6 +2323,18 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
}
}
+void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const
+{
+ LL_DEBUGS("Avatar Rez")
+ << llformat("%s. Time from avatar creation: %.2f", msg.c_str(), mDebugSelfLoadTimer.getElapsedTimeF32())
+ << llendl;
+}
+
+void LLVOAvatarSelf::reportAvatarRezTime() const
+{
+ // TODO: report mDebugSelfLoadTimer.getElapsedTimeF32() somehow.
+}
+
//-----------------------------------------------------------------------------
// setCachedBakedTexture()
// A baked texture id was received from a cache query, make it active
@@ -2558,7 +2578,7 @@ void LLVOAvatarSelf::deleteScratchTextures()
LLImageGL::decTextureCounter(tex_size, 1, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
total_tex_size -= tex_size ;
}
- if( sScratchTexNames.checkData( GL_LUMINANCE_ALPHA ) )
+ if( sScratchTexNames.checkData( LLRender::sGLCoreProfile ? GL_RG : GL_LUMINANCE_ALPHA ) )
{
LLImageGL::decTextureCounter(tex_size, 2, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
total_tex_size -= 2 * tex_size ;
@@ -2600,89 +2620,6 @@ void LLVOAvatarSelf::deleteScratchTextures()
}
}
-BOOL LLVOAvatarSelf::bindScratchTexture( LLGLenum format )
-{
- U32 texture_bytes = 0;
- S32 components = 0;
- GLuint gl_name = getScratchTexName( format, components, &texture_bytes );
- if( gl_name )
- {
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name);
- stop_glerror();
-
- F32* last_bind_time = sScratchTexLastBindTime.getIfThere( format );
- if( last_bind_time )
- {
- if( *last_bind_time != LLImageGL::sLastFrameTime )
- {
- *last_bind_time = LLImageGL::sLastFrameTime;
- LLImageGL::updateBoundTexMem(texture_bytes, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
- }
- }
- else
- {
- LLImageGL::updateBoundTexMem(texture_bytes, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
- sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) );
- }
- return TRUE;
- }
- return FALSE;
-}
-
-LLGLuint LLVOAvatarSelf::getScratchTexName( LLGLenum format, S32& components, U32* texture_bytes )
-{
- GLenum internal_format;
- switch( format )
- {
- case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break;
- case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break;
- case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break;
- case GL_RGB: components = 3; internal_format = GL_RGB8; break;
- case GL_RGBA: components = 4; internal_format = GL_RGBA8; break;
- default: llassert(0); components = 4; internal_format = GL_RGBA8; break;
- }
-
- *texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT;
-
- if( sScratchTexNames.checkData( format ) )
- {
- return *( sScratchTexNames.getData( format ) );
- }
-
- LLGLSUIDefault gls_ui;
-
- U32 name = 0;
- LLImageGL::generateTextures(1, &name );
- stop_glerror();
-
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name);
- stop_glerror();
-
- LLImageGL::setManualImage(
- GL_TEXTURE_2D, 0, internal_format,
- SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT,
- format, GL_UNSIGNED_BYTE, NULL );
- stop_glerror();
-
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- stop_glerror();
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- stop_glerror();
-
- sScratchTexNames.addData( format, new LLGLuint( name ) );
-
- sScratchTexBytes += *texture_bytes;
- LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes;
-
- if(gAuditTexture)
- {
- LLImageGL::incTextureCounter(SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ;
- }
- return name;
-}
-
// static
void LLVOAvatarSelf::dumpScratchTextureByteCount()
{