Hello,
 Some small thing I'd like to say regarding that.

Not all dynamic objects must have callbacks.

One could change the objects attributes manually between calls to
frames, not using the callback mechanism, especially if the rate of
calls to frame() is significantly different from the update()
requirements for that object. At least that what I think...

So, if someone else thinks the same, it wouldn't be true to turn all
non-callbacks owners to STATIC.

Guy.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marco
Jez
Sent: Tuesday, April 01, 2008 6:58 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Performance drop &
higherRAMusageafterswitchingfrom OSG 1.2 to latest SVN

Hi Robert,

> It's a bit of long shot, but you could have a look at what the
> osgUtil::Optimizer is doing with the data, perhaps OSG-2.x is being
> more conservative with collapsing "duplicate" state.

Thanks, precious hint. I've just finished diff'ing the log messages
emitted 
by osgUtil::Optimizer, and I've found the problem: duplicate state 
attributes aren't being shared because their data variance is marked as 
UNSPECIFIED, whereas the optimizer expects it to be STATIC in order to 
perform state sharing. The UNSPECIFIED state didn't even exist in OSG
1.2. 
:-)

The obvious fix in my application is to add a STATIC_OBJECT_DETECTION
flag 
to the Optimizer, but it's not enough. It seems that 
StateSet::computeDataVariance() only changes attributes' variance from 
UNSPECIFIED to DYNAMIC if they have any callbacks; but if they have no 
callbacks, then their variance is left unchanged. Is this a bug?

In StateSet::computeDataVariance(), changing the code:

if (itr->second.first->getDataVariance()==UNSPECIFIED &&
            (itr->second.first->getUpdateCallback() || 
itr->second.first->getEventCallback()))
        {
            itr->second.first->setDataVariance(DYNAMIC);
        }

to:

if (itr->second.first->getDataVariance()==UNSPECIFIED &&
            (itr->second.first->getUpdateCallback() || 
itr->second.first->getEventCallback()))
        {
            itr->second.first->setDataVariance(DYNAMIC);
        }
        else    // <----- ADDED this block
        {
            itr->second.first->setDataVariance(STATIC);
        }

(and similarly for texture attributes) seems to bring memory usage back
to 
normal. Is this an acceptable fix?

BTW, performance is still slightly lower than expected. I think this has
to 
do with extended thread safety as you suggested, because my app is
already 
CPU-bound. Not a great issue though, at least if compared to running out
of 
memory.

Cheers,
Marco

 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to