From Fabien Lavingotte and Robert Osfield, Fixed handling of texture pool size when TextureObject::setAllocate(..) is called.

This commit is contained in:
Robert Osfield
2010-11-04 17:53:58 +00:00
parent 286d4bceaa
commit 2aaf0ed297
2 changed files with 9 additions and 1 deletions

View File

@@ -955,6 +955,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute
_height = height;
_depth = depth;
_border = border;
computeSize();
}
inline bool match(GLenum target,

View File

@@ -91,12 +91,19 @@ void Texture::TextureObject::setAllocated(GLint numMipmapLevels,
_allocated=true;
if (!match(_profile._target,numMipmapLevels,internalFormat,width,height,depth,border))
{
// keep previous size
unsigned int previousSize = _profile._size;
_profile.set(numMipmapLevels,internalFormat,width,height,depth,border);
if (_set)
{
_set->moveToSet(this, _set->getParent()->getTextureObjectSet(_profile));
}
// Update texture pool size
_set->getParent()->getCurrTexturePoolSize() -= previousSize;
_set->getParent()->getCurrTexturePoolSize() += _profile._size;
}
}
}