Fixed for crashes on exit associaciated with VAO usage and vairous niche usage cases

This commit is contained in:
Robert Osfield
2019-01-08 19:32:50 +00:00
parent 1c65815f4e
commit f6b64afdfc
13 changed files with 161 additions and 7 deletions

View File

@@ -43,8 +43,8 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
public:
typedef std::map< const osg::StateSet*, osg::ref_ptr<StateGraph> > ChildList;
typedef std::vector< osg::ref_ptr<RenderLeaf> > LeafList;
typedef std::map< const osg::StateSet*, osg::ref_ptr<StateGraph> > ChildList;
typedef std::vector< osg::ref_ptr<RenderLeaf> > LeafList;
StateGraph* _parent;
@@ -172,6 +172,42 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
void prune();
void resizeGLObjectBuffers(unsigned int maxSize)
{
for(ChildList::iterator itr = _children.begin();
itr != _children.end();
++itr)
{
(itr->second)->resizeGLObjectBuffers(maxSize);
}
for(LeafList::iterator itr = _leaves.begin();
itr != _leaves.end();
++itr)
{
(*itr)->resizeGLObjectBuffers(maxSize);
}
}
void releaseGLObjects(osg::State* state=0) const
{
if (_stateset) _stateset->releaseGLObjects(state);
for(ChildList::const_iterator itr = _children.begin();
itr != _children.end();
++itr)
{
(itr->second)->releaseGLObjects(state);
}
for(LeafList::const_iterator itr = _leaves.begin();
itr != _leaves.end();
++itr)
{
(*itr)->releaseGLObjects(state);
}
}
inline StateGraph* find_or_insert(const osg::StateSet* stateset)
{
// search for the appropriate state group, return it if found.