diff options
author | Dave Parks <davep@lindenlab.com> | 2011-10-14 17:56:55 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-10-14 17:56:55 -0500 |
commit | 984feefbecd0338618ea499dc1fa44c5a5fe747d (patch) | |
tree | 2114f73857009a983ca7b1ce90e2bf36237c57b9 /indra/newview/llvoavatarself.cpp | |
parent | 94c137d5c970bc01e3a4dbe8de6a7104085e5ba6 (diff) | |
parent | baa0ff7d3e34053a1dbc8c5207fe899d9e201ee0 (diff) |
merge
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rw-r--r-- | indra/newview/llvoavatarself.cpp | 85 |
1 files changed, 1 insertions, 84 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 59883e0bb1..581912f844 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2558,7 +2558,7 @@ void LLVOAvatarSelf::deleteScratchTextures() LLImageGL::decTextureCounter(tex_size, 1, LLViewerTexture::AVATAR_SCRATCH_TEX) ; total_tex_size -= tex_size ; } - if( sScratchTexNames.checkData( GL_LUMINANCE_ALPHA ) ) + if( sScratchTexNames.checkData( LLRender::sGLCoreProfile ? GL_RG : GL_LUMINANCE_ALPHA ) ) { LLImageGL::decTextureCounter(tex_size, 2, LLViewerTexture::AVATAR_SCRATCH_TEX) ; total_tex_size -= 2 * tex_size ; @@ -2600,89 +2600,6 @@ void LLVOAvatarSelf::deleteScratchTextures() } } -BOOL LLVOAvatarSelf::bindScratchTexture( LLGLenum format ) -{ - U32 texture_bytes = 0; - S32 components = 0; - GLuint gl_name = getScratchTexName( format, components, &texture_bytes ); - if( gl_name ) - { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); - stop_glerror(); - - F32* last_bind_time = sScratchTexLastBindTime.getIfThere( format ); - if( last_bind_time ) - { - if( *last_bind_time != LLImageGL::sLastFrameTime ) - { - *last_bind_time = LLImageGL::sLastFrameTime; - LLImageGL::updateBoundTexMem(texture_bytes, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ; - } - } - else - { - LLImageGL::updateBoundTexMem(texture_bytes, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ; - sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) ); - } - return TRUE; - } - return FALSE; -} - -LLGLuint LLVOAvatarSelf::getScratchTexName( LLGLenum format, S32& components, U32* texture_bytes ) -{ - GLenum internal_format; - switch( format ) - { - case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; - case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; - case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; - case GL_RGB: components = 3; internal_format = GL_RGB8; break; - case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; - default: llassert(0); components = 4; internal_format = GL_RGBA8; break; - } - - *texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT; - - if( sScratchTexNames.checkData( format ) ) - { - return *( sScratchTexNames.getData( format ) ); - } - - LLGLSUIDefault gls_ui; - - U32 name = 0; - LLImageGL::generateTextures(1, &name ); - stop_glerror(); - - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); - stop_glerror(); - - LLImageGL::setManualImage( - GL_TEXTURE_2D, 0, internal_format, - SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT, - format, GL_UNSIGNED_BYTE, NULL ); - stop_glerror(); - - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - stop_glerror(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - stop_glerror(); - - sScratchTexNames.addData( format, new LLGLuint( name ) ); - - sScratchTexBytes += *texture_bytes; - LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes; - - if(gAuditTexture) - { - LLImageGL::incTextureCounter(SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, components, LLViewerTexture::AVATAR_SCRATCH_TEX) ; - } - return name; -} - // static void LLVOAvatarSelf::dumpScratchTextureByteCount() { |