summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-06-03 14:25:32 -0400
committerLoren Shih <seraph@lindenlab.com>2010-06-03 14:25:32 -0400
commit4f95701895a07066d5b46649d720335da1b62e71 (patch)
tree1341e44d492ecff6f7ae8fa106fd771d1d59aa05 /indra
parent609c389b899f3924f070dea384337bec4da0f2f4 (diff)
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.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llagent.cpp8
-rw-r--r--indra/newview/llagentwearables.cpp10
-rw-r--r--indra/newview/llagentwearables.h3
-rw-r--r--indra/newview/llassetuploadresponders.h2
-rw-r--r--indra/newview/lltexlayer.cpp88
-rw-r--r--indra/newview/lltexlayer.h366
-rw-r--r--indra/newview/lltexlayerparams.h17
-rw-r--r--indra/newview/llvoavatarself.cpp9
-rw-r--r--indra/newview/llvoavatarself.h1
9 files changed, 241 insertions, 263 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 0fa77ff7c2..d2e55f88a0 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3585,7 +3585,13 @@ void LLAgent::sendAgentSetAppearance()
llinfos << "TAT: Sending cached texture data" << llendl;
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
- LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index);
+ BOOL generate_valid_hash = TRUE;
+ if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLVOAvatarDefines::EBakedTextureIndex)baked_index))
+ {
+ generate_valid_hash = FALSE;
+ }
+
+ LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
if (hash.notNull())
{
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index e5796f8e63..5dde626ea8 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1617,13 +1617,13 @@ void LLAgentWearables::queryWearableCache()
gAgentQueryManager.mWearablesCacheQueryID++;
}
-LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex index)
+LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
+ BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
{
LLUUID hash_id;
bool hash_computed = false;
LLMD5 hash;
-
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(index);
+ const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
{
@@ -1636,6 +1636,10 @@ LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextur
{
LLUUID asset_id = wearable->getAssetID();
hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
+ if (!generate_valid_hash)
+ {
+ hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
+ }
hash_computed = true;
}
}
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 5d5c5ae371..a1e1ca24d3 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -164,7 +164,8 @@ protected:
public:
// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
- LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex index);
+ LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
+ BOOL generate_valid_hash = TRUE);
protected:
void sendAgentWearablesUpdate();
diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h
index ade9c96758..2358aeb39d 100644
--- a/indra/newview/llassetuploadresponders.h
+++ b/indra/newview/llassetuploadresponders.h
@@ -78,7 +78,7 @@ public:
boost::function<void(const LLUUID& uuid)> mCallback;
};
-class LLBakedUploadData;
+struct LLBakedUploadData;
class LLSendTexLayerResponder : public LLAssetUploadResponder
{
public:
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) <<
diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h
index 635568542d..615de661af 100644
--- a/indra/newview/lltexlayer.h
+++ b/indra/newview/lltexlayer.h
@@ -1,6 +1,6 @@
/**
* @file lltexlayer.h
- * @brief A texture layer. Used for avatars.
+ * @brief Texture layer classes. Used for avatars.
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
@@ -35,40 +35,31 @@
#include <deque>
#include "lldynamictexture.h"
-#include "llwearable.h"
#include "llvoavatardefines.h"
+#include "lltexlayerparams.h"
class LLVOAvatar;
class LLVOAvatarSelf;
class LLImageTGA;
class LLImageRaw;
class LLXmlTreeNode;
-class LLPolyMorphTarget;
class LLTexLayerSet;
class LLTexLayerSetInfo;
class LLTexLayerInfo;
class LLTexLayerSetBuffer;
-class LLTexLayerParamColor;
-class LLTexLayerParamColorInfo;
-class LLTexLayerParamAlpha;
-class LLTexLayerParamAlphaInfo;
class LLWearable;
class LLViewerVisualParam;
-typedef std::vector<LLTexLayerParamColor *> param_color_list_t;
-typedef std::vector<LLTexLayerParamAlpha *> param_alpha_list_t;
-typedef std::vector<LLTexLayerParamColorInfo *> param_color_info_list_t;
-typedef std::vector<LLTexLayerParamAlphaInfo *> param_alpha_info_list_t;
-
-
-//-----------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerInterface
-// Interface class to generalize functionality shared by LLTexLayer and LLTexLayerTemplate.
-
+//
+// Interface class to generalize functionality shared by LLTexLayer
+// and LLTexLayerTemplate.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerInterface
{
public:
- enum ERenderPass
+ enum ERenderPass
{
RP_COLOR,
RP_BUMP,
@@ -79,84 +70,78 @@ public:
LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable);
virtual ~LLTexLayerInterface() {}
- const LLTexLayerInfo* getInfo() const { return mInfo; }
- virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable ); // This sets mInfo and calls initialization functions
virtual BOOL render(S32 x, S32 y, S32 width, S32 height) = 0;
- void requestUpdate();
- LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
-
virtual void deleteCaches() = 0;
- void invalidateMorphMasks();
- virtual void setHasMorph(BOOL newval) { mHasMorph = newval; }
- BOOL hasMorph() { return mHasMorph; }
- BOOL isMorphValid() { return mMorphMasksValid; }
+ virtual BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0;
+ virtual BOOL isInvisibleAlphaMask() const = 0;
+
+ const LLTexLayerInfo* getInfo() const { return mInfo; }
+ virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions
const std::string& getName() const;
- ERenderPass getRenderPass() const;
- const std::string& getGlobalColor() const;
+ const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
+ LLTexLayerSet* const getTexLayerSet() { return mTexLayerSet; }
- virtual BOOL blendAlphaTexture( S32 x, S32 y, S32 width, S32 height) = 0;
- virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) = 0;
- BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); }
- BOOL isVisibilityMask() const;
- virtual BOOL isInvisibleAlphaMask() = 0;
+ void invalidateMorphMasks();
+ virtual void setHasMorph(BOOL newval) { mHasMorph = newval; }
+ BOOL hasMorph() const { return mHasMorph; }
+ BOOL isMorphValid() const { return mMorphMasksValid; }
- LLTexLayerSet* getLayerSet() {return mTexLayerSet;}
+ void requestUpdate();
+ virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) = 0;
+ BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); }
- LLViewerVisualParam* getVisualParamPtr(S32 index);
+ ERenderPass getRenderPass() const;
+ BOOL isVisibilityMask() const;
+protected:
+ const std::string& getGlobalColor() const;
+ LLViewerVisualParam* getVisualParamPtr(S32 index) const;
protected:
- LLTexLayerSet* const mTexLayerSet;
+ LLTexLayerSet* const mTexLayerSet;
+ const LLTexLayerInfo* mInfo;
+ BOOL mMorphMasksValid;
+ BOOL mHasMorph;
// Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
param_color_list_t mParamColorList;
+ param_alpha_list_t mParamAlphaList;
// mGlobalColor name stored in mInfo
// mFixedColor value stored in mInfo
- param_alpha_list_t mParamAlphaList;
-
- BOOL mMorphMasksValid;
- BOOL mStaticImageInvalid;
-
- BOOL mHasMorph;
-
- const LLTexLayerInfo *mInfo;
-
};
-//-----------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerTemplate
-// Template class
-// Only exists for llvoavatarself
-
+//
+// Only exists for llvoavatarself.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerTemplate : public LLTexLayerInterface
{
public:
LLTexLayerTemplate(LLTexLayerSet* const layer_set);
LLTexLayerTemplate(const LLTexLayerTemplate &layer);
/*virtual*/ ~LLTexLayerTemplate();
-
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
- /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable ); // This sets mInfo and calls initialization functions
- /*virtual*/ BOOL blendAlphaTexture( S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
+ /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions
+ /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
/*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
/*virtual*/ void setHasMorph(BOOL newval);
/*virtual*/ void deleteCaches();
- /*virtual*/ BOOL isInvisibleAlphaMask();
-
+ /*virtual*/ BOOL isInvisibleAlphaMask() const;
+protected:
+ U32 updateWearableCache() const;
+ LLTexLayer* getLayer(U32 i) const;
private:
- U32 updateWearableCache();
- LLTexLayer* getLayer(U32 i);
typedef std::vector<LLWearable*> wearable_cache_t;
- wearable_cache_t mWearableCache;
-
+ mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache
};
-//-----------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayer
-// A single texture layer
-// Only exists for llvoavatarself
-
+//
+// A single texture layer. Only exists for llvoavatarself.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayer : public LLTexLayerInterface
{
public:
@@ -165,79 +150,37 @@ public:
LLTexLayer(const LLTexLayerTemplate &layer_template, LLLocalTextureObject *lto, LLWearable *wearable);
/*virtual*/ ~LLTexLayer();
- /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable ); // This sets mInfo and calls initialization functions
+ /*virtual*/ BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // This sets mInfo and calls initialization functions
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
/*virtual*/ void deleteCaches();
- U8* getAlphaData();
+ const U8* getAlphaData() const;
BOOL findNetColor(LLColor4* color) const;
- /*virtual*/ BOOL blendAlphaTexture( S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
+ /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
/*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color);
void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
- /*virtual*/ BOOL isInvisibleAlphaMask();
-
- void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; }
- LLLocalTextureObject* getLTO() { return mLocalTextureObject; }
+ /*virtual*/ BOOL isInvisibleAlphaMask() const;
- static void calculateTexLayerColor(const param_color_list_t &param_list, LLColor4 &net_color);
+ void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; }
+ LLLocalTextureObject* getLTO() { return mLocalTextureObject; }
+ static void calculateTexLayerColor(const param_color_list_t &param_list, LLColor4 &net_color);
+protected:
+ LLUUID getUUID() const;
private:
- LLUUID getUUID();
-
typedef std::map<U32, U8*> alpha_cache_t;
alpha_cache_t mAlphaCache;
- LLLocalTextureObject *mLocalTextureObject;
-};
-
-// Make private
-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,
- LLTexLayer::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;
+ LLLocalTextureObject* mLocalTextureObject;
};
-//
-// LLTexLayer
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerSet
-// An ordered set of texture layers that get composited into a single texture.
-// Only exists for llvoavatarself
-
+//
+// An ordered set of texture layers that gets composited into a single texture.
+// Only exists for llvoavatarself.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSet
{
friend class LLTexLayerSetBuffer;
@@ -245,186 +188,163 @@ public:
LLTexLayerSet(LLVOAvatarSelf* const avatar);
~LLTexLayerSet();
- const LLTexLayerSetInfo* getInfo() const { return mInfo; }
- BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
-
- BOOL render(S32 x, S32 y, S32 width, S32 height);
- void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
-
- BOOL isBodyRegion(const std::string& region) const;
- LLTexLayerSetBuffer* getComposite();
- const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
- void requestUpdate();
- void requestUpload();
- void cancelUpload();
- void updateComposite();
- BOOL isLocalTextureDataAvailable() const;
- BOOL isLocalTextureDataFinal() const;
- void createComposite();
- void destroyComposite();
- void setUpdatesEnabled(BOOL b);
- BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
- void deleteCaches();
- void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
- void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
- BOOL isMorphValid();
- void invalidateMorphMasks();
- LLTexLayerInterface* findLayerByName(const std::string& name);
- void cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable* wearable);
+ const LLTexLayerSetInfo* getInfo() const { return mInfo; }
+ BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
+
+ BOOL render(S32 x, S32 y, S32 width, S32 height);
+ void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
+
+ BOOL isBodyRegion(const std::string& region) const;
+ LLTexLayerSetBuffer* getComposite();
+ const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
+ void requestUpdate();
+ void requestUpload();
+ void cancelUpload();
+ void updateComposite();
+ BOOL isLocalTextureDataAvailable() const;
+ BOOL isLocalTextureDataFinal() const;
+ void createComposite();
+ void destroyComposite();
+ void setUpdatesEnabled(BOOL b);
+ BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
+ void deleteCaches();
+ void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
+ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
+ BOOL isMorphValid() const;
+ void invalidateMorphMasks();
+ LLTexLayerInterface* findLayerByName(const std::string& name);
+ void cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable* wearable);
- LLVOAvatarSelf* getAvatar() const { return mAvatar; }
- const std::string getBodyRegionName() const;
- BOOL hasComposite() const { return (mComposite.notNull()); }
+ LLVOAvatarSelf* getAvatar() const { return mAvatar; }
+ const std::string getBodyRegionName() const;
+ BOOL hasComposite() const { return (mComposite.notNull()); }
LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
- void setBakedTexIndex( LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
- BOOL isVisible() const { return mIsVisible; }
+ void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
+ BOOL isVisible() const { return mIsVisible; }
-public:
- static BOOL sHasCaches;
-
- typedef std::vector<LLTexLayerInterface *> layer_list_t;
+ static BOOL sHasCaches;
private:
- layer_list_t mLayerList;
- layer_list_t mMaskLayerList;
+ typedef std::vector<LLTexLayerInterface *> layer_list_t;
+ layer_list_t mLayerList;
+ layer_list_t mMaskLayerList;
LLPointer<LLTexLayerSetBuffer> mComposite;
- LLVOAvatarSelf* const mAvatar; // Backlink only; don't make this an LLPointer.
- BOOL mUpdatesEnabled;
- BOOL mIsVisible;
+ LLVOAvatarSelf* const mAvatar; // note: backlink only; don't make this an LLPointer.
+ BOOL mUpdatesEnabled;
+ BOOL mIsVisible;
LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
-
- const LLTexLayerSetInfo *mInfo;
+ const LLTexLayerSetInfo* mInfo;
};
-// Contains shared layer set data
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLTexLayerSetInfo
+//
+// Contains shared layer set data.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetInfo
{
friend class LLTexLayerSet;
public:
LLTexLayerSetInfo();
~LLTexLayerSetInfo();
-
BOOL parseXml(LLXmlTreeNode* node);
void createVisualParams(LLVOAvatar *avatar);
-
private:
std::string mBodyRegion;
S32 mWidth;
S32 mHeight;
std::string mStaticAlphaFileName;
BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName)
-
typedef std::vector<LLTexLayerInfo*> layer_info_list_t;
layer_info_list_t mLayerInfoList;
};
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLTexLayerSetBuffer
+//
// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetBuffer : public LLViewerDynamicTexture
{
public:
LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
virtual ~LLTexLayerSetBuffer();
-
- /*virtual*/ S8 getType() const ;
+ /*virtual*/ S8 getType() const;
virtual void preRender(BOOL clear_depth);
virtual void postRender(BOOL success);
virtual BOOL render();
BOOL updateImmediate();
bool isInitialized(void) const;
- BOOL needsRender();
+ /*virtual*/ BOOL needsRender();
void requestUpdate();
void requestUpload();
void cancelUpload();
- BOOL uploadPending() { return mUploadPending; }
- BOOL render( S32 x, S32 y, S32 width, S32 height );
+ BOOL uploadPending() const { return mUploadPending; }
+ BOOL render(S32 x, S32 y, S32 width, S32 height);
void readBackAndUpload();
-
static void onTextureUploadComplete(const LLUUID& uuid,
void* userdata,
S32 result, LLExtStat ext_status);
static void dumpTotalByteCount();
-
const std::string dumpTextureInfo() const;
-
- virtual void restoreGLTexture();
- virtual void destroyGLTexture();
-
+ virtual void restoreGLTexture();
+ virtual void destroyGLTexture();
protected:
void pushProjection() const;
void popProjection() const;
BOOL isReadyToUpload() const;
-
private:
LLTexLayerSet* const mTexLayerSet;
-
- BOOL mNeedsUpdate; // Whether we need to update our baked textures
- BOOL mNeedsUpload; // Whether we need to send our baked textures to the server
- U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server
- BOOL mUploadPending; // Whether we have received back the new baked textures
- LLUUID mUploadID; // Identifies the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit)
-
+ BOOL mNeedsUpdate; // whether we need to update our baked textures
+ BOOL mNeedsUpload; // whether we need to send our baked textures to the server
+ U32 mNumLowresUploads; // mumber of times we've sent a lowres version of our baked textures to the server
+ BOOL mUploadPending; // whether we have received back the new baked textures
+ LLUUID mUploadID; // the current upload process (null if none). Used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit.
static S32 sGLByteCount;
-
LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested
-
};
-//
-// LLTexLayerSet
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerStaticImageList
//
-
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
{
public:
LLTexLayerStaticImageList();
~LLTexLayerStaticImageList();
-
LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask);
- LLImageTGA* getImageTGA(const std::string& file_name);
-
- void deleteCachedImages();
- void dumpByteCount();
-
-private:
- BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
-
+ LLImageTGA* getImageTGA(const std::string& file_name);
+ void deleteCachedImages();
+ void dumpByteCount() const;
+protected:
+ BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
private:
- LLStringTable mImageNames;
-
- typedef std::map< const char*, LLPointer<LLViewerTexture> > texture_map_t;
- texture_map_t mStaticImageList;
- typedef std::map< const char*, LLPointer<LLImageTGA> > image_tga_map_t;
- image_tga_map_t mStaticImageListTGA;
-
- S32 mGLBytes;
- S32 mTGABytes;
+ LLStringTable mImageNames;
+ typedef std::map<const char*, LLPointer<LLViewerTexture>> texture_map_t;
+ texture_map_t mStaticImageList;
+ typedef std::map<const char*, LLPointer<LLImageTGA>> image_tga_map_t;
+ image_tga_map_t mStaticImageListTGA;
+ S32 mGLBytes;
+ S32 mTGABytes;
};
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLBakedUploadData
+//
// Used by LLTexLayerSetBuffer for a callback.
-// Note to anyone merging branches - this supercedes the previous fix
-// for DEV-31590 "Heap corruption and crash after outfit changes",
-// here and in lltexlayer.cpp. Equally correct and a bit simpler.
-class LLBakedUploadData
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+struct LLBakedUploadData
{
-public:
LLBakedUploadData(const LLVOAvatarSelf* avatar,
LLTexLayerSet* layerset,
- const LLUUID& id,
- BOOL highest_lod);
+ const LLUUID& id);
~LLBakedUploadData() {}
-
const LLUUID mID;
- const LLVOAvatarSelf* mAvatar; // just backlink, don't LLPointer
+ const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
LLTexLayerSet* mTexLayerSet;
- const U64 mStartTime; // Used to measure time baked texture upload requires
- BOOL mHighestLOD;
-
+ const U64 mStartTime; // for measuring baked texture upload time
};
-
#endif // LL_LLTEXLAYER_H
diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h
index 93d01352d4..7747ee1ebf 100644
--- a/indra/newview/lltexlayerparams.h
+++ b/indra/newview/lltexlayerparams.h
@@ -42,6 +42,10 @@ class LLViewerTexture;
class LLVOAvatar;
class LLWearable;
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLTexLayerParam
+//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerParam : public LLViewerVisualParam
{
public:
@@ -55,9 +59,10 @@ protected:
LLVOAvatar* mAvatar;
};
-//-----------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParamAlpha
//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerParamAlpha : public LLTexLayerParam
{
public:
@@ -124,9 +129,10 @@ private:
// LLTexLayerParamAlpha
//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParamColor
//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerParamColor : public LLTexLayerParam
{
public:
@@ -184,8 +190,9 @@ private:
S32 mNumColors;
};
-//
-// LLTexLayerParamColor
-//-----------------------------------------------------------------------------
+typedef std::vector<LLTexLayerParamColor *> param_color_list_t;
+typedef std::vector<LLTexLayerParamAlpha *> param_alpha_list_t;
+typedef std::vector<LLTexLayerParamColorInfo *> param_color_info_list_t;
+typedef std::vector<LLTexLayerParamAlphaInfo *> param_alpha_info_list_t;
#endif
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index ce8f64404e..462c442954 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1328,6 +1328,15 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
return TRUE;
}
+BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const
+{
+ const LLTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet;
+ if (!layerset) return FALSE;
+ const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
+ if (!layerset_buffer) return FALSE;
+ return !layerset_buffer->uploadPending();
+}
+
BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const
{
LLUUID id;
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index e461dc07da..55b4fd87c8 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -177,6 +177,7 @@ public:
bool areTexturesCurrent() const;
BOOL isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const;
BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const;
+ BOOL isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const;
// If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index
/*virtual*/ BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
/*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;