diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/modules/engines/gl_common/evas_gl_common.h | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/modules/engines/gl_common/evas_gl_common.h')
-rw-r--r-- | libraries/evas/src/modules/engines/gl_common/evas_gl_common.h | 659 |
1 files changed, 659 insertions, 0 deletions
diff --git a/libraries/evas/src/modules/engines/gl_common/evas_gl_common.h b/libraries/evas/src/modules/engines/gl_common/evas_gl_common.h new file mode 100644 index 0000000..a088748 --- /dev/null +++ b/libraries/evas/src/modules/engines/gl_common/evas_gl_common.h | |||
@@ -0,0 +1,659 @@ | |||
1 | #ifndef EVAS_GL_COMMON_H | ||
2 | #define EVAS_GL_COMMON_H | ||
3 | |||
4 | #include "evas_common.h" | ||
5 | #include "evas_private.h" | ||
6 | #include "config.h" | ||
7 | |||
8 | #include <stdio.h> | ||
9 | #include <stdlib.h> | ||
10 | #include <string.h> | ||
11 | #include <math.h> | ||
12 | #include <sys/time.h> | ||
13 | #include <unistd.h> | ||
14 | #include <Eet.h> | ||
15 | |||
16 | #define GL_GLEXT_PROTOTYPES | ||
17 | |||
18 | #ifdef BUILD_ENGINE_GL_QUARTZ | ||
19 | # include <OpenGL/gl.h> | ||
20 | # include <OpenGL/glext.h> | ||
21 | #else | ||
22 | # ifdef _EVAS_ENGINE_SDL_H | ||
23 | # if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX) | ||
24 | # include <SDL/SDL_opengles.h> | ||
25 | # else | ||
26 | # include <SDL/SDL_opengl.h> | ||
27 | # endif | ||
28 | # else | ||
29 | # if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) | ||
30 | # if defined(GLES_VARIETY_S3C6410) | ||
31 | # include <GLES2/gl2.h> | ||
32 | # elif defined(GLES_VARIETY_SGX) | ||
33 | # include <GLES2/gl2.h> | ||
34 | # include <GLES2/gl2ext.h> | ||
35 | # endif | ||
36 | # else | ||
37 | # include <GL/gl.h> | ||
38 | # include <GL/glext.h> | ||
39 | # endif | ||
40 | # endif | ||
41 | #endif | ||
42 | |||
43 | #ifndef GL_TEXTURE_RECTANGLE_NV | ||
44 | # define GL_TEXTURE_RECTANGLE_NV 0x84F5 | ||
45 | #endif | ||
46 | #ifndef GL_BGRA | ||
47 | # define GL_BGRA 0x80E1 | ||
48 | #endif | ||
49 | |||
50 | #ifndef EGL_NO_CONTEXT | ||
51 | # define EGL_NO_CONTEXT 0 | ||
52 | #endif | ||
53 | #ifndef EGL_NONE | ||
54 | # define EGL_NONE 0x3038 | ||
55 | #endif | ||
56 | #ifndef EGL_TRUE | ||
57 | # define EGL_TRUE 1 | ||
58 | #endif | ||
59 | #ifndef EGL_FALSE | ||
60 | # define EGL_FALSE 0 | ||
61 | #endif | ||
62 | |||
63 | #ifndef EGL_MAP_GL_TEXTURE_2D_SEC | ||
64 | # define EGL_MAP_GL_TEXTURE_2D_SEC 0x3201 | ||
65 | #endif | ||
66 | #ifndef EGL_MAP_GL_TEXTURE_HEIGHT_SEC | ||
67 | # define EGL_MAP_GL_TEXTURE_HEIGHT_SEC 0x3202 | ||
68 | #endif | ||
69 | #ifndef EGL_MAP_GL_TEXTURE_WIDTH_SEC | ||
70 | # define EGL_MAP_GL_TEXTURE_WIDTH_SEC 0x3203 | ||
71 | #endif | ||
72 | #ifndef EGL_MAP_GL_TEXTURE_FORMAT_SEC | ||
73 | # define EGL_MAP_GL_TEXTURE_FORMAT_SEC 0x3204 | ||
74 | #endif | ||
75 | #ifndef EGL_MAP_GL_TEXTURE_RGB_SEC | ||
76 | # define EGL_MAP_GL_TEXTURE_RGB_SEC 0x3205 | ||
77 | #endif | ||
78 | #ifndef EGL_MAP_GL_TEXTURE_RGBA_SEC | ||
79 | # define EGL_MAP_GL_TEXTURE_RGBA_SEC 0x3206 | ||
80 | #endif | ||
81 | #ifndef EGL_MAP_GL_TEXTURE_BGRA_SEC | ||
82 | # define EGL_MAP_GL_TEXTURE_BGRA_SEC 0x3207 | ||
83 | #endif | ||
84 | #ifndef EGL_MAP_GL_TEXTURE_LUMINANCE_SEC | ||
85 | # define EGL_MAP_GL_TEXTURE_LUMINANCE_SEC 0x3208 | ||
86 | #endif | ||
87 | #ifndef EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC | ||
88 | # define EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC 0x3209 | ||
89 | #endif | ||
90 | #ifndef EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC | ||
91 | # define EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC 0x320a | ||
92 | #endif | ||
93 | #ifndef EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC | ||
94 | # define EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC 0x320b | ||
95 | #endif | ||
96 | #ifndef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC | ||
97 | # define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x320c | ||
98 | #endif | ||
99 | #ifndef GL_PROGRAM_BINARY_LENGTH | ||
100 | # define GL_PROGRAM_BINARY_LENGTH 0x8741 | ||
101 | #endif | ||
102 | #ifndef GL_NUM_PROGRAM_BINARY_FORMATS | ||
103 | # define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE | ||
104 | #endif | ||
105 | #ifndef GL_PROGRAM_BINARY_FORMATS | ||
106 | # define GL_PROGRAM_BINARY_FORMATS 0x87FF | ||
107 | #endif | ||
108 | #ifndef GL_PROGRAM_BINARY_RETRIEVABLE_HINT | ||
109 | # define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 | ||
110 | #endif | ||
111 | |||
112 | #define SHAD_VERTEX 0 | ||
113 | #define SHAD_COLOR 1 | ||
114 | #define SHAD_TEXUV 2 | ||
115 | #define SHAD_TEXUV2 3 | ||
116 | #define SHAD_TEXUV3 4 | ||
117 | #define SHAD_TEXM 5 | ||
118 | |||
119 | typedef struct _Evas_GL_Program Evas_GL_Program; | ||
120 | typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source; | ||
121 | typedef struct _Evas_GL_Shared Evas_GL_Shared; | ||
122 | typedef struct _Evas_Engine_GL_Context Evas_Engine_GL_Context; | ||
123 | typedef struct _Evas_GL_Texture_Pool Evas_GL_Texture_Pool; | ||
124 | typedef struct _Evas_GL_Texture Evas_GL_Texture; | ||
125 | typedef struct _Evas_GL_Image Evas_GL_Image; | ||
126 | typedef struct _Evas_GL_Font_Texture Evas_GL_Font_Texture; | ||
127 | typedef struct _Evas_GL_Polygon Evas_GL_Polygon; | ||
128 | typedef struct _Evas_GL_Polygon_Point Evas_GL_Polygon_Point; | ||
129 | |||
130 | typedef enum { | ||
131 | SHADER_RECT, | ||
132 | SHADER_FONT, | ||
133 | SHADER_IMG, | ||
134 | SHADER_IMG_NOMUL, | ||
135 | SHADER_IMG_BGRA, | ||
136 | SHADER_IMG_BGRA_NOMUL, | ||
137 | SHADER_IMG_MASK, | ||
138 | SHADER_YUV, | ||
139 | SHADER_YUV_NOMUL, | ||
140 | SHADER_YUY2, | ||
141 | SHADER_YUY2_NOMUL, | ||
142 | SHADER_NV12, | ||
143 | SHADER_NV12_NOMUL, | ||
144 | SHADER_TEX, | ||
145 | SHADER_TEX_NOMUL, | ||
146 | SHADER_FILTER_INVERT, | ||
147 | SHADER_FILTER_INVERT_NOMUL, | ||
148 | SHADER_FILTER_INVERT_BGRA, | ||
149 | SHADER_FILTER_INVERT_BGRA_NOMUL, | ||
150 | SHADER_FILTER_GREYSCALE, | ||
151 | SHADER_FILTER_GREYSCALE_NOMUL, | ||
152 | SHADER_FILTER_GREYSCALE_BGRA, | ||
153 | SHADER_FILTER_GREYSCALE_BGRA_NOMUL, | ||
154 | SHADER_FILTER_SEPIA, | ||
155 | SHADER_FILTER_SEPIA_NOMUL, | ||
156 | SHADER_FILTER_SEPIA_BGRA, | ||
157 | SHADER_FILTER_SEPIA_BGRA_NOMUL, | ||
158 | /* SHADER_FILTER_BLUR, */ | ||
159 | /* SHADER_FILTER_BLUR_NOMUL, */ | ||
160 | /* SHADER_FILTER_BLUR_BGRA, */ | ||
161 | /* SHADER_FILTER_BLUR_BGRA_NOMUL, */ | ||
162 | SHADER_LAST | ||
163 | } Evas_GL_Shader; | ||
164 | |||
165 | struct _Evas_GL_Program | ||
166 | { | ||
167 | GLuint vert, frag, prog; | ||
168 | |||
169 | int tex_count; | ||
170 | }; | ||
171 | |||
172 | struct _Evas_GL_Program_Source | ||
173 | { | ||
174 | const char *src; | ||
175 | const unsigned int *bin; | ||
176 | int bin_size; | ||
177 | }; | ||
178 | |||
179 | struct _Evas_GL_Shared | ||
180 | { | ||
181 | Eina_List *images; | ||
182 | |||
183 | int images_size; | ||
184 | |||
185 | struct { | ||
186 | GLint max_texture_units; | ||
187 | GLint max_texture_size; | ||
188 | GLint max_vertex_elements; | ||
189 | GLfloat anisotropic; | ||
190 | Eina_Bool rgb : 1; | ||
191 | Eina_Bool bgra : 1; | ||
192 | Eina_Bool tex_npo2 : 1; | ||
193 | Eina_Bool tex_rect : 1; | ||
194 | Eina_Bool sec_image_map : 1; | ||
195 | Eina_Bool bin_program : 1; | ||
196 | // tuning params - per gpu/cpu combo? | ||
197 | #define MAX_CUTOUT 512 | ||
198 | #define DEF_CUTOUT 512 | ||
199 | |||
200 | // FIXME bug with pipes > 1 right now, should default to 32 | ||
201 | #define MAX_PIPES 128 | ||
202 | #define DEF_PIPES 32 | ||
203 | #define DEF_PIPES_SGX_540 32 | ||
204 | #define DEF_PIPES_TEGRA_2 1 | ||
205 | |||
206 | #define MIN_ATLAS_ALLOC 16 | ||
207 | #define MAX_ATLAS_ALLOC 1024 | ||
208 | #define DEF_ATLAS_ALLOC 1024 | ||
209 | |||
210 | #define MIN_ATLAS_ALLOC_ALPHA 16 | ||
211 | #define MAX_ATLAS_ALLOC_ALPHA 4096 | ||
212 | #define DEF_ATLAS_ALLOC_ALPHA 4096 | ||
213 | |||
214 | #define MAX_ATLAS_W 512 | ||
215 | #define DEF_ATLAS_W 512 | ||
216 | |||
217 | #define MAX_ATLAS_H 512 | ||
218 | #define DEF_ATLAS_H 512 | ||
219 | |||
220 | #define MIN_ATLAS_SLOT 16 | ||
221 | #define MAX_ATLAS_SLOT 512 | ||
222 | #define DEF_ATLAS_SLOT 16 | ||
223 | |||
224 | struct { | ||
225 | struct { | ||
226 | int max; | ||
227 | } cutout; | ||
228 | struct { | ||
229 | int max; | ||
230 | } pipes; | ||
231 | struct { | ||
232 | int max_alloc_size; | ||
233 | int max_alloc_alpha_size; | ||
234 | int max_w; | ||
235 | int max_h; | ||
236 | int slot_size; | ||
237 | } atlas; | ||
238 | } tune; | ||
239 | } info; | ||
240 | |||
241 | struct { | ||
242 | Eina_List *whole; | ||
243 | Eina_List *atlas[33][3]; | ||
244 | } tex; | ||
245 | |||
246 | Eina_Hash *native_pm_hash; | ||
247 | Eina_Hash *native_tex_hash; | ||
248 | |||
249 | Evas_GL_Program shader[SHADER_LAST]; | ||
250 | |||
251 | int references; | ||
252 | int w, h; | ||
253 | int rot; | ||
254 | int mflip; | ||
255 | // persp map | ||
256 | int foc, z0, px, py; | ||
257 | int ax, ay; | ||
258 | }; | ||
259 | |||
260 | #define RTYPE_RECT 1 | ||
261 | #define RTYPE_IMAGE 2 | ||
262 | #define RTYPE_FONT 3 | ||
263 | #define RTYPE_YUV 4 | ||
264 | #define RTYPE_MAP 5 /* need to merge with image */ | ||
265 | #define RTYPE_IMASK 6 | ||
266 | #define RTYPE_YUY2 7 | ||
267 | #define RTYPE_NV12 8 | ||
268 | |||
269 | struct _Evas_Engine_GL_Context | ||
270 | { | ||
271 | int references; | ||
272 | int w, h; | ||
273 | int rot; | ||
274 | int foc, z0, px, py; | ||
275 | RGBA_Draw_Context *dc; | ||
276 | |||
277 | Evas_GL_Shared *shared; | ||
278 | |||
279 | int flushnum; | ||
280 | struct { | ||
281 | int top_pipe; | ||
282 | struct { | ||
283 | GLuint cur_prog; | ||
284 | GLuint cur_tex, cur_texu, cur_texv; | ||
285 | GLuint cur_texm, cur_texmu, cur_texmv; | ||
286 | int render_op; | ||
287 | int cx, cy, cw, ch; | ||
288 | int smooth; | ||
289 | int blend; | ||
290 | int clip; | ||
291 | } current; | ||
292 | } state; | ||
293 | |||
294 | struct { | ||
295 | struct { | ||
296 | int x, y, w, h; | ||
297 | int type; | ||
298 | } region; | ||
299 | struct { | ||
300 | int x, y, w, h; | ||
301 | Eina_Bool active : 1; | ||
302 | } clip; | ||
303 | struct { | ||
304 | Evas_GL_Image *surface; | ||
305 | GLuint cur_prog; | ||
306 | GLuint cur_tex, cur_texu, cur_texv, cur_texm; | ||
307 | void *cur_tex_dyn, *cur_texu_dyn, *cur_texv_dyn; | ||
308 | int render_op; | ||
309 | int cx, cy, cw, ch; | ||
310 | int smooth; | ||
311 | int blend; | ||
312 | int clip; | ||
313 | } shader; | ||
314 | struct { | ||
315 | int num, alloc; | ||
316 | GLshort *vertex; | ||
317 | GLubyte *color; | ||
318 | GLfloat *texuv; | ||
319 | GLfloat *texuv2; | ||
320 | GLfloat *texuv3; | ||
321 | GLfloat *texm; | ||
322 | Eina_Bool line: 1; | ||
323 | Eina_Bool use_vertex : 1; | ||
324 | Eina_Bool use_color : 1; | ||
325 | Eina_Bool use_texuv : 1; | ||
326 | Eina_Bool use_texuv2 : 1; | ||
327 | Eina_Bool use_texuv3 : 1; | ||
328 | Eina_Bool use_texm : 1; | ||
329 | Evas_GL_Image *im; | ||
330 | } array; | ||
331 | } pipe[MAX_PIPES]; | ||
332 | |||
333 | struct { | ||
334 | Eina_Bool size : 1; | ||
335 | } change; | ||
336 | |||
337 | Eina_Bool havestuff : 1; | ||
338 | |||
339 | Evas_GL_Image *def_surface; | ||
340 | |||
341 | /* If this is set: Force drawing with a particular filter */ | ||
342 | GLuint filter_prog; | ||
343 | |||
344 | #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) | ||
345 | // FIXME: hack. expose egl display to gl core for egl image sec extn. | ||
346 | void *egldisp; | ||
347 | #endif | ||
348 | }; | ||
349 | |||
350 | struct _Evas_GL_Texture_Pool | ||
351 | { | ||
352 | Evas_Engine_GL_Context *gc; | ||
353 | GLuint texture, fb; | ||
354 | GLuint intformat, format, dataformat; | ||
355 | int w, h; | ||
356 | int references; | ||
357 | int slot, fslot; | ||
358 | struct { | ||
359 | void *img; | ||
360 | unsigned int *data; | ||
361 | int w, h; | ||
362 | int stride; | ||
363 | int checked_out; | ||
364 | } dyn; | ||
365 | Eina_List *allocations; | ||
366 | Eina_Bool whole : 1; | ||
367 | Eina_Bool render : 1; | ||
368 | Eina_Bool native : 1; | ||
369 | Eina_Bool dynamic : 1; | ||
370 | }; | ||
371 | |||
372 | struct _Evas_GL_Texture | ||
373 | { | ||
374 | Evas_Engine_GL_Context *gc; | ||
375 | Evas_GL_Image *im; | ||
376 | Evas_GL_Texture_Pool *pt, *ptu, *ptv, *ptuv; | ||
377 | int x, y, w, h; | ||
378 | double sx1, sy1, sx2, sy2; | ||
379 | int references; | ||
380 | |||
381 | struct | ||
382 | { | ||
383 | Evas_GL_Texture_Pool *pt[2], *ptuv[2]; | ||
384 | int source; | ||
385 | } double_buffer; | ||
386 | |||
387 | Eina_Bool alpha : 1; | ||
388 | Eina_Bool dyn : 1; | ||
389 | }; | ||
390 | |||
391 | struct _Evas_GL_Image | ||
392 | { | ||
393 | Evas_Engine_GL_Context *gc; | ||
394 | RGBA_Image *im; | ||
395 | Evas_GL_Texture *tex; | ||
396 | RGBA_Image_Loadopts load_opts; | ||
397 | int references; | ||
398 | // if im->im == NULL, it's a render-surface so these here are used | ||
399 | int w, h; | ||
400 | struct { | ||
401 | int space; | ||
402 | void *data; | ||
403 | unsigned char no_free : 1; | ||
404 | } cs; | ||
405 | |||
406 | struct { | ||
407 | void *data; | ||
408 | struct { | ||
409 | void (*bind) (void *data, void *image); | ||
410 | void (*unbind) (void *data, void *image); | ||
411 | void (*free) (void *data, void *image); | ||
412 | void *data; | ||
413 | } func; | ||
414 | int yinvert; | ||
415 | int target; | ||
416 | int mipmap; | ||
417 | unsigned char loose : 1; | ||
418 | } native; | ||
419 | |||
420 | int scale_hint, content_hint; | ||
421 | int csize; | ||
422 | |||
423 | Eina_List *filtered; | ||
424 | |||
425 | unsigned char dirty : 1; | ||
426 | unsigned char cached : 1; | ||
427 | unsigned char alpha : 1; | ||
428 | unsigned char tex_only : 1; | ||
429 | }; | ||
430 | |||
431 | struct _Evas_GL_Font_Texture | ||
432 | { | ||
433 | Evas_GL_Texture *tex; | ||
434 | }; | ||
435 | |||
436 | struct _Evas_GL_Polygon | ||
437 | { | ||
438 | Eina_List *points; | ||
439 | Eina_Bool changed : 1; | ||
440 | }; | ||
441 | |||
442 | struct _Evas_GL_Polygon_Point | ||
443 | { | ||
444 | int x, y; | ||
445 | }; | ||
446 | |||
447 | #if 0 | ||
448 | extern Evas_GL_Program_Source shader_rect_frag_src; | ||
449 | extern Evas_GL_Program_Source shader_rect_vert_src; | ||
450 | extern Evas_GL_Program_Source shader_font_frag_src; | ||
451 | extern Evas_GL_Program_Source shader_font_vert_src; | ||
452 | |||
453 | extern Evas_GL_Program_Source shader_img_frag_src; | ||
454 | extern Evas_GL_Program_Source shader_img_vert_src; | ||
455 | extern Evas_GL_Program_Source shader_img_nomul_frag_src; | ||
456 | extern Evas_GL_Program_Source shader_img_nomul_vert_src; | ||
457 | extern Evas_GL_Program_Source shader_img_bgra_frag_src; | ||
458 | extern Evas_GL_Program_Source shader_img_bgra_vert_src; | ||
459 | extern Evas_GL_Program_Source shader_img_bgra_nomul_frag_src; | ||
460 | extern Evas_GL_Program_Source shader_img_bgra_nomul_vert_src; | ||
461 | extern Evas_GL_Program_Source shader_img_mask_frag_src; | ||
462 | extern Evas_GL_Program_Source shader_img_mask_vert_src; | ||
463 | |||
464 | extern Evas_GL_Program_Source shader_yuv_frag_src; | ||
465 | extern Evas_GL_Program_Source shader_yuv_vert_src; | ||
466 | extern Evas_GL_Program_Source shader_yuv_nomul_frag_src; | ||
467 | extern Evas_GL_Program_Source shader_yuv_nomul_vert_src; | ||
468 | |||
469 | extern Evas_GL_Program_Source shader_yuy2_frag_src; | ||
470 | extern Evas_GL_Program_Source shader_yuy2_vert_src; | ||
471 | extern Evas_GL_Program_Source shader_yuy2_nomul_frag_src; | ||
472 | extern Evas_GL_Program_Source shader_yuy2_nomul_vert_src; | ||
473 | |||
474 | extern Evas_GL_Program_Source shader_tex_frag_src; | ||
475 | extern Evas_GL_Program_Source shader_tex_vert_src; | ||
476 | extern Evas_GL_Program_Source shader_tex_nomul_frag_src; | ||
477 | extern Evas_GL_Program_Source shader_tex_nomul_vert_src; | ||
478 | |||
479 | extern Evas_GL_Program_Source shader_filter_invert_frag_src; | ||
480 | extern Evas_GL_Program_Source shader_filter_invert_nomul_frag_src; | ||
481 | extern Evas_GL_Program_Source shader_filter_invert_bgra_frag_src; | ||
482 | extern Evas_GL_Program_Source shader_filter_invert_bgra_nomul_frag_src; | ||
483 | extern Evas_GL_Program_Source shader_filter_sepia_frag_src; | ||
484 | extern Evas_GL_Program_Source shader_filter_sepia_nomul_frag_src; | ||
485 | extern Evas_GL_Program_Source shader_filter_sepia_bgra_frag_src; | ||
486 | extern Evas_GL_Program_Source shader_filter_sepia_bgra_nomul_frag_src; | ||
487 | extern Evas_GL_Program_Source shader_filter_greyscale_frag_src; | ||
488 | extern Evas_GL_Program_Source shader_filter_greyscale_nomul_frag_src; | ||
489 | extern Evas_GL_Program_Source shader_filter_greyscale_bgra_frag_src; | ||
490 | extern Evas_GL_Program_Source shader_filter_greyscale_bgra_nomul_frag_src; | ||
491 | /* blur (annoyingly) needs (aka is faster with) a vertex shader */ | ||
492 | extern Evas_GL_Program_Source shader_filter_blur_vert_src; | ||
493 | extern Evas_GL_Program_Source shader_filter_blur_frag_src; | ||
494 | extern Evas_GL_Program_Source shader_filter_blur_nomul_frag_src; | ||
495 | extern Evas_GL_Program_Source shader_filter_blur_bgra_frag_src; | ||
496 | extern Evas_GL_Program_Source shader_filter_blur_bgra_nomul_frag_src; | ||
497 | #endif | ||
498 | |||
499 | void glerr(int err, const char *file, const char *func, int line, const char *op); | ||
500 | |||
501 | Evas_Engine_GL_Context *evas_gl_common_context_new(void); | ||
502 | void evas_gl_common_context_free(Evas_Engine_GL_Context *gc); | ||
503 | void evas_gl_common_context_use(Evas_Engine_GL_Context *gc); | ||
504 | void evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc); | ||
505 | void evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot); | ||
506 | void evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc, Evas_GL_Image *surface); | ||
507 | |||
508 | void evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, | ||
509 | int x1, int y1, int x2, int y2, | ||
510 | int clip, int cx, int cy, int cw, int ch, | ||
511 | int r, int g, int b, int a); | ||
512 | void evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc, | ||
513 | int x, int y, int w, int h, | ||
514 | int r, int g, int b, int a); | ||
515 | void evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc, | ||
516 | Evas_GL_Texture *tex, | ||
517 | double sx, double sy, double sw, double sh, | ||
518 | int x, int y, int w, int h, | ||
519 | int r, int g, int b, int a, | ||
520 | Eina_Bool smooth, Eina_Bool tex_only); | ||
521 | void evas_gl_common_context_image_mask_push(Evas_Engine_GL_Context *gc, | ||
522 | Evas_GL_Texture *tex, | ||
523 | Evas_GL_Texture *texm, | ||
524 | double sx, double sy, double sw, double sh, | ||
525 | double sxm, double sym, double swm, double shm, | ||
526 | int x, int y, int w, int h, | ||
527 | int r, int g, int b, int a, | ||
528 | Eina_Bool smooth); | ||
529 | |||
530 | |||
531 | void evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc, | ||
532 | Evas_GL_Texture *tex, | ||
533 | double sx, double sy, double sw, double sh, | ||
534 | int x, int y, int w, int h, | ||
535 | int r, int g, int b, int a); | ||
536 | void evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc, | ||
537 | Evas_GL_Texture *tex, | ||
538 | double sx, double sy, double sw, double sh, | ||
539 | int x, int y, int w, int h, | ||
540 | int r, int g, int b, int a, | ||
541 | Eina_Bool smooth); | ||
542 | void evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc, | ||
543 | Evas_GL_Texture *tex, | ||
544 | double sx, double sy, double sw, double sh, | ||
545 | int x, int y, int w, int h, | ||
546 | int r, int g, int b, int a, | ||
547 | Eina_Bool smooth); | ||
548 | void evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc, | ||
549 | Evas_GL_Texture *tex, | ||
550 | double sx, double sy, double sw, double sh, | ||
551 | int x, int y, int w, int h, | ||
552 | int r, int g, int b, int a, | ||
553 | Eina_Bool smooth); | ||
554 | void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, | ||
555 | Evas_GL_Texture *tex, | ||
556 | int npoints, | ||
557 | RGBA_Map_Point *p, | ||
558 | int clip, int cx, int cy, int cw, int ch, | ||
559 | int r, int g, int b, int a, | ||
560 | Eina_Bool smooth, | ||
561 | Eina_Bool tex_only, | ||
562 | Evas_Colorspace cspace); | ||
563 | void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc); | ||
564 | |||
565 | int evas_gl_common_shader_program_init(Evas_GL_Shared *shared); | ||
566 | void evas_gl_common_shader_program_init_done(void); | ||
567 | void evas_gl_common_shader_program_shutdown(Evas_GL_Program *p); | ||
568 | |||
569 | void evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h); | ||
570 | |||
571 | void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt); | ||
572 | Evas_GL_Texture *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im); | ||
573 | Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im); | ||
574 | Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha); | ||
575 | Evas_GL_Texture *evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); | ||
576 | void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im); | ||
577 | void evas_gl_common_texture_free(Evas_GL_Texture *tex); | ||
578 | Evas_GL_Texture *evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels, unsigned int w, unsigned int h, int fh); | ||
579 | void evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels, unsigned int w, unsigned int h, int fh); | ||
580 | Evas_GL_Texture *evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); | ||
581 | void evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h); | ||
582 | Evas_GL_Texture *evas_gl_common_texture_yuy2_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); | ||
583 | void evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h); | ||
584 | Evas_GL_Texture *evas_gl_common_texture_nv12_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); | ||
585 | void evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h); | ||
586 | Evas_GL_Texture *evas_gl_common_texture_nv12tiled_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); | ||
587 | void evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h); | ||
588 | |||
589 | void evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc); | ||
590 | |||
591 | void evas_gl_common_image_ref(Evas_GL_Image *im); | ||
592 | void evas_gl_common_image_unref(Evas_GL_Image *im); | ||
593 | Evas_GL_Image *evas_gl_common_image_load(Evas_Engine_GL_Context *gc, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error); | ||
594 | Evas_GL_Image *evas_gl_common_image_new_from_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace); | ||
595 | Evas_GL_Image *evas_gl_common_image_new_from_copied_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace); | ||
596 | Evas_GL_Image *evas_gl_common_image_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int cspace); | ||
597 | Evas_GL_Image *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha); | ||
598 | void evas_gl_common_image_native_enable(Evas_GL_Image *im); | ||
599 | void evas_gl_common_image_native_disable(Evas_GL_Image *im); | ||
600 | void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint); | ||
601 | void evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint); | ||
602 | void evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc); | ||
603 | void evas_gl_common_image_free(Evas_GL_Image *im); | ||
604 | Evas_GL_Image *evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha); | ||
605 | void evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h); | ||
606 | void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); | ||
607 | void evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level); | ||
608 | void evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth); | ||
609 | |||
610 | void *evas_gl_font_texture_new(void *gc, RGBA_Font_Glyph *fg); | ||
611 | void evas_gl_font_texture_free(void *); | ||
612 | void evas_gl_font_texture_draw(void *gc, void *surface, void *dc, RGBA_Font_Glyph *fg, int x, int y); | ||
613 | |||
614 | Evas_GL_Polygon *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y); | ||
615 | Evas_GL_Polygon *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly); | ||
616 | void evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int x, int y); | ||
617 | |||
618 | void evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int y2); | ||
619 | |||
620 | #if 0 // filtering disabled | ||
621 | void evas_gl_common_filter_draw(Evas_Engine_GL_Context *context, Evas_GL_Image *im, Evas_Filter_Info *filter); | ||
622 | Filtered_Image *evas_gl_common_image_filtered_get(Evas_GL_Image *im, uint8_t *key, size_t keylen); | ||
623 | Filtered_Image *evas_gl_common_image_filtered_save(Evas_GL_Image *im, Evas_GL_Image *fimage, uint8_t *key, size_t keylen); | ||
624 | void evas_gl_common_image_filtered_free(Evas_GL_Image *im, Filtered_Image *); | ||
625 | #endif | ||
626 | |||
627 | extern void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b); | ||
628 | extern void (*glsym_glBindFramebuffer) (GLenum a, GLuint b); | ||
629 | extern void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e); | ||
630 | extern void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); | ||
631 | extern void (*glsym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei *c, GLenum *d, void *e); | ||
632 | extern void (*glsym_glProgramBinary) (GLuint a, GLenum b, const void *c, GLint d); | ||
633 | extern void (*glsym_glProgramParameteri) (GLuint a, GLuint b, GLint d); | ||
634 | |||
635 | #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) | ||
636 | extern void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e); | ||
637 | extern unsigned int (*secsym_eglDestroyImage) (void *a, void *b); | ||
638 | extern void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b); | ||
639 | extern void *(*secsym_eglMapImageSEC) (void *a, void *b); | ||
640 | extern unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b); | ||
641 | extern unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d); | ||
642 | #endif | ||
643 | |||
644 | //#define GL_ERRORS 1 | ||
645 | |||
646 | #ifdef GL_ERRORS | ||
647 | # define GLERR(fn, fl, ln, op) \ | ||
648 | { \ | ||
649 | int __gl_err = glGetError(); \ | ||
650 | if (__gl_err != GL_NO_ERROR) glerr(__gl_err, fl, fn, ln, op); \ | ||
651 | } | ||
652 | #else | ||
653 | # define GLERR(fn, fl, ln, op) | ||
654 | #endif | ||
655 | |||
656 | Eina_Bool evas_gl_common_module_open(void); | ||
657 | void evas_gl_common_module_close(void); | ||
658 | |||
659 | #endif | ||