All,
I have narrowed it down to two locations where the use of a mutex will fix multi threading issues on OS X. I have attached both the patch file from the latest CVS and submitted the complete updated files to the submissions list.

For some reason the call to GL2Extensions::Get() needed to be protected by a mutex. I do not yet understand why the original code worked on Linux in the first place.

#0  0x00289990 in osg::GL2Extensions::Get ()
#1  0x00289ff4 in osg::Program::flushDeletedGlPrograms ()


Dan

Index: src/osg/Program.cpp
===================================================================
RCS file: /cvs/osg/OpenSceneGraph/src/osg/Program.cpp,v
retrieving revision 1.21
diff -r1.21 Program.cpp
1895a1896
> OpenThreads::ScopedLock<OpenThreads::Mutex> lock (s_mutex_deletedGlProgramCache);
1904d1904
< OpenThreads::ScopedLock<OpenThreads::Mutex> lock (s_mutex_deletedGlProgramCache);
Index: src/osg/Texture.cpp
===================================================================
RCS file: /cvs/osg/OpenSceneGraph/src/osg/Texture.cpp,v
retrieving revision 1.131
diff -r1.131 Texture.cpp
1307a1308
> OpenThreads::ScopedLock<OpenThreads::Mutex> lock (getTextureObjectManager()->_mutex);


On Jul 25, 2006, at 10:17 AM, Robert Osfield wrote:

Hi Daniel,

Could you try:

setenv OSG_CAMERA_THREADING=SingleThreaded

Then run your app and see how it behaves.

Robert.

On 7/25/06, Daniel Larimer <[EMAIL PROTECTED]> wrote:
I am using the default build of OSG 1.1 (I believe it is AGL), but
the problem existed in earlier builds.

This crash does not show up on our Dual Core x86-64 systems.

If you place a mutex inside SceneView::flushAllDeletedGLObjects() and
SceneView::flushDeletedGLObjects(time) then
you can eliminate the crash enough to view the cow model; however,
when running different data sets I get a crash here:

Thread 7 Crashed:
0 libosg.dylib 0x0043bffc osg::Drawable::getExtensions
(unsigned, bool) + 940
1   libosg.dylib                0x0044eb30
osg::Geometry::drawImplementation(osg::State&) const + 96
2 libosgUtil.dylib 0x0103ebdc osgUtil::RenderLeaf::render
(osg::State&, osgUtil::RenderLeaf*) + 3580
3   libosgUtil.dylib            0x01038e0c
osgUtil::RenderBin::drawImplementation(osg::State&,
osgUtil::RenderLeaf*&) + 380
4   libosgUtil.dylib            0x01047a00
osgUtil::RenderStage::drawImplementation(osg::State&,
osgUtil::RenderLeaf*&) + 1056
5   libosgUtil.dylib            0x01047af4
osgUtil::RenderStage::drawInner(osg::State&, osgUtil::RenderLeaf*&,
bool&) + 212
6   libosgUtil.dylib            0x010474e4 osgUtil::RenderStage::draw
(osg::State&, osgUtil::RenderLeaf*&) + 964
7 libosgUtil.dylib 0x0105d14c osgUtil::SceneView::draw () +
12924
8 libcove.1.dylib 0x02044fd0 Cove::OsgSceneHandler::draw
(Cove::Camera const*) const + 172 (OsgSceneHandler.cpp:134)
9 libcove.1.dylib 0x02017d80 Cove::Camera::draw() const +
392 (Camera.cpp:185)
10  libcove.1.dylib             0x0203fbcc Cove::GLWidget::frame
(Cove::FrameState const*) + 372 (GLWidget.cpp:132)
11 libcove.1.dylib 0x0202d7a8 Cove::ContextThread::run () +
360 (ContextThread.cpp:158)
12 QtCore 0x0a1d57ec QThreadPrivate::start (void*)
+ 228
13  libSystem.B.dylib           0x9002bc28 _pthread_body + 96

This crash does not happen on Linux / X11.


Dan

On Jul 25, 2006, at 2:39 AM, Robert Osfield wrote:

> Hi Daniel,
>
> Which version of the OSG are you using?
>
> On 7/24/06, Daniel Larimer <[EMAIL PROTECTED]> wrote:
>>         When I run osgviewer cow.osg
>>
>>         I get the following crash (Thread 1) in
>> flushDeletedGlPrograms().
>>
>> I am running on a Quad G5 with a 7800GT with dual displays.
>
> Are you running X11, AGL, CGL?
>
>>         Is the a bug tracking system in place for OSG?  I have
>> looked all
>> over the website and found only this mailing list.
>
> Bug reporting is done via this mailing list - air all your dirty
> laundry in public and you have great incentive for fixing it pronto
> ;-)
>
> BTW, I now work day in day out on dual core, dual graphics card
> system, so am testing the multi-thread usage all the time.
>
> Unfortunately I don't have a G5 to test against, so I'll have to defer
> to others to help out in reproducing the problem.
>
> If you have just one graphics card then ideally for performance we
> should be just using a single graphics context (since there is only
> one graphics card to process all the data). AGL/CGL make this really > awkward when full screen, as it forces two seperated contexts. Under > X11 its easier it should just create a single graphics context across
> both screens.
>
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to