Fixed for crashes on exit associaciated with VAO usage and vairous niche usage cases
This commit is contained in:
@@ -340,9 +340,14 @@ void Camera::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
|
||||
void Camera::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (_renderer.valid())
|
||||
{
|
||||
_renderer->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
if (_renderingCache.valid())
|
||||
{
|
||||
const_cast<Camera*>(this)->_renderingCache->releaseGLObjects(state);
|
||||
_renderingCache->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
Transform::releaseGLObjects(state);
|
||||
|
||||
@@ -438,7 +438,7 @@ bool GraphicsContext::realize()
|
||||
|
||||
void GraphicsContext::close(bool callCloseImplementation)
|
||||
{
|
||||
OSG_INFO<<"close("<<callCloseImplementation<<")"<<this<<std::endl;
|
||||
OSG_INFO<<"GraphicsContext::close("<<callCloseImplementation<<")"<<this<<std::endl;
|
||||
|
||||
// switch off the graphics thread...
|
||||
setGraphicsThread(0);
|
||||
|
||||
@@ -222,3 +222,26 @@ unsigned int View::findSlaveIndexForCamera(osg::Camera* camera) const
|
||||
return _slaves.size();
|
||||
}
|
||||
|
||||
void View::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_camera) _camera->resizeGLObjectBuffers(maxSize);
|
||||
|
||||
for(Slaves::iterator itr = _slaves.begin();
|
||||
itr != _slaves.end();
|
||||
++itr)
|
||||
{
|
||||
if (itr->_camera.valid()) itr->_camera->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
void View::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (_camera) _camera->releaseGLObjects(state);
|
||||
|
||||
for(Slaves::const_iterator itr = _slaves.begin();
|
||||
itr != _slaves.end();
|
||||
++itr)
|
||||
{
|
||||
if (itr->_camera.valid()) itr->_camera->releaseGLObjects(state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ LightPointDrawable::LightPointDrawable(const LightPointDrawable& lpd,const osg::
|
||||
|
||||
LightPointDrawable::~LightPointDrawable()
|
||||
{
|
||||
OSG_NOTICE<<"LightPointDrawable::~LightPointDrawable()"<<std::endl;
|
||||
}
|
||||
|
||||
void LightPointDrawable::reset()
|
||||
|
||||
@@ -927,6 +927,58 @@ void SceneView::releaseAllGLObjects()
|
||||
_camera->releaseGLObjects(_renderInfo.getState());
|
||||
}
|
||||
|
||||
void SceneView::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
struct Resize
|
||||
{
|
||||
unsigned int maxSize = 1;
|
||||
|
||||
Resize(unsigned int ms) : maxSize(ms) {}
|
||||
|
||||
void operator() (osg::Referenced* object)
|
||||
{
|
||||
if (object) object->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
} operation(maxSize);
|
||||
|
||||
operation(_localStateSet.get());
|
||||
operation(_updateVisitor.get());
|
||||
operation(_cullVisitor.get());
|
||||
operation(_stateGraph.get());
|
||||
operation(_renderStage.get());
|
||||
operation(_cullVisitorRight.get());
|
||||
operation(_stateGraphRight.get());
|
||||
operation(_renderStageRight.get());
|
||||
operation(_globalStateSet.get());
|
||||
operation(_secondaryStateSet.get());
|
||||
operation(_cameraWithOwnership.get());
|
||||
}
|
||||
|
||||
void SceneView::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (state && state!=_renderInfo.getState()) return;
|
||||
|
||||
struct Release
|
||||
{
|
||||
void operator() (const osg::Referenced* object)
|
||||
{
|
||||
if (object) object->releaseGLObjects();
|
||||
}
|
||||
} operation;
|
||||
|
||||
operation(_localStateSet.get());
|
||||
operation(_updateVisitor.get());
|
||||
operation(_cullVisitor.get());
|
||||
operation(_stateGraph.get());
|
||||
operation(_renderStage.get());
|
||||
operation(_cullVisitorRight.get());
|
||||
operation(_stateGraphRight.get());
|
||||
operation(_renderStageRight.get());
|
||||
operation(_globalStateSet.get());
|
||||
operation(_secondaryStateSet.get());
|
||||
operation(_cameraWithOwnership.get());
|
||||
}
|
||||
|
||||
void SceneView::flushAllDeletedGLObjects()
|
||||
{
|
||||
_requiresFlush = false;
|
||||
|
||||
@@ -930,6 +930,18 @@ void Renderer::operator () (osg::GraphicsContext* /*context*/)
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_sceneView[0].valid()) _sceneView[0]->resizeGLObjectBuffers(maxSize);
|
||||
if (_sceneView[1].valid()) _sceneView[1]->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
void Renderer::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (_sceneView[0].valid()) _sceneView[0]->releaseGLObjects(state);
|
||||
if (_sceneView[1].valid()) _sceneView[1]->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
void Renderer::release()
|
||||
{
|
||||
OSG_INFO<<"Renderer::release()"<<std::endl;
|
||||
|
||||
Reference in New Issue
Block a user