summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2013-03-25 18:27:07 -0500
committerDave Parks <davep@lindenlab.com>2013-03-25 18:27:07 -0500
commit41ca92c67c75d86e8053ae45725d36ca3ac7e742 (patch)
tree92d15cb41a3ae1add912bb134581530d48a8b776 /indra/newview/llviewertexture.cpp
parent6620c1f824f2034d432662a84174019a26ed9a78 (diff)
NORSPEC-54 Potential fix for crashing on all sorts of random operations.
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r--indra/newview/llviewertexture.cpp420
1 files changed, 138 insertions, 282 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 08fcb60d03..a57270caeb 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -55,8 +55,6 @@
#include "llappviewer.h"
#include "llface.h"
#include "llviewercamera.h"
-#include "lltextureatlas.h"
-#include "lltextureatlasmanager.h"
#include "lltextureentry.h"
#include "llmediaentry.h"
#include "llvovolume.h"
@@ -97,7 +95,6 @@ S32 LLViewerTexture::sMinLargeImageSize = 65536 ; //256 * 256.
S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA ;
BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE ;
F32 LLViewerTexture::sCurrentTime = 0.0f ;
-BOOL LLViewerTexture::sUseTextureAtlas = FALSE ;
F32 LLViewerTexture::sTexelPixelRatio = 1.0f;
LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF;
@@ -556,8 +553,7 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
}
}
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, desired_discard_bias_min, desired_discard_bias_max);
- LLViewerTexture::sUseTextureAtlas = gSavedSettings.getBOOL("EnableTextureAtlas") ;
-
+
F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ;
F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed();
sCameraMovingBias = llmax(0.2f * camera_moving_speed, 2.0f * camera_angular_speed - 1);
@@ -639,9 +635,12 @@ void LLViewerTexture::init(bool firstinit)
mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval ;
mAdditionalDecodePriority = 0.f ;
mParcelMedia = NULL ;
- mNumFaces = 0 ;
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ mNumFaces[i] = 0;
+ mFaceList[i].clear();
+ }
mNumVolumes = 0;
- mFaceList.clear() ;
mVolumeList.clear();
}
@@ -653,7 +652,10 @@ S8 LLViewerTexture::getType() const
void LLViewerTexture::cleanup()
{
- mFaceList.clear() ;
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ mFaceList[i].clear() ;
+ }
mVolumeList.clear();
if(mGLTexturep)
{
@@ -778,38 +780,57 @@ void LLViewerTexture::setKnownDrawSize(S32 width, S32 height)
}
//virtual
-void LLViewerTexture::addFace(LLFace* facep)
+void LLViewerTexture::addFace(U32 ch, LLFace* facep)
{
- if(mNumFaces >= mFaceList.size())
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+
+ if(mNumFaces[ch] >= mFaceList[ch].size())
{
- mFaceList.resize(2 * mNumFaces + 1) ;
+ mFaceList[ch].resize(2 * mNumFaces[ch] + 1) ;
}
- mFaceList[mNumFaces] = facep ;
- facep->setIndexInTex(mNumFaces) ;
- mNumFaces++ ;
+ mFaceList[ch][mNumFaces[ch]] = facep ;
+ facep->setIndexInTex(ch, mNumFaces[ch]) ;
+ mNumFaces[ch]++ ;
mLastFaceListUpdateTimer.reset() ;
}
//virtual
-void LLViewerTexture::removeFace(LLFace* facep)
+void LLViewerTexture::removeFace(U32 ch, LLFace* facep)
{
- if(mNumFaces > 1)
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+
+ if(mNumFaces[ch] > 1)
{
- S32 index = facep->getIndexInTex() ;
- mFaceList[index] = mFaceList[--mNumFaces] ;
- mFaceList[index]->setIndexInTex(index) ;
+ S32 index = facep->getIndexInTex(ch) ;
+ llassert(index < mFaceList[ch].size());
+ llassert(index < mNumFaces[ch]);
+ mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]] ;
+ mFaceList[ch][index]->setIndexInTex(ch, index) ;
}
else
{
- mFaceList.clear() ;
- mNumFaces = 0 ;
+ mFaceList[ch].clear() ;
+ mNumFaces[ch] = 0 ;
}
mLastFaceListUpdateTimer.reset() ;
}
-S32 LLViewerTexture::getNumFaces() const
+S32 LLViewerTexture::getTotalNumFaces() const
+{
+ S32 ret = 0;
+
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
+ {
+ ret += mNumFaces[i];
+ }
+
+ return ret;
+}
+
+S32 LLViewerTexture::getNumFaces(U32 ch) const
{
- return mNumFaces ;
+ llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
+ return mNumFaces[ch];
}
@@ -832,6 +853,8 @@ void LLViewerTexture::removeVolume(LLVOVolume* volumep)
if(mNumVolumes > 1)
{
S32 index = volumep->getIndexInTex() ;
+ llassert(index < mVolumeList.size());
+ llassert(index < mNumVolumes);
mVolumeList[index] = mVolumeList[--mNumVolumes] ;
mVolumeList[index]->setIndexInTex(index) ;
}
@@ -853,18 +876,22 @@ void LLViewerTexture::reorganizeFaceList()
static const F32 MAX_WAIT_TIME = 20.f; // seconds
static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ;
- if(mNumFaces + MAX_EXTRA_BUFFER_SIZE > mFaceList.size())
+ if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
{
- return ;
+ return;
}
- if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
+ for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
{
- return ;
+ if(mNumFaces[i] + MAX_EXTRA_BUFFER_SIZE > mFaceList[i].size())
+ {
+ return ;
+ }
+
+ mFaceList[i].erase(mFaceList[i].begin() + mNumFaces[i], mFaceList[i].end());
}
-
+
mLastFaceListUpdateTimer.reset() ;
- mFaceList.erase(mFaceList.begin() + mNumFaces, mFaceList.end());
}
void LLViewerTexture::reorganizeVolumeList()
@@ -1130,13 +1157,6 @@ void LLViewerTexture::forceUpdateBindStats(void) const
return mGLTexturep->forceUpdateBindStats() ;
}
-U32 LLViewerTexture::getTexelsInAtlas() const
-{
- llassert(mGLTexturep.notNull()) ;
-
- return mGLTexturep->getTexelsInAtlas() ;
-}
-
U32 LLViewerTexture::getTexelsInGLTexture() const
{
llassert(mGLTexturep.notNull()) ;
@@ -1151,13 +1171,6 @@ BOOL LLViewerTexture::isGLTextureCreated() const
return mGLTexturep->isGLTextureCreated() ;
}
-S32 LLViewerTexture::getDiscardLevelInAtlas() const
-{
- llassert(mGLTexturep.notNull()) ;
-
- return mGLTexturep->getDiscardLevelInAtlas() ;
-}
-
void LLViewerTexture::destroyGLTexture()
{
if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture())
@@ -1470,9 +1483,14 @@ void LLViewerFetchedTexture::addToCreateTexture()
mGLTexturep->setComponents(mComponents) ;
force_update = true ;
- for(U32 i = 0 ; i < mNumFaces ; i++)
+ for (U32 j = 0; j < LLRender::NUM_TEXTURE_CHANNELS; ++j)
{
- mFaceList[i]->dirtyTexture() ;
+ llassert(mNumFaces[j] <= mFaceList[j].size());
+
+ for(U32 i = 0 ; i < mNumFaces[j]; i++)
+ {
+ mFaceList[j][i]->dirtyTexture() ;
+ }
}
//discard the cached raw image and the saved raw image
@@ -1615,11 +1633,8 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
return FALSE;
}
- if(!(res = insertToAtlas()))
- {
- res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
- resetFaceAtlas() ;
- }
+ res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
+
setActive() ;
if (!needsToSaveRawImage())
@@ -1908,28 +1923,32 @@ void LLViewerFetchedTexture::updateVirtualSize()
addTextureStats(0.f, FALSE) ;//reset
}
- for(U32 i = 0 ; i < mNumFaces ; i++)
- {
- LLFace* facep = mFaceList[i] ;
- if( facep )
- {
- LLDrawable* drawable = facep->getDrawable();
- if (drawable)
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
+ {
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+
+ for(U32 i = 0 ; i < mNumFaces[ch]; i++)
+ {
+ LLFace* facep = mFaceList[ch][i] ;
+ if( facep )
{
- if(drawable->isRecentlyVisible())
+ LLDrawable* drawable = facep->getDrawable();
+ if (drawable)
{
- if (getBoostLevel() == LLViewerTexture::BOOST_NONE &&
- drawable->getVObj() && drawable->getVObj()->isSelected())
+ if(drawable->isRecentlyVisible())
{
- setBoostLevel(LLViewerTexture::BOOST_SELECTED);
+ if (getBoostLevel() == LLViewerTexture::BOOST_NONE &&
+ drawable->getVObj() && drawable->getVObj()->isSelected())
+ {
+ setBoostLevel(LLViewerTexture::BOOST_SELECTED);
+ }
+ addTextureStats(facep->getVirtualSize()) ;
+ setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
}
- addTextureStats(facep->getVirtualSize()) ;
- setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
}
}
}
}
-
//reset whether or not a face was selected after 10 seconds
const F32 SELECTION_RESET_TIME = 10.f;
@@ -3005,190 +3024,6 @@ F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const
{
return sCurrentTime - mLastReferencedSavedRawImageTime ;
}
-//----------------------------------------------------------------------------------------------
-//atlasing
-//----------------------------------------------------------------------------------------------
-void LLViewerFetchedTexture::resetFaceAtlas()
-{
- //Nothing should be done here.
-}
-
-//invalidate all atlas slots for this image.
-void LLViewerFetchedTexture::invalidateAtlas(BOOL rebuild_geom)
-{
- for(U32 i = 0 ; i < mNumFaces ; i++)
- {
- LLFace* facep = mFaceList[i] ;
- facep->removeAtlas() ;
- if(rebuild_geom && facep->getDrawable() && facep->getDrawable()->getSpatialGroup())
- {
- facep->getDrawable()->getSpatialGroup()->setState(LLSpatialGroup::GEOM_DIRTY);
- }
- }
-}
-
-BOOL LLViewerFetchedTexture::insertToAtlas()
-{
- if(!LLViewerTexture::sUseTextureAtlas)
- {
- return FALSE ;
- }
- if(getNumFaces() < 1)
- {
- return FALSE ;
- }
- if(mGLTexturep->getDiscardLevelInAtlas() > 0 && mRawDiscardLevel >= mGLTexturep->getDiscardLevelInAtlas())
- {
- return FALSE ;
- }
- if(!LLTextureAtlasManager::getInstance()->canAddToAtlas(mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents(), mGLTexturep->getTexTarget()))
- {
- return FALSE ;
- }
-
- BOOL ret = TRUE ;//if ret is set to false, will generate a gl texture for this image.
- S32 raw_w = mRawImage->getWidth() ;
- S32 raw_h = mRawImage->getHeight() ;
- F32 xscale = 1.0f, yscale = 1.0f ;
- LLPointer<LLTextureAtlasSlot> slot_infop;
- LLTextureAtlasSlot* cur_slotp ;//no need to be smart pointer.
- LLSpatialGroup* groupp ;
- LLFace* facep;
-
- //if the atlas slot pointers for some faces are null, process them later.
- ll_face_list_t waiting_list ;
- for(U32 i = 0 ; i < mNumFaces ; i++)
- {
- {
- facep = mFaceList[i] ;
-
- //face can not use atlas.
- if(!facep->canUseAtlas())
- {
- if(facep->getAtlasInfo())
- {
- facep->removeAtlas() ;
- }
- ret = FALSE ;
- continue ;
- }
-
- //the atlas slot is updated
- slot_infop = facep->getAtlasInfo() ;
- groupp = facep->getDrawable()->getSpatialGroup() ;
-
- if(slot_infop)
- {
- if(slot_infop->getSpatialGroup() != groupp)
- {
- if((cur_slotp = groupp->getCurUpdatingSlot(this))) //switch slot
- {
- facep->setAtlasInfo(cur_slotp) ;
- facep->setAtlasInUse(TRUE) ;
- continue ;
- }
- else //do not forget to update slot_infop->getSpatialGroup().
- {
- LLSpatialGroup* gp = slot_infop->getSpatialGroup() ;
- gp->setCurUpdatingTime(gFrameCount) ;
- gp->setCurUpdatingTexture(this) ;
- gp->setCurUpdatingSlot(slot_infop) ;
- }
- }
- else //same group
- {
- if(gFrameCount && slot_infop->getUpdatedTime() == gFrameCount)//slot is just updated
- {
- facep->setAtlasInUse(TRUE) ;
- continue ;
- }
- }
- }
- else
- {
- //if the slot is null, wait to process them later.
- waiting_list.push_back(facep) ;
- continue ;
- }
-
- //----------
- //insert to atlas
- if(!slot_infop->getAtlas()->insertSubTexture(mGLTexturep, mRawDiscardLevel, mRawImage, slot_infop->getSlotCol(), slot_infop->getSlotRow()))
- {
-
- //the texture does not qualify to add to atlas, do not bother to try for other faces.
- //invalidateAtlas();
- return FALSE ;
- }
-
- //update texture scale
- slot_infop->getAtlas()->getTexCoordScale(raw_w, raw_h, xscale, yscale) ;
- slot_infop->setTexCoordScale(xscale, yscale) ;
- slot_infop->setValid() ;
- slot_infop->setUpdatedTime(gFrameCount) ;
-
- //update spatial group atlas info
- groupp->setCurUpdatingTime(gFrameCount) ;
- groupp->setCurUpdatingTexture(this) ;
- groupp->setCurUpdatingSlot(slot_infop) ;
-
- //make the face to switch to the atlas.
- facep->setAtlasInUse(TRUE) ;
- }
- }
-
- //process the waiting_list
- for(std::vector<LLFace*>::iterator iter = waiting_list.begin(); iter != waiting_list.end(); ++iter)
- {
- facep = (LLFace*)*iter ;
- groupp = facep->getDrawable()->getSpatialGroup() ;
-
- //check if this texture already inserted to atlas for this group
- if((cur_slotp = groupp->getCurUpdatingSlot(this)))
- {
- facep->setAtlasInfo(cur_slotp) ;
- facep->setAtlasInUse(TRUE) ;
- continue ;
- }
-
- //need to reserve a slot from atlas
- slot_infop = LLTextureAtlasManager::getInstance()->reserveAtlasSlot(llmax(mFullWidth, mFullHeight), getComponents(), groupp, this) ;
-
- facep->setAtlasInfo(slot_infop) ;
-
- groupp->setCurUpdatingTime(gFrameCount) ;
- groupp->setCurUpdatingTexture(this) ;
- groupp->setCurUpdatingSlot(slot_infop) ;
-
- //slot allocation failed.
- if(!slot_infop || !slot_infop->getAtlas())
- {
- ret = FALSE ;
- facep->setAtlasInUse(FALSE) ;
- continue ;
- }
-
- //insert to atlas
- if(!slot_infop->getAtlas()->insertSubTexture(mGLTexturep, mRawDiscardLevel, mRawImage, slot_infop->getSlotCol(), slot_infop->getSlotRow()))
- {
- //the texture does not qualify to add to atlas, do not bother to try for other faces.
- ret = FALSE ;
- //invalidateAtlas();
- break ;
- }
-
- //update texture scale
- slot_infop->getAtlas()->getTexCoordScale(raw_w, raw_h, xscale, yscale) ;
- slot_infop->setTexCoordScale(xscale, yscale) ;
- slot_infop->setValid() ;
- slot_infop->setUpdatedTime(gFrameCount) ;
-
- //make the face to switch to the atlas.
- facep->setAtlasInUse(TRUE) ;
- }
-
- return ret ;
-}
//----------------------------------------------------------------------------------------------
//end of LLViewerFetchedTexture
@@ -3535,11 +3370,14 @@ BOOL LLViewerMediaTexture::findFaces()
LLViewerTexture* tex = gTextureList.findImage(mID) ;
if(tex) //this media is a parcel media for tex.
{
- const ll_face_list_t* face_list = tex->getFaceList() ;
- U32 end = tex->getNumFaces() ;
- for(U32 i = 0 ; i < end ; i++)
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
{
- mMediaFaceList.push_back((*face_list)[i]) ;
+ const ll_face_list_t* face_list = tex->getFaceList(ch) ;
+ U32 end = tex->getNumFaces(ch) ;
+ for(U32 i = 0 ; i < end ; i++)
+ {
+ mMediaFaceList.push_back((*face_list)[i]) ;
+ }
}
}
@@ -3604,7 +3442,7 @@ void LLViewerMediaTexture::addMediaToFace(LLFace* facep)
return ; //no need to add the face because the media is not in playing.
}
- switchTexture(facep) ;
+ switchTexture(LLRender::DIFFUSE_MAP, facep) ;
}
void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep)
@@ -3621,19 +3459,19 @@ void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep)
}
mIsPlaying = FALSE ; //set to remove the media from the face.
- switchTexture(facep) ;
+ switchTexture(LLRender::DIFFUSE_MAP, facep) ;
mIsPlaying = TRUE ; //set the flag back.
- if(getNumFaces() < 1) //no face referencing to this media
+ if(getTotalNumFaces() < 1) //no face referencing to this media
{
stopPlaying() ;
}
}
//virtual
-void LLViewerMediaTexture::addFace(LLFace* facep)
+void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep)
{
- LLViewerTexture::addFace(facep) ;
+ LLViewerTexture::addFace(ch, facep) ;
const LLTextureEntry* te = facep->getTextureEntry() ;
if(te && te->getID().notNull())
@@ -3660,9 +3498,9 @@ void LLViewerMediaTexture::addFace(LLFace* facep)
}
//virtual
-void LLViewerMediaTexture::removeFace(LLFace* facep)
+void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep)
{
- LLViewerTexture::removeFace(facep) ;
+ LLViewerTexture::removeFace(ch, facep) ;
const LLTextureEntry* te = facep->getTextureEntry() ;
if(te && te->getID().notNull())
@@ -3680,24 +3518,35 @@ void LLViewerMediaTexture::removeFace(LLFace* facep)
}
}
- //
- //we have some trouble here: the texture of the face is changed.
- //we need to find the former texture, and remove it from the list to avoid memory leaking.
- if(!mNumFaces)
+ std::vector<const LLTextureEntry*> te_list;
+
+ for (U32 ch = 0; ch < 3; ++ch)
{
- mTextureList.clear() ;
- return ;
+ //
+ //we have some trouble here: the texture of the face is changed.
+ //we need to find the former texture, and remove it from the list to avoid memory leaking.
+
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+
+ for(U32 j = 0 ; j < mNumFaces[ch] ; j++)
+ {
+ te_list.push_back(mFaceList[ch][j]->getTextureEntry());//all textures are in use.
+ }
}
- S32 end = getNumFaces() ;
- std::vector<const LLTextureEntry*> te_list(end) ;
- S32 i = 0 ;
- for(U32 j = 0 ; j < mNumFaces ; j++)
+
+ if (te_list.empty())
{
- te_list[i++] = mFaceList[j]->getTextureEntry() ;//all textures are in use.
+ mTextureList.clear() ;
+ return ;
}
+
+ S32 end = te_list.size();
+
for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin();
iter != mTextureList.end(); ++iter)
{
+ S32 i = 0;
+
for(i = 0 ; i < end ; i++)
{
if(te_list[i] && te_list[i]->getID() == (*iter)->getID())//the texture is in use.
@@ -3742,7 +3591,7 @@ void LLViewerMediaTexture::stopPlaying()
mIsPlaying = FALSE ;
}
-void LLViewerMediaTexture::switchTexture(LLFace* facep)
+void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep)
{
if(facep)
{
@@ -3758,7 +3607,7 @@ void LLViewerMediaTexture::switchTexture(LLFace* facep)
if(mIsPlaying) //old textures switch to the media texture
{
- facep->switchTexture(this) ;
+ facep->switchTexture(ch, this) ;
}
else //switch to old textures.
{
@@ -3774,7 +3623,7 @@ void LLViewerMediaTexture::switchTexture(LLFace* facep)
{
tex = LLViewerFetchedTexture::sDefaultImagep ;
}
- facep->switchTexture(tex) ;
+ facep->switchTexture(ch, tex) ;
}
}
}
@@ -3813,14 +3662,17 @@ void LLViewerMediaTexture::setPlaying(BOOL playing)
for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter)
{
- switchTexture(*iter) ;
+ switchTexture(LLRender::DIFFUSE_MAP, *iter) ;
}
}
else //stop playing this media
{
- for(U32 i = mNumFaces ; i ; i--)
+ U32 ch = LLRender::DIFFUSE_MAP;
+
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+ for(U32 i = mNumFaces[ch] ; i ; i--)
{
- switchTexture(mFaceList[i - 1]) ; //current face could be removed in this function.
+ switchTexture(ch, mFaceList[ch][i - 1]) ; //current face could be removed in this function.
}
}
return ;
@@ -3842,14 +3694,18 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
if(mIsPlaying) //media is playing
{
- for(U32 i = 0 ; i < mNumFaces ; i++)
+ for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
{
- LLFace* facep = mFaceList[i] ;
- if(facep->getDrawable()->isRecentlyVisible())
+ llassert(mNumFaces[ch] <= mFaceList[ch].size());
+ for(U32 i = 0 ; i < mNumFaces[ch] ; i++)
{
- addTextureStats(facep->getVirtualSize()) ;
- }
- }
+ LLFace* facep = mFaceList[ch][i] ;
+ if(facep->getDrawable()->isRecentlyVisible())
+ {
+ addTextureStats(facep->getVirtualSize()) ;
+ }
+ }
+ }
}
else //media is not in playing
{