summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-10-22 22:07:00 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-10-22 22:22:17 +0300
commit0bf11e45ea34a21b980c36c99be476613552d560 (patch)
treeda1709b074febd1c92f768c8fd70d3665818c575 /indra/newview/llviewertexture.cpp
parent83600bb16ac305542de9bb9fd8eba1bec90dc1b0 (diff)
SL-14150 Handle more cases of corrupted cache
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r--indra/newview/llviewertexture.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index a2cec9a613..b64e576ad7 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1541,6 +1541,26 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
return FALSE;
}
+ if (mGLTexturep->getHasEplixitFormat())
+ {
+ LLGLenum format = mGLTexturep->getPrimaryFormat();
+ S8 components = mRawImage->getComponents();
+ if ((format == GL_RGBA && components < 4)
+ || (format == GL_RGB && components < 3))
+ {
+ LL_WARNS() << "Can't create a texture " << mID << ": invalid image format " << std::hex << format << " vs components " << (U32)components << LL_ENDL;
+ // Was expecting specific format but raw texture has insufficient components for
+ // such format, using such texture will result in crash or will display wrongly
+ // if we change format. Texture might be corrupted server side, so just set as
+ // missing and clear cashed texture (do not cause reload loop, will retry&recover
+ // during new session)
+ setIsMissingAsset();
+ destroyRawImage();
+ LLAppViewer::getTextureCache()->removeFromCache(mID);
+ return FALSE;
+ }
+ }
+
res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
notifyAboutCreatingTexture();