[osg-users] Inherit parts of shader program

Robert Osfield robert.osfield at gmail.com
Sun Sep 4 04:50:44 PDT 2016


HI Ravi,

No matter what approach you take there will be separate OpenGL program
object built and need to be bound. You can do this explicitly by
creating your own osg::Program and assigning them to the scene graph
or have this done implicitly by the OSG's backend by the utilising the
#pragmatic shader composition.  The later approach adds convenience if
you have dozens of different possible shader combinations but adds a
small CPU overhead in maintaining which GL program objects to apply.

Sharing osg::Shader between osg::Program won't add any significant
performance gain, just avoid a bit of shader compilation during the
compilation phase of the scene graph at application start up.

In general I'd recommend going for a solution that is simple to manage
in your application and then do benchmarking to see if you've got the
performance you need for your application, if you have job done, if
not start looking at where the bottlenecks are.

Robert.

On 4 September 2016 at 02:14, Ravi Mathur <ravidavi at utexas.edu> wrote:
> Thank you Robert! Can you speak to the performance of using multiple osg::Programs vs shader composition?
>
> Another question: suppose I use a separate osg::Program for each osg::Drawable. Each Program would use the same Vertex osg::Shader object, but have its own Fragment osg::Shader object. This is the straightforward answer you mentioned. In this case, do you know if there's any performance benefit to sharing an osg::Shader object among multiple osg::Program objects? Or is it the same (performance-wise) as having separate Vertex & Fragment osg::Shader objects for each osg::Program?
>
> Thanks!
> Ravi
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68511#68511
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list