summaryrefslogtreecommitdiff
path: root/legacy/evas
diff options
context:
space:
mode:
authorSung Park <sungwoo@gmail.com>2012-09-24 07:41:27 +0000
committerSung Park <sungwoo@gmail.com>2012-09-24 07:41:27 +0000
commitbbba85b546d587030cbeeb7453146c7a94c60d17 (patch)
tree54361b352b1d177e281226f09d48fd6749d6188b /legacy/evas
parent8f1c793565f4bd896766490b879ca581458fe55a (diff)
Refactored Evas GL engine code so wayland_egl and gl_x11 and other
engines can share the same code. The common codes are in gl_common/ directory and evas_engine just has to implement a few engine functions. SVN revision: 77032
Diffstat (limited to 'legacy/evas')
-rw-r--r--legacy/evas/ChangeLog8
-rw-r--r--legacy/evas/src/modules/engines/gl_common/Makefile.am3
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api.c2696
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.c286
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.h72
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext_def.h632
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core.c1509
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core.h39
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core_private.h224
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_engine.c2953
10 files changed, 5945 insertions, 2477 deletions
diff --git a/legacy/evas/ChangeLog b/legacy/evas/ChangeLog
index 5d7d8b4266..ec41bbbd7a 100644
--- a/legacy/evas/ChangeLog
+++ b/legacy/evas/ChangeLog
@@ -1049,3 +1049,11 @@
1049 1049
1050 * Fix native surface crash when setting to null in some 1050 * Fix native surface crash when setting to null in some
1051 situations. 1051 situations.
1052
10532012-09-24 Sung W. Park (sung_)
1054
1055 * Refactored Evas GL engine code so wayland_egl and gl_x11 and other
1056 engines can share the same code. The common codes are in gl_common/
1057 directory and evas_engine just has to implement a few engine functions.
1058
1059
diff --git a/legacy/evas/src/modules/engines/gl_common/Makefile.am b/legacy/evas/src/modules/engines/gl_common/Makefile.am
index 0265316160..803ec8f560 100644
--- a/legacy/evas/src/modules/engines/gl_common/Makefile.am
+++ b/legacy/evas/src/modules/engines/gl_common/Makefile.am
@@ -26,6 +26,9 @@ evas_gl_font.c \
26evas_gl_polygon.c \ 26evas_gl_polygon.c \
27evas_gl_line.c \ 27evas_gl_line.c \
28evas_gl_filter.c \ 28evas_gl_filter.c \
29evas_gl_core.c \
30evas_gl_api.c \
31evas_gl_api_ext.c \
29shader/rect_frag.h \ 32shader/rect_frag.h \
30shader/rect_vert.h \ 33shader/rect_vert.h \
31shader/font_frag.h \ 34shader/font_frag.h \
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_api.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_api.c
new file mode 100644
index 0000000000..d705b8a0c7
--- /dev/null
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_api.c
@@ -0,0 +1,2696 @@
1#include "evas_gl_core_private.h"
2#include "evas_gl_api_ext.h"
3
4#define EVGL_FUNC_BEGIN()
5#define EVGL_FUNC_END()
6#define _EVGL_INT_INIT_VALUE -3
7
8void
9evgl_glActiveTexture(GLenum texture)
10{
11 EVGL_FUNC_BEGIN();
12 glActiveTexture(texture);
13 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
14 goto finish;
15
16finish:
17 EVGL_FUNC_END();
18}
19
20void
21evgl_glAttachShader(GLuint program, GLuint shader)
22{
23 EVGL_FUNC_BEGIN();
24 glAttachShader(program, shader);
25 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
26 goto finish;
27
28finish:
29 EVGL_FUNC_END();
30}
31
32void
33evgl_glBindAttribLocation(GLuint program, GLuint index, const char* name)
34{
35 EVGL_FUNC_BEGIN();
36 glBindAttribLocation(program, index, name);
37 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
38 goto finish;
39
40finish:
41 EVGL_FUNC_END();
42}
43
44void
45evgl_glBindBuffer(GLenum target, GLuint buffer)
46{
47 EVGL_FUNC_BEGIN();
48 glBindBuffer(target, buffer);
49 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
50 goto finish;
51
52finish:
53 EVGL_FUNC_END();
54}
55
56void
57evgl_glBindFramebuffer(GLenum target, GLuint framebuffer)
58{
59 EVGL_Context *ctx = NULL;
60
61 EVGL_FUNC_BEGIN();
62
63 ctx = _evgl_current_context_get();
64
65 if (!ctx)
66 {
67 ERR("No current context set.");
68 return;
69 }
70
71 // Take care of BindFramebuffer 0 issue
72 if (framebuffer==0)
73 {
74 if (evgl_direct_enabled(evgl_engine))
75 glBindFramebuffer(target, 0);
76 else
77 glBindFramebuffer(target, ctx->surface_fbo);
78 ctx->current_fbo = 0;
79 }
80 else
81 {
82 glBindFramebuffer(target, framebuffer);
83
84 // Save this for restore when doing make current
85 ctx->current_fbo = framebuffer;
86 }
87
88 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
89 goto finish;
90
91finish:
92 EVGL_FUNC_END();
93}
94
95void
96evgl_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
97{
98 EVGL_FUNC_BEGIN();
99 glBindRenderbuffer(target, renderbuffer);
100 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
101
102 goto finish;
103
104finish:
105 EVGL_FUNC_END();
106}
107
108void
109evgl_glBindTexture(GLenum target, GLuint texture)
110{
111 EVGL_FUNC_BEGIN();
112 glBindTexture(target, texture);
113 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
114 goto finish;
115
116finish:
117 EVGL_FUNC_END();
118}
119
120void
121evgl_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
122{
123 EVGL_FUNC_BEGIN();
124 glBlendColor(red, green, blue, alpha);
125 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
126 goto finish;
127
128finish:
129 EVGL_FUNC_END();
130}
131
132void
133evgl_glBlendEquation(GLenum mode)
134{
135 EVGL_FUNC_BEGIN();
136 glBlendEquation(mode);
137 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
138 goto finish;
139
140finish:
141 EVGL_FUNC_END();
142}
143
144void
145evgl_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
146{
147 EVGL_FUNC_BEGIN();
148 glBlendEquationSeparate(modeRGB, modeAlpha);
149 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
150 goto finish;
151
152finish:
153 EVGL_FUNC_END();
154}
155
156void
157evgl_glBlendFunc(GLenum sfactor, GLenum dfactor)
158{
159 EVGL_FUNC_BEGIN();
160 glBlendFunc(sfactor, dfactor);
161 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
162 goto finish;
163
164finish:
165 EVGL_FUNC_END();
166}
167
168void
169evgl_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
170{
171 EVGL_FUNC_BEGIN();
172 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
173 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
174 goto finish;
175
176finish:
177 EVGL_FUNC_END();
178}
179
180void
181evgl_glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
182{
183 EVGL_FUNC_BEGIN();
184 glBufferData(target, size, data, usage);
185 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
186 goto finish;
187
188finish:
189 EVGL_FUNC_END();
190}
191
192void
193evgl_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
194{
195 EVGL_FUNC_BEGIN();
196 glBufferSubData(target, offset, size, data);
197 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
198 goto finish;
199
200finish:
201 EVGL_FUNC_END();
202}
203
204GLenum
205evgl_glCheckFramebufferStatus(GLenum target)
206{
207 GLenum ret = GL_NONE;
208
209 EVGL_FUNC_BEGIN();
210 ret = glCheckFramebufferStatus(target);
211 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
212 goto finish;
213
214finish:
215 EVGL_FUNC_END();
216 return ret;
217}
218
219#ifdef NO_DIRECT_RENDERING
220void
221evgl_glClear(GLbitfield mask)
222{
223 EVGL_FUNC_BEGIN();
224 glClear(mask);
225 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
226 goto finish;
227
228finish:
229 EVGL_FUNC_END();
230}
231#endif
232
233void
234evgl_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
235{
236 EVGL_FUNC_BEGIN();
237 glClearColor(red, green, blue, alpha);
238 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
239 goto finish;
240
241finish:
242 EVGL_FUNC_END();
243}
244
245void
246evgl_glClearDepthf(GLclampf depth)
247{
248 EVGL_FUNC_BEGIN();
249
250#ifdef GL_GLES
251 glClearDepthf(depth);
252#else
253 glClearDepth(depth);
254#endif
255
256 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
257 goto finish;
258
259finish:
260 EVGL_FUNC_END();
261}
262
263void
264evgl_glClearStencil(GLint s)
265{
266 EVGL_FUNC_BEGIN();
267 glClearStencil(s);
268 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
269 goto finish;
270
271finish:
272 EVGL_FUNC_END();
273}
274
275void
276evgl_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
277{
278 EVGL_FUNC_BEGIN();
279 glColorMask(red, green, blue, alpha);
280 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
281 goto finish;
282
283finish:
284 EVGL_FUNC_END();
285}
286
287void
288evgl_glCompileShader(GLuint shader)
289{
290 EVGL_FUNC_BEGIN();
291 glCompileShader(shader);
292 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
293 goto finish;
294
295finish:
296 EVGL_FUNC_END();
297}
298
299void
300evgl_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
301{
302 EVGL_FUNC_BEGIN();
303 glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
304 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
305 goto finish;
306
307finish:
308 EVGL_FUNC_END();
309}
310
311void
312evgl_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
313{
314 EVGL_FUNC_BEGIN();
315 glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
316 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
317 goto finish;
318
319finish:
320 EVGL_FUNC_END();
321}
322
323void
324evgl_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
325{
326 EVGL_FUNC_BEGIN();
327 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
328 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
329 goto finish;
330
331finish:
332 EVGL_FUNC_END();
333}
334
335void
336evgl_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
337{
338 EVGL_FUNC_BEGIN();
339 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
340 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
341 goto finish;
342
343finish:
344 EVGL_FUNC_END();
345}
346
347GLuint
348evgl_glCreateProgram(void)
349{
350 GLuint ret = _EVGL_INT_INIT_VALUE;
351
352 EVGL_FUNC_BEGIN();
353 ret = glCreateProgram();
354 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
355 goto finish;
356
357finish:
358 EVGL_FUNC_END();
359 return ret;
360}
361
362GLuint
363evgl_glCreateShader(GLenum type)
364{
365 GLuint ret = _EVGL_INT_INIT_VALUE;
366 EVGL_FUNC_BEGIN();
367 ret = glCreateShader(type);
368 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
369 goto finish;
370
371finish:
372 EVGL_FUNC_END();
373 return ret;
374}
375
376void
377evgl_glCullFace(GLenum mode)
378{
379 EVGL_FUNC_BEGIN();
380 glCullFace(mode);
381 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
382 goto finish;
383
384finish:
385 EVGL_FUNC_END();
386}
387
388void
389evgl_glDeleteBuffers(GLsizei n, const GLuint* buffers)
390{
391 EVGL_FUNC_BEGIN();
392 glDeleteBuffers(n, buffers);
393 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
394 goto finish;
395
396finish:
397 EVGL_FUNC_END();
398}
399
400void
401evgl_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
402{
403 EVGL_FUNC_BEGIN();
404 glDeleteFramebuffers(n, framebuffers);
405 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
406 goto finish;
407
408finish:
409 EVGL_FUNC_END();
410}
411
412void
413evgl_glDeleteProgram(GLuint program)
414{
415 EVGL_FUNC_BEGIN();
416 glDeleteProgram(program);
417 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
418 goto finish;
419
420finish:
421 EVGL_FUNC_END();
422}
423
424void
425evgl_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
426{
427 EVGL_FUNC_BEGIN();
428 glDeleteRenderbuffers(n, renderbuffers);
429 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
430 goto finish;
431
432finish:
433 EVGL_FUNC_END();
434}
435
436void
437evgl_glDeleteShader(GLuint shader)
438{
439 EVGL_FUNC_BEGIN();
440 glDeleteShader(shader);
441 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
442 goto finish;
443
444finish:
445 EVGL_FUNC_END();
446}
447
448void
449evgl_glDeleteTextures(GLsizei n, const GLuint* textures)
450{
451 EVGL_FUNC_BEGIN();
452 glDeleteTextures(n, textures);
453 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
454 goto finish;
455
456finish:
457 EVGL_FUNC_END();
458}
459
460void
461evgl_glDepthFunc(GLenum func)
462{
463 EVGL_FUNC_BEGIN();
464 glDepthFunc(func);
465 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
466 goto finish;
467
468finish:
469 EVGL_FUNC_END();
470}
471
472void
473evgl_glDepthMask(GLboolean flag)
474{
475 EVGL_FUNC_BEGIN();
476 glDepthMask(flag);
477 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
478 goto finish;
479
480finish:
481 EVGL_FUNC_END();
482}
483
484void
485evgl_glDepthRangef(GLclampf zNear, GLclampf zFar)
486{
487 EVGL_FUNC_BEGIN();
488
489#ifdef GL_GLES
490 glDepthRangef(zNear, zFar);
491#else
492 glDepthRange(zNear, zFar);
493#endif
494
495 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
496 goto finish;
497
498finish:
499 EVGL_FUNC_END();
500}
501
502void
503evgl_glDetachShader(GLuint program, GLuint shader)
504{
505 EVGL_FUNC_BEGIN();
506 glDetachShader(program, shader);
507 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
508 goto finish;
509
510finish:
511 EVGL_FUNC_END();
512}
513
514#ifdef NO_DIRECT_RENDERING
515void
516evgl_glDisable(GLenum cap)
517{
518 EVGL_FUNC_BEGIN();
519 glDisable(cap);
520 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
521 goto finish;
522
523finish:
524 EVGL_FUNC_END();
525}
526#endif
527
528void
529evgl_glDisableVertexAttribArray(GLuint index)
530{
531 EVGL_FUNC_BEGIN();
532 glDisableVertexAttribArray(index);
533 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
534 goto finish;
535
536finish:
537 EVGL_FUNC_END();
538}
539
540void
541evgl_glDrawArrays(GLenum mode, GLint first, GLsizei count)
542{
543 EVGL_FUNC_BEGIN();
544 glDrawArrays(mode, first, count);
545 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
546 goto finish;
547
548finish:
549 EVGL_FUNC_END();
550}
551
552void
553evgl_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
554{
555 EVGL_FUNC_BEGIN();
556 glDrawElements(mode, count, type, indices);
557 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
558 goto finish;
559
560finish:
561 EVGL_FUNC_END();
562}
563
564#ifdef NO_DIRECT_RENDERING
565void
566evgl_glEnable(GLenum cap)
567{
568 EVGL_FUNC_BEGIN();
569 glEnable(cap);
570 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
571 goto finish;
572
573finish:
574 EVGL_FUNC_END();
575}
576#endif
577
578void
579evgl_glEnableVertexAttribArray(GLuint index)
580{
581 EVGL_FUNC_BEGIN();
582 glEnableVertexAttribArray(index);
583 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
584 goto finish;
585
586finish:
587 EVGL_FUNC_END();
588}
589
590void
591evgl_glFinish(void)
592{
593 EVGL_FUNC_BEGIN();
594 glFinish();
595 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
596 goto finish;
597
598finish:
599 EVGL_FUNC_END();
600}
601
602void
603evgl_glFlush(void)
604{
605 EVGL_FUNC_BEGIN();
606 glFlush();
607 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
608 goto finish;
609
610finish:
611 EVGL_FUNC_END();
612}
613
614void
615evgl_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
616{
617 EVGL_FUNC_BEGIN();
618 glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
619 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
620 goto finish;
621
622finish:
623 EVGL_FUNC_END();
624}
625
626void
627evgl_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
628{
629 EVGL_FUNC_BEGIN();
630 glFramebufferTexture2D(target, attachment, textarget, texture, level);
631 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
632 goto finish;
633
634finish:
635 EVGL_FUNC_END();
636}
637
638void
639evgl_glFrontFace(GLenum mode)
640{
641 EVGL_FUNC_BEGIN();
642 glFrontFace(mode);
643 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
644 goto finish;
645
646finish:
647 EVGL_FUNC_END();
648}
649
650void
651evgl_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
652{
653 EVGL_FUNC_BEGIN();
654 glGetVertexAttribfv(index, pname, params);
655
656 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
657 goto finish;
658
659finish:
660 EVGL_FUNC_END();
661}
662
663void
664evgl_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
665{
666 EVGL_FUNC_BEGIN();
667 glGetVertexAttribiv(index, pname, params);
668
669 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
670 goto finish;
671
672finish:
673 EVGL_FUNC_END();
674}
675
676void
677evgl_glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
678{
679 EVGL_FUNC_BEGIN();
680 glGetVertexAttribPointerv(index, pname, pointer);
681
682 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
683
684 goto finish;
685
686finish:
687 EVGL_FUNC_END();
688}
689
690void
691evgl_glHint(GLenum target, GLenum mode)
692{
693 EVGL_FUNC_BEGIN();
694 glHint(target, mode);
695 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
696 goto finish;
697
698finish:
699 EVGL_FUNC_END();
700}
701
702void
703evgl_glGenBuffers(GLsizei n, GLuint* buffers)
704{
705 EVGL_FUNC_BEGIN();
706 glGenBuffers(n, buffers);
707 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
708 goto finish;
709
710finish:
711 EVGL_FUNC_END();
712}
713
714void
715evgl_glGenerateMipmap(GLenum target)
716{
717 EVGL_FUNC_BEGIN();
718 glGenerateMipmap(target);
719 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
720 goto finish;
721
722finish:
723 EVGL_FUNC_END();
724}
725
726void
727evgl_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
728{
729 EVGL_FUNC_BEGIN();
730 glGenFramebuffers(n, framebuffers);
731 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
732 goto finish;
733
734finish:
735 EVGL_FUNC_END();
736}
737
738void
739evgl_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
740{
741 EVGL_FUNC_BEGIN();
742 glGenRenderbuffers(n, renderbuffers);
743 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
744 goto finish;
745
746finish:
747 EVGL_FUNC_END();
748}
749
750void
751evgl_glGenTextures(GLsizei n, GLuint* textures)
752{
753 EVGL_FUNC_BEGIN();
754 glGenTextures(n, textures);
755 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
756 goto finish;
757
758finish:
759 EVGL_FUNC_END();
760}
761
762void
763evgl_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
764{
765 EVGL_FUNC_BEGIN();
766 glGetActiveAttrib(program, index, bufsize, length, size, type, name);
767 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
768 goto finish;
769
770finish:
771 EVGL_FUNC_END();
772}
773
774void
775evgl_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
776{
777 EVGL_FUNC_BEGIN();
778 glGetActiveUniform(program, index, bufsize, length, size, type, name);
779 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
780 goto finish;
781
782finish:
783 EVGL_FUNC_END();
784}
785
786void
787evgl_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
788{
789 EVGL_FUNC_BEGIN();
790 glGetAttachedShaders(program, maxcount, count, shaders);
791 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
792 goto finish;
793
794finish:
795 EVGL_FUNC_END();
796}
797
798int
799evgl_glGetAttribLocation(GLuint program, const char* name)
800{
801 int ret = _EVGL_INT_INIT_VALUE;
802 EVGL_FUNC_BEGIN();
803 ret = glGetAttribLocation(program, name);
804 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
805 goto finish;
806
807finish:
808 EVGL_FUNC_END();
809 return ret;
810}
811
812void
813evgl_glGetBooleanv(GLenum pname, GLboolean* params)
814{
815 EVGL_FUNC_BEGIN();
816 glGetBooleanv(pname, params);
817 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
818 goto finish;
819
820finish:
821 EVGL_FUNC_END();
822}
823
824void
825evgl_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
826{
827 EVGL_FUNC_BEGIN();
828 glGetBufferParameteriv(target, pname, params);
829 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
830 goto finish;
831
832finish:
833 EVGL_FUNC_END();
834}
835
836GLenum
837evgl_glGetError(void)
838{
839 GLenum ret = GL_NONE;
840
841 EVGL_FUNC_BEGIN();
842 ret = glGetError();
843 goto finish;
844
845finish:
846 EVGL_FUNC_END();
847 return ret;
848}
849
850void
851evgl_glGetFloatv(GLenum pname, GLfloat* params)
852{
853 EVGL_FUNC_BEGIN();
854 glGetFloatv(pname, params);
855 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
856 goto finish;
857
858finish:
859 EVGL_FUNC_END();
860}
861
862void
863evgl_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
864{
865 EVGL_FUNC_BEGIN();
866 glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
867 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
868 goto finish;
869
870finish:
871 EVGL_FUNC_END();
872}
873
874void
875evgl_glGetIntegerv(GLenum pname, GLint* params)
876{
877 EVGL_FUNC_BEGIN();
878 glGetIntegerv(pname, params);
879 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
880 goto finish;
881
882finish:
883 EVGL_FUNC_END();
884}
885
886void
887evgl_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
888{
889 EVGL_FUNC_BEGIN();
890 glGetProgramiv(program, pname, params);
891 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
892 goto finish;
893
894finish:
895 EVGL_FUNC_END();
896}
897
898void
899evgl_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
900{
901 EVGL_FUNC_BEGIN();
902 glGetProgramInfoLog(program, bufsize, length, infolog);
903 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
904 goto finish;
905
906finish:
907 EVGL_FUNC_END();
908}
909
910void
911evgl_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
912{
913 EVGL_FUNC_BEGIN();
914 glGetRenderbufferParameteriv(target, pname, params);
915 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
916 goto finish;
917
918finish:
919 EVGL_FUNC_END();
920}
921
922void
923evgl_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
924{
925 EVGL_FUNC_BEGIN();
926 glGetShaderiv(shader, pname, params);
927 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
928 goto finish;
929
930finish:
931 EVGL_FUNC_END();
932}
933
934void
935evgl_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
936{
937 EVGL_FUNC_BEGIN();
938 glGetShaderInfoLog(shader, bufsize, length, infolog);
939 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
940 goto finish;
941
942finish:
943 EVGL_FUNC_END();
944}
945
946void
947evgl_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
948{
949 EVGL_FUNC_BEGIN();
950
951#ifdef GL_GLES
952 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
953#else
954 if (range)
955 {
956 range[0] = -126; // floor(log2(FLT_MIN))
957 range[1] = 127; // floor(log2(FLT_MAX))
958 }
959 if (precision)
960 {
961 precision[0] = 24; // floor(-log2((1.0/16777218.0)));
962 }
963 return;
964 shadertype = precisiontype = 0;
965#endif
966
967 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
968 goto finish;
969
970finish:
971 EVGL_FUNC_END();
972}
973
974void
975evgl_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
976{
977 EVGL_FUNC_BEGIN();
978 glGetShaderSource(shader, bufsize, length, source);
979 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
980 goto finish;
981
982finish:
983 EVGL_FUNC_END();
984}
985
986const GLubyte *
987evgl_glGetString(GLenum name)
988{
989 const GLubyte *ret = NULL;
990
991 EVGL_FUNC_BEGIN();
992#if 0
993 if (name == GL_EXTENSIONS)
994 return (GLubyte *)_gl_ext_string; //glGetString(GL_EXTENSIONS);
995 else
996 return glGetString(name);
997#endif
998 ret = glGetString(name);
999 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1000 goto finish;
1001
1002finish:
1003 EVGL_FUNC_END();
1004 return ret;
1005}
1006
1007void
1008evgl_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
1009{
1010 EVGL_FUNC_BEGIN();
1011 glGetTexParameterfv(target, pname, params);
1012 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1013 goto finish;
1014
1015finish:
1016 EVGL_FUNC_END();
1017}
1018
1019void
1020evgl_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
1021{
1022 EVGL_FUNC_BEGIN();
1023 glGetTexParameteriv(target, pname, params);
1024 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1025 goto finish;
1026
1027finish:
1028 EVGL_FUNC_END();
1029}
1030
1031void
1032evgl_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
1033{
1034 EVGL_FUNC_BEGIN();
1035 glGetUniformfv(program, location, params);
1036 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1037 goto finish;
1038
1039finish:
1040 EVGL_FUNC_END();
1041}
1042
1043void
1044evgl_glGetUniformiv(GLuint program, GLint location, GLint* params)
1045{
1046 EVGL_FUNC_BEGIN();
1047 glGetUniformiv(program, location, params);
1048 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1049 goto finish;
1050
1051finish:
1052 EVGL_FUNC_END();
1053}
1054int
1055evgl_glGetUniformLocation(GLuint program, const char* name)
1056{
1057 int ret = _EVGL_INT_INIT_VALUE;
1058
1059 EVGL_FUNC_BEGIN();
1060 ret = glGetUniformLocation(program, name);
1061 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1062 goto finish;
1063
1064finish:
1065 EVGL_FUNC_END();
1066 return ret;
1067}
1068
1069GLboolean
1070evgl_glIsBuffer(GLuint buffer)
1071{
1072 GLboolean ret = GL_FALSE;
1073
1074 EVGL_FUNC_BEGIN();
1075 ret = glIsBuffer(buffer);
1076 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1077 goto finish;
1078
1079finish:
1080 EVGL_FUNC_END();
1081 return ret;
1082}
1083
1084GLboolean
1085evgl_glIsEnabled(GLenum cap)
1086{
1087 GLboolean ret = GL_FALSE;
1088
1089 EVGL_FUNC_BEGIN();
1090 ret = glIsEnabled(cap);
1091 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1092 goto finish;
1093
1094finish:
1095 EVGL_FUNC_END();
1096 return ret;
1097}
1098
1099GLboolean
1100evgl_glIsFramebuffer(GLuint framebuffer)
1101{
1102 GLboolean ret = GL_FALSE;
1103
1104 EVGL_FUNC_BEGIN();
1105 ret = glIsFramebuffer(framebuffer);
1106 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1107 goto finish;
1108
1109finish:
1110 EVGL_FUNC_END();
1111 return ret;
1112}
1113
1114GLboolean
1115evgl_glIsProgram(GLuint program)
1116{
1117 GLboolean ret;
1118 EVGL_FUNC_BEGIN();
1119 ret = glIsProgram(program);
1120 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1121 goto finish;
1122
1123finish:
1124 EVGL_FUNC_END();
1125 return ret;
1126}
1127
1128GLboolean
1129evgl_glIsRenderbuffer(GLuint renderbuffer)
1130{
1131 GLboolean ret;
1132 EVGL_FUNC_BEGIN();
1133 ret = glIsRenderbuffer(renderbuffer);
1134 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1135 goto finish;
1136
1137finish:
1138 EVGL_FUNC_END();
1139 return ret;
1140}
1141
1142GLboolean
1143evgl_glIsShader(GLuint shader)
1144{
1145 GLboolean ret;
1146 EVGL_FUNC_BEGIN();
1147 ret = glIsShader(shader);
1148 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1149 goto finish;
1150
1151finish:
1152 EVGL_FUNC_END();
1153 return ret;
1154}
1155
1156GLboolean
1157evgl_glIsTexture(GLuint texture)
1158{
1159 GLboolean ret;
1160 EVGL_FUNC_BEGIN();
1161 ret = glIsTexture(texture);
1162 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1163 goto finish;
1164
1165finish:
1166 EVGL_FUNC_END();
1167 return ret;
1168}
1169
1170void
1171evgl_glLineWidth(GLfloat width)
1172{
1173 EVGL_FUNC_BEGIN();
1174 glLineWidth(width);
1175 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1176 goto finish;
1177
1178finish:
1179 EVGL_FUNC_END();
1180}
1181
1182void
1183evgl_glLinkProgram(GLuint program)
1184{
1185 EVGL_FUNC_BEGIN();
1186 glLinkProgram(program);
1187 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1188 goto finish;
1189
1190finish:
1191 EVGL_FUNC_END();
1192}
1193
1194void
1195evgl_glPixelStorei(GLenum pname, GLint param)
1196{
1197 EVGL_FUNC_BEGIN();
1198 glPixelStorei(pname, param);
1199 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1200 goto finish;
1201
1202finish:
1203 EVGL_FUNC_END();
1204}
1205
1206void
1207evgl_glPolygonOffset(GLfloat factor, GLfloat units)
1208{
1209 EVGL_FUNC_BEGIN();
1210 glPolygonOffset(factor, units);
1211 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1212 goto finish;
1213
1214finish:
1215 EVGL_FUNC_END();
1216}
1217
1218#ifdef NO_DIRECT_RENDERING
1219void
1220evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
1221{
1222 EVGL_FUNC_BEGIN();
1223 glReadPixels(x, y, width, height, format, type, pixels);
1224 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1225 goto finish;
1226
1227finish:
1228 EVGL_FUNC_END();
1229}
1230#endif
1231
1232void
1233evgl_glReleaseShaderCompiler(void)
1234{
1235 EVGL_FUNC_BEGIN();
1236
1237#ifdef GL_GLES
1238 glReleaseShaderCompiler();
1239#else
1240#endif
1241
1242 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1243 goto finish;
1244
1245finish:
1246 EVGL_FUNC_END();
1247}
1248
1249void
1250evgl_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
1251{
1252 EVGL_FUNC_BEGIN();
1253 glRenderbufferStorage(target, internalformat, width, height);
1254 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1255 goto finish;
1256
1257finish:
1258 EVGL_FUNC_END();
1259}
1260
1261void
1262evgl_glSampleCoverage(GLclampf value, GLboolean invert)
1263{
1264 EVGL_FUNC_BEGIN();
1265 glSampleCoverage(value, invert);
1266 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1267 goto finish;
1268
1269finish:
1270 EVGL_FUNC_END();
1271}
1272
1273#ifdef NO_DIRECT_RENDERING
1274void
1275evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
1276{
1277 EVGL_FUNC_BEGIN();
1278 glScissor(x, y, width, height);
1279 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1280 goto finish;
1281
1282finish:
1283 EVGL_FUNC_END();
1284}
1285#endif
1286
1287void
1288evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
1289{
1290 EVGL_FUNC_BEGIN();
1291
1292#ifdef GL_GLES
1293 glShaderBinary(n, shaders, binaryformat, binary, length);
1294#else
1295 // FIXME: need to dlsym/getprocaddress for this
1296 ERR("Binary Shader is not supported here yet.");
1297 return;
1298 n = binaryformat = length = 0;
1299 shaders = binary = 0;
1300#endif
1301
1302 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1303 goto finish;
1304
1305finish:
1306 EVGL_FUNC_END();
1307}
1308
1309void
1310evgl_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
1311{
1312 EVGL_FUNC_BEGIN();
1313 glShaderSource(shader, count, string, length);
1314 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1315 goto finish;
1316
1317finish:
1318 EVGL_FUNC_END();
1319}
1320
1321void
1322evgl_glStencilFunc(GLenum func, GLint ref, GLuint mask)
1323{
1324 EVGL_FUNC_BEGIN();
1325 glStencilFunc(func, ref, mask);
1326 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1327 goto finish;
1328
1329finish:
1330 EVGL_FUNC_END();
1331}
1332
1333void
1334evgl_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
1335{
1336 EVGL_FUNC_BEGIN();
1337 glStencilFuncSeparate(face, func, ref, mask);
1338 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1339 goto finish;
1340
1341finish:
1342 EVGL_FUNC_END();
1343}
1344
1345void
1346evgl_glStencilMask(GLuint mask)
1347{
1348 EVGL_FUNC_BEGIN();
1349 glStencilMask(mask);
1350 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1351 goto finish;
1352
1353finish:
1354 EVGL_FUNC_END();
1355}
1356
1357void
1358evgl_glStencilMaskSeparate(GLenum face, GLuint mask)
1359{
1360 EVGL_FUNC_BEGIN();
1361 glStencilMaskSeparate(face, mask);
1362 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1363 goto finish;
1364
1365finish:
1366 EVGL_FUNC_END();
1367}
1368
1369void
1370evgl_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
1371{
1372 EVGL_FUNC_BEGIN();
1373 glStencilOp(fail, zfail, zpass);
1374 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1375 goto finish;
1376
1377finish:
1378 EVGL_FUNC_END();
1379}
1380
1381void
1382evgl_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
1383{
1384 EVGL_FUNC_BEGIN();
1385 glStencilOpSeparate(face, fail, zfail, zpass);
1386 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1387 goto finish;
1388
1389finish:
1390 EVGL_FUNC_END();
1391}
1392
1393void
1394evgl_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
1395{
1396 EVGL_FUNC_BEGIN();
1397 glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
1398 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1399 goto finish;
1400
1401finish:
1402 EVGL_FUNC_END();
1403}
1404
1405void
1406evgl_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
1407{
1408 EVGL_FUNC_BEGIN();
1409 glTexParameterf(target, pname, param);
1410 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1411 goto finish;
1412
1413finish:
1414 EVGL_FUNC_END();
1415}
1416
1417void
1418evgl_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
1419{
1420 EVGL_FUNC_BEGIN();
1421 glTexParameterfv(target, pname, params);
1422 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1423 goto finish;
1424
1425finish:
1426 EVGL_FUNC_END();
1427}
1428
1429void
1430evgl_glTexParameteri(GLenum target, GLenum pname, GLint param)
1431{
1432 EVGL_FUNC_BEGIN();
1433 glTexParameteri(target, pname, param);
1434 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1435 goto finish;
1436
1437finish:
1438 EVGL_FUNC_END();
1439}
1440
1441void
1442evgl_glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
1443{
1444 EVGL_FUNC_BEGIN();
1445 glTexParameteriv(target, pname, params);
1446 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1447 goto finish;
1448
1449finish:
1450 EVGL_FUNC_END();
1451}
1452
1453void
1454evgl_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
1455{
1456 EVGL_FUNC_BEGIN();
1457 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
1458 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1459 goto finish;
1460
1461finish:
1462 EVGL_FUNC_END();
1463}
1464
1465void
1466evgl_glUniform1f(GLint location, GLfloat x)
1467{
1468 EVGL_FUNC_BEGIN();
1469 glUniform1f(location, x);
1470 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1471 goto finish;
1472
1473finish:
1474 EVGL_FUNC_END();
1475}
1476
1477void
1478evgl_glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
1479{
1480 EVGL_FUNC_BEGIN();
1481 glUniform1fv(location, count, v);
1482 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1483 goto finish;
1484
1485finish:
1486 EVGL_FUNC_END();
1487}
1488
1489void
1490evgl_glUniform1i(GLint location, GLint x)
1491{
1492 EVGL_FUNC_BEGIN();
1493 glUniform1i(location, x);
1494 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1495 goto finish;
1496
1497finish:
1498 EVGL_FUNC_END();
1499}
1500
1501void
1502evgl_glUniform1iv(GLint location, GLsizei count, const GLint* v)
1503{
1504 EVGL_FUNC_BEGIN();
1505 glUniform1iv(location, count, v);
1506 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1507 goto finish;
1508
1509finish:
1510 EVGL_FUNC_END();
1511}
1512
1513void
1514evgl_glUniform2f(GLint location, GLfloat x, GLfloat y)
1515{
1516 EVGL_FUNC_BEGIN();
1517 glUniform2f(location, x, y);
1518 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1519 goto finish;
1520
1521finish:
1522 EVGL_FUNC_END();
1523}
1524
1525void
1526evgl_glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
1527{
1528 EVGL_FUNC_BEGIN();
1529 glUniform2fv(location, count, v);
1530 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1531 goto finish;
1532
1533finish:
1534 EVGL_FUNC_END();
1535}
1536
1537void
1538evgl_glUniform2i(GLint location, GLint x, GLint y)
1539{
1540 EVGL_FUNC_BEGIN();
1541 glUniform2i(location, x, y);
1542 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1543 goto finish;
1544
1545finish:
1546 EVGL_FUNC_END();
1547}
1548
1549void
1550evgl_glUniform2iv(GLint location, GLsizei count, const GLint* v)
1551{
1552 EVGL_FUNC_BEGIN();
1553 glUniform2iv(location, count, v);
1554 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1555 goto finish;
1556
1557finish:
1558 EVGL_FUNC_END();
1559}
1560
1561void
1562evgl_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
1563{
1564 EVGL_FUNC_BEGIN();
1565 glUniform3f(location, x, y, z);
1566 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1567 goto finish;
1568
1569finish:
1570 EVGL_FUNC_END();
1571}
1572
1573void
1574evgl_glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
1575{
1576 EVGL_FUNC_BEGIN();
1577 glUniform3fv(location, count, v);
1578 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1579 goto finish;
1580
1581finish:
1582 EVGL_FUNC_END();
1583}
1584
1585void
1586evgl_glUniform3i(GLint location, GLint x, GLint y, GLint z)
1587{
1588 EVGL_FUNC_BEGIN();
1589 glUniform3i(location, x, y, z);
1590 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1591 goto finish;
1592
1593finish:
1594 EVGL_FUNC_END();
1595}
1596
1597void
1598evgl_glUniform3iv(GLint location, GLsizei count, const GLint* v)
1599{
1600 EVGL_FUNC_BEGIN();
1601 glUniform3iv(location, count, v);
1602 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1603 goto finish;
1604
1605finish:
1606 EVGL_FUNC_END();
1607}
1608
1609void
1610evgl_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1611{
1612 EVGL_FUNC_BEGIN();
1613 glUniform4f(location, x, y, z, w);
1614 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1615 goto finish;
1616
1617finish:
1618 EVGL_FUNC_END();
1619}
1620
1621void
1622evgl_glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
1623{
1624 EVGL_FUNC_BEGIN();
1625 glUniform4fv(location, count, v);
1626 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1627 goto finish;
1628
1629finish:
1630 EVGL_FUNC_END();
1631}
1632
1633void
1634evgl_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
1635{
1636 EVGL_FUNC_BEGIN();
1637 glUniform4i(location, x, y, z, w);
1638 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1639 goto finish;
1640
1641finish:
1642 EVGL_FUNC_END();
1643}
1644
1645void
1646evgl_glUniform4iv(GLint location, GLsizei count, const GLint* v)
1647{
1648 EVGL_FUNC_BEGIN();
1649 glUniform4iv(location, count, v);
1650 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1651 goto finish;
1652
1653finish:
1654 EVGL_FUNC_END();
1655}
1656
1657void
1658evgl_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1659{
1660 EVGL_FUNC_BEGIN();
1661 glUniformMatrix2fv(location, count, transpose, value);
1662 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1663 goto finish;
1664
1665finish:
1666 EVGL_FUNC_END();
1667}
1668
1669void
1670evgl_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1671{
1672 EVGL_FUNC_BEGIN();
1673 glUniformMatrix3fv(location, count, transpose, value);
1674 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1675 goto finish;
1676
1677finish:
1678 EVGL_FUNC_END();
1679}
1680
1681void
1682evgl_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1683{
1684 EVGL_FUNC_BEGIN();
1685 glUniformMatrix4fv(location, count, transpose, value);
1686 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1687 goto finish;
1688
1689finish:
1690 EVGL_FUNC_END();
1691}
1692
1693void
1694evgl_glUseProgram(GLuint program)
1695{
1696 EVGL_FUNC_BEGIN();
1697 glUseProgram(program);
1698 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1699 goto finish;
1700
1701finish:
1702 EVGL_FUNC_END();
1703}
1704
1705void
1706evgl_glValidateProgram(GLuint program)
1707{
1708 EVGL_FUNC_BEGIN();
1709 glValidateProgram(program);
1710 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1711 goto finish;
1712
1713finish:
1714 EVGL_FUNC_END();
1715}
1716
1717void
1718evgl_glVertexAttrib1f(GLuint indx, GLfloat x)
1719{
1720 EVGL_FUNC_BEGIN();
1721 glVertexAttrib1f(indx, x);
1722 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1723 goto finish;
1724
1725finish:
1726 EVGL_FUNC_END();
1727}
1728
1729void
1730evgl_glVertexAttrib1fv(GLuint indx, const GLfloat* values)
1731{
1732 EVGL_FUNC_BEGIN();
1733 glVertexAttrib1fv(indx, values);
1734 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1735 goto finish;
1736
1737finish:
1738 EVGL_FUNC_END();
1739}
1740
1741void
1742evgl_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
1743{
1744 EVGL_FUNC_BEGIN();
1745 glVertexAttrib2f(indx, x, y);
1746 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1747 goto finish;
1748
1749finish:
1750 EVGL_FUNC_END();
1751}
1752
1753void
1754evgl_glVertexAttrib2fv(GLuint indx, const GLfloat* values)
1755{
1756 EVGL_FUNC_BEGIN();
1757 glVertexAttrib2fv(indx, values);
1758 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1759 goto finish;
1760
1761finish:
1762 EVGL_FUNC_END();
1763}
1764
1765void
1766evgl_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
1767{
1768 EVGL_FUNC_BEGIN();
1769 glVertexAttrib3f(indx, x, y, z);
1770 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1771 goto finish;
1772
1773finish:
1774 EVGL_FUNC_END();
1775}
1776
1777void
1778evgl_glVertexAttrib3fv(GLuint indx, const GLfloat* values)
1779{
1780 EVGL_FUNC_BEGIN();
1781 glVertexAttrib3fv(indx, values);
1782 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1783 goto finish;
1784
1785finish:
1786 EVGL_FUNC_END();
1787}
1788
1789void
1790evgl_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1791{
1792 EVGL_FUNC_BEGIN();
1793 glVertexAttrib4f(indx, x, y, z, w);
1794 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1795 goto finish;
1796
1797finish:
1798 EVGL_FUNC_END();
1799}
1800
1801void
1802evgl_glVertexAttrib4fv(GLuint indx, const GLfloat* values)
1803{
1804 EVGL_FUNC_BEGIN();
1805 glVertexAttrib4fv(indx, values);
1806 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1807 goto finish;
1808
1809finish:
1810 EVGL_FUNC_END();
1811}
1812
1813void
1814evgl_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
1815{
1816 EVGL_FUNC_BEGIN();
1817 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
1818 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1819 goto finish;
1820
1821finish:
1822 EVGL_FUNC_END();
1823}
1824
1825#ifdef NO_DIRECT_RENDERING
1826void
1827evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
1828{
1829 EVGL_FUNC_BEGIN();
1830 glViewport(x, y, width, height);
1831 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1832 goto finish;
1833
1834finish:
1835 EVGL_FUNC_END();
1836}
1837#endif
1838
1839//-------------------------------------------------------------//
1840// Calls for stripping precision string in the shader
1841#if 0
1842
1843static const char *
1844opengl_strtok(const char *s, int *n, char **saveptr, char *prevbuf)
1845{
1846 char *start;
1847 char *ret;
1848 char *p;
1849 int retlen;
1850 static const char *delim = " \t\n\r/";
1851
1852 if (prevbuf)
1853 free(prevbuf);
1854
1855 if (s)
1856 {
1857 *saveptr = s;
1858 }
1859 else
1860 {
1861 if (!(*saveptr) || !(*n))
1862 return NULL;
1863 s = *saveptr;
1864 }
1865
1866 for (; *n && strchr(delim, *s); s++, (*n)--)
1867 {
1868 if (*s == '/' && *n > 1)
1869 {
1870 if (s[1] == '/')
1871 {
1872 do {
1873 s++, (*n)--;
1874 } while (*n > 1 && s[1] != '\n' && s[1] != '\r');
1875 }
1876 else if (s[1] == '*')
1877 {
1878 do {
1879 s++, (*n)--;
1880 } while (*n > 2 && (s[1] != '*' || s[2] != '/'));
1881 s++, (*n)--;
1882 s++, (*n)--;
1883 if (*n == 0)
1884 {
1885 break;
1886 }
1887 }
1888 else
1889 {
1890 break;
1891 }
1892 }
1893 }
1894
1895 start = s;
1896 for (; *n && *s && !strchr(delim, *s); s++, (*n)--);
1897 if (*n > 0)
1898 s++, (*n)--;
1899
1900 *saveptr = s;
1901
1902 retlen = s - start;
1903 ret = malloc(retlen + 1);
1904 p = ret;
1905
1906 if (retlen == 0)
1907 {
1908 *p = 0;
1909 return;
1910 }
1911
1912 while (retlen > 0)
1913 {
1914 if (*start == '/' && retlen > 1)
1915 {
1916 if (start[1] == '/')
1917 {
1918 do {
1919 start++, retlen--;
1920 } while (retlen > 1 && start[1] != '\n' && start[1] != '\r');
1921 start++, retlen--;
1922 continue;
1923 } else if (start[1] == '*')
1924 {
1925 do {
1926 start++, retlen--;
1927 } while (retlen > 2 && (start[1] != '*' || start[2] != '/'));
1928 start += 3, retlen -= 3;
1929 continue;
1930 }
1931 }
1932 *(p++) = *(start++), retlen--;
1933 }
1934
1935 *p = 0;
1936 return ret;
1937}
1938
1939static char *
1940do_eglShaderPatch(const char *source, int length, int *patched_len)
1941{
1942 char *saveptr = NULL;
1943 char *sp;
1944 char *p = NULL;
1945
1946 if (!length) length = strlen(source);
1947
1948 *patched_len = 0;
1949 int patched_size = length;
1950 char *patched = malloc(patched_size + 1);
1951
1952 if (!patched) return NULL;
1953
1954 p = opengl_strtok(source, &length, &saveptr, NULL);
1955
1956 for (; p; p = opengl_strtok(0, &length, &saveptr, p))
1957 {
1958 if (!strncmp(p, "lowp", 4) || !strncmp(p, "mediump", 7) || !strncmp(p, "highp", 5))
1959 {
1960 continue;
1961 }
1962 else if (!strncmp(p, "precision", 9))
1963 {
1964 while ((p = opengl_strtok(0, &length, &saveptr, p)) && !strchr(p, ';'));
1965 }
1966 else
1967 {
1968 if (!strncmp(p, "gl_MaxVertexUniformVectors", 26))
1969 {
1970 p = "(gl_MaxVertexUniformComponents / 4)";
1971 }
1972 else if (!strncmp(p, "gl_MaxFragmentUniformVectors", 28))
1973 {
1974 p = "(gl_MaxFragmentUniformComponents / 4)";
1975 }
1976 else if (!strncmp(p, "gl_MaxVaryingVectors", 20))
1977 {
1978 p = "(gl_MaxVaryingFloats / 4)";
1979 }
1980
1981 int new_len = strlen(p);
1982 if (*patched_len + new_len > patched_size)
1983 {
1984 patched_size *= 2;
1985 patched = realloc(patched, patched_size + 1);
1986
1987 if (!patched) return NULL;
1988 }
1989
1990 memcpy(patched + *patched_len, p, new_len);
1991 *patched_len += new_len;
1992 }
1993 }
1994
1995 patched[*patched_len] = 0;
1996 /* check that we don't leave dummy preprocessor lines */
1997 for (sp = patched; *sp;)
1998 {
1999 for (; *sp == ' ' || *sp == '\t'; sp++);
2000 if (!strncmp(sp, "#define", 7))
2001 {
2002 for (p = sp + 7; *p == ' ' || *p == '\t'; p++);
2003 if (*p == '\n' || *p == '\r' || *p == '/')
2004 {
2005 memset(sp, 0x20, 7);
2006 }
2007 }
2008 for (; *sp && *sp != '\n' && *sp != '\r'; sp++);
2009 for (; *sp == '\n' || *sp == '\r'; sp++);
2010 }
2011 return patched;
2012}
2013
2014static int
2015shadersrc_gles_to_gl(GLsizei count, const char** string, char **s, const GLint* length, GLint *l)
2016{
2017 int i;
2018
2019 for(i = 0; i < count; ++i) {
2020 GLint len;
2021 if(length) {
2022 len = length[i];
2023 if (len < 0)
2024 len = string[i] ? strlen(string[i]) : 0;
2025 } else
2026 len = string[i] ? strlen(string[i]) : 0;
2027
2028 if(string[i]) {
2029 s[i] = do_eglShaderPatch(string[i], len, &l[i]);
2030 if(!s[i]) {
2031 while(i)
2032 free(s[--i]);
2033
2034 free(l);
2035 free(s);
2036 return -1;
2037 }
2038 } else {
2039 s[i] = NULL;
2040 l[i] = 0;
2041 }
2042 }
2043
2044 return 0;
2045}
2046
2047
2048void
2049evgl_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
2050{
2051 EVGL_FUNC_BEGIN();
2052
2053#ifdef GL_GLES
2054 glShaderSource(shader, count, string, length);
2055 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2056 goto finish;
2057#else
2058 //GET_EXT_PTR(void, glShaderSource, (int, int, char **, void *));
2059 int size = count;
2060 int i;
2061 int acc_length = 0;
2062 GLchar **tab_prog = malloc(size * sizeof(GLchar *));
2063 int *tab_length = (int *) length;
2064
2065 char **tab_prog_new;
2066 GLint *tab_length_new;
2067
2068 tab_prog_new = malloc(count* sizeof(char*));
2069 tab_length_new = malloc(count* sizeof(GLint));
2070
2071 memset(tab_prog_new, 0, count * sizeof(char*));
2072 memset(tab_length_new, 0, count * sizeof(GLint));
2073
2074 for (i = 0; i < size; i++) {
2075 tab_prog[i] = ((GLchar *) string) + acc_length;
2076 acc_length += tab_length[i];
2077 }
2078
2079 shadersrc_gles_to_gl(count, tab_prog, tab_prog_new, tab_length, tab_length_new);
2080
2081 if (!tab_prog_new || !tab_length_new)
2082 ERR("Error allocating memory for shader string manipulation.");
2083
2084 glShaderSource(shader, count, tab_prog_new, tab_length_new);
2085 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2086
2087 for (i = 0; i < count; i++)
2088 free(tab_prog_new[i]);
2089 free(tab_prog_new);
2090 free(tab_length_new);
2091
2092 free(tab_prog);
2093#endif
2094
2095finish:
2096 EVGL_FUNC_END();
2097}
2098#endif
2099
2100//-------------------------------------------------------------//
2101
2102
2103//-------------------------------------------------------------//
2104// Calls related to Evas GL Direct Rendering
2105//-------------------------------------------------------------//
2106
2107// Transform from Evas Coordinat to GL Coordinate
2108// returns: oc[4] original image object dimension in gl coord
2109// returns: nc[4] tranformed (x, y, width, heigth) in gl coord
2110static void
2111compute_gl_coordinates(Evas_Object *obj, int rot, int clip,
2112 int x, int y, int width, int height,
2113 int imgc[4], int objc[4])
2114{
2115 if (rot == 0)
2116 {
2117 // oringinal image object coordinate in gl coordinate
2118 imgc[0] = obj->cur.geometry.x;
2119 imgc[1] = obj->layer->evas->output.h - obj->cur.geometry.y - obj->cur.geometry.h;
2120 imgc[2] = imgc[0] + obj->cur.geometry.w;
2121 imgc[3] = imgc[1] + obj->cur.geometry.h;
2122
2123 // transformed (x,y,width,height) in gl coordinate
2124 objc[0] = imgc[0] + x;
2125 objc[1] = imgc[1] + y;
2126 objc[2] = objc[0] + width;
2127 objc[3] = objc[1] + height;
2128 }
2129 else if (rot == 180)
2130 {
2131 // oringinal image object coordinate in gl coordinate
2132 imgc[0] = obj->layer->evas->output.w - obj->cur.geometry.x - obj->cur.geometry.w;
2133 imgc[1] = obj->cur.geometry.y;
2134 imgc[2] = imgc[0] + obj->cur.geometry.w;
2135 imgc[3] = imgc[1] + obj->cur.geometry.h;
2136
2137 // transformed (x,y,width,height) in gl coordinate
2138 objc[0] = imgc[0] + obj->cur.geometry.w - x - width;
2139 objc[1] = imgc[1] + obj->cur.geometry.h - y - height;
2140 objc[2] = objc[0] + width;
2141 objc[3] = objc[1] + height;
2142
2143 }
2144 else if (rot == 90)
2145 {
2146 // oringinal image object coordinate in gl coordinate
2147 imgc[0] = obj->cur.geometry.y;
2148 imgc[1] = obj->cur.geometry.x;
2149 imgc[2] = imgc[0] + obj->cur.geometry.h;
2150 imgc[3] = imgc[1] + obj->cur.geometry.w;
2151
2152 // transformed (x,y,width,height) in gl coordinate
2153 objc[0] = imgc[0] + obj->cur.geometry.h - y - height;
2154 objc[1] = imgc[1] + x;
2155 objc[2] = objc[0] + height;
2156 objc[3] = objc[1] + width;
2157 }
2158 else if (rot == 270)
2159 {
2160 // oringinal image object coordinate in gl coordinate
2161 imgc[0] = obj->layer->evas->output.h - obj->cur.geometry.y - obj->cur.geometry.h;
2162 imgc[1] = obj->layer->evas->output.w - obj->cur.geometry.x - obj->cur.geometry.w;
2163 imgc[2] = imgc[0] + obj->cur.geometry.h;
2164 imgc[3] = imgc[1] + obj->cur.geometry.w;
2165
2166 // transformed (x,y,width,height) in gl coordinate
2167 objc[0] = imgc[0] + y;
2168 objc[1] = imgc[1] + obj->cur.geometry.w - x - width;
2169 objc[2] = objc[0] + height;
2170 objc[3] = objc[1] + width;
2171 }
2172 else
2173 {
2174 ERR("Invalid rotation angle %d.", rot);
2175 return;
2176 }
2177
2178 if (clip)
2179 {
2180 // Clip against original image object
2181 if (objc[0] < imgc[0]) objc[0] = imgc[0];
2182 if (objc[0] > imgc[2]) objc[0] = 0;
2183
2184 if (objc[1] < imgc[1]) objc[1] = imgc[1];
2185 if (objc[1] > imgc[3]) objc[1] = 0;
2186
2187 if (objc[2] < imgc[0]) objc[0] = 0;
2188 if (objc[2] > imgc[2]) objc[2] = imgc[2];
2189
2190 if (objc[3] < imgc[1]) objc[1] = 0;
2191 if (objc[3] > imgc[3]) objc[3] = imgc[3];
2192 }
2193
2194 imgc[2] = imgc[2]-imgc[0]; // width
2195 imgc[3] = imgc[3]-imgc[1]; // height
2196
2197 objc[2] = objc[2]-objc[0]; // width
2198 objc[3] = objc[3]-objc[1]; // height
2199}
2200
2201static void
2202evgl_glClear(GLbitfield mask)
2203{
2204 EVGL_Engine *ee = evgl_engine;
2205 EVGL_Resource *rsc;
2206 EVGL_Context *ctx;
2207 Evas_Object *img;
2208 int rot = 0;
2209 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2210
2211 EVGL_FUNC_BEGIN();
2212
2213 if (!(rsc=_evgl_tls_resource_get(ee)))
2214 {
2215 ERR("Unable to execute GL command. Error retrieving tls");
2216 return;
2217 }
2218
2219 ctx = rsc->current_ctx;
2220 if (!ctx)
2221 {
2222 ERR("Unable to retrive Current Context");
2223 return;
2224 }
2225
2226 if (evgl_direct_enabled(evgl_engine))
2227 {
2228 if (!(rsc->current_ctx->current_fbo))
2229 {
2230 if ((!ctx->direct_scissor))
2231 {
2232 glEnable(GL_SCISSOR_TEST);
2233 ctx->direct_scissor = 1;
2234 }
2235
2236 img = rsc->direct_img_obj;
2237 rot = ee->funcs->rotation_angle_get(ee->engine_data);
2238
2239 compute_gl_coordinates(img, rot, 0, 0, 0, 0, 0, oc, nc);
2240
2241
2242 if ((ctx->scissor_upated) && (ctx->scissor_enabled))
2243 {
2244 glScissor(ctx->scissor_coord[0], ctx->scissor_coord[1],
2245 ctx->scissor_coord[2], ctx->scissor_coord[3]);
2246 ctx->direct_scissor = 0;
2247 }
2248 else
2249 glScissor(oc[0], oc[1], oc[2], oc[3]);
2250
2251 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2252
2253 glClear(mask);
2254 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2255 }
2256 else
2257 {
2258 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2259 {
2260 glDisable(GL_SCISSOR_TEST);
2261 ctx->direct_scissor = 0;
2262 }
2263
2264 glClear(mask);
2265 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2266 }
2267 }
2268 else
2269 {
2270 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2271 {
2272 glDisable(GL_SCISSOR_TEST);
2273 ctx->direct_scissor = 0;
2274 }
2275
2276 glClear(mask);
2277 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2278 }
2279 goto finish;
2280
2281finish:
2282 EVGL_FUNC_END();
2283}
2284
2285static void
2286evgl_glEnable(GLenum cap)
2287{
2288 EVGL_Context *ctx;
2289
2290 EVGL_FUNC_BEGIN();
2291
2292 ctx = _evgl_current_context_get();
2293
2294 if (cap == GL_SCISSOR_TEST)
2295 if (ctx) ctx->scissor_enabled = 1;
2296 glEnable(cap);
2297 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2298 goto finish;
2299
2300finish:
2301 EVGL_FUNC_END();
2302}
2303
2304static void
2305evgl_glDisable(GLenum cap)
2306{
2307 EVGL_Context *ctx;
2308
2309 EVGL_FUNC_BEGIN();
2310
2311 ctx = _evgl_current_context_get();
2312
2313 if (cap == GL_SCISSOR_TEST)
2314 if (ctx) ctx->scissor_enabled = 0;
2315 glDisable(cap);
2316 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2317 goto finish;
2318
2319finish:
2320 EVGL_FUNC_END();
2321}
2322
2323
2324static void
2325evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
2326{
2327 EVGL_Engine *ee = evgl_engine;
2328 EVGL_Resource *rsc;
2329 EVGL_Context *ctx;
2330 Evas_Object *img;
2331 int rot = 0;
2332 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2333
2334 EVGL_FUNC_BEGIN();
2335
2336 if (!(rsc=_evgl_tls_resource_get(ee)))
2337 {
2338 ERR("Unable to execute GL command. Error retrieving tls");
2339 return;
2340 }
2341
2342 ctx = rsc->current_ctx;
2343 if (!ctx)
2344 {
2345 ERR("Unable to retrive Current Context");
2346 return;
2347 }
2348
2349 if (evgl_direct_enabled(evgl_engine))
2350 {
2351
2352 if (!(rsc->current_ctx->current_fbo))
2353 {
2354 img = rsc->direct_img_obj;
2355 rot = ee->funcs->rotation_angle_get(ee->engine_data);
2356
2357 compute_gl_coordinates(img, rot, 1, x, y, width, height, oc, nc);
2358 glReadPixels(nc[0], nc[1], nc[2], nc[3], format, type, pixels);
2359 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2360 }
2361 else
2362 {
2363 glReadPixels(x, y, width, height, format, type, pixels);
2364 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2365 }
2366 }
2367 else
2368 {
2369 glReadPixels(x, y, width, height, format, type, pixels);
2370 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2371 }
2372 goto finish;
2373
2374finish:
2375 EVGL_FUNC_END();
2376}
2377
2378static void
2379evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
2380{
2381 EVGL_Engine *ee = evgl_engine;
2382 EVGL_Resource *rsc;
2383 EVGL_Context *ctx;
2384 Evas_Object *img;
2385 int rot = 0;
2386 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2387
2388 EVGL_FUNC_BEGIN();
2389
2390 if (!(rsc=_evgl_tls_resource_get(ee)))
2391 {
2392 ERR("Unable to execute GL command. Error retrieving tls");
2393 return;
2394 }
2395
2396 ctx = rsc->current_ctx;
2397 if (!ctx)
2398 {
2399 ERR("Unable to retrive Current Context");
2400 return;
2401 }
2402
2403 if (evgl_direct_enabled(evgl_engine))
2404 {
2405 if (!(rsc->current_ctx->current_fbo))
2406 {
2407 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2408 {
2409 glDisable(GL_SCISSOR_TEST);
2410 }
2411
2412 img = rsc->direct_img_obj;
2413 rot = ee->funcs->rotation_angle_get(ee->engine_data);
2414
2415 compute_gl_coordinates(img, rot, 1, x, y, width, height, oc, nc);
2416 glScissor(nc[0], nc[1], nc[2], nc[3]);
2417
2418 // Update coordinates
2419 ctx->scissor_coord[0] = nc[0];
2420 ctx->scissor_coord[1] = nc[1];
2421 ctx->scissor_coord[2] = nc[2];
2422 ctx->scissor_coord[3] = nc[3];
2423
2424 ctx->direct_scissor = 0;
2425
2426 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2427 // Check....!!!!
2428 ctx->scissor_upated = 1;
2429 }
2430 else
2431 {
2432 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2433 {
2434 glDisable(GL_SCISSOR_TEST);
2435 ctx->direct_scissor = 0;
2436 }
2437
2438 glScissor(x, y, width, height);
2439 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2440
2441 ctx->scissor_upated = 0;
2442 }
2443 }
2444 else
2445 {
2446 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2447 {
2448 glDisable(GL_SCISSOR_TEST);
2449 ctx->direct_scissor = 0;
2450 }
2451
2452 glScissor(x, y, width, height);
2453 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2454 }
2455 goto finish;
2456
2457finish:
2458 EVGL_FUNC_END();
2459}
2460
2461static void
2462evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
2463{
2464 EVGL_Engine *ee = evgl_engine;
2465 EVGL_Resource *rsc;
2466 EVGL_Context *ctx;
2467 Evas_Object *img;
2468 int rot = 0;
2469 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2470
2471 if (!(rsc=_evgl_tls_resource_get(ee)))
2472 {
2473 ERR("Unable to execute GL command. Error retrieving tls");
2474 return;
2475 }
2476
2477 ctx = rsc->current_ctx;
2478 if (!ctx)
2479 {
2480 ERR("Unable to retrive Current Context");
2481 return;
2482 }
2483
2484 if (evgl_direct_enabled(evgl_engine))
2485 {
2486 if (!(rsc->current_ctx->current_fbo))
2487 {
2488 if ((!ctx->direct_scissor))
2489 {
2490 glEnable(GL_SCISSOR_TEST);
2491 ctx->direct_scissor = 1;
2492 }
2493
2494 img = rsc->direct_img_obj;
2495 rot = ee->funcs->rotation_angle_get(ee->engine_data);
2496
2497 compute_gl_coordinates(img, rot, 0, x, y, width, height, oc, nc);
2498
2499 if ((ctx->scissor_upated) && (ctx->scissor_enabled))
2500 {
2501 glScissor(ctx->scissor_coord[0], ctx->scissor_coord[1],
2502 ctx->scissor_coord[2], ctx->scissor_coord[3]);
2503 ctx->direct_scissor = 0;
2504 }
2505 else
2506 glScissor(oc[0], oc[1], oc[2], oc[3]);
2507
2508 glViewport(nc[0], nc[1], nc[2], nc[3]);
2509 }
2510 else
2511 {
2512 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2513 {
2514 glDisable(GL_SCISSOR_TEST);
2515 ctx->direct_scissor = 0;
2516 }
2517
2518 glViewport(x, y, width, height);
2519 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2520 }
2521 }
2522 else
2523 {
2524 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2525 {
2526 glDisable(GL_SCISSOR_TEST);
2527 ctx->direct_scissor = 0;
2528 }
2529
2530 glViewport(x, y, width, height);
2531 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2532 }
2533 goto finish;
2534
2535finish:
2536 EVGL_FUNC_END();
2537}
2538//-------------------------------------------------------------//
2539
2540
2541
2542void
2543_evgl_api_get(Evas_GL_API *funcs)
2544{
2545 funcs->version = EVAS_GL_API_VERSION;
2546
2547#define ORD(f) EVAS_API_OVERRIDE(f, funcs, evgl_)
2548 // GLES 2.0
2549 ORD(glActiveTexture);
2550 ORD(glAttachShader);
2551 ORD(glBindAttribLocation);
2552 ORD(glBindBuffer);
2553 ORD(glBindTexture);
2554 ORD(glBlendColor);
2555 ORD(glBlendEquation);
2556 ORD(glBlendEquationSeparate);
2557 ORD(glBlendFunc);
2558 ORD(glBlendFuncSeparate);
2559 ORD(glBufferData);
2560 ORD(glBufferSubData);
2561 ORD(glCheckFramebufferStatus);
2562 ORD(glClear);
2563 ORD(glClearColor);
2564 ORD(glClearDepthf);
2565 ORD(glClearStencil);
2566 ORD(glColorMask);
2567 ORD(glCompileShader);
2568 ORD(glCompressedTexImage2D);
2569 ORD(glCompressedTexSubImage2D);
2570 ORD(glCopyTexImage2D);
2571 ORD(glCopyTexSubImage2D);
2572 ORD(glCreateProgram);
2573 ORD(glCreateShader);
2574 ORD(glCullFace);
2575 ORD(glDeleteBuffers);
2576 ORD(glDeleteFramebuffers);
2577 ORD(glDeleteProgram);
2578 ORD(glDeleteRenderbuffers);
2579 ORD(glDeleteShader);
2580 ORD(glDeleteTextures);
2581 ORD(glDepthFunc);
2582 ORD(glDepthMask);
2583 ORD(glDepthRangef);
2584 ORD(glDetachShader);
2585 ORD(glDisable);
2586 ORD(glDisableVertexAttribArray);
2587 ORD(glDrawArrays);
2588 ORD(glDrawElements);
2589 ORD(glEnable);
2590 ORD(glEnableVertexAttribArray);
2591 ORD(glFinish);
2592 ORD(glFlush);
2593 ORD(glFramebufferRenderbuffer);
2594 ORD(glFramebufferTexture2D);
2595 ORD(glFrontFace);
2596 ORD(glGenBuffers);
2597 ORD(glGenerateMipmap);
2598 ORD(glGenFramebuffers);
2599 ORD(glGenRenderbuffers);
2600 ORD(glGenTextures);
2601 ORD(glGetActiveAttrib);
2602 ORD(glGetActiveUniform);
2603 ORD(glGetAttachedShaders);
2604 ORD(glGetAttribLocation);
2605 ORD(glGetBooleanv);
2606 ORD(glGetBufferParameteriv);
2607 ORD(glGetError);
2608 ORD(glGetFloatv);
2609 ORD(glGetFramebufferAttachmentParameteriv);
2610 ORD(glGetIntegerv);
2611 ORD(glGetProgramiv);
2612 ORD(glGetProgramInfoLog);
2613 ORD(glGetRenderbufferParameteriv);
2614 ORD(glGetShaderiv);
2615 ORD(glGetShaderInfoLog);
2616 ORD(glGetShaderPrecisionFormat);
2617 ORD(glGetShaderSource);
2618 ORD(glGetString);
2619 ORD(glGetTexParameterfv);
2620 ORD(glGetTexParameteriv);
2621 ORD(glGetUniformfv);
2622 ORD(glGetUniformiv);
2623 ORD(glGetUniformLocation);
2624 ORD(glGetVertexAttribfv);
2625 ORD(glGetVertexAttribiv);
2626 ORD(glGetVertexAttribPointerv);
2627 ORD(glHint);
2628 ORD(glIsBuffer);
2629 ORD(glIsEnabled);
2630 ORD(glIsFramebuffer);
2631 ORD(glIsProgram);
2632 ORD(glIsRenderbuffer);
2633 ORD(glIsShader);
2634 ORD(glIsTexture);
2635 ORD(glLineWidth);
2636 ORD(glLinkProgram);
2637 ORD(glPixelStorei);
2638 ORD(glPolygonOffset);
2639 ORD(glReadPixels);
2640 ORD(glReleaseShaderCompiler);
2641 ORD(glRenderbufferStorage);
2642 ORD(glSampleCoverage);
2643 ORD(glScissor);
2644 ORD(glShaderBinary);
2645 ORD(glShaderSource);
2646 ORD(glStencilFunc);
2647 ORD(glStencilFuncSeparate);
2648 ORD(glStencilMask);
2649 ORD(glStencilMaskSeparate);
2650 ORD(glStencilOp);
2651 ORD(glStencilOpSeparate);
2652 ORD(glTexImage2D);
2653 ORD(glTexParameterf);
2654 ORD(glTexParameterfv);
2655 ORD(glTexParameteri);
2656 ORD(glTexParameteriv);
2657 ORD(glTexSubImage2D);
2658 ORD(glUniform1f);
2659 ORD(glUniform1fv);
2660 ORD(glUniform1i);
2661 ORD(glUniform1iv);
2662 ORD(glUniform2f);
2663 ORD(glUniform2fv);
2664 ORD(glUniform2i);
2665 ORD(glUniform2iv);
2666 ORD(glUniform3f);
2667 ORD(glUniform3fv);
2668 ORD(glUniform3i);
2669 ORD(glUniform3iv);
2670 ORD(glUniform4f);
2671 ORD(glUniform4fv);
2672 ORD(glUniform4i);
2673 ORD(glUniform4iv);
2674 ORD(glUniformMatrix2fv);
2675 ORD(glUniformMatrix3fv);
2676 ORD(glUniformMatrix4fv);
2677 ORD(glUseProgram);
2678 ORD(glValidateProgram);
2679 ORD(glVertexAttrib1f);
2680 ORD(glVertexAttrib1fv);
2681 ORD(glVertexAttrib2f);
2682 ORD(glVertexAttrib2fv);
2683 ORD(glVertexAttrib3f);
2684 ORD(glVertexAttrib3fv);
2685 ORD(glVertexAttrib4f);
2686 ORD(glVertexAttrib4fv);
2687 ORD(glVertexAttribPointer);
2688 ORD(glViewport);
2689
2690 ORD(glBindFramebuffer);
2691 ORD(glBindRenderbuffer);
2692#undef ORD
2693
2694 evgl_api_ext_get(funcs);
2695}
2696
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.c
new file mode 100644
index 0000000000..4f81ccf4dc
--- /dev/null
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.c
@@ -0,0 +1,286 @@
1
2#include "evas_gl_api_ext.h"
3
4#include <dlfcn.h>
5
6
7#define MAX_EXTENSION_STRING_BUFFER 10240
8
9char _gl_ext_string[10240] = { 0 };
10
11#ifndef EGL_NATIVE_PIXMAP_KHR
12# define EGL_NATIVE_PIXMAP_KHR 0x30b0
13#endif
14
15/////////////////////////////////////////////////////////////////////////////////////////////////////
16// Extension HEADER
17/////////////////////////////////////////////////////////////////////////////////////////////////////
18#define _EVASGL_EXT_CHECK_SUPPORT(name)
19#define _EVASGL_EXT_DISCARD_SUPPORT()
20#define _EVASGL_EXT_BEGIN(name)
21#define _EVASGL_EXT_END()
22#define _EVASGL_EXT_DRVNAME(name)
23#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param) ret (*glextsym_##name) param = NULL;
24#define _EVASGL_EXT_FUNCTION_END()
25#define _EVASGL_EXT_FUNCTION_DRVFUNC(name)
26
27#include "evas_gl_api_ext_def.h"
28
29#undef _EVASGL_EXT_CHECK_SUPPORT
30#undef _EVASGL_EXT_DISCARD_SUPPORT
31#undef _EVASGL_EXT_BEGIN
32#undef _EVASGL_EXT_END
33#undef _EVASGL_EXT_DRVNAME
34#undef _EVASGL_EXT_FUNCTION_BEGIN
35#undef _EVASGL_EXT_FUNCTION_END
36#undef _EVASGL_EXT_FUNCTION_DRVFUNC
37/////////////////////////////////////////////////////////////////////////////////////////////////////
38
39/////////////////////////////////////////////////////////////////////////////////////////////////////
40// Extension HEADER
41/////////////////////////////////////////////////////////////////////////////////////////////////////
42#define _EVASGL_EXT_CHECK_SUPPORT(name)
43#define _EVASGL_EXT_DISCARD_SUPPORT()
44#define _EVASGL_EXT_BEGIN(name) int _gl_ext_support_##name = 0;
45#define _EVASGL_EXT_END()
46#define _EVASGL_EXT_DRVNAME(name)
47#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param)
48#define _EVASGL_EXT_FUNCTION_END()
49#define _EVASGL_EXT_FUNCTION_DRVFUNC(name)
50
51#include "evas_gl_api_ext_def.h"
52
53#undef _EVASGL_EXT_CHECK_SUPPORT
54#undef _EVASGL_EXT_DISCARD_SUPPORT
55#undef _EVASGL_EXT_BEGIN
56#undef _EVASGL_EXT_END
57#undef _EVASGL_EXT_DRVNAME
58#undef _EVASGL_EXT_FUNCTION_BEGIN
59#undef _EVASGL_EXT_FUNCTION_END
60#undef _EVASGL_EXT_FUNCTION_DRVFUNC
61/////////////////////////////////////////////////////////////////////////////////////////////////////
62
63
64// Evas extensions from EGL extensions
65#ifdef GL_GLES
66static void *
67evgl_evasglCreateImage(int target, void* buffer, int *attrib_list)
68{
69 EVGL_Engine *ee = evgl_engine;
70 EGLDisplay dpy = EGL_NO_DISPLAY;
71
72 if ((ee) && (ee->funcs->display_get))
73 {
74 dpy = (EGLDisplay)ee->funcs->display_get(ee->engine_data);
75 return EXT_FUNC(eglCreateImage)(dpy, EGL_NO_CONTEXT, target, buffer, attrib_list);
76 }
77 else
78 {
79 ERR("Invalid Engine... (Can't acccess EGL Display)\n");
80 return NULL;
81 }
82}
83
84static void
85evgl_evasglDestroyImage(EvasGLImage image)
86{
87 EVGL_Engine *ee = evgl_engine;
88 EGLDisplay dpy = EGL_NO_DISPLAY;
89
90 if ((ee) && (ee->funcs->display_get))
91 {
92 dpy = (EGLDisplay)ee->funcs->display_get(ee->engine_data);
93 EXT_FUNC(eglDestroyImage)(dpy, image);
94 }
95 else
96 ERR("Invalid Engine... (Can't acccess EGL Display)\n");
97}
98
99static void
100evgl_glEvasGLImageTargetTexture2D(GLenum target, EvasGLImage image)
101{
102 EXT_FUNC(glEGLImageTargetTexture2DOES)(target, image);
103}
104
105static void
106evgl_glEvasGLImageTargetRenderbufferStorage(GLenum target, EvasGLImage image)
107{
108 EXT_FUNC(glEGLImageTargetTexture2DOES)(target, image);
109}
110
111#else
112#endif
113
114static int _evgl_api_ext_status = 0;
115
116void
117evgl_api_ext_init(void *getproc, const char *glueexts)
118{
119 const char *glexts;
120 typedef void (*_getproc_fn) (void);
121 typedef _getproc_fn (*fp_getproc)(const char *);
122
123 fp_getproc gp = (fp_getproc)getproc;
124
125 memset(_gl_ext_string, 0x00, MAX_EXTENSION_STRING_BUFFER);
126
127
128#define FINDSYM(getproc, dst, sym) \
129 if ((!dst) && (getproc)) dst = (__typeof__(dst))getproc(sym); \
130 if (!dst) dst = (__typeof__(dst))dlsym(RTLD_DEFAULT, sym);
131
132 // GLES Extensions
133 glexts = (const char*)glGetString(GL_EXTENSIONS);
134 /*
135 // GLUE Extensions
136#ifdef GL_GLES
137getproc = &eglGetProcAddress;
138glueexts = eglQueryString(re->win->egl_disp, EGL_EXTENSIONS);
139#else
140getproc = &glXGetProcAddress;
141glueexts = glXQueryExtensionsString(re->info->info.display,
142re->info->info.screen);
143#endif
144 */
145
146 /////////////////////////////////////////////////////////////////////////////////////////////////////
147 // Extension HEADER
148 /////////////////////////////////////////////////////////////////////////////////////////////////////
149#define GETPROCADDR(sym) \
150 (((!(*drvfunc)) && (gp)) ? (__typeof__((*drvfunc)))gp(sym) : (__typeof__((*drvfunc)))dlsym(RTLD_DEFAULT, sym))
151
152#define _EVASGL_EXT_BEGIN(name) \
153 { \
154 int *ext_support = &_gl_ext_support_##name;
155
156#define _EVASGL_EXT_END() \
157 }
158
159#define _EVASGL_EXT_CHECK_SUPPORT(name) \
160 (strstr(glexts, #name) != NULL || strstr(glueexts, #name) != NULL)
161
162#define _EVASGL_EXT_DISCARD_SUPPORT() \
163 ext_support = 0;
164
165#define _EVASGL_EXT_DRVNAME(name) \
166 if (_EVASGL_EXT_CHECK_SUPPORT(name)) *ext_support = 1;
167
168#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param) \
169 { \
170 ret (**drvfunc)param = &glextsym_##name;
171
172#define _EVASGL_EXT_FUNCTION_END() \
173 if ((*drvfunc) == NULL) _EVASGL_EXT_DISCARD_SUPPORT(); \
174 }
175
176#define _EVASGL_EXT_FUNCTION_DRVFUNC(name) \
177 *drvfunc = name;
178
179#include "evas_gl_api_ext_def.h"
180
181#undef _EVASGL_EXT_CHECK_SUPPORT
182#undef _EVASGL_EXT_DISCARD_SUPPORT
183#undef _EVASGL_EXT_BEGIN
184#undef _EVASGL_EXT_END
185#undef _EVASGL_EXT_DRVNAME
186#undef _EVASGL_EXT_FUNCTION_BEGIN
187#undef _EVASGL_EXT_FUNCTION_END
188#undef _EVASGL_EXT_FUNCTION_DRVFUNC
189
190#undef GETPROCADDR
191 /////////////////////////////////////////////////////////////////////////////////////////////////////
192
193
194
195 _gl_ext_string[0] = 0x00; //NULL;
196
197 /////////////////////////////////////////////////////////////////////////////////////////////////////
198 // Extension HEADER
199 /////////////////////////////////////////////////////////////////////////////////////////////////////
200#define _EVASGL_EXT_BEGIN(name) \
201 if (_gl_ext_support_##name != 0) strcat(_gl_ext_string, #name" ");
202
203#define _EVASGL_EXT_END()
204#define _EVASGL_EXT_CHECK_SUPPORT(name)
205#define _EVASGL_EXT_DISCARD_SUPPORT()
206#define _EVASGL_EXT_DRVNAME(name)
207#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param)
208#define _EVASGL_EXT_FUNCTION_END()
209#define _EVASGL_EXT_FUNCTION_DRVFUNC(name)
210
211#include "evas_gl_api_ext_def.h"
212
213#undef _EVASGL_EXT_CHECK_SUPPORT
214#undef _EVASGL_EXT_DISCARD_SUPPORT
215#undef _EVASGL_EXT_BEGIN
216#undef _EVASGL_EXT_END
217#undef _EVASGL_EXT_DRVNAME
218#undef _EVASGL_EXT_FUNCTION_BEGIN
219#undef _EVASGL_EXT_FUNCTION_END
220#undef _EVASGL_EXT_FUNCTION_DRVFUNC
221 /////////////////////////////////////////////////////////////////////////////////////////////////////
222
223
224
225
226 _evgl_api_ext_status = 1;
227}
228
229void
230evgl_api_ext_get(Evas_GL_API *gl_funcs)
231{
232 if (_evgl_api_ext_status != 1)
233 {
234 ERR("EVGL extension is not yet initialized.");
235 return;
236 }
237
238#define ORD(f) EVAS_API_OVERRIDE(f, gl_funcs, glextsym_)
239
240 /////////////////////////////////////////////////////////////////////////////////////////////////////
241 // Extension HEADER
242 /////////////////////////////////////////////////////////////////////////////////////////////////////
243#define _EVASGL_EXT_CHECK_SUPPORT(name)
244#define _EVASGL_EXT_DISCARD_SUPPORT()
245#define _EVASGL_EXT_BEGIN(name) \
246 if (_gl_ext_support_##name != 0) \
247 {
248#define _EVASGL_EXT_END() \
249 }
250#define _EVASGL_EXT_DRVNAME(name)
251#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param) \
252 ORD(name);
253#define _EVASGL_EXT_FUNCTION_END()
254#define _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(ret, name, param)
255#define _EVASGL_EXT_FUNCTION_PRIVATE_END()
256#define _EVASGL_EXT_FUNCTION_DRVFUNC(name)
257
258#include "evas_gl_api_ext_def.h"
259
260#undef _EVASGL_EXT_CHECK_SUPPORT
261#undef _EVASGL_EXT_DISCARD_SUPPORT
262#undef _EVASGL_EXT_BEGIN
263#undef _EVASGL_EXT_END
264#undef _EVASGL_EXT_DRVNAME
265#undef _EVASGL_EXT_FUNCTION_BEGIN
266#undef _EVASGL_EXT_FUNCTION_END
267#undef _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN
268#undef _EVASGL_EXT_FUNCTION_PRIVATE_END
269#undef _EVASGL_EXT_FUNCTION_DRVFUNC
270 /////////////////////////////////////////////////////////////////////////////////////////////////////
271#undef ORD
272
273}
274
275const char *
276evgl_api_ext_string_get()
277{
278 if (_evgl_api_ext_status != 1)
279 {
280 ERR("EVGL extension is not yet initialized.");
281 return NULL;
282 }
283
284 return _gl_ext_string;
285}
286
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.h b/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.h
new file mode 100644
index 0000000000..3ab49ce132
--- /dev/null
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.h
@@ -0,0 +1,72 @@
1#ifndef _EVAS_GL_API_EXT_H
2#define _EVAS_GL_API_EXT_H
3
4typedef char GLchar;
5
6#include "evas_gl_core_private.h"
7
8#ifdef GL_GLES
9#include <EGL/egl.h>
10#include <EGL/eglext.h>
11#else
12# include <GL/glext.h>
13# include <GL/glx.h>
14#endif
15
16/////////////////////////////////////////////////////////////////////////////////////////////////////
17// Extension HEADER
18/////////////////////////////////////////////////////////////////////////////////////////////////////
19#define _EVASGL_EXT_CHECK_SUPPORT(name)
20#define _EVASGL_EXT_DISCARD_SUPPORT()
21#define _EVASGL_EXT_BEGIN(name)
22#define _EVASGL_EXT_END()
23#define _EVASGL_EXT_DRVNAME(name)
24#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param) extern ret (*glextsym_##name) param;
25#define _EVASGL_EXT_FUNCTION_END()
26#define _EVASGL_EXT_FUNCTION_DRVFUNC(name)
27
28#include "evas_gl_api_ext_def.h"
29
30#undef _EVASGL_EXT_CHECK_SUPPORT
31#undef _EVASGL_EXT_DISCARD_SUPPORT
32#undef _EVASGL_EXT_BEGIN
33#undef _EVASGL_EXT_END
34#undef _EVASGL_EXT_DRVNAME
35#undef _EVASGL_EXT_FUNCTION_BEGIN
36#undef _EVASGL_EXT_FUNCTION_END
37#undef _EVASGL_EXT_FUNCTION_DRVFUNC
38/////////////////////////////////////////////////////////////////////////////////////////////////////
39#define EXT_FUNC(fname) glextsym_##fname
40
41
42/////////////////////////////////////////////////////////////////////////////////////////////////////
43// Extension HEADER
44/////////////////////////////////////////////////////////////////////////////////////////////////////
45#define _EVASGL_EXT_CHECK_SUPPORT(name)
46#define _EVASGL_EXT_DISCARD_SUPPORT()
47#define _EVASGL_EXT_BEGIN(name) extern int _gl_ext_support_##name;
48#define _EVASGL_EXT_END()
49#define _EVASGL_EXT_DRVNAME(name)
50#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param)
51#define _EVASGL_EXT_FUNCTION_END()
52#define _EVASGL_EXT_FUNCTION_DRVFUNC(name)
53
54#include "evas_gl_api_ext_def.h"
55
56#undef _EVASGL_EXT_CHECK_SUPPORT
57#undef _EVASGL_EXT_DISCARD_SUPPORT
58#undef _EVASGL_EXT_BEGIN
59#undef _EVASGL_EXT_END
60#undef _EVASGL_EXT_DRVNAME
61#undef _EVASGL_EXT_FUNCTION_BEGIN
62#undef _EVASGL_EXT_FUNCTION_END
63#undef _EVASGL_EXT_FUNCTION_DRVFUNC
64/////////////////////////////////////////////////////////////////////////////////////////////////////
65#define EXTENSION_SUPPORT(name) (_gl_ext_support_##name == 1)
66
67extern void evgl_api_ext_init(void *getproc, const char *glueexts);
68extern void evgl_api_ext_get(Evas_GL_API *gl_funcs);
69extern const char *evgl_api_ext_string_get();
70
71#endif //_EVAS_GL_API_EXT_H
72
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext_def.h b/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext_def.h
new file mode 100644
index 0000000000..d5d1fa3b2b
--- /dev/null
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext_def.h
@@ -0,0 +1,632 @@
1
2//////////////////////////////////////////////////////////////////////////////////////////////////
3#ifndef _EVASGL_EXT_BEGIN
4
5#define _EVASGL_EXT_USE_DEFAULT_DEFINE
6
7#define _EVASGL_EXT_CHECK_SUPPORT(name)
8#define _EVASGL_EXT_DISCARD_SUPPORT()
9
10// Begin of the extension block (name : EVAS extension name)
11#define _EVASGL_EXT_BEGIN(name)
12// End of the extension block
13#define _EVASGL_EXT_END()
14
15// Driver extensions to wrap (name : SPEC extension name)
16#define _EVASGL_EXT_DRVNAME(name)
17
18// These functions will be exported to 'EVAS extension function'.
19// The functions of this block must correspond with the functions list in Evas_GL.h.
20// Begin of the extension function block (ret : return value, name : function name, param : parameters with bracket)
21#define _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param) ret (*name) param;
22// End of the extension function block
23#define _EVASGL_EXT_FUNCTION_END()
24
25// These functions will not be exported. Only be used in engines privately.
26// Begin of the extension function block (ret : return value, name : function name, param : parameters with bracket)
27#define _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(ret, name, param)
28// End of the extension function block
29#define _EVASGL_EXT_FUNCTION_PRIVATE_END()
30
31// Driver extension functions to wrap (name : SPEC extension function name)
32#define _EVASGL_EXT_FUNCTION_DRVFUNC(name)
33
34#endif
35//////////////////////////////////////////////////////////////////////////////////////////////////
36
37#ifndef _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN
38#define _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(ret, name, param) _EVASGL_EXT_FUNCTION_BEGIN(ret, name, param)
39#define _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN_DEFINED
40#endif
41
42#ifndef _EVASGL_EXT_FUNCTION_PRIVATE_END
43#define _EVASGL_EXT_FUNCTION_PRIVATE_END() _EVASGL_EXT_FUNCTION_END()
44#define _EVASGL_EXT_FUNCTION_PRIVATE_END_DEFINED
45#endif
46
47///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
48// GL/GLES EXTENSIONS
49///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
50_EVASGL_EXT_BEGIN(get_program_binary)
51 _EVASGL_EXT_DRVNAME(GL_OES_get_program_binary)
52
53 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetProgramBinaryOES, (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary))
54 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetProgramBinary"))
55 _EVASGL_EXT_FUNCTION_END()
56 _EVASGL_EXT_FUNCTION_BEGIN(void, glProgramBinaryOES, (GLuint program, GLenum binaryFormat, const void *binary, GLint length))
57 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glProgramBinary"))
58 _EVASGL_EXT_FUNCTION_END()
59_EVASGL_EXT_END()
60
61
62_EVASGL_EXT_BEGIN(mapbuffer)
63 _EVASGL_EXT_DRVNAME(GL_OES_mapbuffer)
64
65 _EVASGL_EXT_FUNCTION_BEGIN(void *, glMapBufferOES, (GLenum target, GLenum access))
66 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glMapBuffer"))
67 _EVASGL_EXT_FUNCTION_END()
68 _EVASGL_EXT_FUNCTION_BEGIN(GLboolean, glUnmapBufferOES, (GLenum target))
69 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glUnmapBuffer"))
70 _EVASGL_EXT_FUNCTION_END()
71 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetBufferPointervOES, (GLenum target, GLenum pname, void** params))
72 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetBufferPointerv"))
73 _EVASGL_EXT_FUNCTION_END()
74_EVASGL_EXT_END()
75
76_EVASGL_EXT_BEGIN(texture_3D)
77 _EVASGL_EXT_DRVNAME(GL_OES_texture_3D)
78
79 _EVASGL_EXT_FUNCTION_BEGIN(void, glTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels))
80 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glTexImage3D"))
81 _EVASGL_EXT_FUNCTION_END()
82 _EVASGL_EXT_FUNCTION_BEGIN(void, glTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels))
83 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glTexSubImage3D"))
84 _EVASGL_EXT_FUNCTION_END()
85 _EVASGL_EXT_FUNCTION_BEGIN(void, glCopyTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height))
86 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glCopyTexSubImage3D"))
87 _EVASGL_EXT_FUNCTION_END()
88 _EVASGL_EXT_FUNCTION_BEGIN(void, glCompressedTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data))
89 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glCompressedTexImage3D"))
90 _EVASGL_EXT_FUNCTION_END()
91 _EVASGL_EXT_FUNCTION_BEGIN(void, glCompressedTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data))
92 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glCompressedTexSubImage3D"))
93 _EVASGL_EXT_FUNCTION_END()
94 _EVASGL_EXT_FUNCTION_BEGIN(void, glFramebufferTexture3DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset))
95 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glFramebufferTexture3D"))
96 _EVASGL_EXT_FUNCTION_END()
97_EVASGL_EXT_END()
98
99
100_EVASGL_EXT_BEGIN(AMD_performance_monitor)
101 _EVASGL_EXT_DRVNAME(AMD_performance_monitor)
102
103 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetPerfMonitorGroupsAMD, (GLint* numGroups, GLsizei groupsSize, GLuint* groups))
104 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetPerfMonitorGroupsAMD"))
105 _EVASGL_EXT_FUNCTION_END()
106 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetPerfMonitorCountersAMD, (GLuint group, GLint* numCounters, GLint* maxActiveCounters, GLsizei counterSize, GLuint* counters))
107 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetPerfMonitorCountersAMD"))
108 _EVASGL_EXT_FUNCTION_END()
109 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetPerfMonitorGroupStringAMD, (GLuint group, GLsizei bufSize, GLsizei* length, char* groupString))
110 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetPerfMonitorGroupStringAMD"))
111 _EVASGL_EXT_FUNCTION_END()
112 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetPerfMonitorCounterStringAMD, (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, char* counterString))
113 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetPerfMonitorCounterStringAMD"))
114 _EVASGL_EXT_FUNCTION_END()
115 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetPerfMonitorCounterInfoAMD, (GLuint group, GLuint counter, GLenum pname, void* data))
116 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetPerfMonitorCounterInfoAMD"))
117 _EVASGL_EXT_FUNCTION_END()
118 _EVASGL_EXT_FUNCTION_BEGIN(void, glGenPerfMonitorsAMD, (GLsizei n, GLuint* monitors))
119 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGenPerfMonitorsAMD"))
120 _EVASGL_EXT_FUNCTION_END()
121 _EVASGL_EXT_FUNCTION_BEGIN(void, glDeletePerfMonitorsAMD, (GLsizei n, GLuint* monitors))
122 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glDeletePerfMonitorsAMD"))
123 _EVASGL_EXT_FUNCTION_END()
124 _EVASGL_EXT_FUNCTION_BEGIN(void, glSelectPerfMonitorCountersAMD, (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* countersList))
125 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glSelectPerfMonitorCountersAMD"))
126 _EVASGL_EXT_FUNCTION_END()
127 _EVASGL_EXT_FUNCTION_BEGIN(void, glBeginPerfMonitorAMD, (GLuint monitor))
128 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glBeginPerfMonitorAMD"))
129 _EVASGL_EXT_FUNCTION_END()
130 _EVASGL_EXT_FUNCTION_BEGIN(void, glEndPerfMonitorAMD, (GLuint monitor))
131 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glEndPerfMonitorAMD"))
132 _EVASGL_EXT_FUNCTION_END()
133 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetPerfMonitorCounterDataAMD, (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint* bytesWritten))
134 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetPerfMonitorCounterDataAMD"))
135 _EVASGL_EXT_FUNCTION_END()
136_EVASGL_EXT_END()
137
138
139_EVASGL_EXT_BEGIN(discard_framebuffer)
140 _EVASGL_EXT_DRVNAME(GL_EXT_discard_framebuffer)
141
142 _EVASGL_EXT_FUNCTION_BEGIN(void, glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
143 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glDiscardFramebuffer"))
144 _EVASGL_EXT_FUNCTION_END()
145_EVASGL_EXT_END()
146
147
148_EVASGL_EXT_BEGIN(multi_draw_arrays)
149 _EVASGL_EXT_DRVNAME(GL_EXT_multi_draw_arrays)
150
151 _EVASGL_EXT_FUNCTION_BEGIN(void, glMultiDrawArraysEXT, (GLenum mode, GLint* first, GLsizei* count, GLsizei primcount))
152 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glMultiDrawArrays"))
153 _EVASGL_EXT_FUNCTION_END()
154 _EVASGL_EXT_FUNCTION_BEGIN(void, glMultiDrawElementsEXT, (GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount))
155 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glMultiDrawElementsARB"))
156 _EVASGL_EXT_FUNCTION_END()
157_EVASGL_EXT_END()
158
159
160_EVASGL_EXT_BEGIN(NV_fence)
161 _EVASGL_EXT_DRVNAME(GL_NV_fence)
162
163 _EVASGL_EXT_FUNCTION_BEGIN(void, glDeleteFencesNV, (GLsizei n, const GLuint* fences))
164 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glDeleteFencesNV"))
165 _EVASGL_EXT_FUNCTION_END()
166 _EVASGL_EXT_FUNCTION_BEGIN(void, glGenFencesNV, (GLsizei n, GLuint* fences))
167 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGenFencesNV"))
168 _EVASGL_EXT_FUNCTION_END()
169 _EVASGL_EXT_FUNCTION_BEGIN(unsigned char, glIsFenceNV, (GLuint fence))
170 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glIsFenceNV"))
171 _EVASGL_EXT_FUNCTION_END()
172 _EVASGL_EXT_FUNCTION_BEGIN(unsigned char, glTestFenceNV, (GLuint fence))
173 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glTestFenceNV"))
174 _EVASGL_EXT_FUNCTION_END()
175 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetFenceivNV, (GLuint fence, GLenum pname, GLint* params))
176 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetFenceivNV"))
177 _EVASGL_EXT_FUNCTION_END()
178 _EVASGL_EXT_FUNCTION_BEGIN(void, glFinishFenceNV, (GLuint fence))
179 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glFinishFenceNV"))
180 _EVASGL_EXT_FUNCTION_END()
181 _EVASGL_EXT_FUNCTION_BEGIN(void, glSetFenceNV, (GLuint, GLenum))
182 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glSetFenceNV"))
183 _EVASGL_EXT_FUNCTION_END()
184_EVASGL_EXT_END()
185
186
187_EVASGL_EXT_BEGIN(QCOM_driver_control)
188 _EVASGL_EXT_DRVNAME(GL_QCOM_driver_control)
189
190 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetDriverControlsQCOM, (GLint* num, GLsizei size, GLuint* driverControls))
191 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetDriverControlsQCOM"))
192 _EVASGL_EXT_FUNCTION_END()
193 _EVASGL_EXT_FUNCTION_BEGIN(void, glGetDriverControlStringQCOM, (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString))
194 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glGetDriverControlStringQCOM"))
195 _EVASGL_EXT_FUNCTION_END()
196 _EVASGL_EXT_FUNCTION_BEGIN(void, glEnableDriverControlQCOM, (GLuint driverControl))
197 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glEnableDriverControlQCOM"))
198 _EVASGL_EXT_FUNCTION_END()
199 _EVASGL_EXT_FUNCTION_BEGIN(void, glDisableDriverControlQCOM, (GLuint driverControl))
200 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glDisableDriverControlQCOM"))
201 _EVASGL_EXT_FUNCTION_END()
202_EVASGL_EXT_END()
203
204
205_EVASGL_EXT_BEGIN(QCOM_extended_get)
206 _EVASGL_EXT_DRVNAME(GL_QCOM_extended_get)
207
208 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetTexturesQCOM, (GLuint* textures, GLint maxTextures, GLint* numTextures))
209 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetTexturesQCOM"))
210 _EVASGL_EXT_FUNCTION_END()
211 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetBuffersQCOM, (GLuint* buffers, GLint maxBuffers, GLint* numBuffers))
212 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetBuffersQCOM"))
213 _EVASGL_EXT_FUNCTION_END()
214 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetRenderbuffersQCOM, (GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers))
215 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetRenderbuffersQCOM"))
216 _EVASGL_EXT_FUNCTION_END()
217 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetFramebuffersQCOM, (GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers))
218 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetFramebuffersQCOM"))
219 _EVASGL_EXT_FUNCTION_END()
220 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetTexLevelParameterivQCOM, (GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params))
221 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetTexLevelParameterivQCOM"))
222 _EVASGL_EXT_FUNCTION_END()
223 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtTexObjectStateOverrideiQCOM, (GLenum target, GLenum pname, GLint param))
224 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtTexObjectStateOverrideiQCOM"))
225 _EVASGL_EXT_FUNCTION_END()
226 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetTexSubImageQCOM, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void* texels))
227 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetTexSubImageQCOM"))
228 _EVASGL_EXT_FUNCTION_END()
229 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetBufferPointervQCOM, (GLenum target, void** params))
230 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetBufferPointervQCOM"))
231 _EVASGL_EXT_FUNCTION_END()
232_EVASGL_EXT_END()
233
234
235_EVASGL_EXT_BEGIN(QCOM_extended_get2)
236 _EVASGL_EXT_DRVNAME(GL_QCOM_extended_get2)
237
238 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetShadersQCOM, (GLuint* shaders, GLint maxShaders, GLint* numShaders))
239 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetShadersQCOM"))
240 _EVASGL_EXT_FUNCTION_END()
241 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetProgramsQCOM, (GLuint* programs, GLint maxPrograms, GLint* numPrograms))
242 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetProgramsQCOM"))
243 _EVASGL_EXT_FUNCTION_END()
244 _EVASGL_EXT_FUNCTION_BEGIN(unsigned char, glExtIsProgramBinaryQCOM, (GLuint program))
245 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtIsProgramBinaryQCOM"))
246 _EVASGL_EXT_FUNCTION_END()
247 _EVASGL_EXT_FUNCTION_BEGIN(void, glExtGetProgramBinarySourceQCOM, (GLuint program, GLenum shadertype, char* source, GLint* length))
248 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glExtGetProgramBinarySourceQCOM"))
249 _EVASGL_EXT_FUNCTION_END()
250_EVASGL_EXT_END()
251
252_EVASGL_EXT_BEGIN(multisampled_render_to_texture)
253 _EVASGL_EXT_DRVNAME(GL_IMG_multisampled_render_to_texture)
254 _EVASGL_EXT_DRVNAME(GL_EXT_multisampled_render_to_texture)
255
256 _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(void, glRenderbufferStorageMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height))
257 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glRenderbufferStorageMultisampleIMG"))
258 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glRenderbufferStorageMultisampleEXT"))
259 _EVASGL_EXT_FUNCTION_PRIVATE_END()
260 _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(void, glFramebufferTexture2DMultisample, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples))
261 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glFramebufferTexture2DMultisampleIMG"))
262 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("glFramebufferTexture2DMultisampleEXT"))
263 _EVASGL_EXT_FUNCTION_PRIVATE_END()
264_EVASGL_EXT_END()
265
266_EVASGL_EXT_BEGIN(compressed_ETC1_RGB8_texture)
267 _EVASGL_EXT_DRVNAME(GL_OES_compressed_ETC1_RGB8_texture)
268_EVASGL_EXT_END()
269
270_EVASGL_EXT_BEGIN(compressed_paletted_texture)
271 _EVASGL_EXT_DRVNAME(GL_OES_compressed_paletted_texture)
272_EVASGL_EXT_END()
273
274_EVASGL_EXT_BEGIN(depth24)
275 _EVASGL_EXT_DRVNAME(GL_OES_depth24)
276_EVASGL_EXT_END()
277
278_EVASGL_EXT_BEGIN(depth32)
279 _EVASGL_EXT_DRVNAME(GL_OES_depth32)
280_EVASGL_EXT_END()
281
282_EVASGL_EXT_BEGIN(EGL_image)
283 _EVASGL_EXT_DRVNAME(GL_OES_EvasGL_image)
284_EVASGL_EXT_END()
285
286_EVASGL_EXT_BEGIN(packed_depth_stencil)
287 _EVASGL_EXT_DRVNAME(GL_OES_packed_depth_stencil)
288_EVASGL_EXT_END()
289
290_EVASGL_EXT_BEGIN(rgb8_rgba8)
291 _EVASGL_EXT_DRVNAME(GL_OES_rgb8_rgba8)
292_EVASGL_EXT_END()
293
294_EVASGL_EXT_BEGIN(standard_derivatives)
295 _EVASGL_EXT_DRVNAME(GL_OES_standard_derivatives)
296_EVASGL_EXT_END()
297
298_EVASGL_EXT_BEGIN(stencil1)
299 _EVASGL_EXT_DRVNAME(GL_OES_stencil1)
300_EVASGL_EXT_END()
301
302_EVASGL_EXT_BEGIN(stencil4)
303 _EVASGL_EXT_DRVNAME(GL_OES_stencil4)
304_EVASGL_EXT_END()
305
306_EVASGL_EXT_BEGIN(texture_float)
307 _EVASGL_EXT_DRVNAME(GL_OES_texture_float)
308_EVASGL_EXT_END()
309
310_EVASGL_EXT_BEGIN(texture_half_float)
311 _EVASGL_EXT_DRVNAME(GL_OES_texture_half_float)
312_EVASGL_EXT_END()
313
314_EVASGL_EXT_BEGIN(texture_half_float_linear)
315 _EVASGL_EXT_DRVNAME(GL_OES_texture_half_float_linear)
316_EVASGL_EXT_END()
317
318_EVASGL_EXT_BEGIN(texture_npot) // Desktop differs
319 _EVASGL_EXT_DRVNAME(GL_OES_texture_npot)
320_EVASGL_EXT_END()
321
322_EVASGL_EXT_BEGIN(texture_npot_DESKTOP) // Desktop differs
323 _EVASGL_EXT_DRVNAME(GL_OES_texture_npot)
324_EVASGL_EXT_END()
325
326_EVASGL_EXT_BEGIN(vertex_half_float) // Desktop differs
327 _EVASGL_EXT_DRVNAME(GL_OES_vertex_half_float)
328_EVASGL_EXT_END()
329
330_EVASGL_EXT_BEGIN(vertex_half_float_DESKTOP) // Desktop differs
331 _EVASGL_EXT_DRVNAME(GL_OES_vertex_half_float)
332_EVASGL_EXT_END()
333
334_EVASGL_EXT_BEGIN(vertex_type_10_10_10_2)
335 _EVASGL_EXT_DRVNAME(GL_OES_vertex_type_10_10_10_2)
336_EVASGL_EXT_END()
337
338_EVASGL_EXT_BEGIN(compressed_3DC_texture)
339 _EVASGL_EXT_DRVNAME(GL_AMD_compressed_3DC_texture)
340_EVASGL_EXT_END()
341
342_EVASGL_EXT_BEGIN(compressed_ATC_texture)
343 _EVASGL_EXT_DRVNAME(GL_AMD_compressed_ATC_texture)
344_EVASGL_EXT_END()
345
346_EVASGL_EXT_BEGIN(program_binary_Z400)
347 _EVASGL_EXT_DRVNAME(GL_AMD_program_binary_Z400)
348_EVASGL_EXT_END()
349
350_EVASGL_EXT_BEGIN(blend_minmax)
351 _EVASGL_EXT_DRVNAME(GL_EXT_blend_minmax)
352_EVASGL_EXT_END()
353
354_EVASGL_EXT_BEGIN(read_format_bgra) // Desktop differs
355 _EVASGL_EXT_DRVNAME(GL_EXT_read_format_bgra)
356_EVASGL_EXT_END()
357
358_EVASGL_EXT_BEGIN(read_format_bgra_DESKTOP) // Desktop differs
359 _EVASGL_EXT_DRVNAME(GL_EXT_read_format_bgra)
360_EVASGL_EXT_END()
361
362_EVASGL_EXT_BEGIN(texture_filter_anisotrophic)
363 _EVASGL_EXT_DRVNAME(GL_EXT_texture_filter_anisotropic)
364_EVASGL_EXT_END()
365
366_EVASGL_EXT_BEGIN(texture_format_BGRA8888) // Desktop differs
367 _EVASGL_EXT_DRVNAME(GL_EXT_texture_format_BGRA8888)
368_EVASGL_EXT_END()
369
370_EVASGL_EXT_BEGIN(texture_format_BGRA8888_DESKTOP) // Desktop differs
371 _EVASGL_EXT_DRVNAME(GL_EXT_texture_format_BGRA8888)
372_EVASGL_EXT_END()
373
374_EVASGL_EXT_BEGIN(texture_type_2_10_10_10_rev) // Desktop differs
375 _EVASGL_EXT_DRVNAME(GL_EXT_texture_type_2_10_10_10_REV)
376_EVASGL_EXT_END()
377
378_EVASGL_EXT_BEGIN(texture_type_2_10_10_10_rev_DESKTOP) // Desktop differs
379 _EVASGL_EXT_DRVNAME(GL_EXT_texture_type_2_10_10_10_REV)
380_EVASGL_EXT_END()
381
382_EVASGL_EXT_BEGIN(IMG_program_binary)
383 _EVASGL_EXT_DRVNAME(GL_IMG_program_binary)
384_EVASGL_EXT_END()
385
386_EVASGL_EXT_BEGIN(IMG_read_format)
387 _EVASGL_EXT_DRVNAME(GL_IMG_read_format)
388_EVASGL_EXT_END()
389
390_EVASGL_EXT_BEGIN(IMG_shader_binary)
391 _EVASGL_EXT_DRVNAME(GL_IMG_shader_binary)
392_EVASGL_EXT_END()
393
394_EVASGL_EXT_BEGIN(IMG_texture_compression_pvrtc)
395 _EVASGL_EXT_DRVNAME(GL_IMG_texture_compression_pvrtc)
396_EVASGL_EXT_END()
397
398_EVASGL_EXT_BEGIN(QCOM_perfmon_global_mode)
399 _EVASGL_EXT_DRVNAME(GL_QCOM_perfmon_global_mode)
400_EVASGL_EXT_END()
401
402_EVASGL_EXT_BEGIN(QCOM_writeonly_rendering)
403 _EVASGL_EXT_DRVNAME(GL_QCOM_writeonly_rendering)
404_EVASGL_EXT_END()
405///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
406
407
408///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
409// EGL EXTENSIONS
410///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
411#ifdef GL_GLES
412
413_EVASGL_EXT_BEGIN(EGL_KHR_image_base)
414
415 _EVASGL_EXT_DRVNAME(EGL_KHR_image_base)
416
417 _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(void *, eglCreateImage, (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const int *e))
418 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglCreateImageKHR"))
419 _EVASGL_EXT_FUNCTION_PRIVATE_END()
420 _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(void, eglDestroyImage, (EGLDisplay a, void *b))
421 _EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglDestroyImageKHR"))