Removed State::AppliedProgramObjectSet container and Obsever usage from osg::State to address threading bug crash.

The State::AppliedProgramObjectSet wasn't ever being used actively in the current rev of the OSG so populating and clearing was no longer neccessary, allowing the code to be removed completely.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14377 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-07-22 16:02:33 +00:00
parent 3b23b474dc
commit 7dc3b34bfd
5 changed files with 3 additions and 58 deletions

View File

@ -49,7 +49,7 @@ PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 3) SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 3) SET(OPENSCENEGRAPH_MINOR_VERSION 3)
SET(OPENSCENEGRAPH_PATCH_VERSION 3) SET(OPENSCENEGRAPH_PATCH_VERSION 3)
SET(OPENSCENEGRAPH_SOVERSION 113) SET(OPENSCENEGRAPH_SOVERSION 114)
# set to 0 when not a release candidate, non zero means that any generated # set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number # svn tags will be treated as release candidates of given number

View File

@ -112,7 +112,7 @@ class VertexAttribAlias
* which typically stall the graphics pipeline (see, for instance, * which typically stall the graphics pipeline (see, for instance,
* \c captureCurrentState() and \c getModelViewMatrix()). * \c captureCurrentState() and \c getModelViewMatrix()).
*/ */
class OSG_EXPORT State : public Referenced, public Observer class OSG_EXPORT State : public Referenced
{ {
public : public :
@ -214,7 +214,6 @@ class OSG_EXPORT State : public Referenced, public Observer
/** reset the state object to an empty stack.*/ /** reset the state object to an empty stack.*/
void reset(); void reset();
inline const Viewport* getCurrentViewport() const inline const Viewport* getCurrentViewport() const
{ {
return static_cast<const Viewport*>(getLastAppliedAttribute(osg::StateAttribute::VIEWPORT)); return static_cast<const Viewport*>(getLastAppliedAttribute(osg::StateAttribute::VIEWPORT));
@ -1329,11 +1328,6 @@ class OSG_EXPORT State : public Referenced, public Observer
if (_lastAppliedProgramObject!=program) if (_lastAppliedProgramObject!=program)
{ {
_lastAppliedProgramObject = program; _lastAppliedProgramObject = program;
if (program && _appliedProgramObjectSet.count(program)==0)
{
_appliedProgramObjectSet.insert(program);
program->addObserver(this);
}
} }
} }
inline const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; } inline const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; }
@ -1463,8 +1457,6 @@ class OSG_EXPORT State : public Referenced, public Observer
/** Initialize extension used by osg:::State.*/ /** Initialize extension used by osg:::State.*/
void initializeExtensionProcs(); void initializeExtensionProcs();
virtual void objectDeleted(void* object);
/** Get the GL adapter object used to map OpenGL 1.0 glBegin/glEnd usage to vertex arrays.*/ /** Get the GL adapter object used to map OpenGL 1.0 glBegin/glEnd usage to vertex arrays.*/
inline GLBeginEndAdapter& getGLBeginEndAdapter() { return _glBeginEndAdapter; } inline GLBeginEndAdapter& getGLBeginEndAdapter() { return _glBeginEndAdapter; }
@ -1574,8 +1566,6 @@ class OSG_EXPORT State : public Referenced, public Observer
typedef std::vector<ref_ptr<const Matrix> > MatrixStack; typedef std::vector<ref_ptr<const Matrix> > MatrixStack;
typedef std::set<const Program::PerContextProgram* > AppliedProgramObjectSet;
inline const ModeMap& getModeMap() const {return _modeMap;}; inline const ModeMap& getModeMap() const {return _modeMap;};
inline const AttributeMap& getAttributeMap() const {return _attributeMap;}; inline const AttributeMap& getAttributeMap() const {return _attributeMap;};
inline const UniformMap& getUniformMap() const {return _uniformMap;}; inline const UniformMap& getUniformMap() const {return _uniformMap;};
@ -1788,7 +1778,6 @@ class OSG_EXPORT State : public Referenced, public Observer
TextureModeMapList _textureModeMapList; TextureModeMapList _textureModeMapList;
TextureAttributeMapList _textureAttributeMapList; TextureAttributeMapList _textureAttributeMapList;
AppliedProgramObjectSet _appliedProgramObjectSet;
const Program::PerContextProgram* _lastAppliedProgramObject; const Program::PerContextProgram* _lastAppliedProgramObject;
StateSetStack _stateStateStack; StateSetStack _stateStateStack;

View File

@ -21,7 +21,7 @@ extern "C" {
#define OPENSCENEGRAPH_MAJOR_VERSION 3 #define OPENSCENEGRAPH_MAJOR_VERSION 3
#define OPENSCENEGRAPH_MINOR_VERSION 3 #define OPENSCENEGRAPH_MINOR_VERSION 3
#define OPENSCENEGRAPH_PATCH_VERSION 3 #define OPENSCENEGRAPH_PATCH_VERSION 3
#define OPENSCENEGRAPH_SOVERSION 113 #define OPENSCENEGRAPH_SOVERSION 114
/* Convenience macro that can be used to decide whether a feature is present or not i.e. /* Convenience macro that can be used to decide whether a feature is present or not i.e.
* #if OSG_MIN_VERSION_REQUIRED(2,9,5) * #if OSG_MIN_VERSION_REQUIRED(2,9,5)

View File

@ -134,28 +134,8 @@ State::~State()
//_texCoordArrayList.clear(); //_texCoordArrayList.clear();
//_vertexAttribArrayList.clear(); //_vertexAttribArrayList.clear();
// OSG_NOTICE<<"State::~State()"<<this<<std::endl;
for(AppliedProgramObjectSet::iterator itr = _appliedProgramObjectSet.begin();
itr != _appliedProgramObjectSet.end();
++itr)
{
(*itr)->removeObserver(this);
}
} }
void State::objectDeleted(void* object)
{
const Program::PerContextProgram* ppcp = reinterpret_cast<const Program::PerContextProgram*>(object);
AppliedProgramObjectSet::iterator itr = _appliedProgramObjectSet.find(ppcp);
if (itr != _appliedProgramObjectSet.end())
{
// OSG_NOTICE<<"Removing _appliedProgramObjectSet entry "<<ppcp<<std::endl;
_appliedProgramObjectSet.erase(itr);
}
}
void State::releaseGLObjects() void State::releaseGLObjects()
{ {
// release any GL objects held by the shader composer // release any GL objects held by the shader composer
@ -208,7 +188,6 @@ void State::releaseGLObjects()
void State::reset() void State::reset()
{ {
#if 1 #if 1
for(ModeMap::iterator mitr=_modeMap.begin(); for(ModeMap::iterator mitr=_modeMap.begin();
mitr!=_modeMap.end(); mitr!=_modeMap.end();
@ -290,17 +269,6 @@ void State::reset()
_lastAppliedProgramObject = 0; _lastAppliedProgramObject = 0;
for(AppliedProgramObjectSet::iterator apitr=_appliedProgramObjectSet.begin();
apitr!=_appliedProgramObjectSet.end();
++apitr)
{
(*apitr)->resetAppliedUniforms();
(*apitr)->removeObserver(this);
}
_appliedProgramObjectSet.clear();
// what about uniforms??? need to clear them too... // what about uniforms??? need to clear them too...
// go through all active Unfirom's, setting to change to force update, // go through all active Unfirom's, setting to change to force update,
// the idea is to leave only the global defaults left. // the idea is to leave only the global defaults left.
@ -1767,14 +1735,6 @@ void State::print(std::ostream& fout) const
} }
fout<<"}"<<std::endl; fout<<"}"<<std::endl;
#if 0
TextureModeMapList _textureModeMapList;
TextureAttributeMapList _textureAttributeMapList;
AppliedProgramObjectSet _appliedProgramObjectSet;
const Program::PerContextProgram* _lastAppliedProgramObject;
#endif
fout<<"StateSetStack _stateSetStack {"<<std::endl; fout<<"StateSetStack _stateSetStack {"<<std::endl;
for(StateSetStack::const_iterator itr = _stateStateStack.begin(); for(StateSetStack::const_iterator itr = _stateStateStack.begin();

View File

@ -940,12 +940,8 @@ void SceneView::releaseAllGLObjects()
if (!_camera) return; if (!_camera) return;
_camera->releaseGLObjects(_renderInfo.getState()); _camera->releaseGLObjects(_renderInfo.getState());
// we need to reset State as it keeps handles to Program objects.
if (_renderInfo.getState()) _renderInfo.getState()->reset();
} }
void SceneView::flushAllDeletedGLObjects() void SceneView::flushAllDeletedGLObjects()
{ {
_requiresFlush = false; _requiresFlush = false;