Compiler options and extensions in GLSL on NVidia hardware


one of the nice things about Cg is that it lets you add compiler options to your code. For example it is possible to specify if loops should be unrolled or use a data-dependent branch. Also features can be enabled or disable by targeting different profile.

GLSL on the other ahdn appears to be more criptic.
Now I have a problem with one GLSL shader doing a loop which appear to be compiled by unrolling and not brnaching.
The loop looks like
for(i = 0; i < max; i ++) { … }
and only works when max <= 8.

I would like to ensure the driver is using fragment_program_2 as well as loop branching. How can I do so in GLSL?



I think the problem is in the current drivers the nv4x functionality (branching in PS, texture lookups in VS etc.) is disabled for GLSL. You need to use a registry hack to enable it.
An easy way to do it is download glview from realtech-vr. There is a ‘registry’ page that allows you to enable the option.

I’m not sure why this is the case, but my guess is that nvidia isn’t ready for people to use nv4x functionality with GLSL quite yet.

Hope that helps.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.