GLSL version:
For maximum portability, provide shader code that works with oldest GLSL versions, and do not declare "#version". This means targeting ancient GLSL 1.10 version for desktop OpenGL (introduced in OpenGL 2.0) and targeting GLSL 1.00 for OpenGLES (introduced in OpenGLES 2.0). This means using "attribute", "varying" keywords, and querying the textures using "texture2D", "textureCube" and so on.
When compiling the shader on modern OpenGL or OpenGLES, we will add a modern #version statement to the shader, and define a few macros that make it use modern keywords (e.g. "attribute" will be replaced with "in" in vertex shader; "texture2D" call will be replaced with "texture"). The resulting shader will not use any deprecated features, so it should be fine for OpenGL "core" profile (without compatibility) too.
As of now, this means we bump the #version for the desktop OpenGL 3.1 core profile (if OpenGL >= 3.1) and we bump the #version for the mobile OpenGLES 3 (if OpenGLES >= 3.0).
Note: If you know you want to target only newer OpenGL(ES) versions, you can also specify #version in shader code explicitly. We will not add another #version then. It is your responsibility then to provide proper alternatives for desktop OpenGL and mobile OpenGLES, as they use similar but not exactly compatible GLSL versions.
For geometry shaders, you can assume GLSL >= 1.50 (OpenGL 3.2). We do not support geometry shaders with older versions.
Set InternalUpgradeGlslVersion to False
to test that shaders work also without it.
Upon creation, we check current OpenGL context abilities.
Currently 2 support levels are possible: no support at all (ancient OpenGL) or support built-in (newer OpenGL versions, >= 2.0). The support for shaders using ARB extensions has been removed at 2023-01, as practically no GPU had it and we didn't really test it.
Both cases are automatically handled inside, so usually you do not have to care about these details.