From fc0b238654091c6090d5d85ceda51fbc6cb71eaa Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 23 Feb 2022 17:55:44 -0600 Subject: Fix for media textures failing to update (and eating lots of memory) on Mac/Intel --- indra/llrender/llimagegl.cpp | 23 ++++++++++++++--------- indra/llrender/llimagegl.h | 3 +++ 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 5cf3a2a15f..63f9a67e2c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1685,18 +1685,23 @@ void LLImageGL::syncToMainThread(LLGLuint new_tex_name) [=]() { LL_PROFILE_ZONE_NAMED("cglt - delete callback"); - if (new_tex_name != 0) - { - if (mTexName != 0 && mTexName != new_tex_name) - { - LLImageGL::deleteTextures(1, &mTexName); - } - mTexName = new_tex_name; - unref(); - } + syncTexName(new_tex_name); + unref(); }); } +void LLImageGL::syncTexName(LLGLuint texname) +{ + if (texname != 0) + { + if (mTexName != 0 && mTexName != texname) + { + LLImageGL::deleteTextures(1, &mTexName); + } + mTexName = texname; + } +} + BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const { llassert_always(sAllowReadBackRaw) ; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 574d83c37e..4d5b60d6bc 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -304,6 +304,9 @@ public: void setTexName(GLuint texName) { mTexName = texName; } + //similar to setTexName, but will call deleteTextures on mTexName if mTexName is not 0 or texname + void syncTexName(LLGLuint texname); + //for debug use: show texture size distribution //---------------------------------------- static S32 sCurTexSizeBar ; -- cgit v1.2.3