<div dir="ltr"><div>Hi Glenn,</div><div><br></div><div>The way I'd tackle the issue of compilation of shaders taking a long time is to avoid doing it frame time, doing as much work in scene graph setup/compilation.</div><div><br></div><div>For you usage case I assume you have a complex shader with many different constant inputs either controlling code paths or values, and the scene graph is configuring these as the values change provided by the scene graph via the #PCS defines. If you can work out what range of different defines you will need then build a subgraph with each of these combinations and the sharing osg::Program that depends upon these then compile this subgraph, once it's all compiled you can discard it save for the osg::Program that you then reuse in your main application.</div><div><br></div><div>This approach should in theory populate the osg::Program with all the GLSL program combinations that you will need and the OSG can internally just use these when rendering your main scene graph.</div><div><br></div><div>Robert. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 23 Feb 2020 at 14:14, OpenSceneGraph Users <<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Robert,<div><br></div><div>I have an application with several complex shaders. According to the profiler some of them take a while to link (glLinkProgram), long enough to cause a frame drop. This app cannot tolerate any frame drops so I was looking into glProgramBinary as a possible mitigation. I'm open to other ideas of course.</div><div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div>Glenn Waldron / osgEarth</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 20, 2020 at 10:31 AM OpenSceneGraph Users <<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Glenn,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 19 Feb 2020 at 17:56, OpenSceneGraph Users <<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I was looking in the glProgramBinary support in osg::Program. I don't *think* it is integrated with your "pragmatic" define-based shader composition system. Specifically there doesn't seem to be a way to associate a ProgramBinary with a particular defineString at the PerContextProgram level.<div><br></div><div>Am I right? And if so will you consider a submission to make this work?</div></div></blockquote><div><br></div><div>When writing the #pragma(tic) shader composition functionality I was just focused on conventional GLSL compiled shaders, I didn't consider glProgramBinary, so no idea of how it might interact, I don't expect it would would work though as the main task of shader composition is compositing the shaders to compile and compiling these at runtime.</div><div><br></div><div>Is there a reason why you are trying to the the glProgramBinary path?</div><div><br></div><div>Robert.<br></div><div> </div></div></div>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div></div>