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:
parent
3b23b474dc
commit
7dc3b34bfd
@ -49,7 +49,7 @@ PROJECT(OpenSceneGraph)
|
||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||
SET(OPENSCENEGRAPH_MINOR_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
|
||||
# svn tags will be treated as release candidates of given number
|
||||
|
@ -112,7 +112,7 @@ class VertexAttribAlias
|
||||
* which typically stall the graphics pipeline (see, for instance,
|
||||
* \c captureCurrentState() and \c getModelViewMatrix()).
|
||||
*/
|
||||
class OSG_EXPORT State : public Referenced, public Observer
|
||||
class OSG_EXPORT State : public Referenced
|
||||
{
|
||||
public :
|
||||
|
||||
@ -214,7 +214,6 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
/** reset the state object to an empty stack.*/
|
||||
void reset();
|
||||
|
||||
|
||||
inline const Viewport* getCurrentViewport() const
|
||||
{
|
||||
return static_cast<const Viewport*>(getLastAppliedAttribute(osg::StateAttribute::VIEWPORT));
|
||||
@ -1329,11 +1328,6 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
if (_lastAppliedProgramObject!=program)
|
||||
{
|
||||
_lastAppliedProgramObject = program;
|
||||
if (program && _appliedProgramObjectSet.count(program)==0)
|
||||
{
|
||||
_appliedProgramObjectSet.insert(program);
|
||||
program->addObserver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
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.*/
|
||||
void initializeExtensionProcs();
|
||||
|
||||
virtual void objectDeleted(void* object);
|
||||
|
||||
/** Get the GL adapter object used to map OpenGL 1.0 glBegin/glEnd usage to vertex arrays.*/
|
||||
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::set<const Program::PerContextProgram* > AppliedProgramObjectSet;
|
||||
|
||||
inline const ModeMap& getModeMap() const {return _modeMap;};
|
||||
inline const AttributeMap& getAttributeMap() const {return _attributeMap;};
|
||||
inline const UniformMap& getUniformMap() const {return _uniformMap;};
|
||||
@ -1788,7 +1778,6 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
TextureModeMapList _textureModeMapList;
|
||||
TextureAttributeMapList _textureAttributeMapList;
|
||||
|
||||
AppliedProgramObjectSet _appliedProgramObjectSet;
|
||||
const Program::PerContextProgram* _lastAppliedProgramObject;
|
||||
|
||||
StateSetStack _stateStateStack;
|
||||
|
@ -21,7 +21,7 @@ extern "C" {
|
||||
#define OPENSCENEGRAPH_MAJOR_VERSION 3
|
||||
#define OPENSCENEGRAPH_MINOR_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.
|
||||
* #if OSG_MIN_VERSION_REQUIRED(2,9,5)
|
||||
|
@ -134,27 +134,7 @@ State::~State()
|
||||
//_texCoordArrayList.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()
|
||||
{
|
||||
@ -208,7 +188,6 @@ void State::releaseGLObjects()
|
||||
|
||||
void State::reset()
|
||||
{
|
||||
|
||||
#if 1
|
||||
for(ModeMap::iterator mitr=_modeMap.begin();
|
||||
mitr!=_modeMap.end();
|
||||
@ -290,17 +269,6 @@ void State::reset()
|
||||
|
||||
_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...
|
||||
// go through all active Unfirom's, setting to change to force update,
|
||||
// the idea is to leave only the global defaults left.
|
||||
@ -1767,14 +1735,6 @@ void State::print(std::ostream& fout) const
|
||||
}
|
||||
fout<<"}"<<std::endl;
|
||||
|
||||
#if 0
|
||||
TextureModeMapList _textureModeMapList;
|
||||
TextureAttributeMapList _textureAttributeMapList;
|
||||
|
||||
AppliedProgramObjectSet _appliedProgramObjectSet;
|
||||
const Program::PerContextProgram* _lastAppliedProgramObject;
|
||||
#endif
|
||||
|
||||
|
||||
fout<<"StateSetStack _stateSetStack {"<<std::endl;
|
||||
for(StateSetStack::const_iterator itr = _stateStateStack.begin();
|
||||
|
@ -940,12 +940,8 @@ void SceneView::releaseAllGLObjects()
|
||||
if (!_camera) return;
|
||||
|
||||
_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()
|
||||
{
|
||||
_requiresFlush = false;
|
||||
|
Loading…
Reference in New Issue
Block a user