summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldrawpoolbump.cpp26
-rw-r--r--indra/newview/llviewermedia.cpp11
2 files changed, 33 insertions, 4 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();
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 42bd5d8367..e442afe4b1 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2911,10 +2911,16 @@ void LLViewerMediaImpl::update()
mTexUpdateQueue, // Worker thread queue
[=]() // work done on update worker thread
{
+#if LL_IMAGEGL_THREAD_CHECK
+ media_tex->getGLTexture()->mActiveThread = LLThread::currentID();
+#endif
doMediaTexUpdate(media_tex, data, data_width, data_height, x_pos, y_pos, width, height, true);
},
[=]() // callback to main thread
{
+#if LL_IMAGEGL_THREAD_CHECK
+ media_tex->getGLTexture()->mActiveThread = LLThread::currentID();
+#endif
mTextureUpdatePending = false;
media_tex->unref();
unref();
@@ -2991,7 +2997,10 @@ void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* da
// copy just the subimage covered by the image raw to GL
media_tex->setSubImage(data, data_width, data_height, x_pos, y_pos, width, height, tex_name);
- media_tex->getGLTexture()->syncToMainThread(tex_name);
+ if (sync)
+ {
+ media_tex->getGLTexture()->syncToMainThread(tex_name);
+ }
// release the data pointer before freeing raw so LLImageRaw destructor doesn't
// free memory at data pointer