Hi Glenn, I've been investigating the way that the StateVisitor handles your model and found that the reason why it isn't treating the StateAttribute/StateSet as duplicate is because it's only doing this optimization of state that is STATIC. Your CullFace object has a DataVariance of UNSPECIFIED to the code is treating it as something that might change so it not necessarily safe to optimize away.
You changes discard any check against DataVariance so are unsafe to apply, as they'd optimize away state that should be kept as-is, for instance it'd treat DYNAMIC and UNSPECIFIED state as STATIC. The question is now, should we relax the StateVisitor so that is optimizes both UNSPECIFIED and STATIC state, and my guess is that this would probably be safe to do. However, this is something that almost certainly should be controllable. Robert. On Sat, Jun 28, 2008 at 3:59 PM, Robert Osfield <[EMAIL PROTECTED]> wrote: > Hi Glenn, > > On Sat, Jun 28, 2008 at 2:45 PM, Glenn Waldron <[EMAIL PROTECTED]> wrote: >> The specific problem I'm addressing is that StateVisitor fails to collapse >> duplicate StateSets whose attributes are identical yet point to different >> physical instances. >> >> Attached is a dataset that shows the problem. The file contains exactly 2 >> StateSets, and they are identical (look under the MatrixTransform nodes). >> After stepping thought the code myself, I found that the StateVisitor does >> not consider them to be equal because the CullFace objects do not share the >> same pointer (each StateSet has its own instance). > > The StateVisitor should in theory find the duplicate CullFace first, > then change the StateSet's so that each one shares the same CullFace > instance. I'll investigate why this isn't happening in this case. > > Robert. > > > > >> Thanks again for taking a look. >> Glenn >> >> On Sat, Jun 28, 2008 at 7:48 AM, Robert Osfield <[EMAIL PROTECTED]> >> wrote: >>> >>> Hi Glenn, >>> >>> The StateVisitor has been working for quite a while, as far as I'm >>> aware has worked pretty well. >>> >>> Is there a specific problem you are addressing? If so could you >>> provide a dataset that isn't be optimized that you would expect to be >>> optimized, I can then step through the code and review it thoroghly. >>> >>> Cheers, >>> Robert. >>> >>> On Fri, Jun 27, 2008 at 9:18 PM, Glenn Waldron <[EMAIL PROTECTED]> wrote: >>> > Robert, >>> > >>> > The Optimizer::StateVisitor compares StateSet attributes for pointer >>> > equality only. This one-line change forces it to compare the attribute >>> > contents instead of just comparing their pointers, which I believe is >>> > the >>> > right approach for optimization. >>> > >>> > Glenn >>> > >>> > -- >>> > Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : >>> > 703-652-4791 >>> > _______________________________________________ >>> > osg-submissions mailing list >>> > [email protected] >>> > >>> > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org >>> > >>> > >>> _______________________________________________ >>> osg-submissions mailing list >>> [email protected] >>> >>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org >> >> >> >> -- >> Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 703-652-4791 >> _______________________________________________ >> osg-submissions mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org >> >> > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
