Glslang shader “header” file naming conventions
Glslang shader “header” file naming conventions
For typical shader stages glslang enforces the naming conventions *.vert
, *.tesc
, *.tese
, *.geom
, *.frag
, *.comp
which let you compile your shaders to Spir-V without specifying the -S
flag.
*.vert
*.tesc
*.tese
*.geom
*.frag
*.comp
-S
However what about "header" files with common functions that you may include inside many shaders for multiple different stages using the GL_GOOGLE_include_directive
extension?
GL_GOOGLE_include_directive
Obviously people are free to name them however they want but are there some reasonable conventions that have emerged?
@Nicol Bolas Thinking about it that way you're probably right. I'm not sure how commonly used it is. I couldn't find specification either. The way I learned about it was by trying the
GL_ARB_shading_language_include
extension which didn't work and then glslang spat an error message saying that it needs GL_GOOGLE_include_directive
in order to use #include
inside my shader.– gcc-6.0
Jul 2 at 2:12
GL_ARB_shading_language_include
GL_GOOGLE_include_directive
#include
1 Answer
1
The shaderc tests for file inclusion use .glsl
as the suffix for included files, while still using .vert
, .frag
etc. for the top-level file.
.glsl
.vert
.frag
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I can't find an extension specification for that extension anywhere online. So I'm not sure how it could be widely used enough for "some reasonable conventions" to emerge.
– Nicol Bolas
Jul 2 at 2:01