From fe95b0a5ec1d7ec92bcbca3824138b1ce9a5b49c Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 3 Apr 2023 11:15:48 -0700 Subject: Revert "SL-19331: No need to create texture in doMediaTexUpdate - should already be handled by preMediaTexUpdate" This reverts commit bf9d090045d7baf72f2ba7eadab0adc9d5c8f553. --- indra/newview/llviewermedia.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 969f0a3594..f672781f48 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2965,15 +2965,12 @@ void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* da LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; LLMutexLock lock(&mLock); // don't allow media source tear-down during update - const LLGLuint tex_name = media_tex->getGLTexture() ? media_tex->getGLTexture()->getTexName() : (LLGLuint)0; - if (!tex_name) - { - llassert(false); - return; - } - // wrap "data" in an LLImageRaw but do NOT make a copy LLPointer raw = new LLImageRaw(data, media_tex->getWidth(), media_tex->getHeight(), media_tex->getComponents(), true); + + // Allocate GL texture based on LLImageRaw but do NOT copy to GL + LLGLuint tex_name = 0; + media_tex->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER, true, &tex_name); // 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); -- cgit v1.2.3 From dda6402893a83b770d5022bf775f9cd9b0d93755 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 3 Apr 2023 11:24:26 -0700 Subject: SL-19331: Add comment on reason for revert --- indra/newview/llviewermedia.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index f672781f48..aae3bd7f25 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2968,6 +2968,10 @@ void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* da // wrap "data" in an LLImageRaw but do NOT make a copy LLPointer raw = new LLImageRaw(data, media_tex->getWidth(), media_tex->getHeight(), media_tex->getComponents(), true); + // *NOTE: Recreating the GL texture each media update may seem wasteful + // (note the texture creation in preMediaTexUpdate), however, it apparently + // prevents GL calls from blocking, due to poor bookkeeping of state of + // updated textures by the OpenGL implementation. // Allocate GL texture based on LLImageRaw but do NOT copy to GL LLGLuint tex_name = 0; media_tex->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER, true, &tex_name); -- cgit v1.2.3