summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r--indra/newview/llviewertexture.cpp73
1 files changed, 47 insertions, 26 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index e59e86529a..c38f19f579 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -651,14 +651,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
@@ -674,7 +676,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()
@@ -715,6 +718,7 @@ void LLViewerTexture::setBoostLevel(S32 level)
{
mBoostLevel = level;
if(mBoostLevel != LLViewerTexture::BOOST_NONE &&
+ mBoostLevel != LLViewerTexture::BOOST_ALM &&
mBoostLevel != LLViewerTexture::BOOST_SELECTED &&
mBoostLevel != LLViewerTexture::BOOST_ICON)
{
@@ -891,40 +895,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 < mVolumeList.size());
- llassert(index < mNumVolumes);
- mVolumeList[index] = mVolumeList[--mNumVolumes];
- mVolumeList[index]->setIndexInTex(index);
+ S32 index = volumep->getIndexInTex(ch);
+ llassert(index < mVolumeList[ch].size());
+ llassert(index < 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()
@@ -955,9 +959,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)
@@ -966,7 +974,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,6 +1558,10 @@ void LLViewerFetchedTexture::processTextureStats()
{
mDesiredDiscardLevel = 0;
}
+ else if (!LLPipeline::sRenderDeferred && mBoostLevel == LLGLTexture::BOOST_ALM)
+ {
+ mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
+ }
else if (mDontDiscard && mBoostLevel == LLGLTexture::BOOST_ICON)
{
if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
@@ -1814,8 +1829,9 @@ void LLViewerFetchedTexture::updateVirtualSize()
{
if(drawable->isRecentlyVisible())
{
- if (getBoostLevel() == LLViewerTexture::BOOST_NONE &&
- drawable->getVObj() && drawable->getVObj()->isSelected())
+ if ((getBoostLevel() == LLViewerTexture::BOOST_NONE || getBoostLevel() == LLViewerTexture::BOOST_ALM)
+ && drawable->getVObj()
+ && drawable->getVObj()->isSelected())
{
setBoostLevel(LLViewerTexture::BOOST_SELECTED);
}
@@ -1832,6 +1848,7 @@ void LLViewerFetchedTexture::updateVirtualSize()
if (getBoostLevel() == LLViewerTexture::BOOST_SELECTED &&
gFrameTimeSeconds - mSelectedTime > SELECTION_RESET_TIME)
{
+ // Could have been BOOST_ALM, but if user was working with this texture, better keep it as NONE
setBoostLevel(LLViewerTexture::BOOST_NONE);
}
@@ -2105,7 +2122,7 @@ bool LLViewerFetchedTexture::updateFetch()
// Load the texture progressively: we try not to rush to the desired discard too fast.
// If the camera is not moving, we do not tweak the discard level notch by notch but go to the desired discard with larger boosted steps
// This mitigates the "textures stay blurry" problem when loading while not killing the texture memory while moving around
- S32 delta_level = (mBoostLevel > LLGLTexture::BOOST_NONE) ? 2 : 1;
+ S32 delta_level = (mBoostLevel > LLGLTexture::BOOST_ALM) ? 2 : 1;
if (current_discard < 0)
{
desired_discard = llmax(desired_discard, getMaxDiscardLevel() - delta_level);
@@ -3117,6 +3134,10 @@ void LLViewerLODTexture::processTextureStats()
if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
}
+ else if (!LLPipeline::sRenderDeferred && mBoostLevel == LLGLTexture::BOOST_ALM)
+ {
+ mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
+ }
else if (mBoostLevel < LLGLTexture::BOOST_HIGH && mMaxVirtualSize <= 10.f)
{
// If the image has not been significantly visible in a while, we don't want it