Is there a way to find out if a light is enabled in GLSL that doesn’t involve passing attributes or creating a ton of different shaders?
What about using NVidia’s C for Graphics (Cg)? Can I do it with Cg?
I am now convinced that you can’t do it. But now I ask: why not?
According to my understanding of “Enable or Not to Enable” part of GLSL Common Mistakes this is a philosophical reason: shaders are written to override fixed pipeline, therefore they shouldn’t rely on fixed pipeline states. You gotta use a different shader for each capability you need.
Also I guess this might be a design choice based on the fact that branches are expensive on the GPU and someone must have thought that you shouldn’t be doing things like
in the first place.