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.
This commit is contained in:
@@ -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.*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user