From 00f53244c8dacfb65def11445823761917bf25bc Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Wed, 7 Jan 2015 02:04:03 +0200 Subject: MAINT-4773 FIXED Some transparent textures are rendered as white. This bug fix related also to MAINT-4092. In 4092 sometimes when we don't have information about the texture during the setup the materail (LLVOVolume::setTEMaterialParams()), we should substitute the material with disabled "diffuse alpha mode" (for detail in cases see MAINT-4092 JIRA ticket comment). This bug fix cover the case when after the loading texture we have all information about alpha mode, and in this case we should restore diffuse alpha mode if need. In short: now we always believe that information about the material is valid (LLVOVolume::setTEMaterialParams()). Of course before setup it we check information about texture (if it possible) , if texture is not exist in database or not 32 bit depth (for diffuse) we made changes. But in all other cases (if we can't receive information about texture) we remeber this case in mWaitingTextureInfo multimap. When information about texture will be available we get it in: LLVOVolume::notify AboutCreatingTexture() or Volume::notifyAboutMissingAsset() and again, we recheck it and if need change (substitute) the material parameters. I suppose that this solution is better than was before. If this patch will be accepted , I think that MAINT-4092 should be rechecked again. --- indra/newview/llviewertexture.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 4e2eef39d6..e684be4361 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -655,12 +655,36 @@ S8 LLViewerTexture::getType() const void LLViewerTexture::cleanup() { + notifyAboutMissingAsset(); + mFaceList[LLRender::DIFFUSE_MAP].clear(); mFaceList[LLRender::NORMAL_MAP].clear(); mFaceList[LLRender::SPECULAR_MAP].clear(); mVolumeList.clear(); } +void LLViewerTexture::notifyAboutCreatingTexture() +{ + for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) + { + for(U32 f = 0; f < mNumFaces[ch]; f++) + { + mFaceList[ch][f]->notifyAboutCreatingTexture(this); + } + } +} + +void LLViewerTexture::notifyAboutMissingAsset() +{ + for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) + { + for(U32 f = 0; f < mNumFaces[ch]; f++) + { + mFaceList[ch][f]->notifyAboutMissingAsset(this); + } + } +} + // virtual void LLViewerTexture::dump() { @@ -1281,7 +1305,7 @@ void LLViewerFetchedTexture::addToCreateTexture() llassert(mNumFaces[j] <= mFaceList[j].size()); for(U32 i = 0; i < mNumFaces[j]; i++) - { + { mFaceList[j][i]->dirtyTexture(); } } @@ -1431,9 +1455,11 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) destroyRawImage(); return FALSE; } - - res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); - + + res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); + + notifyAboutCreatingTexture(); + setActive(); if (!needsToSaveRawImage()) @@ -1441,6 +1467,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) mNeedsAux = FALSE; destroyRawImage(); } + return res; } @@ -2132,6 +2159,8 @@ void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing) } if (is_missing) { + notifyAboutMissingAsset(); + if (mUrl.empty()) { LL_WARNS() << mID << ": Marking image as missing" << LL_ENDL; -- cgit v1.2.3