Hi,

I noticed a bug in BufferObject handling. The size stored into the profile 
object when the GLBufferObject is added to a profile-set is used to update the 
BufferObject pool size. The buffer-alignment is not considered here.

When a BufferObject is compiled, the profile size can get an update as the 
buffer-alignment is also considered in the size calculation. But this update in 
the object's size is not reflected in the pool-size. When the object gets 
deleted, it can cause the pool-size variable to underflow. The fix is a small 
change in the function void GLBufferObject::compileBuffer() which are marked in 
red below:

if (newTotalSize > _profile._size)
    {
        OSG_INFO<<"newTotalSize="<<newTotalSize<<", 
_profile._size="<<_profile._size<<std::endl;

        unsigned int sizeDifference = newTotalSize - _profile._size;
        _profile._size = newTotalSize;

        if (_set)
        {
            _set->moveToSet(this, 
_set->getParent()->getGLBufferObjectSet(_profile));
            _set->getParent()->getCurrGLBufferObjectPoolSize() += 
sizeDifference;
        }

    }


Thank you!

Cheers,
Anish

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66007#66007





_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to