[osg-users] Crash in nVidia driver : particles + dynamically adding/removing views

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Tue Nov 3 13:29:56 PST 2009


Hi all,

Some might recall, about a year ago, I identified a bug and provided 
examples for nVidia to fix a bug in their driver when adding/removing 
views (graphics contexts) at run time in a multithreaded app. That's 
been working great for a while. Now I'm getting a crash in the nvidia 
driver when adding/and removing views dynamically at run time, but only 
when the scene contains an osgParticle::PrecipitationEffect (or a 
similar effect, such as the osgOcean::SiltEffect which was derived from 
PrecipitationEffect).

I've put together an example app that demonstrates this. The code is 
attached. Note that you need to link to osg, osgDB, osgGA, osgUtil, 
osgViewer, osgText, osgParticle, and OpenThreads (as well as 
OpenGL32.lib on Windows for the straight OpenGL calls present in 
SiltEffect.cpp).

The example app can be compiled to use either 
osgParticle::PrecipitationEffect (which comes from OSG, no 
modification), osgOcean::SiltEffect (which comes from osgOcean) or no 
effect. See the #define USE_EFFECT at the top of the osgviewer.cpp file. 
Once the app is running, you can press 'a' to spawn a new view (with a 
new graphics context). Press 'a' again to remove that second view. You 
can in theory do this many times, and it should work as many times as 
you want (open, close, open, close, ...).

In my testing, the second time you spawn a new view (so pressing 'a' 3 
times total), either the app crashes or the second view starts 
displaying weirdly (all gray). The crash occurs in nvogl32.dll which is 
part of the nVidia driver. Of course, when using neither 
PrecipitationEffect nor SiltEffect, no crash occurs.

I can confirm that this occurs both on Windows (Vista 32bit, driver 
190.62) and Linux (Ubuntu 64bit, 180.44). Though on Ubuntu, the app 
crashes much less often, but the second window displays weirdly (all 
gray) which happens sometimes on Windows too as mentioned above.

Now, taking the SiltEffect for example, it seems that it's the drawing 
itself that causes problems, because commenting out the last 2 lines of 
SiltEffect::SiltDrawable::drawImplementation() (SiltEffect.cpp lines 
805-806) removes the crash (of course then the effect is not visible 
anymore).

Could someone please try this example to see if they can reproduce the 
issue?

Also, if someone could check the code I have and see if something 
obvious would cause it to crash, that would be nice. Note that 
SiltEffect is a reduced version of osgParticle::PrecipitationEffect, but 
it could be nice to test modifications in there to see if the same thing 
can be done in a different way that the driver might like better.

In the event that everything seems good on the OSG side, I'll submit the 
example to nVidia as a bug report, and see what they have to say.

Thanks in advance,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SiltEffect.zip
Type: application/x-zip-compressed
Size: 11539 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091103/82361cbb/attachment.bin>


More information about the osg-users mailing list