[osg-users] [ShaderComposition] Redondant call to useProgram

Julien Valentin julienvalentin51 at gmail.com
Sat Nov 4 11:03:32 PDT 2017


Hi Robert,

Using the new shader composition (ex osgshadercompostion), I was surprised to detect a lot of redondant call to gluseprogram...
I debugged a few and don't understand well State::push/popDefine and its policy to invalidate defineMap (defineMap.changed = true; seams to be called at each push/pop) 
(It's difficult to interact since it' s in the header)

The problem seams here since it always tags as changed definemap (and so lead to some useless passage in State.cpp line 672


Code:
  if ((_lastAppliedProgramObject!=0) && (previousLastAppliedProgramObject==_lastAppliedProgramObject) && _defineMap.changed)
        {
            // OSG_NOTICE<<"State::apply(StateSet*) Program already applied ("<<(previousLastAppliedProgramObject==_lastAppliedProgramObject)<<") and _defineMap.changed= "<<_defineMap.changed<<std::endl;
            _lastAppliedProgramObject->getProgram()->apply(*this);
        }


 
Hoping this helps you to diagnose the problem :/

Thank you!

Cheers,
Julien

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72306#72306







More information about the osg-users mailing list