1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
#ifndef _FX_SHADERS_H
#define _FX_SHADERS_H
#include <GLES2/gl2.h>
#include <stdbool.h>
struct fx_renderer;
GLuint compile_shader(GLuint type, const GLchar *src);
GLuint link_program(const GLchar *frag_src);
bool check_gl_ext(const char *exts, const char *ext);
void load_gl_proc(void *proc_ptr, const char *name);
enum fx_tex_shader_source {
SHADER_SOURCE_TEXTURE_RGBA = 1,
SHADER_SOURCE_TEXTURE_RGBX = 2,
SHADER_SOURCE_TEXTURE_EXTERNAL = 3,
};
enum fx_rounded_quad_shader_source {
SHADER_SOURCE_QUAD_ROUND = 1,
SHADER_SOURCE_QUAD_ROUND_TOP_LEFT = 2,
SHADER_SOURCE_QUAD_ROUND_TOP_RIGHT = 3,
SHADER_SOURCE_QUAD_ROUND_BOTTOM_RIGHT = 4,
SHADER_SOURCE_QUAD_ROUND_BOTTOM_LEFT = 5,
};
struct quad_shader {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
};
bool link_quad_program(struct quad_shader *shader);
struct quad_round_shader {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
GLint size;
GLint position;
GLint radius;
};
bool link_quad_round_program(struct quad_round_shader *shader, enum fx_rounded_quad_shader_source source);
struct tex_shader {
GLuint program;
GLint proj;
GLint tex_proj;
GLint tex;
GLint alpha;
GLint pos_attrib;
GLint size;
GLint position;
GLint radius;
GLint has_titlebar;
GLint discard_transparent;
GLint dim;
GLint dim_color;
};
bool link_tex_program(struct tex_shader *shader, enum fx_tex_shader_source source);
struct rounded_border_corner_shader {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
GLint is_top_left;
GLint is_top_right;
GLint is_bottom_left;
GLint is_bottom_right;
GLint position;
GLint radius;
GLint half_size;
GLint half_thickness;
};
bool link_rounded_border_corner_program(struct rounded_border_corner_shader *shader);
struct stencil_mask_shader {
GLuint program;
GLint proj;
GLint pos_attrib;
GLint half_size;
GLint position;
GLint radius;
};
bool link_stencil_mask_program(struct stencil_mask_shader *shader);
struct box_shadow_shader {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
GLint position;
GLint size;
GLint blur_sigma;
GLint corner_radius;
};
bool link_box_shadow_program(struct box_shadow_shader *shader);
struct blur_shader {
GLuint program;
GLint proj;
GLint tex_proj;
GLint tex;
GLint pos_attrib;
GLint radius;
GLint halfpixel;
};
bool link_blur1_program(struct blur_shader *shader);
bool link_blur2_program(struct blur_shader *shader);
struct blur_effects_shader {
GLuint program;
GLint proj;
GLint tex_proj;
GLint tex;
GLint pos_attrib;
GLfloat noise;
GLfloat brightness;
GLfloat contrast;
GLfloat saturation;
};
bool link_blur_effects_program(struct blur_effects_shader *shader);
#endif
|