[osg-users] [ShaderComposition] Redondant call to useProgram
Julien Valentin
julienvalentin51 at gmail.com
Wed Nov 8 08:00:37 PST 2017
Hi Robert,
robertosfield wrote:
> Which version of the OSG are you using?
>
I'm talking about master git (haven't check out the branch)
robertosfield wrote:
> Is the standard osgshadercomposition example generating this issue or is it modified version?
>
Yes, no mod required in the osgshadercomposition example
robertosfield wrote:
> How are you detecting up the redundant calls issue?
>
I added a test a long time ago in Program.cpp Program::apply( osg::State& state )
Code:
if( pcp != state.getLastAppliedProgramObject())
{
// for shader debugging: to minimize performance impact,
// optionally validate based on notify level.
// TODO: enable this using notify level, or perhaps its own getenv()?
if( osg::isNotifyEnabled(osg::INFO) )
pcp->validateProgram();
pcp->useProgram();
state.setLastAppliedProgramObject(pcp);
}else{
OSG_WARN<<"WARNING: redondant useProgram pcp == state.getLastAppliedProgramObject()"<<std::endl;
}
Ihaven't check but perhaps I could have false positive in case state.LastProgram not updated (perhaps it's the case but i doubt of it)...
I'll try to find a more elegant way to avoid these redondant calls but as the author, you may have a better understanding of the impl.
Cheers
robertosfield wrote:
> Hi Julien,
>
> I can't provide an answers without digging deeply in the code, this
> week I'm really busy with clients so can't look in to. Next week I'll
> be getting back to the shader_pipeline branch and better able to look
> into it.
>
> Which version of the OSG are you using? Is the standard
> osgshadercomposition example generating this issue or is it modified
> version? How are you detecting up the redundant calls issue?
>
> Robert.
>
> On 4 November 2017 at 18:03, Julien Valentin <> wrote:
>
> > 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
> >
> >
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> ------------------
> Post generated by Mail2Forum
Code:
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72338#72338
More information about the osg-users
mailing list