summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-02-22 19:48:01 -0600
committerDave Parks <davep@lindenlab.com>2022-02-22 19:48:01 -0600
commit74641a121316a13e106d525fb1684c517791766d (patch)
treecebff8187d51369cc498d669184f5c046ca3a28d /indra
parentce534cf32e1df84b6b10435e9604b0cbde6abf95 (diff)
SL-16815 Cleanup -- disable multithreaded bumpmap generation while tracking down loading issues, fix sync issue in single threaded mode in media textures, restore LL_IMAGEGL_THREAD_CHECK functionality
Diffstat (limited to 'indra')
-rw-r--r--indra/llrender/llimagegl.cpp2
-rw-r--r--indra/newview/lldrawpoolbump.cpp26
-rw-r--r--indra/newview/llviewermedia.cpp11
3 files changed, 35 insertions, 4 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 10fdd7c9a9..9e26247e1e 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1644,6 +1644,8 @@ void LLImageGLThread::updateClass()
void LLImageGL::syncToMainThread(LLGLuint new_tex_name)
{
LL_PROFILE_ZONE_SCOPED;
+ llassert(!on_main_thread());
+
{
LL_PROFILE_ZONE_NAMED("cglt - sync");
if (gGLManager.mHasSync)
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