glamor: support GLES3 shaders

Some hardware (preferably mobile) working on GLES3 way faster than
on desktop GL and supports more features. This commit will allow using
GLES3 if glamor is running over GL ES, and version 3 is supported.

Changes are the following:
1. Add compatibility layer for 120/GLES2 shaders with defines in and out
2. Switch attribute and varying to in and out in almost all shaders
   (aside gradient)
3. Add newGL-only frag_color variable, which defines as gl_FragColor on
   old pipelines
4. Switch all shaders to use frag_color.
5. Previous commit is reverted, because now we have more than one GL ES
version, previous commit used to set version 100 for all ES shaders, which
is not true for ES 3

Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
This commit is contained in:
Konstantin Pugin
2022-07-24 16:03:51 +03:00
committed by Emma Anholt
parent 8adff2891f
commit ee107cd491
15 changed files with 125 additions and 112 deletions

View File

@@ -54,6 +54,19 @@
" gl_PointSize = 1.0;\n" \
"#endif\n"
#define GLAMOR_COMPAT_DEFINES_VS \
"#define in attribute\n" \
"#define out varying\n" \
#define GLAMOR_COMPAT_DEFINES_FS \
"#if __VERSION__ < 130\n" \
"#define in varying\n" \
"#define frag_color gl_FragColor\n" \
"#define texture texture2D\n" \
"#else\n" \
"out vec4 frag_color;\n" \
"#endif\n"
#include "glyphstr.h"
#include "glamor_debug.h"