From ff565128af47a04f6bf198bf9025434c78ed23a9 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 8 Jan 2008 13:24:29 +0000 Subject: [PATCH] Introduced new osg::discardDeletedOpenGLObjects() methods, and usage of it in GrpahicsContext::close() to handle cases where deletingOpenGLObjects is no possible, such as when GraphicsWindowEmbedded is used. --- include/osg/BufferObject | 6 +++++ include/osg/Drawable | 12 +++++++++ include/osg/FragmentProgram | 6 +++++ include/osg/FrameBufferObject | 8 ++++++ include/osg/GLObjects | 6 +++++ include/osg/Program | 6 +++++ include/osg/Shader | 5 ++++ include/osg/Texture | 2 ++ include/osg/VertexProgram | 7 +++++ src/osg/BufferObject.cpp | 9 +++++-- src/osg/Drawable.cpp | 17 ++++++++++-- src/osg/FragmentProgram.cpp | 7 +++++ src/osg/FrameBufferObject.cpp | 15 +++++++++++ src/osg/GLObjects.cpp | 33 ++++++++++++++++------- src/osg/GraphicsContext.cpp | 30 ++++++++++----------- src/osg/Program.cpp | 7 +++++ src/osg/Shader.cpp | 7 +++++ src/osg/Texture.cpp | 15 +++++++++++ src/osg/VertexProgram.cpp | 7 +++++ src/osgWrappers/osg/BufferObject.cpp | 4 +++ src/osgWrappers/osg/Drawable.cpp | 8 ++++++ src/osgWrappers/osg/FragmentProgram.cpp | 4 +++ src/osgWrappers/osg/FrameBufferObject.cpp | 8 ++++++ src/osgWrappers/osg/Program.cpp | 4 +++ src/osgWrappers/osg/Shader.cpp | 4 +++ src/osgWrappers/osg/Texture.cpp | 4 +++ src/osgWrappers/osg/VertexProgram.cpp | 4 +++ 27 files changed, 216 insertions(+), 29 deletions(-) diff --git a/include/osg/BufferObject b/include/osg/BufferObject index 0b8424122..2829ec14d 100644 --- a/include/osg/BufferObject +++ b/include/osg/BufferObject @@ -157,6 +157,12 @@ class OSG_EXPORT BufferObject : public Object * in the OpenGL context related to contextID.*/ static void flushDeletedBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime); + /** dicard all the cached display list which need to be deleted + * in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. */ + static void discardDeletedBufferObjects(unsigned int contextID); + /** Extensions class which encapsulates the querying of extensions and * associated function pointers, and provide convenience wrappers to * check for the extensions or use the associated functions.*/ diff --git a/include/osg/Drawable b/include/osg/Drawable index 01be3e95c..29aaeb31a 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -444,6 +444,12 @@ class OSG_EXPORT Drawable : public Object * in the OpenGL context related to contextID.*/ static void flushAllDeletedDisplayLists(unsigned int contextID); + /** Flush all the cached display list which need to be deleted + * in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. */ + static void discardAllDeletedDisplayLists(unsigned int contextID); + /** Flush the cached display list which need to be deleted * in the OpenGL context related to contextID.*/ static void flushDeletedDisplayLists(unsigned int contextID,double& availableTime); @@ -458,6 +464,12 @@ class OSG_EXPORT Drawable : public Object * in the OpenGL context related to contextID.*/ static void flushDeletedVertexBufferObjects(unsigned int contextID,double currentTime, double& availableTime); + /** Flush all the cached vertex buffer objects which need to be deleted + * in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. */ + static void discardDeletedVertexBufferObjects(unsigned int contextID); + typedef unsigned int AttributeType; enum AttributeTypes diff --git a/include/osg/FragmentProgram b/include/osg/FragmentProgram index 5f34d5604..8e7085590 100644 --- a/include/osg/FragmentProgram +++ b/include/osg/FragmentProgram @@ -216,6 +216,12 @@ class OSG_EXPORT FragmentProgram : public StateAttribute * in the OpenGL context related to contextID.*/ static void flushDeletedFragmentProgramObjects(unsigned int contextID,double currentTime, double& availableTime); + /** discard all the cached fragment programs which need to be deleted + * in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. */ + static void discardDeletedFragmentProgramObjects(unsigned int contextID); + virtual void apply(State& state) const; virtual void compileGLObjects(State& state) const { apply(state); } diff --git a/include/osg/FrameBufferObject b/include/osg/FrameBufferObject index e68e1f411..595f58ac7 100644 --- a/include/osg/FrameBufferObject +++ b/include/osg/FrameBufferObject @@ -171,6 +171,10 @@ namespace osg * in the OpenGL context related to contextID.*/ static void flushDeletedRenderBuffers(unsigned int contextID,double currentTime, double& availableTime); + /** discard all the cached RenderBuffers which need to be deleted in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. */ + static void discardDeletedRenderBuffers(unsigned int contextID); protected: virtual ~RenderBuffer(); @@ -315,6 +319,10 @@ namespace osg * in the OpenGL context related to contextID.*/ static void flushDeletedFrameBufferObjects(unsigned int contextID,double currentTime, double& availableTime); + /** discard all the cached FBOs which need to be deleted + * in the OpenGL context related to contextID.*/ + static void discardDeletedFrameBufferObjects(unsigned int contextID); + protected: virtual ~FrameBufferObject(); FrameBufferObject& operator = (const FrameBufferObject&) { return *this; } diff --git a/include/osg/GLObjects b/include/osg/GLObjects index 8ea6caa85..32689deef 100644 --- a/include/osg/GLObjects +++ b/include/osg/GLObjects @@ -26,6 +26,12 @@ extern OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double curr * Note, must be called from a thread which has current the graphics context associated with contextID. */ extern OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID); +/** Discard all deleted OpenGL objects. + * Note, unlike flushAllDeletedObjectObjects discard does not + * do any OpenGL calls so can be called from any thread, but as a consequence it + * also doesn't remove the associated OpenGL resource so discard should only be + * called when the associated graphics context is being/has been closed. */ +extern OSG_EXPORT void discardAllDeletedGLObjects(unsigned int contextID); } diff --git a/include/osg/Program b/include/osg/Program index 451ccd6da..c9d35e642 100644 --- a/include/osg/Program +++ b/include/osg/Program @@ -124,6 +124,12 @@ class OSG_EXPORT Program : public osg::StateAttribute * in the OpenGL context related to contextID.*/ static void flushDeletedGlPrograms(unsigned int contextID,double currentTime, double& availableTime); + /** discard all the cached glPrograms which need to be deleted + * in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. */ + static void discardDeletedGlPrograms(unsigned int contextID); + struct ActiveVarInfo { ActiveVarInfo() : _location(-1), _type(Uniform::UNDEFINED), _size(-1) {} ActiveVarInfo( GLint loc, GLenum type, GLint size ) : _location(loc), _type(type), _size(size) {} diff --git a/include/osg/Shader b/include/osg/Shader index 58101f9b3..a1791ba24 100644 --- a/include/osg/Shader +++ b/include/osg/Shader @@ -114,6 +114,11 @@ class OSG_EXPORT Shader : public osg::Object * in the OpenGL context related to contextID.*/ static void flushDeletedGlShaders(unsigned int contextID,double currentTime, double& availableTime); + /** discard all the cached glShaders which need to be deleted in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. */ + static void discardDeletedGlShaders(unsigned int contextID); + static Shader::Type getTypeId( const std::string& tname ); protected: diff --git a/include/osg/Texture b/include/osg/Texture index 851fcabf4..ace2ddc3d 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -886,6 +886,8 @@ class OSG_EXPORT Texture : public osg::StateAttribute static unsigned int getMinimumNumberOfTextureObjectsToRetainInCache(); static void flushAllDeletedTextureObjects(unsigned int contextID); + + static void discardAllDeletedTextureObjects(unsigned int contextID); static void flushDeletedTextureObjects(unsigned int contextID,double currentTime, double& availableTime); diff --git a/include/osg/VertexProgram b/include/osg/VertexProgram index d9dab96fc..7f44d7cd2 100644 --- a/include/osg/VertexProgram +++ b/include/osg/VertexProgram @@ -217,6 +217,13 @@ class OSG_EXPORT VertexProgram : public StateAttribute */ static void flushDeletedVertexProgramObjects(unsigned int contextID,double currentTime, double& availableTime); + /** discard all the cached vertex programs which need to be deleted + * in the OpenGL context related to contextID. + * Note, unlike flush no OpenGL calls are made, instead the handles are all removed. + * this call is useful for when an OpenGL context has been destroyed. + */ + static void discardDeletedVertexProgramObjects(unsigned int contextID); + virtual void apply(State& state) const; virtual void compileGLObjects(State& state) const { apply(state); } diff --git a/src/osg/BufferObject.cpp b/src/osg/BufferObject.cpp index 557591efd..83bf19d73 100644 --- a/src/osg/BufferObject.cpp +++ b/src/osg/BufferObject.cpp @@ -48,8 +48,6 @@ void BufferObject::deleteBufferObject(unsigned int contextID,GLuint globj) } } -/** flush all the cached display list which need to be deleted - * in the OpenGL context related to contextID.*/ void BufferObject::flushDeletedBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime) { // if no time available don't try to flush objects. @@ -86,6 +84,13 @@ void BufferObject::flushDeletedBufferObjects(unsigned int contextID,double /*cur availableTime -= elapsedTime; } +void BufferObject::discardDeletedBufferObjects(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedBufferObjectCache); + DisplayListMap& dll = s_deletedBufferObjectCache[contextID]; + dll.clear(); +} + BufferObject::BufferObject(): _target(0), diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 9c0b12aa8..3aa0fae3e 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -116,6 +116,14 @@ void Drawable::flushAllDeletedDisplayLists(unsigned int contextID) dll.clear(); } +void Drawable::discardAllDeletedDisplayLists(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedDisplayListCache); + + DisplayListMap& dll = s_deletedDisplayListCache[contextID]; + dll.clear(); +} + void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availableTime) { // if no time available don't try to flush objects. @@ -206,8 +214,6 @@ void Drawable::deleteVertexBufferObject(unsigned int contextID,GLuint globj) } } -/** flush all the cached display lists which need to be deleted - * in the OpenGL context related to contextID.*/ void Drawable::flushDeletedVertexBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime) { // if no time available don't try to flush objects. @@ -244,6 +250,13 @@ void Drawable::flushDeletedVertexBufferObjects(unsigned int contextID,double /*c availableTime -= elapsedTime; } +void Drawable::discardDeletedVertexBufferObjects(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedVertexBufferObjectCache); + DisplayListMap& dll = s_deletedVertexBufferObjectCache[contextID]; + dll.clear(); +} + Drawable::Drawable() :Object(true) diff --git a/src/osg/FragmentProgram.cpp b/src/osg/FragmentProgram.cpp index 9a933cc5e..f2bb35305 100644 --- a/src/osg/FragmentProgram.cpp +++ b/src/osg/FragmentProgram.cpp @@ -73,6 +73,13 @@ void FragmentProgram::flushDeletedFragmentProgramObjects(unsigned int contextID, availableTime -= elapsedTime; } +void FragmentProgram::discardDeletedFragmentProgramObjects(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedFragmentProgramObjectCache); + FragmentProgramObjectList& vpol = s_deletedFragmentProgramObjectCache[contextID]; + vpol.clear(); +} + FragmentProgram::FragmentProgram() { diff --git a/src/osg/FrameBufferObject.cpp b/src/osg/FrameBufferObject.cpp index 7df489b12..ee0dd1f18 100644 --- a/src/osg/FrameBufferObject.cpp +++ b/src/osg/FrameBufferObject.cpp @@ -132,6 +132,13 @@ void RenderBuffer::flushDeletedRenderBuffers(unsigned int contextID,double /*cur availableTime -= elapsedTime; } +void RenderBuffer::discardDeletedRenderBuffers(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedRenderBufferCache); + RenderBufferHandleList& pList = s_deletedRenderBufferCache[contextID]; + pList.clear(); +} + RenderBuffer::RenderBuffer() : Object(), @@ -532,6 +539,14 @@ void FrameBufferObject::flushDeletedFrameBufferObjects(unsigned int contextID,do availableTime -= elapsedTime; } +void FrameBufferObject::discardDeletedFrameBufferObjects(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedFrameBufferObjectCache); + FrameBufferObjectHandleList& pList = s_deletedFrameBufferObjectCache[contextID]; + + pList.clear(); +} + FrameBufferObject::FrameBufferObject() diff --git a/src/osg/GLObjects.cpp b/src/osg/GLObjects.cpp index 81f3452ec..89af9e518 100644 --- a/src/osg/GLObjects.cpp +++ b/src/osg/GLObjects.cpp @@ -22,31 +22,44 @@ void osg::flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime) { - osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime); - osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime); - osg::Texture::flushDeletedTextureObjects(contextID,currentTime,availableTime); + osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime); osg::Drawable::flushDeletedDisplayLists(contextID,availableTime); osg::Drawable::flushDeletedVertexBufferObjects(contextID,currentTime,availableTime); - osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime); osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime); + osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime); osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime); + osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime); osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime); - osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime); + osg::Texture::flushDeletedTextureObjects(contextID,currentTime,availableTime); + osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime); } void osg::flushAllDeletedGLObjects(unsigned int contextID) { double currentTime = DBL_MAX; double availableTime = DBL_MAX; - osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime); - osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime); - osg::Texture::flushAllDeletedTextureObjects(contextID); + osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime); osg::Drawable::flushAllDeletedDisplayLists(contextID); osg::Drawable::flushDeletedVertexBufferObjects(contextID,currentTime,availableTime); - osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime); osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime); + osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime); osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime); + osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime); osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime); - osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime); + osg::Texture::flushAllDeletedTextureObjects(contextID); + osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime); } +void osg::discardAllDeletedGLObjects(unsigned int contextID) +{ + osg::BufferObject::discardDeletedBufferObjects(contextID); + osg::Drawable::discardAllDeletedDisplayLists(contextID); + osg::Drawable::discardDeletedVertexBufferObjects(contextID); + osg::FragmentProgram::discardDeletedFragmentProgramObjects(contextID); + osg::FrameBufferObject::discardDeletedFrameBufferObjects(contextID); + osg::Program::discardDeletedGlPrograms(contextID); + osg::RenderBuffer::discardDeletedRenderBuffers(contextID); + osg::Shader::discardDeletedGlShaders(contextID); + osg::Texture::discardAllDeletedTextureObjects(contextID); + osg::VertexProgram::discardDeletedVertexProgramObjects(contextID); +} diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index ea34985eb..feae4cfd1 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -464,21 +465,9 @@ void GraphicsContext::close(bool callCloseImplementation) osg::notify(osg::INFO)<<"Doing Flush"<getFrameStamp()?_state->getFrameStamp()->getReferenceTime():0.0; + osg::flushAllDeletedGLObjects(_state->getContextID()); - osg::FrameBufferObject::flushDeletedFrameBufferObjects(_state->getContextID(),currentTime,availableTime); - osg::RenderBuffer::flushDeletedRenderBuffers(_state->getContextID(),currentTime,availableTime); - osg::Texture::flushAllDeletedTextureObjects(_state->getContextID()); - osg::Drawable::flushAllDeletedDisplayLists(_state->getContextID()); - osg::Drawable::flushDeletedVertexBufferObjects(_state->getContextID(),currentTime,availableTime); - osg::VertexProgram::flushDeletedVertexProgramObjects(_state->getContextID(),currentTime,availableTime); - osg::FragmentProgram::flushDeletedFragmentProgramObjects(_state->getContextID(),currentTime,availableTime); - osg::Program::flushDeletedGlPrograms(_state->getContextID(),currentTime,availableTime); - osg::Shader::flushDeletedGlShaders(_state->getContextID(),currentTime,availableTime); - - osg::notify(osg::INFO)<<"Done Flush "<reset(); @@ -486,12 +475,23 @@ void GraphicsContext::close(bool callCloseImplementation) } else { - osg::notify(osg::INFO)<<"makeCurrent did not succedd, could not do flush/deletion of OpenGL objects."<getContextID()); + } + if (_state.valid()) { decrementContextIDUsageCount(_state->getContextID()); diff --git a/src/osg/Program.cpp b/src/osg/Program.cpp index 26f13b5b1..85df1026a 100644 --- a/src/osg/Program.cpp +++ b/src/osg/Program.cpp @@ -1977,6 +1977,13 @@ void Program::flushDeletedGlPrograms(unsigned int contextID,double /*currentTime availableTime -= elapsedTime; } +void Program::discardDeletedGlPrograms(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedGlProgramCache); + GlProgramHandleList& pList = s_deletedGlProgramCache[contextID]; + pList.clear(); +} + /////////////////////////////////////////////////////////////////////////// // osg::Program diff --git a/src/osg/Shader.cpp b/src/osg/Shader.cpp index 4c7f8f359..8fd0cc598 100644 --- a/src/osg/Shader.cpp +++ b/src/osg/Shader.cpp @@ -83,6 +83,13 @@ void Shader::flushDeletedGlShaders(unsigned int contextID,double /*currentTime*/ availableTime -= elapsedTime; } +void Shader::discardDeletedGlShaders(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedGlShaderCache); + + GlShaderHandleList& pList = s_deletedGlShaderCache[contextID]; + pList.clear(); +} /////////////////////////////////////////////////////////////////////////// // osg::Shader diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index d8acfe82e..7438850e1 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -101,6 +101,8 @@ public: void flushAllTextureObjects(unsigned int contextID); + void discardAllTextureObjects(unsigned int contextID); + void flushTextureObjects(unsigned int contextID,double currentTime, double& availableTime); void setExpiryDelay(double expiryDelay) { _expiryDelay = expiryDelay; } @@ -238,6 +240,14 @@ void TextureObjectManager::flushAllTextureObjects(unsigned int contextID) tol.clear(); } +void TextureObjectManager::discardAllTextureObjects(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(_mutex); + + Texture::TextureObjectList& tol = _textureObjectListMap[contextID]; + tol.clear(); +} + void TextureObjectManager::flushTextureObjects(unsigned int contextID,double currentTime, double& availableTime) { // if no time available don't try to flush objects. @@ -334,6 +344,11 @@ void Texture::flushAllDeletedTextureObjects(unsigned int contextID) if (getTextureObjectManager()) getTextureObjectManager()->flushAllTextureObjects(contextID); } +void Texture::discardAllDeletedTextureObjects(unsigned int contextID) +{ + if (getTextureObjectManager()) getTextureObjectManager()->discardAllTextureObjects(contextID); +} + void Texture::flushDeletedTextureObjects(unsigned int contextID,double currentTime, double& availbleTime) { if (getTextureObjectManager()) getTextureObjectManager()->flushTextureObjects(contextID, currentTime, availbleTime); diff --git a/src/osg/VertexProgram.cpp b/src/osg/VertexProgram.cpp index 3a8c05a4b..8abc4a8e3 100644 --- a/src/osg/VertexProgram.cpp +++ b/src/osg/VertexProgram.cpp @@ -73,6 +73,13 @@ void VertexProgram::flushDeletedVertexProgramObjects(unsigned int contextID,doub availableTime -= elapsedTime; } +void VertexProgram::discardDeletedVertexProgramObjects(unsigned int contextID) +{ + OpenThreads::ScopedLock lock(s_mutex_deletedVertexProgramObjectCache); + VertexProgramObjectList& vpol = s_deletedVertexProgramObjectCache[contextID]; + vpol.clear(); +} + VertexProgram::VertexProgram() { diff --git a/src/osgWrappers/osg/BufferObject.cpp b/src/osgWrappers/osg/BufferObject.cpp index c0afc67e6..e6c6879eb 100644 --- a/src/osgWrappers/osg/BufferObject.cpp +++ b/src/osgWrappers/osg/BufferObject.cpp @@ -119,6 +119,10 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferObject) __void__flushDeletedBufferObjects__unsigned_int__double__double_R1_S, "flush all the cached display list which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedBufferObjects, IN, unsigned int, contextID, + __void__discardDeletedBufferObjects__unsigned_int_S, + "dicard all the cached display list which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_StaticMethod2(osg::BufferObject::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized, __Extensions_P1__getExtensions__unsigned_int__bool_S, "Function to call to get the extension of a specified context. ", diff --git a/src/osgWrappers/osg/Drawable.cpp b/src/osgWrappers/osg/Drawable.cpp index 9e17ad7c5..5421b99ba 100644 --- a/src/osgWrappers/osg/Drawable.cpp +++ b/src/osgWrappers/osg/Drawable.cpp @@ -408,6 +408,10 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Drawable) __void__flushAllDeletedDisplayLists__unsigned_int_S, "Flush all the cached display list which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardAllDeletedDisplayLists, IN, unsigned int, contextID, + __void__discardAllDeletedDisplayLists__unsigned_int_S, + "Flush all the cached display list which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_StaticMethod2(void, flushDeletedDisplayLists, IN, unsigned int, contextID, IN, double &, availableTime, __void__flushDeletedDisplayLists__unsigned_int__double_R1_S, "Flush the cached display list which need to be deleted in the OpenGL context related to contextID. ", @@ -420,6 +424,10 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Drawable) __void__flushDeletedVertexBufferObjects__unsigned_int__double__double_R1_S, "Flush all the cached vertex buffer objects which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedVertexBufferObjects, IN, unsigned int, contextID, + __void__discardDeletedVertexBufferObjects__unsigned_int_S, + "Flush all the cached vertex buffer objects which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_StaticMethod2(osg::Drawable::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized, __Extensions_P1__getExtensions__unsigned_int__bool_S, "Function to call to get the extension of a specified context. ", diff --git a/src/osgWrappers/osg/FragmentProgram.cpp b/src/osgWrappers/osg/FragmentProgram.cpp index bcb8fd2cd..385bdbce1 100644 --- a/src/osgWrappers/osg/FragmentProgram.cpp +++ b/src/osgWrappers/osg/FragmentProgram.cpp @@ -173,6 +173,10 @@ BEGIN_OBJECT_REFLECTOR(osg::FragmentProgram) __void__flushDeletedFragmentProgramObjects__unsigned_int__double__double_R1_S, "flush all the cached fragment programs which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedFragmentProgramObjects, IN, unsigned int, contextID, + __void__discardDeletedFragmentProgramObjects__unsigned_int_S, + "discard all the cached fragment programs which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_StaticMethod2(osg::FragmentProgram::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized, __Extensions_P1__getExtensions__unsigned_int__bool_S, "Function to call to get the extension of a specified context. ", diff --git a/src/osgWrappers/osg/FrameBufferObject.cpp b/src/osgWrappers/osg/FrameBufferObject.cpp index ed0f89024..8185e177a 100644 --- a/src/osgWrappers/osg/FrameBufferObject.cpp +++ b/src/osgWrappers/osg/FrameBufferObject.cpp @@ -237,6 +237,10 @@ BEGIN_OBJECT_REFLECTOR(osg::FrameBufferObject) __void__flushDeletedFrameBufferObjects__unsigned_int__double__double_R1_S, "flush all the cached FBOs which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedFrameBufferObjects, IN, unsigned int, contextID, + __void__discardDeletedFrameBufferObjects__unsigned_int_S, + "discard all the cached FBOs which need to be deleted in the OpenGL context related to contextID. ", + ""); I_ProtectedMethod0(void, dirtyAll, Properties::NON_VIRTUAL, Properties::NON_CONST, @@ -347,6 +351,10 @@ BEGIN_OBJECT_REFLECTOR(osg::RenderBuffer) __void__flushDeletedRenderBuffers__unsigned_int__double__double_R1_S, "flush all the cached RenderBuffers which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedRenderBuffers, IN, unsigned int, contextID, + __void__discardDeletedRenderBuffers__unsigned_int_S, + "discard all the cached RenderBuffers which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_ProtectedMethod0(void, dirtyAll, Properties::NON_VIRTUAL, Properties::CONST, diff --git a/src/osgWrappers/osg/Program.cpp b/src/osgWrappers/osg/Program.cpp index 119a03d90..7c7b58783 100644 --- a/src/osgWrappers/osg/Program.cpp +++ b/src/osgWrappers/osg/Program.cpp @@ -195,6 +195,10 @@ BEGIN_OBJECT_REFLECTOR(osg::Program) __void__flushDeletedGlPrograms__unsigned_int__double__double_R1_S, "flush all the cached glPrograms which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedGlPrograms, IN, unsigned int, contextID, + __void__discardDeletedGlPrograms__unsigned_int_S, + "discard all the cached glPrograms which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_SimpleProperty(const osg::Program::AttribBindingList &, AttribBindingList, __C5_AttribBindingList_R1__getAttribBindingList, 0); diff --git a/src/osgWrappers/osg/Shader.cpp b/src/osgWrappers/osg/Shader.cpp index caac4bacd..7ed91242b 100644 --- a/src/osgWrappers/osg/Shader.cpp +++ b/src/osgWrappers/osg/Shader.cpp @@ -153,6 +153,10 @@ BEGIN_OBJECT_REFLECTOR(osg::Shader) __void__flushDeletedGlShaders__unsigned_int__double__double_R1_S, "flush all the cached glShaders which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedGlShaders, IN, unsigned int, contextID, + __void__discardDeletedGlShaders__unsigned_int_S, + "discard all the cached glShaders which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_StaticMethod1(osg::Shader::Type, getTypeId, IN, const std::string &, tname, __Shader_Type__getTypeId__C5_std_string_R1_S, "", diff --git a/src/osgWrappers/osg/Texture.cpp b/src/osgWrappers/osg/Texture.cpp index 395a87475..7cf1d9f4a 100644 --- a/src/osgWrappers/osg/Texture.cpp +++ b/src/osgWrappers/osg/Texture.cpp @@ -475,6 +475,10 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Texture) __void__flushAllDeletedTextureObjects__unsigned_int_S, "", ""); + I_StaticMethod1(void, discardAllDeletedTextureObjects, IN, unsigned int, contextID, + __void__discardAllDeletedTextureObjects__unsigned_int_S, + "", + ""); I_StaticMethod3(void, flushDeletedTextureObjects, IN, unsigned int, contextID, IN, double, currentTime, IN, double &, availableTime, __void__flushDeletedTextureObjects__unsigned_int__double__double_R1_S, "", diff --git a/src/osgWrappers/osg/VertexProgram.cpp b/src/osgWrappers/osg/VertexProgram.cpp index a55c7aa35..89f706a0a 100644 --- a/src/osgWrappers/osg/VertexProgram.cpp +++ b/src/osgWrappers/osg/VertexProgram.cpp @@ -173,6 +173,10 @@ BEGIN_OBJECT_REFLECTOR(osg::VertexProgram) __void__flushDeletedVertexProgramObjects__unsigned_int__double__double_R1_S, "Flush all the cached vertex programs which need to be deleted in the OpenGL context related to contextID. ", ""); + I_StaticMethod1(void, discardDeletedVertexProgramObjects, IN, unsigned int, contextID, + __void__discardDeletedVertexProgramObjects__unsigned_int_S, + "discard all the cached vertex programs which need to be deleted in the OpenGL context related to contextID. ", + "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. "); I_StaticMethod2(osg::VertexProgram::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized, __Extensions_P1__getExtensions__unsigned_int__bool_S, "Function to call to get the extension of a specified context. ",