Search code examples
includeglsl

How do we know if we're in a vertex or a fragment shader?


We have some GLSL code in a shared file included both in vertex and fragment shaders (quite many of them). I'd like to ifdef a certain function based on whether it's included in a vertex or a fragment shader.

Is there a reserved word or a define that we can use for that?


Solution

  • No, you'll have to inject a define yourself.