Introduced preliminary osg::deleteAllGLObjects() and osg::discardAllGLObjects() functions and associated support into Texture and BufferObjects
This commit is contained in:
@@ -238,6 +238,8 @@ class OSG_EXPORT GLBufferObject : public Referenced
|
||||
* by contextID.*/
|
||||
static void deleteBufferObject(unsigned int contextID,GLuint globj);
|
||||
|
||||
static void deleteAllBufferObjects(unsigned int contextID);
|
||||
static void discardAllBufferObjects(unsigned int contextID);
|
||||
static void flushAllDeletedBufferObjects(unsigned int contextID);
|
||||
static void discardAllDeletedBufferObjects(unsigned int contextID);
|
||||
static void flushDeletedBufferObjects(unsigned int contextID,double currentTime, double& availbleTime);
|
||||
@@ -315,7 +317,7 @@ class OSG_EXPORT GLBufferObject : public Referenced
|
||||
static void setExtensions(unsigned int contextID,Extensions* extensions);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual ~GLBufferObject();
|
||||
|
||||
unsigned int _contextID;
|
||||
@@ -351,6 +353,9 @@ class OSG_EXPORT GLBufferObjectSet : public Referenced
|
||||
GLBufferObjectSet(GLBufferObjectManager* parent, const BufferObjectProfile& profile);
|
||||
|
||||
void handlePendingOrphandedGLBufferObjects();
|
||||
|
||||
void deleteAllGLBufferObjects();
|
||||
void discardAllGLBufferObjects();
|
||||
void flushAllDeletedGLBufferObjects();
|
||||
void discardAllDeletedGLBufferObjects();
|
||||
void flushDeletedGLBufferObjects(double currentTime, double& availableTime);
|
||||
@@ -419,6 +424,9 @@ class OSG_EXPORT GLBufferObjectManager : public osg::Referenced
|
||||
GLBufferObject* generateGLBufferObject(const osg::BufferObject* bufferObject);
|
||||
|
||||
void handlePendingOrphandedGLBufferObjects();
|
||||
|
||||
void deleteAllGLBufferObjects();
|
||||
void discardAllGLBufferObjects();
|
||||
void flushAllDeletedGLBufferObjects();
|
||||
void discardAllDeletedGLBufferObjects();
|
||||
void flushDeletedGLBufferObjects(double currentTime, double& availableTime);
|
||||
|
||||
@@ -26,13 +26,24 @@ 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);
|
||||
|
||||
/** Do a GL delete all OpenGL objects.
|
||||
* Note, must be called from a thread which has current the graphics context associated with contextID. */
|
||||
extern OSG_EXPORT void deleteAllGLObjects(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
|
||||
* 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);
|
||||
|
||||
/** Discard all OpenGL objects.
|
||||
* Note, unlike deletedAllObjectObjects 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 discardAllGLObjects(unsigned int contextID);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -983,6 +983,7 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
_profile.match(target,numMipmapLevels,internalFormat,width,height,depth,border);
|
||||
}
|
||||
|
||||
|
||||
void bind();
|
||||
|
||||
inline GLenum id() const { return _id; }
|
||||
@@ -1019,6 +1020,10 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
bool _allocated;
|
||||
unsigned int _frameLastUsed;
|
||||
double _timeStamp;
|
||||
|
||||
protected:
|
||||
virtual ~TextureObject();
|
||||
|
||||
};
|
||||
|
||||
typedef std::list< ref_ptr<TextureObject> > TextureObjectList;
|
||||
@@ -1029,6 +1034,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
TextureObjectSet(TextureObjectManager* parent, const TextureProfile& profile);
|
||||
|
||||
void handlePendingOrphandedTextureObjects();
|
||||
|
||||
void deleteAllTextureObjects();
|
||||
void discardAllTextureObjects();
|
||||
void flushAllDeletedTextureObjects();
|
||||
void discardAllDeletedTextureObjects();
|
||||
void flushDeletedTextureObjects(double currentTime, double& availableTime);
|
||||
@@ -1104,6 +1112,8 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
GLsizei depth,
|
||||
GLint border);
|
||||
void handlePendingOrphandedTextureObjects();
|
||||
void deleteAllTextureObjects();
|
||||
void discardAllTextureObjects();
|
||||
void flushAllDeletedTextureObjects();
|
||||
void discardAllDeletedTextureObjects();
|
||||
void flushDeletedTextureObjects(double currentTime, double& availableTime);
|
||||
@@ -1173,12 +1183,11 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
/** Get the minimum number of display lists to retain in the deleted display list cache. */
|
||||
static unsigned int getMinimumNumberOfTextureObjectsToRetainInCache();
|
||||
|
||||
static void deleteAllTextureObjects(unsigned int contextID);
|
||||
static void discardAllTextureObjects(unsigned int contextID);
|
||||
static void flushAllDeletedTextureObjects(unsigned int contextID);
|
||||
|
||||
static void discardAllDeletedTextureObjects(unsigned int contextID);
|
||||
|
||||
static void flushDeletedTextureObjects(unsigned int contextID,double currentTime, double& availableTime);
|
||||
|
||||
static void releaseTextureObject(unsigned int contextID, TextureObject* to);
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user