pragmatic shaders changes?

18 views
Skip to first unread message

Trajce Nikolov NICK

unread,
May 20, 2020, 4:41:15 PM5/20/20
to osg-...@googlegroups.com
Hi Community, Robert,

I am working with the latest from the trunk and I see older coder which uses #pragmatic shaders is no longer working as it should - and it was working ok just can not recall the OSG version. Here is how I use the #pragmatic shaders:

in the shader:
#pragma import_defines (MY_DEFINE) 

#ifdef (MY_DEFINE)
....
#endif

in the code:
node->getOrCreateStateSet()->setDefine("MY_DEFINE");

This was working for years, now it doesn't. Was this changed over the past few versions?

Thanks a bunch as always!

Cheers,
Nick

--
trajce nikolov nick

OpenSceneGraph Users

unread,
May 21, 2020, 2:25:11 AM5/21/20
to OpenSceneGraph Users
Hi Nick,

#Pragmatic shader composition should be working mostly the same in master and the 3.6 branch.  I haven't seen reports of issues.

In what way doesn't you application work?  What happens if you remove the () around your #ifdef i.e. use

#ifdef MY_DEFINE
...
#endif

The OSG itself won't have any influence over this particular behavior, it just injects the #define so if the above tweak makes a difference then it'll be down to GLSL compiler in the driver changing it's behavior over time.

For debugging shaders it can be useful to enable the OSG's debug notification output.  This will include output of the shaders to the console that you can redirect to a file and then review what GLSL code the OSG is sending to the driver.

Robert.




OpenSceneGraph Users

unread,
May 21, 2020, 9:05:52 AM5/21/20
to OpenSceneGraph Users
One issue I encountered with pragmatic shader comp was related to CompileVisitor. Looks like CompileVisitor does not know much about pragmatic defines and applies Shaders without actually substituting proper values to defines. In some cases this resulted in error logs while compiling shaders. These shaders are later compiled correctly when applied in Render stage. But if someone checks logs for shader compilation results it may encounter these errors.

Cheers,
Wojtek

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

OpenSceneGraph Users

unread,
May 21, 2020, 10:08:45 AM5/21/20
to OpenSceneGraph Users
On Thu, 21 May 2020 at 14:11, OpenSceneGraph Users <osg-...@lists.openscenegraph.org> wrote:
One issue I encountered with pragmatic shader comp was related to CompileVisitor. Looks like CompileVisitor does not know much about pragmatic defines and applies Shaders without actually substituting proper values to defines. In some cases this resulted in error logs while compiling shaders. These shaders are later compiled correctly when applied in Render stage. But if someone checks logs for shader compilation results it may encounter these errors.

I've seen this problem, and I think I did some work to improve things.  It's while back though... been focused on new fangled low level graphics APIs long enough now that I have to go chasing git histories to figure out what was done when.  If my vague memory is correct there is chance that in the 3.6.x set the problem with compilation side has been improved.

As a general note, unless you really need something from the OSG master I'd stick with one of the 3.6.x stable releases.  These have all the testing done on them.  Master has lots of experiment stuff that hasn't been tested and debugged like the stable releases.


 
Reply all
Reply to author
Forward
0 new messages