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