@Raziel
Quote:
Are shaders usable like c/c++ source files
Yes and no
In the context of the shader language GLSL and when looking at the .fragment / .vertex files, then yes, those are very much like C source files and when they are compiled they will also run through a C-like pre-processor with ifdef support.
However, in the context of this ScummVM source pile, they are not precompiled when you do a "make" but are loaded and compiled during runtime, so in this case they are just text assets which end up in some char array.
Quote:
so f.e. could I ifdef those changes for amigaos4
Right now this means:
no, you cannot place sth. like #ifdef __amigaos4__ or whatever inside such a shader and expect it to work. While the GLSL (pre)compiler understands #ifdef, it doesn't have anything like __amigaos4__ predefined, your #ifdef __amigaos4__ would always evaluate to #if 0 and the enclosed block will be ignored.
Quote:
or do I have to apply them every time I compile a new build?
I don't get that. You only have to make sure that you change the shader files in the way I explained before.
Anyway, if you want you can change ScummVM to support your "#ifdef __amigaos4__" from inside those shader files:
1. open the file "graphics/opengl/compat_shaders.cpp"
2. locate lines 30 and 44
3. right below those lines insert the following (and don't forget the " and the \n):
#ifdef __amigaos4__
"#define __amigaos4__\n"
#endif
so that you end up with
const char *compatVertex =
#ifdef __amigaos4__
"#define __amigaos4__\n"
#endif
"#if defined(GL_ES)\n"
...
const char *compatFragment =
#ifdef __amigaos4__
"#define __amigaos4__\n"
#endif
"#if defined(GL_ES)\n"
...
Now something like #ifdef __amigaos4__ will work from inside the #?.fragment and #?.vertex files (as always: untested. I chose __amigaos4__ because it's being used in the ScummVM sources).