diff --git a/src/content/docs/current/Reference/Miscellaneous/debugging_shaders.mdx b/src/content/docs/current/Reference/Miscellaneous/debugging_shaders.mdx index 3c3dbbe..88182e3 100644 --- a/src/content/docs/current/Reference/Miscellaneous/debugging_shaders.mdx +++ b/src/content/docs/current/Reference/Miscellaneous/debugging_shaders.mdx @@ -14,7 +14,7 @@ The 'Use no error context' setting will prevent the game from loading on some AM ::: # Finding Compilation Errors -Iris does not have proper support for line numbers in error messages. Line numbers in error messages correspond to the patched version of your shader code, which will not necessarily line up with the line numbers in your original code, especially if you have made use of the `#include` directive. The patched shader output can be found in the `.minecraft/patched_shaders`. Here's an example. +Iris does not have proper support for line numbers in error messages. Line numbers in error messages correspond to the patched version of your shader code, which will not necessarily line up with the line numbers in your original code, especially if you have made use of [the `#include` directive](../include). The patched shader output can be found in the `.minecraft/patched_shaders`. Here's an example. ![`deferred2.fsh: ERROR: 0:336: 'something' : undeclared identifier`](../../../../../assets/debugging/compilationerror.webp) In this error message, we can see that the error occurs on line 336 of `deferred2.fsh`. diff --git a/src/content/docs/current/Reference/Miscellaneous/include.mdx b/src/content/docs/current/Reference/Miscellaneous/include.mdx new file mode 100644 index 0000000..896958e --- /dev/null +++ b/src/content/docs/current/Reference/Miscellaneous/include.mdx @@ -0,0 +1,20 @@ +--- +title: include +description: Allows the shader to be split across multiple files +sidebar: + label: include + order: 2 +--- + +### `#include ""` + +This preprocessor directive is replaced with the contents of the included file. + +Absolute imports have a leading slash, and are treated as relative to the top-level `shaders/` folder. + +Relative imports lack a leading slash, and are treated as relative to the current file. + +```glsl title="shaders/overworld/foo" +#include "/bar" // includes shaders/bar +#include "bar" // includes shaders/overworld/bar +```