|
|
|
|
|
When shader programs are getting complex one might want to minimize redundant code by placing it into separate files. For example a lighting function can be used in multiple programs and even in different types of shaders - e.g. the fragment or vertex shader. To support this, ACGL can import shader files from within other shader files. This is done by a special pragma:
|
|
|
|
|
|
#pragma ACGLimport "filename"
|
|
|
|
|
|
In contrast to C, the imported files don't need an include guard (#ifndef / #define / #endif) and only will get included one time. Imported files can also import other files. The final shader version will be the maximum version of all imported files. Note that the parsing for this does not support explicit contexts for version, e.g. "#version 330 core" might be a problem while just "#version 330" will work fine.
|
|
|
|
|
|
Error messages will state from which included file the error was generated, for example:
|
|
|
|
|
|
Error:
|
|
|
In files:
|
|
|
1 Shader/Foo.fsh
|
|
|
2 Shader/Bar.glsl
|
|
|
1(35) : error C7011: implicit cast from "float" to "vec4"
|
|
|
|
|
|
First we see a list of files contributing to the shader and next we see the error while the first number is the file number and the second the line number. |
|
|
\ No newline at end of file |