With built-in culling disabled, it might be useful to have something like a read-only “bool front_facing” passed from the projection/culling stage into the fragment shader.
With ‘kill’, culling could easily be replicated in the fragment shader, so this should not be an issue.
This could be useful for
1)reducing pass count for shadow generation
2)two-sided lighting
3)other things that haven’t come to my mind yet
An alternate approach might as well be to offer two distinct fragment shaders for backfaces and frontfaces, though this would greatly complicate the hardware implementation. This could also be handled automatically by the API and wouldn’t have to be exposed to the client application.
Any thoughts?