Built-in macros



SYNTHCLIPSE_ONLY

SYNTHCLIPSE_ONLY macro definition is always automatically added to all shaders before build (on the top of the shader). It is just an empty definition:

#define SYNTHCLIPSE_ONLY

(This shader addition can be verified in Code Preview View).

It can be used to turn on/off some code only when run shaders in Synthclipse. It also might be used to remap some names of uniform variables or functions, for example:

#ifdef SYNTHCLIPSE_ONLY 
#define kore main
#define MyProjectionMatrix synth_ProjectionMatrix
#endif

uniform mat4 MyProjectionMatrix;

/**
 * kore() function is the main entry point of a shder used in the Kha framework
 * https://github.com/KTXSoftware/Kha/wiki
 */
void kore() {
        ...
}

SYNTHCLIPSE

SYNTHCLIPE macro is a macro defined only in a project settings. It is NOT passed to a shader. It might be used only to fool Eclipse C++ editor.

Synthclipse is using C++ editor for editing GLSL code to get great, fully featured tool for free, but the flaw of this is that some valid GLSL constructions, like for example Uniform Blocks, are not recognized as correct syntax. To get rid of red error highlights in Eclipse editor one might use a workaround:

// A valid GLSL Uniform Block. Not correct in Eclipse C++ editor:

in {
    vec3 N;
    vec3 L;
    vec3 V;
} fs_in;

// A valid GLSL Uniform Block. Workaround, correct in Eclipse C++ editor:

#ifdef SYNTHCLIPSE
// this won't be included in the final shader
#define VS_IN struct
#endif

in VS_IN {
    vec3 N;
    vec3 L;
    vec3 V;
} fs_in;

IMPORTANT: Errors in the editor don't necessery mean that you cannot run the shader. You don't need to do such workarounds if you are OK with red highlights of the code.