On top of a shader will give the following error message:
WARNING:GRAPHICS: ERROR: 0:9: '' : syntax error: #extension must always be before any non-preprocessor tokens
This is caused by Defold inserting things at the top of the shader when building.
Defold should insert these declarations after any initial # lines in the file (Typical things Defold inserts in the actual file are float precision modifiers and such).
Some special cases:
the #version token must always be on the first line of the file, so that should always be inserted at the top
If the shader itself contains a #version token on the first line then defold should not insert it's own
Defold inserts a #line token. The values used with that token should be changed depending on where in the file it is actually inserted (ie. the value should be increased for each line it is moved down from the top)
Defold inserts the "precision mediump float;" directive in the file on GLES. On desktop it should insert "#define precision //" so that user set precision directives are removed on desktop.
Adding #extension directive like:
#extension GL_EXT_shader_framebuffer_fetch : require
On top of a shader will give the following error message:
WARNING:GRAPHICS: ERROR: 0:9: '' : syntax error: #extension must always be before any non-preprocessor tokens
This is caused by Defold inserting things at the top of the shader when building. Defold should insert these declarations after any initial # lines in the file (Typical things Defold inserts in the actual file are float precision modifiers and such).
Some special cases: