From 6d3a90219cbe9d98ec2270564fb31f474b9770d3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 21 Jan 2008 11:36:54 +0000 Subject: [PATCH] Removed redundental vertex buffer object flush methods --- include/osg/Drawable | 16 ----------- src/osg/BufferObject.cpp | 2 +- src/osg/Drawable.cpp | 61 +--------------------------------------- src/osg/GLObjects.cpp | 3 -- 4 files changed, 2 insertions(+), 80 deletions(-) diff --git a/include/osg/Drawable b/include/osg/Drawable index 29aaeb31a..5017519fc 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -454,22 +454,6 @@ class OSG_EXPORT Drawable : public Object * in the OpenGL context related to contextID.*/ static void flushDeletedDisplayLists(unsigned int contextID,double& availableTime); - /** Use deleteVertexBufferObject instead of glDeleteBuffers to allow - * OpenGL buffer objects to be cached until they can be deleted - * by the OpenGL context in which they were created, specified - * by contextID.*/ - static void deleteVertexBufferObject(unsigned int contextID,GLuint globj); - - /** Flush all the cached vertex buffer objects which need to be deleted - * 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/src/osg/BufferObject.cpp b/src/osg/BufferObject.cpp index 83bf19d73..be914a00d 100644 --- a/src/osg/BufferObject.cpp +++ b/src/osg/BufferObject.cpp @@ -28,7 +28,7 @@ using namespace osg; -// static cache of deleted display lists which can only +// static cache of deleted buffer object lists which can only // by completely deleted once the appropriate OpenGL context // is set. Used osg::BufferObject::deleteDisplayList(..) and flushDeletedBufferObjects(..) below. typedef std::multimap DisplayListMap; diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 3aa0fae3e..99f564a5d 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -194,70 +194,11 @@ void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availabl } elapsedTime = timer.delta_s(start_tick,timer.tick()); - // if (noDeleted) notify(NOTICE)<<"Number display lists deleted = "< lock(s_mutex_deletedVertexBufferObjectCache); - - // insert the globj into the cache for the appropriate context. - s_deletedVertexBufferObjectCache[contextID].insert(DisplayListMap::value_type(0,globj)); - } -} - -void Drawable::flushDeletedVertexBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime) -{ - // if no time available don't try to flush objects. - if (availableTime<=0.0) return; - - const osg::Timer& timer = *osg::Timer::instance(); - osg::Timer_t start_tick = timer.tick(); - double elapsedTime = 0.0; - - - { - OpenThreads::ScopedLock lock(s_mutex_deletedVertexBufferObjectCache); - - const Extensions* extensions = getExtensions(contextID,true); - - unsigned int noDeleted = 0; - - DisplayListMap& dll = s_deletedVertexBufferObjectCache[contextID]; - - DisplayListMap::iterator ditr=dll.begin(); - for(; - ditr!=dll.end() && elapsedTimeglDeleteBuffers(1,&(ditr->second)); - elapsedTime = timer.delta_s(start_tick,timer.tick()); - ++noDeleted; - } - if (ditr!=dll.begin()) dll.erase(dll.begin(),ditr); - - if (noDeleted!=0) notify(osg::INFO)<<"Number VBOs deleted = "< lock(s_mutex_deletedVertexBufferObjectCache); - DisplayListMap& dll = s_deletedVertexBufferObjectCache[contextID]; - dll.clear(); -} - - Drawable::Drawable() :Object(true) { diff --git a/src/osg/GLObjects.cpp b/src/osg/GLObjects.cpp index fdad7a953..f4c79c915 100644 --- a/src/osg/GLObjects.cpp +++ b/src/osg/GLObjects.cpp @@ -25,7 +25,6 @@ void osg::flushDeletedGLObjects(unsigned int contextID, double currentTime, doub { osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime); osg::Drawable::flushDeletedDisplayLists(contextID,availableTime); - osg::Drawable::flushDeletedVertexBufferObjects(contextID,currentTime,availableTime); osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime); osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime); osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime); @@ -42,7 +41,6 @@ void osg::flushAllDeletedGLObjects(unsigned int contextID) double availableTime = DBL_MAX; osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime); osg::Drawable::flushAllDeletedDisplayLists(contextID); - osg::Drawable::flushDeletedVertexBufferObjects(contextID,currentTime,availableTime); osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime); osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime); osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime); @@ -57,7 +55,6 @@ 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);