Hi Paul,

>From the sounds of it your have uncovered two unrelated bugs in
Optimizer and it'd be appropriate to fix both.  With a quick read
through your email I can't pinpoint what code is amiss and what to
mix. Would it be possible to create a non proprietary dataset that
reproduces this problem?

Robert.

On Mon, Jan 25, 2010 at 6:54 PM, Paul Martz <[email protected]> wrote:
> Hi Robert -- I'm seeing a crash in the Optimizer with a large proprietary
> model, and would greatly appreciate your input on a fix.
>
> The crash is in MergeGeodes in both 2.8.2 and svn trunk head. I can
> reproduce the problem with:
>
>  export OSG_OPTIMIZER=FLATTEN_STATIC_TRANSFORMS|MERGE_GEODES
>  osgconv largemodel.ive out.ive
>
> But if I remove the FLATTEN_STATIC_TRANSFORMS and use only MERGE_GEODES,
> there is no crash. Something about FLATTEN_STATIC_TRANSFORMS is causing
> MERGE_GEODES to crash.
>
> Here's what I know so far:
>
> When OSG crashes, we're at Optimizer.cpp line 3079:
>  bool Optimizer::MergeGeodesVisitor::mergeGeode(osg::Geode& lhs, osg::Geode&
> rhs)
>  {
>      for (unsigned int i=0; i<rhs.getNumDrawables(); ++i)
>      {
> -->       lhs.addDrawable(rhs.getDrawable(i));
>      }
>
>      return true;
>  }
> The mergeGeodes function has been passed lhs and rhs which are unfortunately
> the same Geode. This is causing an infinite loop of addDrawable calls, until
> std::vector eventually throws an exception.
>
> The structure of the subgraph at this point is a Group with two Geode
> children, but they are both the same Geode. FLATTEN_STATIC_TRANSFORMS is
> somehow creating this subgraph, because (as I noted above) the crash goes
> away if I don't set FLATTEN_STATIC_TRANSFORMS.
>
> MERGE_GEODES already has a mechanism for detecting duplicate Geodes, in the
> function mergeGeodes(osg::Group& group). But it is not detecting the same
> Geode added twice to a single Group parent.
>
> So I'd like your advice on the fix.
>
> It might be a mistake to add the same Geode twice to a parent, but I don't
> believe there's anything in addChild to prevent this, so it'd be nice if
> MERGE_GEODES would detect this condition and handle it gracefully, print out
> a warning or something, but should not crash. So I could modify the existing
> duplicate Geode check to look for and handle this case. Do you agree?
>
> Alternatively, or in addition, I could dig into the FLATTEN_STATIC_TRANSFORM
> code and try to figure out how this subgraph is being created in the first
> place. Then, when I have more info, we could discuss a possible fix for
> FLATTEN_STATIC_TRANSFORMS. (Breaking for lunch right now, will dig in this
> afternoon.)
>
> Thoughts? Thanks for your time on this.
>   -Paul
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to