diff options
author | Jacek Antonelli | 2010-02-09 21:11:42 -0600 |
---|---|---|
committer | Jacek Antonelli | 2010-02-16 18:50:15 -0600 |
commit | e6247fbe78c4d3dacb74f3b2359aba2b6538133b (patch) | |
tree | 10c42d670a2c635b4339f7f68809c221756774f8 /linden/indra/newview/lltexlayer.cpp | |
parent | Ported some cURL and HTTP-related changes from Snowglobe. (diff) | |
download | meta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.zip meta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.tar.gz meta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.tar.bz2 meta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.tar.xz |
Ported many texture engine changes from Snowglobe.
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lltexlayer.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp index 424c525..968c496 100644 --- a/linden/indra/newview/lltexlayer.cpp +++ b/linden/indra/newview/lltexlayer.cpp | |||
@@ -115,7 +115,6 @@ LLTexLayerSetBuffer::~LLTexLayerSetBuffer() | |||
115 | if( mBumpTex.notNull()) | 115 | if( mBumpTex.notNull()) |
116 | { | 116 | { |
117 | mBumpTex = NULL ; | 117 | mBumpTex = NULL ; |
118 | LLImageGL::sGlobalTextureMemoryInBytes -= mWidth * mHeight * 4; | ||
119 | LLTexLayerSetBuffer::sGLBumpByteCount -= mWidth * mHeight * 4; | 118 | LLTexLayerSetBuffer::sGLBumpByteCount -= mWidth * mHeight * 4; |
120 | } | 119 | } |
121 | } | 120 | } |
@@ -132,7 +131,7 @@ void LLTexLayerSetBuffer::destroyGLTexture() | |||
132 | if( mBumpTex.notNull() ) | 131 | if( mBumpTex.notNull() ) |
133 | { | 132 | { |
134 | mBumpTex = NULL ; | 133 | mBumpTex = NULL ; |
135 | LLImageGL::sGlobalTextureMemoryInBytes -= mWidth * mHeight * 4; | 134 | //LLImageGL::sGlobalTextureMemoryInBytes -= mWidth * mHeight * 4; |
136 | LLTexLayerSetBuffer::sGLBumpByteCount -= mWidth * mHeight * 4; | 135 | LLTexLayerSetBuffer::sGLBumpByteCount -= mWidth * mHeight * 4; |
137 | } | 136 | } |
138 | 137 | ||
@@ -165,6 +164,14 @@ void LLTexLayerSetBuffer::createBumpTexture() | |||
165 | 164 | ||
166 | LLImageGL::sGlobalTextureMemoryInBytes += mWidth * mHeight * 4; | 165 | LLImageGL::sGlobalTextureMemoryInBytes += mWidth * mHeight * 4; |
167 | LLTexLayerSetBuffer::sGLBumpByteCount += mWidth * mHeight * 4; | 166 | LLTexLayerSetBuffer::sGLBumpByteCount += mWidth * mHeight * 4; |
167 | |||
168 | if(gAuditTexture) | ||
169 | { | ||
170 | mBumpTex->setCategory(LLViewerImageBoostLevel::TEXLAYER_BUMP) ; | ||
171 | mBumpTex->setTextureSize(mWidth * mHeight * 4) ; | ||
172 | mBumpTex->setComponents(4) ; | ||
173 | mBumpTex->incTextureCounter() ; | ||
174 | } | ||
168 | } | 175 | } |
169 | } | 176 | } |
170 | 177 | ||
@@ -619,7 +626,7 @@ void LLTexLayerSetBuffer::bindBumpTexture( U32 stage ) | |||
619 | if( mLastBindTime != LLImageGL::sLastFrameTime ) | 626 | if( mLastBindTime != LLImageGL::sLastFrameTime ) |
620 | { | 627 | { |
621 | mLastBindTime = LLImageGL::sLastFrameTime; | 628 | mLastBindTime = LLImageGL::sLastFrameTime; |
622 | LLImageGL::updateBoundTexMem(mWidth * mHeight * 4); | 629 | mBumpTex->updateBoundTexMem(); |
623 | } | 630 | } |
624 | } | 631 | } |
625 | else | 632 | else |
@@ -833,7 +840,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) | |||
833 | if( image_gl ) | 840 | if( image_gl ) |
834 | { | 841 | { |
835 | LLGLSUIDefault gls_ui; | 842 | LLGLSUIDefault gls_ui; |
836 | gGL.getTexUnit(0)->bind(image_gl); | 843 | gGL.getTexUnit(0)->bind(image_gl, TRUE); |
837 | gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); | 844 | gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); |
838 | gl_rect_2d_simple_tex( width, height ); | 845 | gl_rect_2d_simple_tex( width, height ); |
839 | } | 846 | } |
@@ -1418,7 +1425,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) | |||
1418 | 1425 | ||
1419 | LLTexUnit::eTextureAddressMode old_mode = image_gl->getAddressMode(); | 1426 | LLTexUnit::eTextureAddressMode old_mode = image_gl->getAddressMode(); |
1420 | 1427 | ||
1421 | gGL.getTexUnit(0)->bind(image_gl); | 1428 | gGL.getTexUnit(0)->bind(image_gl, TRUE); |
1422 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | 1429 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); |
1423 | 1430 | ||
1424 | gl_rect_2d_simple_tex( width, height ); | 1431 | gl_rect_2d_simple_tex( width, height ); |
@@ -1440,7 +1447,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) | |||
1440 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); | 1447 | LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); |
1441 | if( image_gl ) | 1448 | if( image_gl ) |
1442 | { | 1449 | { |
1443 | gGL.getTexUnit(0)->bind(image_gl); | 1450 | gGL.getTexUnit(0)->bind(image_gl, TRUE); |
1444 | gl_rect_2d_simple_tex( width, height ); | 1451 | gl_rect_2d_simple_tex( width, height ); |
1445 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 1452 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
1446 | } | 1453 | } |
@@ -1617,7 +1624,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 | |||
1617 | 1624 | ||
1618 | LLTexUnit::eTextureAddressMode old_mode = image_gl->getAddressMode(); | 1625 | LLTexUnit::eTextureAddressMode old_mode = image_gl->getAddressMode(); |
1619 | 1626 | ||
1620 | gGL.getTexUnit(0)->bind(image_gl); | 1627 | gGL.getTexUnit(0)->bind(image_gl, TRUE); |
1621 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | 1628 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); |
1622 | 1629 | ||
1623 | gl_rect_2d_simple_tex( width, height ); | 1630 | gl_rect_2d_simple_tex( width, height ); |
@@ -1643,7 +1650,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 | |||
1643 | ( (image_gl->getComponents() == 1) && getInfo()->mStaticImageIsMask ) ) | 1650 | ( (image_gl->getComponents() == 1) && getInfo()->mStaticImageIsMask ) ) |
1644 | { | 1651 | { |
1645 | LLGLSNoAlphaTest gls_no_alpha_test; | 1652 | LLGLSNoAlphaTest gls_no_alpha_test; |
1646 | gGL.getTexUnit(0)->bind(image_gl); | 1653 | gGL.getTexUnit(0)->bind(image_gl, TRUE); |
1647 | gl_rect_2d_simple_tex( width, height ); | 1654 | gl_rect_2d_simple_tex( width, height ); |
1648 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 1655 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
1649 | } | 1656 | } |
@@ -2088,14 +2095,14 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) | |||
2088 | // Create the GL texture, and then hang onto it for future use. | 2095 | // Create the GL texture, and then hang onto it for future use. |
2089 | if( mNeedsCreateTexture ) | 2096 | if( mNeedsCreateTexture ) |
2090 | { | 2097 | { |
2091 | mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); | 2098 | mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw, 0, TRUE, LLViewerImageBoostLevel::TEXLAYER_CACHE); |
2092 | mNeedsCreateTexture = FALSE; | 2099 | mNeedsCreateTexture = FALSE; |
2093 | gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); | 2100 | gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); |
2094 | mCachedProcessedImageGL->setAddressMode(LLTexUnit::TAM_CLAMP); | 2101 | mCachedProcessedImageGL->setAddressMode(LLTexUnit::TAM_CLAMP); |
2095 | } | 2102 | } |
2096 | 2103 | ||
2097 | LLGLSNoAlphaTest gls_no_alpha_test; | 2104 | LLGLSNoAlphaTest gls_no_alpha_test; |
2098 | gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); | 2105 | gGL.getTexUnit(0)->bind(mCachedProcessedImageGL, TRUE); |
2099 | gl_rect_2d_simple_tex( width, height ); | 2106 | gl_rect_2d_simple_tex( width, height ); |
2100 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 2107 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
2101 | stop_glerror(); | 2108 | stop_glerror(); |
@@ -2543,7 +2550,7 @@ LLImageGL* LLTexStaticImageList::getImageGL(const std::string& file_name, BOOL i | |||
2543 | // that once an image is a mask it's always a mask. | 2550 | // that once an image is a mask it's always a mask. |
2544 | image_gl->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); | 2551 | image_gl->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); |
2545 | } | 2552 | } |
2546 | image_gl->createGLTexture(0, image_raw); | 2553 | image_gl->createGLTexture(0, image_raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); |
2547 | 2554 | ||
2548 | gGL.getTexUnit(0)->bind(image_gl); | 2555 | gGL.getTexUnit(0)->bind(image_gl); |
2549 | image_gl->setAddressMode(LLTexUnit::TAM_CLAMP); | 2556 | image_gl->setAddressMode(LLTexUnit::TAM_CLAMP); |