From Jannik Heller , GL object deletion fix.
"This submission changes deleteGLObject calls to scheduleGLObjectForDeletion, to ensure that the actual deletion happens from the correct thread (the graphics thread). This fixes the leak I reported in http://forum.openscenegraph.org/viewtopic.php?t=15567 , and possibly also http://forum.openscenegraph.org/viewtopic.php?t=15564."
This commit is contained in:
parent
8cefa05e3a
commit
3e0435febd
@ -67,7 +67,7 @@ void FragmentProgram::dirtyFragmentProgramObject()
|
||||
{
|
||||
if (_fragmentProgramIDList[i] != 0)
|
||||
{
|
||||
osg::get<GLFragmentProgramManager>(i)->deleteGLObject(_fragmentProgramIDList[i]);
|
||||
osg::get<GLFragmentProgramManager>(i)->scheduleGLObjectForDeletion(_fragmentProgramIDList[i]);
|
||||
_fragmentProgramIDList[i] = 0;
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ void FragmentProgram::releaseGLObjects(State* state) const
|
||||
unsigned int contextID = state->getContextID();
|
||||
if (_fragmentProgramIDList[contextID] != 0)
|
||||
{
|
||||
osg::get<GLFragmentProgramManager>(contextID)->deleteGLObject(_fragmentProgramIDList[contextID]);
|
||||
osg::get<GLFragmentProgramManager>(contextID)->scheduleGLObjectForDeletion(_fragmentProgramIDList[contextID]);
|
||||
_fragmentProgramIDList[contextID] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ RenderBuffer::~RenderBuffer()
|
||||
{
|
||||
for(unsigned i=0; i<_objectID.size(); ++i)
|
||||
{
|
||||
if (_objectID[i]) osg::get<GLRenderBufferManager>(i)->deleteGLObject(_objectID[i]);
|
||||
if (_objectID[i]) osg::get<GLRenderBufferManager>(i)->scheduleGLObjectForDeletion(_objectID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ void RenderBuffer::releaseGLObjects(osg::State* state) const
|
||||
unsigned int contextID = state->getContextID();
|
||||
if (_objectID[contextID])
|
||||
{
|
||||
osg::get<GLRenderBufferManager>(contextID)->deleteGLObject(_objectID[contextID]);
|
||||
osg::get<GLRenderBufferManager>(contextID)->scheduleGLObjectForDeletion(_objectID[contextID]);
|
||||
_objectID[contextID] = 0;
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ void RenderBuffer::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (_objectID[i])
|
||||
{
|
||||
osg::get<GLRenderBufferManager>(i)->deleteGLObject(_objectID[i]);
|
||||
osg::get<GLRenderBufferManager>(i)->scheduleGLObjectForDeletion(_objectID[i]);
|
||||
_objectID[i] = 0;
|
||||
}
|
||||
}
|
||||
@ -595,7 +595,7 @@ FrameBufferObject::~FrameBufferObject()
|
||||
{
|
||||
for(unsigned i=0; i<_fboID.size(); ++i)
|
||||
{
|
||||
if (_fboID[i]) osg::get<GLFrameBufferObjectManager>(i)->deleteGLObject(_fboID[i]);
|
||||
if (_fboID[i]) osg::get<GLFrameBufferObjectManager>(i)->scheduleGLObjectForDeletion(_fboID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ void FrameBufferObject::releaseGLObjects(osg::State* state) const
|
||||
unsigned int contextID = state->getContextID();
|
||||
if (_fboID[contextID])
|
||||
{
|
||||
osg::get<GLFrameBufferObjectManager>(contextID)->deleteGLObject(_fboID[contextID]);
|
||||
osg::get<GLFrameBufferObjectManager>(contextID)->scheduleGLObjectForDeletion(_fboID[contextID]);
|
||||
_fboID[contextID] = 0;
|
||||
}
|
||||
}
|
||||
@ -623,7 +623,7 @@ void FrameBufferObject::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (_fboID[i])
|
||||
{
|
||||
osg::get<GLFrameBufferObjectManager>(i)->deleteGLObject(_fboID[i]);
|
||||
osg::get<GLFrameBufferObjectManager>(i)->scheduleGLObjectForDeletion(_fboID[i]);
|
||||
_fboID[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ Program::PerContextProgram::~PerContextProgram()
|
||||
{
|
||||
if (_ownsProgramHandle)
|
||||
{
|
||||
osg::get<GLProgramManager>(_contextID)->deleteGLObject(_glProgramHandle);
|
||||
osg::get<GLProgramManager>(_contextID)->scheduleGLObjectForDeletion(_glProgramHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,7 +464,7 @@ Shader::PerContextShader::PerContextShader(const Shader* shader, unsigned int co
|
||||
|
||||
Shader::PerContextShader::~PerContextShader()
|
||||
{
|
||||
osg::get<GLShaderManager>(_contextID)->deleteGLObject(_glShaderHandle);
|
||||
osg::get<GLShaderManager>(_contextID)->scheduleGLObjectForDeletion(_glShaderHandle);
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ void VertexProgram::dirtyVertexProgramObject()
|
||||
{
|
||||
if (_vertexProgramIDList[i] != 0)
|
||||
{
|
||||
osg::get<GLVertexProgramManager>(i)->deleteGLObject(_vertexProgramIDList[i]);
|
||||
osg::get<GLVertexProgramManager>(i)->scheduleGLObjectForDeletion(_vertexProgramIDList[i]);
|
||||
_vertexProgramIDList[i] = 0;
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ void VertexProgram::releaseGLObjects(State* state) const
|
||||
unsigned int contextID = state->getContextID();
|
||||
if (_vertexProgramIDList[contextID] != 0)
|
||||
{
|
||||
osg::get<GLVertexProgramManager>(contextID)->deleteGLObject(_vertexProgramIDList[contextID]);
|
||||
osg::get<GLVertexProgramManager>(contextID)->scheduleGLObjectForDeletion(_vertexProgramIDList[contextID]);
|
||||
_vertexProgramIDList[contextID] = 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user