Hi Pjotr, I have just done a review of your changes and am a bit confused by them, I am also rather cold on osgFX as I neither the author or have looked at the code in a long time. osgFX is rather odd and neglected part of the OSG, the lazy initialization is down to the need for using the OpenGL feature tests to work out which technique to use, you can only do this from within a graphics context. The need for a graphics context to do the test is what complicates osgFX internals and leads to some of these problems.
Personally I'd rather move the OpenGL feature test into the compile traversal that is done prior to update, event and cull traversals, but it can still happen multi-threaded. I haven't thought enough about the specifics of osgFX of late to know what best to do, but as your submissions stands it just seems to complicate things and not really address the key design weakness of osgFX, so I'd rather resolve this weakness and sort out any threading/multi-context issues at the same time. The other alternative is simple to remove of osgFX as it's rather out of date w.r.t OpenGL features. Robert. On 13 June 2013 09:57, Pjotr Svetachov <[email protected]> wrote: > Hello, > > osgFX::Effect has lazy initialization of techniques and the techniques have > lazy initialization of passes. This all happens during node traversal. We do > parallel cull traversal with slave cameras. This causes crashes when using > osgFX effect nodes. There are two places that lead to a crash, either when > the cull traversal enters osgFX::Effect::traverse and the techniques are > flagged dirty or when the cull traversal enters > osgFX::Technique::traverse_implementation and the passes are flagged as > dirty. > > A quick fix is to use a mutex or a read-write-mutex in both methods, but > that would have performance consequences for people using a lot of effects. > The ideal solution would be to let the update traversal handle the > initialization. > > Attached is a fix for the problem. The fix makes sure that the techniques > and passes are only redefined by the update visitor. If another visitor than > the update visitor is visiting the Effect of Techniques node and they > require an update, instead of doing the update it will just flag the node to > require an update traversal. After the update visitor is done it will undo > the flag. > > Cheers, > Pjotr > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
