Hi Dario,

On 12 April 2016 at 09:58, Dario Minieri <[email protected]> wrote:

> Simple question: set a uniform value via set() method is thread-safe or we
> have to set the value via Uniform callback? Apparently, set() works fine,
> but thread interactions are devious :D
>

osg::Uniform::set() is not thread safe.  However, whether this is a problem
for your usage model is not something I can say without more knowledge of
your usage model.

Updating via an update callback doesn't add thread safety by itself.  If
you are using DrawThreadPerContext or
CullThreadPerCameraDrawThreadPerContext then the draw thread is allowed to
run at the same time as the update, event and cull traversals of the next
frame.  If you update the state or geometry in this case you need to to set
the StateSet/Geometry DataVariance to DYNAMIC to prevent the draw thread
from reading and the same time as it's being written.  This does however
reduce the amount of the time the the draw thread can run in parallel with
the update, event and cull traversals, in particular if the dynamic objects
are in an opaque bin.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to