diff options
author | Dave Parks <davep@lindenlab.com> | 2021-12-03 15:07:31 +0000 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2021-12-03 15:07:31 +0000 |
commit | e7830b39f01d9f9c82e9e2029634dffb8386b24e (patch) | |
tree | 4be81717808f245e62cc7a76b5c148b2096472a1 /indra/newview/llviewertexture.cpp | |
parent | 511de439a35ddb22c6f174b85c599d4881b9c139 (diff) |
SL-16436 and SL-16327 Fix for RenderDebugGL test failures and fix for grey textures
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index f932acd48c..37ed2e9f20 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1476,6 +1476,10 @@ void LLViewerFetchedTexture::addToCreateTexture() BOOL LLViewerFetchedTexture::preCreateTexture(S32 usename/*= 0*/) { LL_PROFILE_ZONE_SCOPED; +#if LL_IMAGEGL_THREAD_CHECK + mGLTexturep->checkActiveThread(); +#endif + if (!mNeedsCreateTexture) { destroyRawImage(); @@ -1603,6 +1607,9 @@ void LLViewerFetchedTexture::postCreateTexture() { return; } +#if LL_IMAGEGL_THREAD_CHECK + mGLTexturep->checkActiveThread(); +#endif notifyAboutCreatingTexture(); @@ -1619,36 +1626,45 @@ void LLViewerFetchedTexture::postCreateTexture() void LLViewerFetchedTexture::scheduleCreateTexture() { - ref(); - mNeedsCreateTexture = TRUE; - if (preCreateTexture()) + if (!mNeedsCreateTexture) { + ref(); mNeedsCreateTexture = TRUE; -#if LL_WINDOWS //flip to 0 to revert to single-threaded OpenGL texture uploads - auto mainq = mMainQueue.lock(); - if (mainq) + if (preCreateTexture()) { - mainq->postTo( - mImageQueue, - // work to be done on LLImageGL worker thread - [this]() - { - //actually create the texture on a background thread - createTexture(); - }, - // callback to be run on main thread - [this]() - { - //finalize on main thread - postCreateTexture(); - unref(); - }); - } - else + mNeedsCreateTexture = TRUE; +#if LL_WINDOWS //flip to 0 to revert to single-threaded OpenGL texture uploads + auto mainq = mMainQueue.lock(); + if (mainq) + { + mainq->postTo( + mImageQueue, + // work to be done on LLImageGL worker thread + [this]() + { +#if LL_IMAGEGL_THREAD_CHECK + mGLTexturep->mActiveThread = LLThread::currentID(); #endif - { - gTextureList.mCreateTextureList.insert(this); - unref(); + //actually create the texture on a background thread + createTexture(); + }, + // callback to be run on main thread + [this]() + { +#if LL_IMAGEGL_THREAD_CHECK + mGLTexturep->mActiveThread = LLThread::currentID(); +#endif + //finalize on main thread + postCreateTexture(); + unref(); + }); + } + else +#endif + { + gTextureList.mCreateTextureList.insert(this); + unref(); + } } } } @@ -2967,7 +2983,8 @@ void LLViewerFetchedTexture::destroyRawImage() void LLViewerFetchedTexture::switchToCachedImage() { LL_PROFILE_ZONE_SCOPED; - if(mCachedRawImage.notNull()) + if(mCachedRawImage.notNull() && + !mNeedsCreateTexture) // <--- texture creation is pending, don't step on it { mRawImage = mCachedRawImage; |