@@ -1293,7 +1293,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
12931293{
12941294    if  (!force_render && !hasMorph ())
12951295    {
1296-         LL_DEBUGS () << " skipping renderMorphMasks for "   << getUUID () << LL_ENDL;
1296+         LL_DEBUGS (" Morph "  ) << " skipping renderMorphMasks for "   << getUUID () << LL_ENDL;
12971297        return ;
12981298    }
12991299    LL_PROFILE_ZONE_SCOPED;
@@ -1325,7 +1325,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
13251325        success &= param->render ( x, y, width, height );
13261326        if  (!success && !force_render)
13271327        {
1328-             LL_DEBUGS () << " Failed to render param "   << param->getID () << "  ; skipping morph mask."   << LL_ENDL;
1328+             LL_DEBUGS (" Morph "  ) << " Failed to render param "   << param->getID () << "  ; skipping morph mask."   << LL_ENDL;
13291329            return ;
13301330        }
13311331    }
@@ -1365,7 +1365,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
13651365            }
13661366            else 
13671367            {
1368-                 LL_WARNS () << " Skipping rendering of "   << getInfo ()->mStaticImageFileName 
1368+                 LL_WARNS (" Morph "  ) << " Skipping rendering of "   << getInfo ()->mStaticImageFileName 
13691369                        << " ; expected 1 or 4 components."   << LL_ENDL;
13701370            }
13711371        }
@@ -1404,8 +1404,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
14041404                //  We can get bad morph masks during login, on minimize, and occasional gl errors.
14051405                //  We should only be doing this when we believe something has changed with respect to the user's appearance.
14061406        {
1407-                         LL_DEBUGS (" Avatar "  ) << " gl alpha cache of morph mask not found, doing readback: "   << getName () << LL_ENDL;
1408-                          //  clear out a slot if we have filled our cache
1407+             LL_DEBUGS (" Morph "  ) << " gl alpha cache of morph mask not found, doing readback: "   << getName () << LL_ENDL;
1408+             //  clear out a slot if we have filled our cache
14091409            S32 max_cache_entries = getTexLayerSet ()->getAvatarAppearance ()->isSelf () ? 4  : 1 ;
14101410            while  ((S32)mAlphaCache .size () >= max_cache_entries)
14111411            {
@@ -1444,13 +1444,20 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
14441444                    }
14451445
14461446                    glGetTexImage (LLTexUnit::getInternalType (LLTexUnit::TT_TEXTURE), 0 , GL_RGBA, GL_UNSIGNED_BYTE, temp);
1447- 
1448-                     U8* alpha_cursor = alpha_data;
1449-                     U8* pixel        = temp;
1450-                     for  (int  i = 0 ; i < pixels; i++)
1447+                     GLenum error = glGetError ();
1448+                     if  (error != GL_NO_ERROR)
1449+                     {
1450+                         LL_INFOS (" Morph"  ) << " GL Error while reading back morph texture. Error code: "   << error << LL_ENDL;
1451+                     }
1452+                     else 
14511453                    {
1452-                         *alpha_cursor++ = pixel[3 ];
1453-                         pixel += 4 ;
1454+                         U8* alpha_cursor = alpha_data;
1455+                         U8* pixel = temp;
1456+                         for  (int  i = 0 ; i < pixels; i++)
1457+                         {
1458+                             *alpha_cursor++ = pixel[3 ];
1459+                             pixel += 4 ;
1460+                         }
14541461                    }
14551462
14561463                    gGL .getTexUnit (0 )->disable ();
0 commit comments