diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/lltexlayer.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/newview/lltexlayer.cpp')
-rw-r--r-- | linden/indra/newview/lltexlayer.cpp | 263 |
1 files changed, 4 insertions, 259 deletions
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp index 63d167d..d8a97cf 100644 --- a/linden/indra/newview/lltexlayer.cpp +++ b/linden/indra/newview/lltexlayer.cpp | |||
@@ -55,8 +55,6 @@ | |||
55 | 55 | ||
56 | // SJB: We really always want to use the GL cache; | 56 | // SJB: We really always want to use the GL cache; |
57 | // let GL page textures in and out of video RAM instead of trying to do so by hand. | 57 | // let GL page textures in and out of video RAM instead of trying to do so by hand. |
58 | // const U32 USE_AVATAR_GL_CACHE_THRESHOLD = 1024 * 1024 * 35; // 35 MB | ||
59 | BOOL gUseAvatarGLCache = TRUE; //FALSE; | ||
60 | 58 | ||
61 | LLGradientPaletteList gGradientPaletteList; | 59 | LLGradientPaletteList gGradientPaletteList; |
62 | 60 | ||
@@ -237,8 +235,6 @@ BOOL LLTexLayerSetBuffer::render() | |||
237 | { | 235 | { |
238 | U8* baked_bump_data = NULL; | 236 | U8* baked_bump_data = NULL; |
239 | 237 | ||
240 | // gUseAvatarGLCache = ( gImageList.getMaxResidentTexMem() > USE_AVATAR_GL_CACHE_THRESHOLD ); | ||
241 | |||
242 | // do we need to upload, and do we have sufficient data to create an uploadable composite? | 238 | // do we need to upload, and do we have sufficient data to create an uploadable composite? |
243 | // When do we upload the texture if gAgent.mNumPendingQueries is non-zero? | 239 | // When do we upload the texture if gAgent.mNumPendingQueries is non-zero? |
244 | BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal()); | 240 | BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal()); |
@@ -773,7 +769,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) | |||
773 | glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); | 769 | glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); |
774 | glBlendFunc( GL_ONE, GL_ZERO ); | 770 | glBlendFunc( GL_ONE, GL_ZERO ); |
775 | 771 | ||
776 | if( gUseAvatarGLCache ) | ||
777 | { | 772 | { |
778 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE ); | 773 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE ); |
779 | if( image_gl ) | 774 | if( image_gl ) |
@@ -787,29 +782,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) | |||
787 | success = FALSE; | 782 | success = FALSE; |
788 | } | 783 | } |
789 | } | 784 | } |
790 | else | ||
791 | { | ||
792 | LLImageRaw* image_raw = gTexStaticImageList.getImageRaw( getInfo()->mStaticAlphaFileName ); | ||
793 | if( image_raw ) | ||
794 | { | ||
795 | GLenum format = GL_ALPHA; | ||
796 | if( mAvatar->bindScratchTexture(format) ) | ||
797 | { | ||
798 | glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, image_raw->getWidth(), image_raw->getHeight(), format, GL_UNSIGNED_BYTE, image_raw->getData() ); | ||
799 | stop_glerror(); | ||
800 | |||
801 | gl_rect_2d_simple_tex( width, height ); | ||
802 | } | ||
803 | else | ||
804 | { | ||
805 | success = FALSE; | ||
806 | } | ||
807 | } | ||
808 | else | ||
809 | { | ||
810 | success = FALSE; | ||
811 | } | ||
812 | } | ||
813 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | 785 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); |
814 | 786 | ||
815 | glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); | 787 | glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); |
@@ -1286,23 +1258,6 @@ BOOL LLTexLayer::parseData( LLXmlTreeNode* node ) | |||
1286 | //----------------------------------------------------------------------------- | 1258 | //----------------------------------------------------------------------------- |
1287 | 1259 | ||
1288 | 1260 | ||
1289 | BOOL LLTexLayer::loadStaticImageRaw() | ||
1290 | { | ||
1291 | if( mStaticImageRaw.isNull() && !mStaticImageInvalid) | ||
1292 | { | ||
1293 | mStaticImageRaw = gTexStaticImageList.getImageRaw( getInfo()->mStaticImageFileName ); | ||
1294 | // We now have something in one of our caches | ||
1295 | LLTexLayerSet::sHasCaches |= mStaticImageRaw.notNull() ? TRUE : FALSE; | ||
1296 | if( mStaticImageRaw.isNull() ) | ||
1297 | { | ||
1298 | llwarns << "Unable to load static file: " << getInfo()->mStaticImageFileName << llendl; | ||
1299 | mStaticImageInvalid = TRUE; // don't try again. | ||
1300 | return FALSE; | ||
1301 | } | ||
1302 | } | ||
1303 | return TRUE; | ||
1304 | } | ||
1305 | |||
1306 | void LLTexLayer::deleteCaches() | 1261 | void LLTexLayer::deleteCaches() |
1307 | { | 1262 | { |
1308 | for( alpha_list_t::iterator iter = mParamAlphaList.begin(); | 1263 | for( alpha_list_t::iterator iter = mParamAlphaList.begin(); |
@@ -1375,7 +1330,6 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) | |||
1375 | 1330 | ||
1376 | if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly ) | 1331 | if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly ) |
1377 | { | 1332 | { |
1378 | if( gUseAvatarGLCache ) | ||
1379 | { | 1333 | { |
1380 | LLImageGL* image_gl = NULL; | 1334 | LLImageGL* image_gl = NULL; |
1381 | if( mTexLayerSet->getAvatar()->getLocalTextureGL( getInfo()->mLocalTexture, &image_gl ) ) | 1335 | if( mTexLayerSet->getAvatar()->getLocalTextureGL( getInfo()->mLocalTexture, &image_gl ) ) |
@@ -1401,29 +1355,10 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) | |||
1401 | success = FALSE; | 1355 | success = FALSE; |
1402 | } | 1356 | } |
1403 | } | 1357 | } |
1404 | else | ||
1405 | { | ||
1406 | LLPointer<LLImageRaw> image_raw = new LLImageRaw; | ||
1407 | if( mTexLayerSet->getAvatar()->getLocalTextureRaw( getInfo()->mLocalTexture, image_raw ) ) | ||
1408 | { | ||
1409 | success &= renderImageRaw( image_raw->getData(), | ||
1410 | image_raw->getWidth(), | ||
1411 | image_raw->getHeight(), | ||
1412 | image_raw->getComponents(), | ||
1413 | width, | ||
1414 | height, | ||
1415 | FALSE ); | ||
1416 | } | ||
1417 | else | ||
1418 | { | ||
1419 | success = FALSE; | ||
1420 | } | ||
1421 | } | ||
1422 | } | 1358 | } |
1423 | 1359 | ||
1424 | if( !getInfo()->mStaticImageFileName.empty() ) | 1360 | if( !getInfo()->mStaticImageFileName.empty() ) |
1425 | { | 1361 | { |
1426 | if( gUseAvatarGLCache ) | ||
1427 | { | 1362 | { |
1428 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); | 1363 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); |
1429 | if( image_gl ) | 1364 | if( image_gl ) |
@@ -1437,26 +1372,6 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) | |||
1437 | success = FALSE; | 1372 | success = FALSE; |
1438 | } | 1373 | } |
1439 | } | 1374 | } |
1440 | else | ||
1441 | { | ||
1442 | // Don't load the image file until we actually need it the first time. Like now. | ||
1443 | if (!loadStaticImageRaw()) | ||
1444 | { | ||
1445 | success = FALSE; | ||
1446 | } | ||
1447 | if( mStaticImageRaw.notNull() ) | ||
1448 | { | ||
1449 | success &= renderImageRaw( | ||
1450 | mStaticImageRaw->getData(), | ||
1451 | mStaticImageRaw->getWidth(), | ||
1452 | mStaticImageRaw->getHeight(), | ||
1453 | mStaticImageRaw->getComponents(), width, height, getInfo()->mStaticImageIsMask ); | ||
1454 | } | ||
1455 | else | ||
1456 | { | ||
1457 | success = FALSE; | ||
1458 | } | ||
1459 | } | ||
1460 | } | 1375 | } |
1461 | 1376 | ||
1462 | if( ((-1 == getInfo()->mLocalTexture) || | 1377 | if( ((-1 == getInfo()->mLocalTexture) || |
@@ -1610,7 +1525,6 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 | |||
1610 | // Accumulate the alpha component of the texture | 1525 | // Accumulate the alpha component of the texture |
1611 | if( getInfo()->mLocalTexture != -1 ) | 1526 | if( getInfo()->mLocalTexture != -1 ) |
1612 | { | 1527 | { |
1613 | if( gUseAvatarGLCache ) | ||
1614 | { | 1528 | { |
1615 | LLImageGL* image_gl = NULL; | 1529 | LLImageGL* image_gl = NULL; |
1616 | if( mTexLayerSet->getAvatar()->getLocalTextureGL( getInfo()->mLocalTexture, &image_gl ) ) | 1530 | if( mTexLayerSet->getAvatar()->getLocalTextureGL( getInfo()->mLocalTexture, &image_gl ) ) |
@@ -1635,30 +1549,10 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 | |||
1635 | success = FALSE; | 1549 | success = FALSE; |
1636 | } | 1550 | } |
1637 | } | 1551 | } |
1638 | else | ||
1639 | { | ||
1640 | LLPointer<LLImageRaw> image_raw = new LLImageRaw; | ||
1641 | if( mTexLayerSet->getAvatar()->getLocalTextureRaw( getInfo()->mLocalTexture, image_raw ) ) | ||
1642 | { | ||
1643 | if(image_raw->getComponents() == 4) | ||
1644 | { | ||
1645 | success &= renderImageRaw( | ||
1646 | image_raw->getData(), | ||
1647 | image_raw->getWidth(), | ||
1648 | image_raw->getHeight(), | ||
1649 | image_raw->getComponents(), width, height, FALSE ); | ||
1650 | } | ||
1651 | } | ||
1652 | else | ||
1653 | { | ||
1654 | success = FALSE; | ||
1655 | } | ||
1656 | } | ||
1657 | } | 1552 | } |
1658 | 1553 | ||
1659 | if( !getInfo()->mStaticImageFileName.empty() ) | 1554 | if( !getInfo()->mStaticImageFileName.empty() ) |
1660 | { | 1555 | { |
1661 | if( gUseAvatarGLCache ) | ||
1662 | { | 1556 | { |
1663 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); | 1557 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); |
1664 | if( image_gl ) | 1558 | if( image_gl ) |
@@ -1677,31 +1571,6 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 | |||
1677 | success = FALSE; | 1571 | success = FALSE; |
1678 | } | 1572 | } |
1679 | } | 1573 | } |
1680 | else | ||
1681 | { | ||
1682 | // Don't load the image file until we actually need it the first time. Like now. | ||
1683 | if (!loadStaticImageRaw()) | ||
1684 | { | ||
1685 | success = FALSE; | ||
1686 | } | ||
1687 | |||
1688 | if( mStaticImageRaw.notNull() ) | ||
1689 | { | ||
1690 | if( (mStaticImageRaw->getComponents() == 4) || | ||
1691 | ( (mStaticImageRaw->getComponents() == 1) && getInfo()->mStaticImageIsMask ) ) | ||
1692 | { | ||
1693 | success &= renderImageRaw( | ||
1694 | mStaticImageRaw->getData(), | ||
1695 | mStaticImageRaw->getWidth(), | ||
1696 | mStaticImageRaw->getHeight(), | ||
1697 | mStaticImageRaw->getComponents(), width, height, getInfo()->mStaticImageIsMask ); | ||
1698 | } | ||
1699 | } | ||
1700 | else | ||
1701 | { | ||
1702 | success = FALSE; | ||
1703 | } | ||
1704 | } | ||
1705 | } | 1574 | } |
1706 | 1575 | ||
1707 | // Draw a rectangle with the layer color to multiply the alpha by that color's alpha. | 1576 | // Draw a rectangle with the layer color to multiply the alpha by that color's alpha. |
@@ -2106,8 +1975,7 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) | |||
2106 | if( !mCachedProcessedImageGL || | 1975 | if( !mCachedProcessedImageGL || |
2107 | (mCachedProcessedImageGL->getWidth() != image_tga_width) || | 1976 | (mCachedProcessedImageGL->getWidth() != image_tga_width) || |
2108 | (mCachedProcessedImageGL->getHeight() != image_tga_height) || | 1977 | (mCachedProcessedImageGL->getHeight() != image_tga_height) || |
2109 | (weight_changed && !(gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE))) || | 1978 | (weight_changed && !(gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE))) ) |
2110 | (!gUseAvatarGLCache) ) | ||
2111 | { | 1979 | { |
2112 | // llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl; | 1980 | // llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl; |
2113 | mCachedEffectiveWeight = effective_weight; | 1981 | mCachedEffectiveWeight = effective_weight; |
@@ -2149,7 +2017,6 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) | |||
2149 | 2017 | ||
2150 | if( mCachedProcessedImageGL ) | 2018 | if( mCachedProcessedImageGL ) |
2151 | { | 2019 | { |
2152 | if( gUseAvatarGLCache ) // 64 MB | ||
2153 | { | 2020 | { |
2154 | if (gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE)) | 2021 | if (gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE)) |
2155 | { | 2022 | { |
@@ -2187,94 +2054,6 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) | |||
2187 | } | 2054 | } |
2188 | stop_glerror(); | 2055 | stop_glerror(); |
2189 | } | 2056 | } |
2190 | else | ||
2191 | { | ||
2192 | if( (mCachedProcessedImageGL->getWidth() != VOAVATAR_SCRATCH_TEX_WIDTH) || | ||
2193 | (mCachedProcessedImageGL->getHeight() != VOAVATAR_SCRATCH_TEX_HEIGHT) ) | ||
2194 | { | ||
2195 | if (gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE)) | ||
2196 | { | ||
2197 | mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); | ||
2198 | |||
2199 | LLGLSNoAlphaTest gls_no_alpha_test; | ||
2200 | |||
2201 | mCachedProcessedImageGL->bind(); | ||
2202 | mCachedProcessedImageGL->setClamp(TRUE, TRUE); | ||
2203 | |||
2204 | gGradientPaletteList.setHardwarePalette( getInfo()->mDomain, effective_weight ); | ||
2205 | gl_rect_2d_simple_tex( width, height ); | ||
2206 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | ||
2207 | mCachedProcessedImageGL->destroyGLTexture(); | ||
2208 | } | ||
2209 | else | ||
2210 | { | ||
2211 | // Create the GL texture, bind it and draw a rect, and then immediately destroy it. | ||
2212 | mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); | ||
2213 | |||
2214 | LLGLSNoAlphaTest gls_no_alpha_test; | ||
2215 | |||
2216 | mCachedProcessedImageGL->bind(); | ||
2217 | mCachedProcessedImageGL->setClamp(TRUE, TRUE); | ||
2218 | |||
2219 | gl_rect_2d_simple_tex( width, height ); | ||
2220 | |||
2221 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | ||
2222 | |||
2223 | mCachedProcessedImageGL->destroyGLTexture(); | ||
2224 | } | ||
2225 | stop_glerror(); | ||
2226 | } | ||
2227 | else | ||
2228 | { | ||
2229 | if (gGLManager.mHasPalettedTextures && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_PALETTE)) | ||
2230 | { | ||
2231 | // Write into a pre-existing GL Image, and then bind and render that. | ||
2232 | // Faster than creating a new GL Image and then destroying it. | ||
2233 | if( mTexLayer->getTexLayerSet()->getAvatar()->bindScratchTexture( GL_COLOR_INDEX ) ) | ||
2234 | { | ||
2235 | glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, | ||
2236 | mCachedProcessedImageGL->getWidth(), | ||
2237 | mCachedProcessedImageGL->getHeight(), | ||
2238 | GL_COLOR_INDEX, GL_UNSIGNED_BYTE, | ||
2239 | mStaticImageRaw->getData() ); | ||
2240 | stop_glerror(); | ||
2241 | |||
2242 | LLGLSNoAlphaTest gls_no_alpha_test; | ||
2243 | gGradientPaletteList.setHardwarePalette( getInfo()->mDomain, effective_weight ); | ||
2244 | gl_rect_2d_simple_tex( width, height ); | ||
2245 | |||
2246 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | ||
2247 | } | ||
2248 | else | ||
2249 | { | ||
2250 | success = FALSE; | ||
2251 | } | ||
2252 | } | ||
2253 | else | ||
2254 | { | ||
2255 | // Write into a pre-existing GL Image, and then bind and render that. | ||
2256 | // Faster than creating a new GL Image and then destroying it. | ||
2257 | if( mTexLayer->getTexLayerSet()->getAvatar()->bindScratchTexture( GL_ALPHA ) ) | ||
2258 | { | ||
2259 | glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, | ||
2260 | mCachedProcessedImageGL->getWidth(), | ||
2261 | mCachedProcessedImageGL->getHeight(), | ||
2262 | GL_ALPHA, GL_UNSIGNED_BYTE, | ||
2263 | mStaticImageRaw->getData() ); | ||
2264 | stop_glerror(); | ||
2265 | |||
2266 | LLGLSNoAlphaTest gls_no_alpha_test; | ||
2267 | gl_rect_2d_simple_tex( width, height ); | ||
2268 | |||
2269 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | ||
2270 | } | ||
2271 | else | ||
2272 | { | ||
2273 | success = FALSE; | ||
2274 | } | ||
2275 | } | ||
2276 | } | ||
2277 | } | ||
2278 | } | 2057 | } |
2279 | 2058 | ||
2280 | // Don't keep the cache for other people's avatars | 2059 | // Don't keep the cache for other people's avatars |
@@ -2625,7 +2404,6 @@ LLStringTable LLTexStaticImageList::sImageNames(16384); | |||
2625 | 2404 | ||
2626 | LLTexStaticImageList::LLTexStaticImageList() | 2405 | LLTexStaticImageList::LLTexStaticImageList() |
2627 | : | 2406 | : |
2628 | mRawBytes( 0 ), | ||
2629 | mGLBytes( 0 ), | 2407 | mGLBytes( 0 ), |
2630 | mTGABytes( 0 ) | 2408 | mTGABytes( 0 ) |
2631 | {} | 2409 | {} |
@@ -2638,36 +2416,31 @@ LLTexStaticImageList::~LLTexStaticImageList() | |||
2638 | void LLTexStaticImageList::dumpByteCount() | 2416 | void LLTexStaticImageList::dumpByteCount() |
2639 | { | 2417 | { |
2640 | llinfos << "Avatar Static Textures " << | 2418 | llinfos << "Avatar Static Textures " << |
2641 | " Raw:" << (mRawBytes / 1024) << | ||
2642 | "KB GL:" << (mGLBytes / 1024) << | 2419 | "KB GL:" << (mGLBytes / 1024) << |
2643 | "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; | 2420 | "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; |
2644 | } | 2421 | } |
2645 | 2422 | ||
2646 | void LLTexStaticImageList::deleteCachedImages() | 2423 | void LLTexStaticImageList::deleteCachedImages() |
2647 | { | 2424 | { |
2648 | if( mRawBytes || mGLBytes || mTGABytes ) | 2425 | if( mGLBytes || mTGABytes ) |
2649 | { | 2426 | { |
2650 | llinfos << "Clearing Static Textures " << | 2427 | llinfos << "Clearing Static Textures " << |
2651 | " Raw:" << (mRawBytes / 1024) << | ||
2652 | "KB GL:" << (mGLBytes / 1024) << | 2428 | "KB GL:" << (mGLBytes / 1024) << |
2653 | "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; | 2429 | "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; |
2654 | 2430 | ||
2655 | //mStaticImageLists uses LLPointers, clear() will cause deletion | 2431 | //mStaticImageLists uses LLPointers, clear() will cause deletion |
2656 | 2432 | ||
2657 | mStaticImageListRaw.clear(); | ||
2658 | mStaticImageListTGA.clear(); | 2433 | mStaticImageListTGA.clear(); |
2659 | mStaticImageListGL.clear(); | 2434 | mStaticImageListGL.clear(); |
2660 | 2435 | ||
2661 | mRawBytes = 0; | ||
2662 | mGLBytes = 0; | 2436 | mGLBytes = 0; |
2663 | mTGABytes = 0; | 2437 | mTGABytes = 0; |
2664 | } | 2438 | } |
2665 | } | 2439 | } |
2666 | 2440 | ||
2667 | // Note: in general, for a given image image we'll call either getImageTga(), getImageRaw() or getImageGL(). | 2441 | // Note: in general, for a given image image we'll call either getImageTga() or getImageGL(). |
2668 | // We call getImageTga() if the image is used as an alpha gradient. | 2442 | // We call getImageTga() if the image is used as an alpha gradient. |
2669 | // Otherwise, we call getImageRaw() if we have 32 MB or less of video RAM or less and getImageGL() if we have | 2443 | // Otherwise, we call getImageGL() |
2670 | // more video RAM than that. | ||
2671 | 2444 | ||
2672 | // Returns an LLImageTGA that contains the encoded data from a tga file named file_name. | 2445 | // Returns an LLImageTGA that contains the encoded data from a tga file named file_name. |
2673 | // Caches the result to speed identical subsequent requests. | 2446 | // Caches the result to speed identical subsequent requests. |
@@ -2699,34 +2472,6 @@ LLImageTGA* LLTexStaticImageList::getImageTGA(const LLString& file_name) | |||
2699 | 2472 | ||
2700 | 2473 | ||
2701 | 2474 | ||
2702 | // Returns an LLImageRaw that contains the decoded data from a tga file named file_name. | ||
2703 | // Caches the result to speed identical subsequent requests. | ||
2704 | LLImageRaw* LLTexStaticImageList::getImageRaw(const LLString& file_name) | ||
2705 | { | ||
2706 | LLPointer<LLImageRaw> image_raw; | ||
2707 | const char *namekey = sImageNames.addString(file_name); | ||
2708 | image_raw_map_t::iterator iter = mStaticImageListRaw.find(namekey); | ||
2709 | if( iter != mStaticImageListRaw.end() ) | ||
2710 | { | ||
2711 | image_raw = iter->second; | ||
2712 | } | ||
2713 | else | ||
2714 | { | ||
2715 | image_raw = new LLImageRaw(); | ||
2716 | if( loadImageRaw( file_name, image_raw ) ) | ||
2717 | { | ||
2718 | mStaticImageListRaw[ namekey ] = image_raw; | ||
2719 | mRawBytes += image_raw->getDataSize(); | ||
2720 | } | ||
2721 | else | ||
2722 | { | ||
2723 | image_raw = NULL; | ||
2724 | } | ||
2725 | } | ||
2726 | |||
2727 | return image_raw; | ||
2728 | } | ||
2729 | |||
2730 | // Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name. | 2475 | // Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name. |
2731 | // Caches the result to speed identical subsequent requests. | 2476 | // Caches the result to speed identical subsequent requests. |
2732 | LLImageGL* LLTexStaticImageList::getImageGL(const LLString& file_name, BOOL is_mask ) | 2477 | LLImageGL* LLTexStaticImageList::getImageGL(const LLString& file_name, BOOL is_mask ) |