[osg-submissions] Reuse of context IDs and cleanup of OpenGL resources.
Robert Osfield
robert.osfield at gmail.com
Tue Apr 15 11:30:49 PDT 2008
Hi Mark,
Your test program is a pretty esoteric forcing of an error, akin to tricking
the osgViewer into not doing the right thing. The problem is simply fixed
by doing a releaseGLObjects() on those objects that you've hidden from the
viewer. I'm not convinced we need a more elaborate system just to catch
this rather unusual usage model.
Robert.
On Tue, Apr 15, 2008 at 6:31 PM, Mark Sciabica <msciabica at itracs.com> wrote:
> Hi Robert,
>
> Running my test program against the 2.3.7 developer release exhibits the
> same errors as 2.2.0. Textures and display lists are not being regenerated
> when a new context reuses a contextID, unless those objects are under one of
> the Context's cameras when the context is destroyed.
>
> Mark
>
> Robert Osfield wrote:
>
> Hi Mark,
>
> The SVN version of OSG has extra support for deleting and discarding GL
> object ID's. I believe this will probably address the problems you've seen.
>
> Could you move to OSG-2.3.7 or OSG-SVN to see if the problem is addressed.
>
> Robert.
>
> On Mon, Apr 14, 2008 at 9:55 PM, Mark Sciabica <msciabica at itracs.com>
> wrote:
>
> > These changes are a fix for the bug reported here:
> >
> >
> > http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-January/006048.html
> >
> >
> >
> > Briefly, the bug is that objects that allocate OpenGL resources (e.g.
> > textures or display lists) for a given contextID believe those objects are
> > still valid even after the contextID becomes invalid and then reused by
> > another context.
> >
> >
> >
> > A source file is attached that reproduces the bug for display lists,
> > textures, and fonts. Other resource types have not been tested, although
> > code has been added to clean up all types that currently clean up their
> > deleted items caches in the GraphicsContext::close function.
> >
> >
> >
> > The modifications were made against the 2.2.0 branch.
> >
> >
> >
> > Summary of changes.
> >
> >
> >
> > 1. ContextData now has a list of objects using OpenGL resources for its
> > contextID.
> >
> >
> >
> > 2. Objects using OpenGL resources now add themselves to the above list
> > when they allocate such a resource, and remove themselves when they
> > deallocate it.
> >
> >
> >
> > 3. GraphicsContext::close deallocates the registered resources if no
> > other contexts are using its contextID. Calling releaseGLObjects on the
> > camera now seems redundant so was removed. (Exception: if the _state member
> > of the GraphicsContext is NULL (which it is when close() is called more than
> > once(and it is)) then the camera will have its GLObjects released in ALL
> > contexts. This seems incorrect as it needlessly releases objects in
> > unrelated contexts.)
> >
> >
> >
> > 4. ContextData was made an Observer of the objects in its list to avoid
> > dereferencing invalid pointers if those objects are destroyed without
> > deallocating their resources.
> >
> >
> >
> > 5. Static functions that allocate resources and manage a cache of
> > deleted objects were made nonstatic so they could register the object with
> > the context at the time the resource was allocated. They assume the object
> > they're called against is the object owning the resource. These functions
> > have also been made protected to help enforce this.
> >
> >
> >
> >
> >
> > Regards,
> >
> >
> >
> > Mark
> >
> > _______________________________________________
> > osg-submissions mailing list
> > osg-submissions at lists.openscenegraph.org
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> >
> >
> ------------------------------
>
> _______________________________________________
> osg-submissions mailing listosg-submissions at lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
>
> _______________________________________________
> osg-submissions mailing list
> osg-submissions at lists.openscenegraph.org
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080415/fb98f3d0/attachment-0001.htm
More information about the osg-submissions
mailing list