[osg-users] Performance drop & higherRAMusageafterswitchingfromOSG 1.2 to latest SVN
Marco Jez
marco.jez at gmail.com
Thu Apr 3 05:52:17 PDT 2008
Hi Robert,
I've attached a modified cow.osg from which I've removed explicit
DataVariance properties from state attributes. Just load the same model
multiple times with OSG_NOTIFY_LEVEL set to INFO, and read the optimization
report. Here are the results:
osgviewer cow_undet.osg cow_undet.osg cow_undet.osg cow_undet.osg
[OSG 2.3]
...
Optimizer::optimize() doing SHARE_DUPLICATE_STATE
Num of StateSet=4
searching for duplicate attributes
Optimizer::optimize() doing FLATTEN_STATIC_TRANSFORMS
...
...
[OSG 1.2]
...
Optimizer::optimize() doing SHARE_DUPLICATE_STATE
Num of StateSet=4
state attribute list
013DEE90 Material
013E87E0 Material
013E9898 Material
0147F510 Material
013E7F08 TexGen
013E8F10 TexGen
...
...
As you can see, current osgUtil::Optimizer fails to share duplicate state
attributes because their variance is set to UNSPECIFIED. I think the reason
why nobody noticed this behaviour before is that all .osg and .ive models
that were created with older versions of OSG have either DYNAMIC or STATIC
variance, as the UNSPECIFIED flag was introduced later.
As for what piece of code should be fixed, I think it's much a design
choice. A fundamental question is: what is the postcondition of
Object::computeDataVariance()? I find it logical to state that after
computeDataVariance() is called, the object's variance is either STATIC or
DYNAMIC. If the function doesn't find any reason why the object should be
tagged as dynamic, it should mark it as static. After all, if an object is
dynamic because the user externally modifies it, it's user's responsibility
to set its data variance accordingly.
Another concern is what an osgDB plugin should do when it reads from a
format that doesn't provide information about data variance. Since the user
receives only the root node of a scene graph that is created in an "opaque"
way, should child nodes and attributes be marked as STATIC if not explicitly
made dynamic by the plugin itself?
BTW, was the UNSPECIFIED flag really necessary? :-)
Cheers,
Marco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cow_undet.osg
Type: application/octet-stream
Size: 653653 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080403/0a37d3c0/attachment-0001.obj
More information about the osg-users
mailing list