Update texturelist/volumetexture management with changes from upstream. Note: TEX_LIST_SCALE not utilized in singu... yet.

This commit is contained in:
Shyotl
2019-10-19 04:05:34 -05:00
parent 835083a741
commit 4043130f75
17 changed files with 379 additions and 187 deletions

View File

@@ -306,6 +306,13 @@ public:
SPECULAR_MAP,
NUM_TEXTURE_CHANNELS,
};
enum eVolumeTexIndex
{
LIGHT_TEX = 0,
SCULPT_TEX,
NUM_VOLUME_TEXTURE_CHANNELS,
};
typedef enum {
TRIANGLES = 0,

View File

@@ -41,6 +41,7 @@
#include "llviewerinventory.h"
#include "llinventorymodel.h"
#include "llinventoryfunctions.h"
#include "llviewertexturelist.h"
// menu includes
#include "llevent.h"
@@ -493,7 +494,7 @@ public:
}
LLUUID id = me->mTexturesToSave.begin()->first;
LLViewerTexture* imagep = LLViewerTextureManager::findTexture(id);
LLViewerTexture* imagep = LLViewerTextureManager::findFetchedTexture(id, TEX_LIST_STANDARD);
if (!imagep)
{
me->mTexturesToSave.erase(id);

View File

@@ -149,7 +149,7 @@ LocalBitmap::LocalBitmap(const Params& p)
viewer_image->ref();
/* finalizing by adding LLViewerTexture instance into gTextureList */
gTextureList.addImage(viewer_image);
gTextureList.addImage(viewer_image, TEX_LIST_STANDARD);
/* filename is valid, bitmap is decoded and valid, i can haz liftoff! */
valid = true;
@@ -194,7 +194,7 @@ void LocalBitmap::updateSelf()
linkstatus = LINK_ON;
}
LLViewerFetchedTexture* image = gTextureList.findImage(id);
LLViewerFetchedTexture* image = gTextureList.findImage(id, TEX_LIST_STANDARD);
if (!image->forSculpt())
image->createGLTexture(LOCAL_DISCARD_LEVEL, new_imgraw);
else
@@ -306,11 +306,11 @@ void LocalBitmap::setType( S32 type )
void LocalBitmap::setID(const LLUUID& uuid)
{
LLViewerFetchedTexture* image = gTextureList.findImage(id);
LLViewerFetchedTexture* image = gTextureList.findImage(id, TEX_LIST_STANDARD);
gTextureList.deleteImage(image);
id = uuid;
image->setID(id);
gTextureList.addImage(image);
gTextureList.addImage(image, TEX_LIST_STANDARD);
}
/* [information query functions] */
@@ -536,7 +536,7 @@ void LocalAssetBrowser::DelBitmap( std::vector<LLScrollListItem*> delete_vector,
{
if ((*iter).getID() == id)
{
LLViewerFetchedTexture* image = gTextureList.findImage(id);
LLViewerFetchedTexture* image = gTextureList.findImage(id, TEX_LIST_STANDARD);
gTextureList.deleteImage( image );
image->unref();
iter = loaded_bitmaps.erase(iter);
@@ -695,7 +695,7 @@ void LocalAssetBrowser::PerformSculptUpdates(LocalBitmap& unit)
// update code [begin]
if (unit.volume_dirty)
{
LLImageRaw* rawimage = gTextureList.findImage(unit.getID())->getCachedRawImage();
LLImageRaw* rawimage = gTextureList.findImage(unit.getID(), TEX_LIST_STANDARD)->getCachedRawImage();
aobj.object->getVolume()->sculpt(rawimage->getWidth(), rawimage->getHeight(), rawimage->getComponents(), rawimage->getData(), 0, true);
unit.volume_dirty = false;

View File

@@ -328,6 +328,25 @@ void LLMaterialMgr::remove(const LLUUID& object_id, const U8 te)
put(object_id, te, LLMaterial::null);
}
void LLMaterialMgr::setLocalMaterial(const LLUUID& region_id, LLMaterialPtr material_ptr)
{
LLUUID uuid;
uuid.generate();
LLMaterialID material_id(uuid);
while (mMaterials.end() != mMaterials.find(material_id))
{ //probability that this loop will executed is very, very low (one in a billion chance)
uuid.generate();
material_id.set(uuid.mData);
}
LL_DEBUGS("Materials") << "region " << region_id << "new local material id " << material_id << LL_ENDL;
mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, material_ptr));
setMaterialCallbacks(material_id, material_ptr);
mGetPending.erase(pending_material_t(region_id, material_id));
}
const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data)
{
LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
@@ -340,17 +359,26 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
itMaterial = ret.first;
}
setMaterialCallbacks(material_id, itMaterial->second);
mGetPending.erase(pending_material_t(region_id, material_id));
return itMaterial->second;
}
void LLMaterialMgr::setMaterialCallbacks(const LLMaterialID& material_id, const LLMaterialPtr material_ptr)
{
TEMaterialPair te_mat_pair;
te_mat_pair.materialID = material_id;
U32 i = 0;
while (i < LLTEContents::MAX_TES)
while (i < LLTEContents::MAX_TES && !mGetTECallbacks.empty())
{
te_mat_pair.te = i++;
get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair);
if (itCallbackTE != mGetTECallbacks.end())
{
(*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te);
(*itCallbackTE->second)(material_id, material_ptr, te_mat_pair.te);
delete itCallbackTE->second;
mGetTECallbacks.erase(itCallbackTE);
}
@@ -359,15 +387,11 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
if (itCallback != mGetCallbacks.end())
{
(*itCallback->second)(material_id, itMaterial->second);
(*itCallback->second)(material_id, material_ptr);
delete itCallback->second;
mGetCallbacks.erase(itCallback);
}
mGetPending.erase(pending_material_t(region_id, material_id));
return itMaterial->second;
}
void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUID& region_id)

View File

@@ -55,14 +55,17 @@ public:
boost::signals2::connection getAll(const LLUUID& region_id, getall_callback_t::slot_type cb);
void put(const LLUUID& object_id, const U8 te, const LLMaterial& material);
void remove(const LLUUID& object_id, const U8 te);
protected:
//explicitly add new material to material manager
void setLocalMaterial(const LLUUID& region_id, LLMaterialPtr material_ptr);
private:
void clearGetQueues(const LLUUID& region_id);
bool isGetPending(const LLUUID& region_id, const LLMaterialID& material_id) const;
bool isGetAllPending(const LLUUID& region_id) const;
void markGetPending(const LLUUID& region_id, const LLMaterialID& material_id);
const LLMaterialPtr setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data);
void setMaterialCallbacks(const LLMaterialID& material_id, const LLMaterialPtr material_ptr);
static void onIdle(void*);
void processGetQueue();
void onGetResponse(bool success, const LLSD& content, const LLUUID& region_id);
@@ -72,15 +75,6 @@ protected:
void onPutResponse(bool success, const LLSD& content);
void onRegionRemoved(LLViewerRegion* regionp);
protected:
typedef std::set<LLMaterialID> material_queue_t;
typedef std::map<LLUUID, material_queue_t> get_queue_t;
get_queue_t mGetQueue;
typedef std::pair<const LLUUID, LLMaterialID> pending_material_t;
typedef std::map<const pending_material_t, F64> get_pending_map_t;
get_pending_map_t mGetPending;
typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
get_callback_map_t mGetCallbacks;
// struct for TE-specific material ID query
class TEMaterialPair
@@ -108,22 +102,32 @@ protected:
bool operator()(const TEMaterialPair& left, const TEMaterialPair& right) const { return left < right; }
};
typedef std::set<LLMaterialID> material_queue_t;
typedef std::map<LLUUID, material_queue_t> get_queue_t;
typedef std::pair<const LLUUID, LLMaterialID> pending_material_t;
typedef std::map<const pending_material_t, F64> get_pending_map_t;
typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*, TEMaterialPairHasher> get_callback_te_map_t;
get_callback_te_map_t mGetTECallbacks;
typedef uuid_set_t getall_queue_t;
getall_queue_t mGetAllQueue;
getall_queue_t mGetAllRequested;
typedef std::set<LLUUID> getall_queue_t;
typedef std::map<LLUUID, F64> getall_pending_map_t;
getall_pending_map_t mGetAllPending;
typedef std::map<LLUUID, getall_callback_t*> getall_callback_map_t;
getall_callback_map_t mGetAllCallbacks;
typedef std::map<U8, LLMaterial> facematerial_map_t;
typedef std::map<LLUUID, facematerial_map_t> put_queue_t;
put_queue_t mPutQueue;
material_map_t mMaterials;
get_queue_t mGetQueue;
get_pending_map_t mGetPending;
get_callback_map_t mGetCallbacks;
get_callback_te_map_t mGetTECallbacks;
getall_queue_t mGetAllQueue;
getall_queue_t mGetAllRequested;
getall_pending_map_t mGetAllPending;
getall_callback_map_t mGetAllCallbacks;
put_queue_t mPutQueue;
material_map_t mMaterials;
U32 getMaxEntries(const LLViewerRegion* regionp);
};

View File

@@ -2184,7 +2184,7 @@ void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical)
{
if (te)
{
LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL;
LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_STANDARD) : NULL;
if(!tex)
{
tex = LLViewerFetchedTexture::sDefaultImagep;

View File

@@ -457,10 +457,17 @@ public:
if(log_texture_traffic && data_size > 0)
{
LLViewerTexture* tex = LLViewerTextureManager::findTexture(mID) ;
if(tex)
// one worker per multiple textures
std::vector<LLViewerTexture*> textures;
LLViewerTextureManager::findTextures(mID, textures);
std::vector<LLViewerTexture*>::iterator iter = textures.begin();
while (iter != textures.end())
{
gTotalTextureBytesPerBoostLevel[tex->getBoostLevel()] += data_size ;
LLViewerTexture* tex = *iter++;
if (tex)
{
gTotalTextureBytesPerBoostLevel[tex->getBoostLevel()] += data_size;
}
}
}

View File

@@ -2186,9 +2186,9 @@ public:
{
LLAppViewer::getTextureCache()->removeFromCache(id);
img->forceRefetch();
for (S32 i = 0; i < img->getNumVolumes(); ++i)
for (S32 i = 0; i < img->getNumVolumes(LLRender::SCULPT_TEX); ++i)
{
LLVOVolume* volume = (*(img->getVolumeList()))[i];
LLVOVolume* volume = (*(img->getVolumeList(LLRender::SCULPT_TEX)))[i];
if (volume && volume->isSculpted())
{
const LLSculptParams *sculpt_params = volume->getSculptParams();

View File

@@ -1020,7 +1020,7 @@ void LLObjectBackup::exportNextTexture()
continue;
}
LLViewerTexture* imagep = LLViewerTextureManager::findTexture(id);
LLViewerTexture* imagep = LLViewerTextureManager::findFetchedTexture(id, TEX_LIST_STANDARD);
if (imagep)
{
if (imagep->getDiscardLevel() > 0)

View File

@@ -136,7 +136,7 @@ LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb,
{
if(mSourceCallbackList)
{
mSourceCallbackList->insert(target->getID());
mSourceCallbackList->insert(LLTextureKey(target->getID(), (ETexListType)target->getTextureListType()));
}
}
@@ -148,7 +148,7 @@ void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex)
{
if(mSourceCallbackList)
{
mSourceCallbackList->erase(tex->getID());
mSourceCallbackList->erase(LLTextureKey(tex->getID(), (ETexListType)tex->getTextureListType()));
}
}
@@ -175,24 +175,39 @@ LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &m
{
return new LLViewerMediaTexture(media_id, usemipmaps, gl_image);
}
LLViewerTexture* LLViewerTextureManager::findTexture(const LLUUID& id)
void LLViewerTextureManager::findFetchedTextures(const LLUUID& id, std::vector<LLViewerFetchedTexture*> &output)
{
LLViewerTexture* tex;
//search fetched texture list
tex = gTextureList.findImage(id);
//search media texture list
if(!tex)
{
tex = LLViewerTextureManager::findMediaTexture(id);
}
return tex;
return gTextureList.findTexturesByID(id, output);
}
LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID& id)
void LLViewerTextureManager::findTextures(const LLUUID& id, std::vector<LLViewerTexture*> &output)
{
return gTextureList.findImage(id);
std::vector<LLViewerFetchedTexture*> fetched_output;
gTextureList.findTexturesByID(id, fetched_output);
std::vector<LLViewerFetchedTexture*>::iterator iter = fetched_output.begin();
while (iter != fetched_output.end())
{
output.push_back(*iter);
iter++;
}
//search media texture list
if (output.empty())
{
LLViewerTexture* tex;
tex = LLViewerTextureManager::findMediaTexture(id);
if (tex)
{
output.push_back(tex);
}
}
}
LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID& id, S32 tex_type)
{
return gTextureList.findImage(id, (ETexListType)tex_type);
}
LLViewerMediaTexture* LLViewerTextureManager::findMediaTexture(const LLUUID &media_id)
@@ -629,14 +644,16 @@ void LLViewerTexture::init(bool firstinit)
mAdditionalDecodePriority = 0.f;
mParcelMedia = NULL;
mNumVolumes = 0;
memset(&mNumVolumes, 0, sizeof(U32)* LLRender::NUM_VOLUME_TEXTURE_CHANNELS);
mFaceList[LLRender::DIFFUSE_MAP].clear();
mFaceList[LLRender::NORMAL_MAP].clear();
mFaceList[LLRender::SPECULAR_MAP].clear();
mNumFaces[LLRender::DIFFUSE_MAP] =
mNumFaces[LLRender::NORMAL_MAP] =
mNumFaces[LLRender::SPECULAR_MAP] = 0;
mVolumeList.clear();
mVolumeList[LLRender::LIGHT_TEX].clear();
mVolumeList[LLRender::SCULPT_TEX].clear();
}
//virtual
@@ -652,7 +669,8 @@ void LLViewerTexture::cleanup()
mFaceList[LLRender::DIFFUSE_MAP].clear();
mFaceList[LLRender::NORMAL_MAP].clear();
mFaceList[LLRender::SPECULAR_MAP].clear();
mVolumeList.clear();
mVolumeList[LLRender::LIGHT_TEX].clear();
mVolumeList[LLRender::SCULPT_TEX].clear();
}
void LLViewerTexture::notifyAboutCreatingTexture()
@@ -858,40 +876,40 @@ S32 LLViewerTexture::getNumFaces(U32 ch) const
//virtual
void LLViewerTexture::addVolume(LLVOVolume* volumep)
void LLViewerTexture::addVolume(U32 ch, LLVOVolume* volumep)
{
if( mNumVolumes >= mVolumeList.size())
if (mNumVolumes[ch] >= mVolumeList[ch].size())
{
mVolumeList.resize(2 * mNumVolumes + 1);
mVolumeList[ch].resize(2 * mNumVolumes[ch] + 1);
}
mVolumeList[mNumVolumes] = volumep;
volumep->setIndexInTex(mNumVolumes);
mNumVolumes++;
mVolumeList[ch][mNumVolumes[ch]] = volumep;
volumep->setIndexInTex(ch, mNumVolumes[ch]);
mNumVolumes[ch]++;
mLastVolumeListUpdateTimer.reset();
}
//virtual
void LLViewerTexture::removeVolume(LLVOVolume* volumep)
void LLViewerTexture::removeVolume(U32 ch, LLVOVolume* volumep)
{
if(mNumVolumes > 1)
if (mNumVolumes[ch] > 1)
{
S32 index = volumep->getIndexInTex();
llassert(index < (S32)mVolumeList.size());
llassert(index < (S32)mNumVolumes);
mVolumeList[index] = mVolumeList[--mNumVolumes];
mVolumeList[index]->setIndexInTex(index);
S32 index = volumep->getIndexInTex(ch);
llassert(index < (S32)mVolumeList[ch].size());
llassert(index < (S32)mNumVolumes[ch]);
mVolumeList[ch][index] = mVolumeList[ch][--mNumVolumes[ch]];
mVolumeList[ch][index]->setIndexInTex(ch, index);
}
else
{
mVolumeList.clear();
mNumVolumes = 0;
mVolumeList[ch].clear();
mNumVolumes[ch] = 0;
}
mLastVolumeListUpdateTimer.reset();
}
S32 LLViewerTexture::getNumVolumes() const
S32 LLViewerTexture::getNumVolumes(U32 ch) const
{
return mNumVolumes;
return mNumVolumes[ch];
}
void LLViewerTexture::reorganizeFaceList()
@@ -922,9 +940,13 @@ void LLViewerTexture::reorganizeVolumeList()
static const F32 MAX_WAIT_TIME = 20.f; // seconds
static const U32 MAX_EXTRA_BUFFER_SIZE = 4;
if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size())
for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i)
{
return;
if (mNumVolumes[i] + MAX_EXTRA_BUFFER_SIZE > mVolumeList[i].size())
{
return;
}
}
if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
@@ -933,7 +955,10 @@ void LLViewerTexture::reorganizeVolumeList()
}
mLastVolumeListUpdateTimer.reset();
mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end());
for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i)
{
mVolumeList[i].erase(mVolumeList[i].begin() + mNumVolumes[i], mVolumeList[i].end());
}
}
//virtual
@@ -1547,10 +1572,10 @@ void LLViewerFetchedTexture::processTextureStats()
}
else
{
S32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight)
{
if (mFullWidth > desired_size || mFullHeight > desired_size)
if ((U32)mFullWidth > desired_size || (U32)mFullHeight > desired_size)
{
mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
}
@@ -1659,7 +1684,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
S32 ddiscard = MAX_DISCARD_LEVEL - (S32)desired;
ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY);
priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR;
setAdditionalDecodePriority(1.0f);//boost the textures without any data so far.
setAdditionalDecodePriority(0.1f);//boost the textures without any data so far.
}
else if ((mMinDiscardLevel > 0) && (cur_discard <= mMinDiscardLevel))
{
@@ -1874,7 +1899,8 @@ bool LLViewerFetchedTexture::updateFetch()
static LLCachedControl<bool> textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled");
static LLCachedControl<F32> sCameraMotionThreshold(gSavedSettings,"TextureCameraMotionThreshold");
static LLCachedControl<S32> sCameraMotionBoost(gSavedSettings,"TextureCameraMotionBoost");
if(textures_decode_disabled)
if(textures_decode_disabled ||
(gUseWireframe && mBoostLevel < LLGLTexture::BOOST_AVATAR_BAKED_SELF)) // don't fetch the surface textures in wireframe mode
{
return false;
}
@@ -3207,12 +3233,12 @@ void LLViewerLODTexture::processTextureStats()
discard_level = floorf(discard_level);
F32 min_discard = 0.f;
S32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
if (mBoostLevel <= LLGLTexture::BOOST_SCULPTED)
{
desired_size = DESIRED_NORMAL_TEXTURE_SIZE;
}
if (mFullWidth > desired_size || mFullHeight > desired_size)
if ((U32)mFullWidth > desired_size || (U32)mFullHeight > desired_size)
min_discard = 1.f;
discard_level = llclamp(discard_level, min_discard, (F32)MAX_DISCARD_LEVEL);
@@ -3375,7 +3401,7 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL
setCategory(LLGLTexture::MEDIA);
LLViewerTexture* tex = gTextureList.findImage(mID);
LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
if(tex) //this media is a parcel media for tex.
{
tex->setParcelMedia(this);
@@ -3385,7 +3411,7 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL
//virtual
LLViewerMediaTexture::~LLViewerMediaTexture()
{
LLViewerTexture* tex = gTextureList.findImage(mID);
LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
if(tex) //this media is a parcel media for tex.
{
tex->setParcelMedia(NULL);
@@ -3440,7 +3466,7 @@ BOOL LLViewerMediaTexture::findFaces()
BOOL ret = TRUE;
LLViewerTexture* tex = gTextureList.findImage(mID);
LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
if(tex) //this media is a parcel media for tex.
{
for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
@@ -3549,7 +3575,7 @@ void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep)
const LLTextureEntry* te = facep->getTextureEntry();
if(te && te->getID().notNull())
{
LLViewerTexture* tex = gTextureList.findImage(te->getID());
LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_STANDARD);
if(tex)
{
mTextureList.push_back(tex);//increase the reference number by one for tex to avoid deleting it.
@@ -3578,7 +3604,7 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep)
const LLTextureEntry* te = facep->getTextureEntry();
if(te && te->getID().notNull())
{
LLViewerTexture* tex = gTextureList.findImage(te->getID());
LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_STANDARD);
if(tex)
{
for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
@@ -3650,7 +3676,7 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep)
if(te && te->getID().notNull()) //should have a texture
{
LL_ERRS() << "mTextureList texture reference number is corrupted." << LL_ENDL;
LL_ERRS() << "mTextureList texture reference number is corrupted. Texture id: " << te->getID() << " List size: " << (U32)mTextureList.size() << LL_ENDL;
}
}
@@ -3687,10 +3713,10 @@ void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep)
const LLTextureEntry* te = facep->getTextureEntry();
if(te)
{
LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL;
LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_STANDARD) : NULL;
if(!tex && te->getID() != mID)//try parcel media.
{
tex = gTextureList.findImage(mID);
tex = gTextureList.findImage(mID, TEX_LIST_STANDARD);
}
if(!tex)
{

View File

@@ -61,11 +61,12 @@ class LLMessageSystem;
class LLViewerMediaImpl ;
class LLVOVolume ;
class LLFace ; //But llface.h is already included...(?)
struct LLTextureKey;
class LLLoadedCallbackEntry
{
public:
typedef std::set< LLUUID > source_callback_list_t;
typedef std::set< LLTextureKey > source_callback_list_t;
public:
LLLoadedCallbackEntry(loaded_callback_func cb,
@@ -138,6 +139,8 @@ public:
void setID(const LLUUID& id) { mID = id; } // Edit for local assets to cut down on reloads, be sure to remove from wherever this has been added first.
void setBoostLevel(S32 level);
S32 getBoostLevel() { return mBoostLevel; }
void setTextureListType(S32 tex_type) { mTextureListType = tex_type; }
S32 getTextureListType() { return mTextureListType; }
void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const;
void resetTextureStats();
@@ -159,10 +162,10 @@ public:
S32 getNumFaces(U32 ch) const;
const ll_face_list_t* getFaceList(U32 channel) const {llassert(channel < LLRender::NUM_TEXTURE_CHANNELS); return &mFaceList[channel];}
virtual void addVolume(LLVOVolume* volumep);
virtual void removeVolume(LLVOVolume* volumep);
S32 getNumVolumes() const;
const ll_volume_list_t* getVolumeList() const { return &mVolumeList; }
virtual void addVolume(U32 channel, LLVOVolume* volumep);
virtual void removeVolume(U32 channel, LLVOVolume* volumep);
S32 getNumVolumes(U32 channel) const;
const ll_volume_list_t* getVolumeList(U32 channel) const { return &mVolumeList[channel]; }
virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
@@ -192,6 +195,8 @@ private:
static bool isMemoryForTextureLow() ;
protected:
LLUUID mID;
S32 mTextureListType; // along with mID identifies where to search for this texture in TextureList
F32 mSelectedTime; // time texture was last selected
mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need?
mutable S32 mMaxVirtualSizeResetCounter ;
@@ -203,8 +208,8 @@ protected:
U32 mNumFaces[LLRender::NUM_TEXTURE_CHANNELS];
LLFrameTimer mLastFaceListUpdateTimer ;
ll_volume_list_t mVolumeList;
U32 mNumVolumes;
ll_volume_list_t mVolumeList[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
U32 mNumVolumes[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
LLFrameTimer mLastVolumeListUpdateTimer;
//do not use LLPointer here.
@@ -636,8 +641,9 @@ public:
//
//"find-texture" just check if the texture exists, if yes, return it, otherwise return null.
//
static LLViewerTexture* findTexture(const LLUUID& id) ;
static LLViewerFetchedTexture* findFetchedTexture(const LLUUID& id) ;
static void findFetchedTextures(const LLUUID& id, std::vector<LLViewerFetchedTexture*> &output);
static void findTextures(const LLUUID& id, std::vector<LLViewerTexture*> &output);
static LLViewerFetchedTexture* findFetchedTexture(const LLUUID& id, S32 tex_type);
static LLViewerMediaTexture* findMediaTexture(const LLUUID& id) ;
static LLViewerMediaTexture* createMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
@@ -720,18 +726,18 @@ private:
private:
BOOL mUsingDefaultTexture; //if set, some textures are still gray.
U32 mTotalBytesUsed ; //total bytes of textures bound/used for the current frame.
U32 mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256.
U32 mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame.
U32 mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256.
U32Bytes mTotalBytesUsed ; //total bytes of textures bound/used for the current frame.
U32Bytes mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256.
U32Bytes mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame.
U32Bytes mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256.
//
//data size
//
U32 mTotalBytesLoaded ; //total bytes fetched by texture pipeline
U32 mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache
U32 mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256.
U32 mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties
U32Bytes mTotalBytesLoaded ; //total bytes fetched by texture pipeline
U32Bytes mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache
U32Bytes mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256.
U32Bytes mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties
//
//time

View File

@@ -82,8 +82,25 @@ S32 LLViewerTextureList::sNumImages = 0;
LLViewerTextureList gTextureList;
static LLTrace::BlockTimerStatHandle FTM_PROCESS_IMAGES("Process Images");
ETexListType get_element_type(S32 priority)
{
return (priority == LLViewerFetchedTexture::BOOST_ICON) ? TEX_LIST_SCALE : TEX_LIST_STANDARD;
}
///////////////////////////////////////////////////////////////////////////////
LLTextureKey::LLTextureKey()
: textureId(LLUUID::null),
textureType(TEX_LIST_STANDARD)
{
}
LLTextureKey::LLTextureKey(LLUUID id, ETexListType tex_type)
: textureId(id), textureType(tex_type)
{
}
///////////////////////////////////////////////////////////////////////////////
LLViewerTextureList::LLViewerTextureList()
: mForceResetTextureStats(FALSE),
mUpdateStats(FALSE),
@@ -398,7 +415,8 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string&
if (full_path.empty() || (full && !gDirUtilp->fileExists(full_path)))
{
LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL;
return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
LLViewerTexture::EBoostLevel priority = LLGLTexture::BOOST_UI;
return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, priority);
}
std::string url = "file://" + full_path;
@@ -438,16 +456,10 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
new_id.generate(url);
}
LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id);
LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id, get_element_type(boost_priority));
if (!imagep.isNull())
{
if (boost_priority != LLViewerTexture::BOOST_ALM && imagep->getBoostLevel() == LLViewerTexture::BOOST_ALM)
{
// Workaround: we need BOOST_ALM texture for something, 'rise' to NONE
imagep->setBoostLevel(LLViewerTexture::BOOST_NONE);
}
LLViewerFetchedTexture *texture = imagep.get();
if (texture->getUrl().empty())
{
@@ -482,15 +494,21 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
addImage(imagep, get_element_type(boost_priority));
if (boost_priority != 0)
{
if (boost_priority == LLViewerFetchedTexture::BOOST_UI ||
boost_priority == LLViewerFetchedTexture::BOOST_ICON)
if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
{
imagep->dontDiscard();
}
if (boost_priority == LLViewerFetchedTexture::BOOST_ICON)
{
// Agent and group Icons are downloadable content, nothing manages
// icon deletion yet, so they should not persist
imagep->dontDiscard();
imagep->forceActive();
}
imagep->setBoostLevel(boost_priority);
}
}
@@ -524,9 +542,15 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id,
return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI));
}
LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id);
LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, get_element_type(boost_priority));
if (!imagep.isNull())
{
if (boost_priority != LLViewerTexture::BOOST_ALM && imagep->getBoostLevel() == LLViewerTexture::BOOST_ALM)
{
// Workaround: we need BOOST_ALM texture for something, 'rise' to NONE
imagep->setBoostLevel(LLViewerTexture::BOOST_NONE);
}
LLViewerFetchedTexture *texture = imagep.get();
if (request_from_host.isOk() &&
!texture->getTargetHost().isOk())
@@ -583,16 +607,22 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
{
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
addImage(imagep, get_element_type(boost_priority));
if (boost_priority != 0)
{
if (boost_priority == LLViewerFetchedTexture::BOOST_UI ||
boost_priority == LLViewerFetchedTexture::BOOST_ICON)
if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
{
imagep->dontDiscard();
}
if (boost_priority == LLViewerFetchedTexture::BOOST_ICON)
{
// Agent and group Icons are downloadable content, nothing manages
// icon deletion yet, so they should not persist.
imagep->dontDiscard();
imagep->forceActive();
}
imagep->setBoostLevel(boost_priority);
}
else
@@ -606,13 +636,29 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
return imagep ;
}
LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id)
void LLViewerTextureList::findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output)
{
LLTextureKey search_key(image_id, TEX_LIST_STANDARD);
uuid_map_t::iterator iter = mUUIDMap.lower_bound(search_key);
while (iter != mUUIDMap.end() && iter->first.textureId == image_id)
{
output.push_back(iter->second);
iter++;
}
}
LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLTextureKey &search_key)
{
// Singu note: Reworked hotspot
const auto& iter = mUUIDDict.find(image_id);
const auto& iter = mUUIDDict.find(search_key);
if(iter == mUUIDDict.end())
return NULL;
return iter->second;
return iter->second;
}
LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id, ETexListType tex_type)
{
return findImage(LLTextureKey(image_id, tex_type));
}
void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image)
@@ -657,7 +703,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
<< " but doesn't have mInImageList set"
<< " ref count is " << image->getNumRefs()
<< LL_ENDL;
const auto& iter = mUUIDDict.find(image->getID());
const auto& iter = mUUIDDict.find(LLTextureKey(image->getID(), (ETexListType)image->getTextureListType()));
if(iter == mUUIDDict.end())
{
LL_INFOS() << "Image " << image->getID() << " is also not in mUUIDMap!" << LL_ENDL ;
@@ -682,7 +728,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
image->setInImageList(FALSE) ;
}
void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image)
void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, ETexListType tex_type)
{
if (!new_image)
{
@@ -690,8 +736,9 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image)
return;
}
LLUUID image_id = new_image->getID();
LLTextureKey key(image_id, tex_type);
LLViewerFetchedTexture *image = findImage(image_id);
LLViewerFetchedTexture *image = findImage(key);
if (image)
{
LL_INFOS() << "Image with ID " << image_id << " already in list" << LL_ENDL;
@@ -699,12 +746,13 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image)
sNumImages++;
addImageToList(new_image);
auto ret_pair = mUUIDMap.emplace(image_id, new_image);
auto ret_pair = mUUIDMap.emplace(key, new_image);
if (!ret_pair.second)
{
ret_pair.first->second = new_image;
}
mUUIDDict.insert_or_assign(image_id, new_image);
mUUIDDict.insert_or_assign(key, new_image);
new_image->setTextureListType(tex_type);
}
@@ -717,9 +765,9 @@ void LLViewerTextureList::deleteImage(LLViewerFetchedTexture *image)
mCallbackList.erase(image);
}
const LLUUID& id = image->getID();
llverify(mUUIDMap.erase(id) == 1);
llverify(mUUIDDict.erase(id) == 1);
const LLTextureKey key(image->getID(), (ETexListType)image->getTextureListType());
llverify(mUUIDMap.erase(key) == 1);
llverify(mUUIDDict.erase(key) == 1);
sNumImages--;
removeImageFromList(image);
}
@@ -866,14 +914,14 @@ void LLViewerTextureList::updateImagesDecodePriorities()
static const S32 MAX_PRIO_UPDATES = gSavedSettings.getS32("TextureFetchUpdatePriorities"); // default: 32
const size_t max_update_count = llmin((S32) (MAX_PRIO_UPDATES*MAX_PRIO_UPDATES*gFrameIntervalSeconds) + 1, MAX_PRIO_UPDATES);
S32 update_counter = llmin(max_update_count, mUUIDMap.size());
uuid_map_t::iterator iter = mUUIDMap.upper_bound(mLastUpdateUUID);
uuid_map_t::iterator iter = mUUIDMap.upper_bound(mLastUpdateKey);
while ((update_counter-- > 0) && !mUUIDMap.empty())
{
if (iter == mUUIDMap.end())
{
iter = mUUIDMap.begin();
}
mLastUpdateUUID = iter->first;
mLastUpdateKey = iter->first;
LLPointer<LLViewerFetchedTexture> imagep = iter->second;
++iter; // safe to incrament now
@@ -1065,7 +1113,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
update_counter = max_update_count;
if(update_counter > 0)
{
uuid_map_t::iterator iter2 = mUUIDMap.upper_bound(mLastFetchUUID);
uuid_map_t::iterator iter2 = mUUIDMap.upper_bound(mLastFetchKey);
while ((update_counter > 0) && (total_update_count > 0))
{
if (iter2 == mUUIDMap.end())
@@ -1095,7 +1143,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
fetch_count += (imagep->updateFetch() ? 1 : 0);
if (min_count <= (S32)min_update_count)
{
mLastFetchUUID = imagep->getID();
mLastFetchKey = LLTextureKey(imagep->getID(), (ETexListType)imagep->getTextureListType());
}
if ((min_count-- <= 0) && (image_op_timer.getElapsedTimeF32() > max_time))
{
@@ -1556,14 +1604,22 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
LLUUID image_id;
msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id);
LLViewerFetchedTexture* image = gTextureList.findImage( image_id );
LLViewerFetchedTexture* image = gTextureList.findImage( image_id, TEX_LIST_STANDARD);
if( image )
{
LL_WARNS() << "not in db" << LL_ENDL;
LL_WARNS() << "Image not in db" << LL_ENDL;
image->setIsMissingAsset();
}
image = gTextureList.findImage(image_id, TEX_LIST_SCALE);
if (image)
{
LL_WARNS() << "Icon not in db" << LL_ENDL;
image->setIsMissingAsset();
}
}
///////////////////////////////////////////////////////////////////////////////
// explicitly cleanup resources, as this is a singleton class with process
@@ -1642,13 +1698,18 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st
//don't compress UI images
imagep->getGLTexture()->setAllowCompression(false);
//all UI images are non-deletable
imagep->setNoDelete();
LLUIImagePtr new_imagep = new LLUIImage(name, imagep);
new_imagep->setScaleStyle(scale_style);
mUIImages.insert(std::make_pair(name, new_imagep));
mUITextureList.push_back(imagep);
if (imagep->getBoostLevel() != LLGLTexture::BOOST_ICON &&
imagep->getBoostLevel() != LLGLTexture::BOOST_PREVIEW)
{
// Don't add downloadable content into this list
// all UI images are non-deletable and list does not support deletion
imagep->setNoDelete();
mUIImages.insert(std::make_pair(name, new_imagep));
mUITextureList.push_back(imagep);
}
//Note:
//Some other textures such as ICON also through this flow to be fetched.

View File

@@ -62,12 +62,48 @@ typedef void (*LLImageCallback)(BOOL success,
BOOL final,
void* userdata);
enum ETexListType
{
TEX_LIST_STANDARD = 0,
TEX_LIST_SCALE
};
struct LLTextureKey
{
LLTextureKey();
LLTextureKey(LLUUID id, ETexListType tex_type);
LLUUID textureId;
ETexListType textureType;
friend bool operator == (const LLTextureKey& lhs, const LLTextureKey& rhs) {
return lhs.textureId == rhs.textureId && lhs.textureType == rhs.textureType;
}
friend bool operator<(const LLTextureKey& key1, const LLTextureKey& key2)
{
if (key1.textureId != key2.textureId)
{
return key1.textureId < key2.textureId;
}
else
{
return key1.textureType < key2.textureType;
}
}
template <typename H>
friend H AbslHashValue(H h, const LLTextureKey& key) {
return H::combine(std::move(h), key.textureId, key.textureType);
}
};
class LLViewerTextureList
{
LOG_CLASS(LLViewerTextureList);
friend class LLTextureView;
friend class LLViewerTextureManager;
friend class LocalBitmap;
friend class LocalAssetBrowser;
public:
static BOOL createUploadFile(const std::string& filename, const std::string& out_filename, const U8 codec);
@@ -88,7 +124,9 @@ public:
void restoreGL();
BOOL isInitialized() const {return mInitialized;}
LLViewerFetchedTexture *findImage(const LLUUID &image_id);
void findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output);
LLViewerFetchedTexture *findImage(const LLUUID &image_id, ETexListType tex_type);
LLViewerFetchedTexture *findImage(const LLTextureKey &search_key);
void dirtyImage(LLViewerFetchedTexture *image);
@@ -123,10 +161,8 @@ private:
F32 updateImagesFetchTextures(F32 max_time);
void updateImagesUpdateStats();
public:
void addImage(LLViewerFetchedTexture *image);
void addImage(LLViewerFetchedTexture *image, ETexListType tex_type);
void deleteImage(LLViewerFetchedTexture *image);
private:
void addImageToList(LLViewerFetchedTexture *image);
void removeImageFromList(LLViewerFetchedTexture *image);
@@ -188,12 +224,12 @@ public:
BOOL mForceResetTextureStats;
private:
typedef std::map< LLUUID, LLPointer<LLViewerFetchedTexture> > uuid_map_t;
typedef std::map< LLTextureKey, LLPointer<LLViewerFetchedTexture> > uuid_map_t;
uuid_map_t mUUIDMap;
typedef absl::flat_hash_map< LLUUID, LLViewerFetchedTexture* > uuid_dict_t;
typedef absl::flat_hash_map< LLTextureKey, LLViewerFetchedTexture* > uuid_dict_t;
uuid_dict_t mUUIDDict;
LLUUID mLastUpdateUUID;
LLUUID mLastFetchUUID;
LLTextureKey mLastUpdateKey;
LLTextureKey mLastFetchKey;
typedef std::set<LLPointer<LLViewerFetchedTexture>, LLViewerFetchedTexture::Compare> image_priority_list_t;
image_priority_list_t mImageList;

View File

@@ -2852,7 +2852,7 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU
uuid == IMG_INVISIBLE)
{
// Should already exist, don't need to find it on sim or baked-texture host.
result = gTextureList.findImage(uuid);
result = gTextureList.findImage(uuid, TEX_LIST_STANDARD);
}
if (!result)
@@ -5748,7 +5748,7 @@ bool LLVOAvatar::allTexturesCompletelyDownloaded(uuid_set_t& ids) const
{
for (auto it = ids.begin(); it != ids.end(); ++it)
{
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it);
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
if (imagep && imagep->getDiscardLevel()!=0)
{
return false;
@@ -5782,7 +5782,7 @@ void LLVOAvatar::bakedTextureOriginCounts(S32 &sb_count, // server-bake, has ori
collectBakedTextureUUIDs(baked_ids);
for (auto it = baked_ids.begin(); it != baked_ids.end(); ++it)
{
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it);
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
bool has_url = false, has_host = false;
if (!imagep->getUrl().empty())
{
@@ -5807,7 +5807,7 @@ std::string LLVOAvatar::bakedTextureOriginInfo()
collectBakedTextureUUIDs(baked_ids);
for (auto it = baked_ids.begin(); it != baked_ids.end(); ++it)
{
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it);
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
bool has_url = false, has_host = false;
if (!imagep->getUrl().empty())
{
@@ -5836,7 +5836,7 @@ S32Bytes LLVOAvatar::totalTextureMemForUUIDS(uuid_set_t& ids)
S32Bytes result(0);
for (auto it = ids.begin(); it != ids.end(); ++it)
{
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it);
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
if (imagep)
{
result += imagep->getTextureMemory();
@@ -5924,7 +5924,7 @@ void LLVOAvatar::releaseOldTextures()
{
if (new_texture_ids.find(*it) == new_texture_ids.end())
{
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it);
LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_STANDARD);
if (imagep)
{
current_texture_mem += imagep->getTextureMemory();

View File

@@ -239,7 +239,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
mMediaImplList.resize(getNumTEs());
mLastFetchedMediaVersion = -1;
mIndexInTex = 0;
memset(&mIndexInTex, 0, sizeof(S32) * LLRender::NUM_VOLUME_TEXTURE_CHANNELS);
mMDCImplCount = 0;
mLastRiggingInfoLOD = -1;
}
@@ -285,7 +285,12 @@ void LLVOVolume::markDead()
if (mSculptTexture.notNull())
{
mSculptTexture->removeVolume(this);
mSculptTexture->removeVolume(LLRender::SCULPT_TEX, this);
}
if (mLightTexture.notNull())
{
mLightTexture->removeVolume(LLRender::LIGHT_TEX, this);
}
}
@@ -852,7 +857,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced)
{
const LLLightImageParams* params = getLightImageParams();
LLUUID id = params->getLightTexture();
mLightTexture = LLViewerTextureManager::getFetchedTexture(id);
mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_ALM);
if (mLightTexture.notNull())
{
F32 rad = getLightRadius();
@@ -1116,11 +1121,11 @@ void LLVOVolume::updateSculptTexture()
{
if (old_sculpt.notNull())
{
old_sculpt->removeVolume(this);
old_sculpt->removeVolume(LLRender::SCULPT_TEX, this);
}
if (mSculptTexture.notNull())
{
mSculptTexture->addVolume(this);
mSculptTexture->addVolume(LLRender::SCULPT_TEX, this);
}
}
@@ -1231,9 +1236,9 @@ void LLVOVolume::sculpt()
getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset());
//notify rebuild any other VOVolumes that reference this sculpty volume
for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i)
for (S32 i = 0; i < mSculptTexture->getNumVolumes(LLRender::SCULPT_TEX); ++i)
{
LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i];
LLVOVolume* volume = (*(mSculptTexture->getVolumeList(LLRender::SCULPT_TEX)))[i];
if (volume != this && volume->getVolume() == getVolume())
{
gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE);
@@ -2273,7 +2278,7 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
//setup new materials
for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)
{
LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second);
LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second);
LLViewerObject::setTEMaterialParams(it->first, it->second);
}
@@ -2382,7 +2387,7 @@ S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialPa
if(new_material) {
pMaterial = new_material;
LLMaterialMgr::getInstance()->put(getID(),te,*pMaterial);
LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial);
}
}
@@ -2946,27 +2951,42 @@ S32 LLVOVolume::getFaceIndexWithMediaImpl(const LLViewerMediaImpl* media_impl, S
void LLVOVolume::setLightTextureID(LLUUID id)
{
LLViewerTexture* old_texturep = getLightTexture(); // same as mLightTexture, but inits if nessesary
if (id.notNull())
{
if (!hasLightTexture())
{
setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, TRUE, true);
}
else if (old_texturep)
{
old_texturep->removeVolume(LLRender::LIGHT_TEX, this);
}
LLLightImageParams* param_block = (LLLightImageParams*)getLightImageParams();
if (param_block && param_block->getLightTexture() != id)
{
param_block->setLightTexture(id);
parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
}
}
else
{
if (hasLightTexture())
LLViewerTexture* tex = getLightTexture();
if (tex)
{
setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true);
parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
mLightTexture = NULL;
tex->addVolume(LLRender::LIGHT_TEX, this); // new texture
}
else
{
LL_WARNS() << "Can't get light texture for ID " << id.asString() << LL_ENDL;
}
}
else if (hasLightTexture())
{
if (old_texturep)
{
old_texturep->removeVolume(LLRender::LIGHT_TEX, this);
}
setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true);
parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true);
mLightTexture = NULL;
}
}
@@ -3178,7 +3198,7 @@ LLViewerTexture* LLVOVolume::getLightTexture()
{
if (mLightTexture.isNull() || id != mLightTexture->getID())
{
mLightTexture = LLViewerTextureManager::getFetchedTexture(id);
mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_ALM);
}
}
else

View File

@@ -224,10 +224,10 @@ public:
/*virtual*/ BOOL setMaterial(const U8 material);
void setTexture(const S32 face);
S32 getIndexInTex() const {return mIndexInTex ;}
S32 getIndexInTex(U32 ch) const {return mIndexInTex[ch];}
/*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false);
void updateSculptTexture();
void setIndexInTex(S32 index) { mIndexInTex = index ;}
void setIndexInTex(U32 ch, S32 index) { mIndexInTex[ch] = index ;}
void sculpt();
static void rebuildMeshAssetCallback(LLVFS *vfs,
const LLUUID& asset_uuid,
@@ -416,7 +416,7 @@ private:
LLPointer<LLViewerFetchedTexture> mLightTexture;
media_list_t mMediaImplList;
S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1
S32 mIndexInTex;
S32 mIndexInTex[LLRender::NUM_VOLUME_TEXTURE_CHANNELS];
S32 mMDCImplCount;
LLPointer<LLRiggedVolume> mRiggedVolume;

View File

@@ -96,7 +96,7 @@ LLSimInfo::LLSimInfo(U64 handle)
void LLSimInfo::setLandForSaleImage (LLUUID image_id)
{
const bool is_whitecore = gHippoGridManager->getConnectedGrid()->isWhiteCore();
if (is_whitecore && mMapImageID[SIM_LAYER_OVERLAY].isNull() && image_id.notNull() && gTextureList.findImage(image_id))
if (is_whitecore && mMapImageID[SIM_LAYER_OVERLAY].isNull() && image_id.notNull() && gTextureList.findImage(image_id, TEX_LIST_STANDARD))
LLAppViewer::getTextureCache()->removeFromCache(image_id);
mMapImageID[SIM_LAYER_OVERLAY] = image_id;