diff options
Diffstat (limited to 'indra/newview/lldrawpoolbump.cpp')
-rw-r--r-- | indra/newview/lldrawpoolbump.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 0a0cfc5cdf..ce4177d1f8 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -76,6 +76,8 @@ static S32 cube_channel = -1; static S32 diffuse_channel = -1; static S32 bump_channel = -1; +#define LL_BUMPLIST_MULTITHREADED 0 + // static void LLStandardBumpmap::init() { @@ -1172,6 +1174,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI { bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA); +#if LL_BUMPLIST_MULTITHREADED auto tex_queue = LLImageGLThread::sEnabled ? sTexUpdateQueue.lock() : nullptr; if (tex_queue) @@ -1188,8 +1191,10 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI bump_ptr->unref(); dst_ptr->unref(); }); + } else +#endif { bump->createGLTexture(0, dst_image); } @@ -1204,22 +1209,34 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI auto* bump_ptr = bump.get(); auto* dst_ptr = dst_image.get(); +#if LL_BUMPLIST_MULTITHREADED bump_ptr->ref(); dst_ptr->ref(); +#endif bump_ptr->setExplicitFormat(GL_RGBA8, GL_ALPHA); auto create_texture = [bump_ptr, dst_ptr]() { +#if LL_IMAGEGL_THREAD_CHECK + bump_ptr->getGLTexture()->mActiveThread = LLThread::currentID(); +#endif LL_PROFILE_ZONE_NAMED("bil - create texture deferred"); bump_ptr->createGLTexture(0, dst_ptr); }; auto gen_normal_map = [bump_ptr, dst_ptr]() { +#if LL_IMAGEGL_THREAD_CHECK + bump_ptr->getGLTexture()->mActiveThread = LLThread::currentID(); +#endif LL_PROFILE_ZONE_NAMED("bil - generate normal map"); if (gNormalMapGenProgram.mProgramObject == 0) { +#if LL_BUMPLIST_MULTITHREADED + bump_ptr->unref(); + dst_ptr->unref(); +#endif return; } gPipeline.mScreen.bindTarget(); @@ -1302,18 +1319,21 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI gNormalMapGenProgram.unbind(); //generateNormalMapFromAlpha(dst_image, nrm_image); - +#if LL_BUMPLIST_MULTITHREADED bump_ptr->unref(); dst_ptr->unref(); +#endif }; - auto main_queue = LLImageGLThread::sEnabled ? sMainQueue.lock() : nullptr; +#if LL_BUMPLIST_MULTITHREADED + auto main_queue = sMainQueue.lock(); - if (main_queue) + if (LLImageGLThread::sEnabled) { //dispatch creation to background thread main_queue->postTo(sTexUpdateQueue, create_texture, gen_normal_map); } else +#endif { create_texture(); gen_normal_map(); |