From 0bf11e45ea34a21b980c36c99be476613552d560 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 22 Oct 2020 22:07:00 +0300 Subject: SL-14150 Handle more cases of corrupted cache --- indra/newview/llviewertexture.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/newview/llviewertexture.cpp') 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(); -- cgit v1.2.3 From ad6b1b0b7c8674a6b41f8f090d3ef3d9e4914e30 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 23 Oct 2020 09:58:17 +0300 Subject: SL-14150 Fix spelling --- indra/newview/llviewertexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index b64e576ad7..187cc0021c 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1541,7 +1541,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) return FALSE; } - if (mGLTexturep->getHasEplixitFormat()) + if (mGLTexturep->getHasExplicitFormat()) { LLGLenum format = mGLTexturep->getPrimaryFormat(); S8 components = mRawImage->getComponents(); -- cgit v1.2.3