<div dir="ltr"><div>Hi Robert,</div><div><br></div><div>That was the right hint and I must admit that I always forget it :-). Setting the datavaraiance to osg::Object::DYNAMIC fixed the crash! As for the other hints re performance, this is for sort of DEBUG mode for the sim so we are ok, but thanks for these as well!<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 12, 2018 at 4:09 PM Robert Osfield <<a href="mailto:robert.osfield@gmail.com">robert.osfield@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nick,<br>
<br>
There are plenty of ways mutlti-thread setting of Text labels could<br>
cause problems if the threads reading from the Text are running in<br>
parallel to the ones setting it. A mutex "might" help but it could<br>
easily be done in the wrong way. If you are modifying text<br>
dynamically then you should set the DataVariance to DYNAMIC. However,<br>
adding mutex and using DataVariance of DYNAMIC might protect things if<br>
you do it all right but performance issues can easily become dominant<br>
as it can easily stall the various threads.<br>
<br>
It may be that trying to dynamically update Text is simply the wrong<br>
solution for your application. It might be that writing your own<br>
custom shader to implement text is the better thing to do.<br>
<br>
Robert.<br>
<br>
<br>
<br>
<br>
On Wed, 12 Sep 2018 at 13:24, Trajce Nikolov NICK<br>
<<a href="mailto:trajce.nikolov.nick@gmail.com" target="_blank">trajce.nikolov.nick@gmail.com</a>> wrote:<br>
><br>
> Hi Robert,<br>
><br>
> we are experiencing some crashes in our sim software. And I know you will not like this post since I can not produce minimal case exercising this issue - I tried to mimic the sim code into one simple app but in this minimal app all works just great. So I will try to explain and count on you with hints<br>
><br>
> The environment is multithreaded:<br>
> - high res thread updating labels guarded by mutex<br>
> - the osg threads with update callbacks on osgText::Text that is setting the labels with setText(...) guarded by mutex<br>
><br>
> The env is XUbuntu 18, NVIDIA GTX 1080<br>
><br>
> And the crash happens at<br>
> Text::drawImplementationSinglePass ln: 1151 glyphquad._primitives->draw(state, usingVertexBufferObjects);<br>
><br>
> which furthers<br>
><br>
> DrawElementsUShort::draw ln: 266<br>
><br>
> if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);<br>
> else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));<br>
><br>
> _numInstances is 0 when the crash happens so the crash happens here:<br>
><br>
> glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));<br>
><br>
> Any clue or at least a thought when this can happen? Mean while I will continue testing and will really try again to make a small app reproducing this behavior<br>
><br>
> Thanks a bunch as always!<br>
><br>
> Cheers,<br>
> Nick<br>
><br>
> --<br>
> trajce nikolov nick<br>
> _______________________________________________<br>
> osg-users mailing list<br>
> <a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">trajce nikolov nick<br></div>