From Fabien Lavingotte and Robert Osfield, Fixed handling of texture pool size when TextureObject::setAllocate(..) is called.
This commit is contained in:
@@ -955,6 +955,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
_height = height;
|
||||
_depth = depth;
|
||||
_border = border;
|
||||
computeSize();
|
||||
}
|
||||
|
||||
inline bool match(GLenum target,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user