parent
396b97aebf
commit
1120a7ccb9
|
|
@ -7808,7 +7808,18 @@
|
|||
<key>RenderLowMemMinDiscardIncrement</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Minimum increment of discard level if system memory gets low</string>
|
||||
<string>Minimum increment of discard bias if available texture memory gets low</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>0.1</real>
|
||||
</map>
|
||||
<key>RenderHighMemMinDiscardDecrement</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Minimum decrement of discard bias if excess texture memory is available</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
|
|
|||
|
|
@ -1761,7 +1761,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
|
|||
mRawImage = NULL;
|
||||
mAuxImage = NULL;
|
||||
llassert_always(mFormattedImage.notNull());
|
||||
S32 discard = mHaveAllData ? 0 : mLoadedDiscard;
|
||||
|
||||
// if we have the entire image data (and the image is not J2C), decode the full res image
|
||||
// DO NOT decode a higher res j2c than was requested. This is a waste of time and memory.
|
||||
S32 discard = mHaveAllData && mFormattedImage->getCodec() != IMG_CODEC_J2C ? 0 : mLoadedDiscard;
|
||||
mDecoded = false;
|
||||
setState(DECODE_IMAGE_UPDATE);
|
||||
LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard
|
||||
|
|
@ -2318,6 +2321,10 @@ void LLTextureFetchWorker::callbackDecoded(bool success, const std::string &erro
|
|||
mRawImage = raw;
|
||||
mAuxImage = aux;
|
||||
mDecodedDiscard = mFormattedImage->getDiscardLevel();
|
||||
if (mDecodedDiscard < mDesiredDiscard)
|
||||
{
|
||||
LL_WARNS_ONCE(LOG_TXT) << "Decoded higher resolution than requested" << LL_ENDL;
|
||||
}
|
||||
LL_DEBUGS(LOG_TXT) << mID << ": Decode Finished. Discard: " << mDecodedDiscard
|
||||
<< " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -559,7 +559,10 @@ void LLViewerTexture::updateClass()
|
|||
// lower discard bias over time when free memory is available
|
||||
if (sDesiredDiscardBias > 1.f && over_pct < 0.f)
|
||||
{
|
||||
sDesiredDiscardBias -= gFrameIntervalSeconds * 0.01f;
|
||||
static LLCachedControl<F32> high_mem_discard_decrement(gSavedSettings, "RenderHighMemMinDiscardDecrement", .1f);
|
||||
|
||||
F32 decrement = high_mem_discard_decrement - llmin(over_pct, 0.f);
|
||||
sDesiredDiscardBias -= decrement * gFrameIntervalSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1066,13 +1066,26 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
|
|||
{
|
||||
LLViewerFetchedTexture* imagep = mCreateTextureList.front();
|
||||
llassert(imagep->mCreatePending);
|
||||
imagep->createTexture();
|
||||
|
||||
// desired discard may change while an image is being decoded. If the texture in VRAM is sufficient
|
||||
// for the current desired discard level, skip the texture creation. This happens more often than it probably
|
||||
// should
|
||||
bool redundant_load = imagep->hasGLTexture() && imagep->getDiscardLevel() <= imagep->getDesiredDiscardLevel();
|
||||
|
||||
if (!redundant_load)
|
||||
{
|
||||
imagep->createTexture();
|
||||
}
|
||||
|
||||
imagep->postCreateTexture();
|
||||
imagep->mCreatePending = false;
|
||||
mCreateTextureList.pop();
|
||||
|
||||
if (imagep->hasGLTexture() && imagep->getDiscardLevel() < imagep->getDesiredDiscardLevel())
|
||||
{
|
||||
// NOTE: this may happen if the desired discard reduces while a decode is in progress and does not
|
||||
// necessarily indicate a problem, but if log occurrences excede that of dsiplay_stats: FPS,
|
||||
// something has probably gone wrong.
|
||||
LL_WARNS_ONCE("Texture") << "Texture will be downscaled immediately after loading." << LL_ENDL;
|
||||
imagep->scaleDown();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue