summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongyeon Kim <dy5.kim@samsung.com>2015-04-14 15:51:32 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-03 11:30:21 +0900
commite789b24ff4689468dbe91d969bb3b40d668d044e (patch)
treefc0f867d7313b2f6412cab06122407df5642037d
parent777f7f20479afd3322f02a1db2125cd8f2c1c5a0 (diff)
Evas GL: 1.x support for GLX
Summary: Now we can support EVAS_GL_GLES_1_X version for GLX backend with both direct and indirect rendering. Refactored api get functions to have similar code path for each version. @feature Test Plan: Evas GL test case Reviewers: cedric, jpeg Subscribers: cedric, mer.kim, mythri, wonsik Differential Revision: https://phab.enlightenment.org/D2342
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api.c35
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext.c116
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext.h7
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h1
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_gles1.c6
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c46
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core_private.h8
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c2
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c7
10 files changed, 86 insertions, 144 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c b/src/modules/evas/engines/gl_common/evas_gl_api.c
index b22189cc65..6ef7a3d45b 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -4716,7 +4716,7 @@ _evgld_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
4716//-------------------------------------------------------------// 4716//-------------------------------------------------------------//
4717 4717
4718static void 4718static void
4719_normal_gl_api_get(Evas_GL_API *funcs) 4719_normal_gles2_api_get(Evas_GL_API *funcs)
4720{ 4720{
4721 funcs->version = EVAS_GL_API_VERSION; 4721 funcs->version = EVAS_GL_API_VERSION;
4722 4722
@@ -4892,8 +4892,6 @@ _normal_gl_api_get(Evas_GL_API *funcs)
4892 ORD(glReleaseShaderCompiler); 4892 ORD(glReleaseShaderCompiler);
4893 4893
4894#undef ORD 4894#undef ORD
4895
4896 evgl_api_ext_get(funcs);
4897} 4895}
4898 4896
4899static void 4897static void
@@ -4915,7 +4913,7 @@ _direct_scissor_off_api_get(Evas_GL_API *funcs)
4915 4913
4916 4914
4917static void 4915static void
4918_debug_gl_api_get(Evas_GL_API *funcs) 4916_debug_gles2_api_get(Evas_GL_API *funcs)
4919{ 4917{
4920 funcs->version = EVAS_GL_API_VERSION; 4918 funcs->version = EVAS_GL_API_VERSION;
4921 4919
@@ -5065,20 +5063,18 @@ _debug_gl_api_get(Evas_GL_API *funcs)
5065 ORD(glBindFramebuffer); 5063 ORD(glBindFramebuffer);
5066 ORD(glBindRenderbuffer); 5064 ORD(glBindRenderbuffer);
5067#undef ORD 5065#undef ORD
5068
5069 evgl_api_ext_get(funcs);
5070} 5066}
5071 5067
5072void 5068void
5073_evgl_api_get(Evas_GL_API *funcs, int debug) 5069_evgl_api_gles2_get(Evas_GL_API *funcs, Eina_Bool debug)
5074{ 5070{
5075 if (debug) 5071 if (debug)
5076 _debug_gl_api_get(funcs); 5072 _debug_gles2_api_get(funcs);
5077 else 5073 else
5078 _normal_gl_api_get(funcs); 5074 _normal_gles2_api_get(funcs);
5079 5075
5080 if (evgl_engine->direct_scissor_off) 5076 if (evgl_engine->direct_scissor_off)
5081 _direct_scissor_off_api_get(funcs); 5077 _direct_scissor_off_api_get(funcs);
5082} 5078}
5083 5079
5084static void 5080static void
@@ -5368,8 +5364,6 @@ _normal_gles3_api_get(Evas_GL_API *funcs)
5368 ORD(glReleaseShaderCompiler); 5364 ORD(glReleaseShaderCompiler);
5369 5365
5370#undef ORD 5366#undef ORD
5371
5372 evgl_api_gles3_ext_get(funcs);
5373} 5367}
5374 5368
5375static void 5369static void
@@ -5628,8 +5622,6 @@ _debug_gles3_api_get(Evas_GL_API *funcs)
5628 ORD(glVertexAttribIPointer); 5622 ORD(glVertexAttribIPointer);
5629 ORD(glWaitSync); 5623 ORD(glWaitSync);
5630#undef ORD 5624#undef ORD
5631
5632 evgl_api_gles3_ext_get(funcs);
5633} 5625}
5634 5626
5635 5627
@@ -5761,7 +5753,7 @@ _evgl_load_gles3_apis(void *dl_handle, Evas_GL_API *funcs)
5761 5753
5762 5754
5763static Eina_Bool 5755static Eina_Bool
5764_evgl_api_init(void) 5756_evgl_gles3_api_init(void)
5765{ 5757{
5766 static Eina_Bool _initialized = EINA_FALSE; 5758 static Eina_Bool _initialized = EINA_FALSE;
5767 if (_initialized) return EINA_TRUE; 5759 if (_initialized) return EINA_TRUE;
@@ -5797,20 +5789,17 @@ _evgl_api_init(void)
5797 { 5789 {
5798 return EINA_FALSE; 5790 return EINA_FALSE;
5799 } 5791 }
5800/* TODO 5792
5801 if (!_evgl_api_gles3_ext_init())
5802 WRN("Could not initialize OpenGL ES 1 extensions yet.");
5803*/
5804 _initialized = EINA_TRUE; 5793 _initialized = EINA_TRUE;
5805 return EINA_TRUE; 5794 return EINA_TRUE;
5806} 5795}
5807 5796
5808 5797
5809Eina_Bool 5798void
5810_evgl_api_gles3_get(Evas_GL_API *funcs, Eina_Bool debug) 5799_evgl_api_gles3_get(Evas_GL_API *funcs, Eina_Bool debug)
5811{ 5800{
5812 if(!_evgl_api_init()) 5801 if (!_evgl_gles3_api_init())
5813 return EINA_FALSE; 5802 return;
5814 5803
5815 if (debug) 5804 if (debug)
5816 _debug_gles3_api_get(funcs); 5805 _debug_gles3_api_get(funcs);
@@ -5820,7 +5809,7 @@ _evgl_api_gles3_get(Evas_GL_API *funcs, Eina_Bool debug)
5820 if (evgl_engine->direct_scissor_off) 5809 if (evgl_engine->direct_scissor_off)
5821 _direct_scissor_off_api_get(funcs); 5810 _direct_scissor_off_api_get(funcs);
5822 5811
5823 return EINA_TRUE; 5812 return;
5824} 5813}
5825 5814
5826Evas_GL_API * 5815Evas_GL_API *
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
index 1aae248d09..1d9869e361 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
@@ -310,9 +310,13 @@ evgl_evasglQueryWaylandBuffer(Evas_GL *evas_gl EINA_UNUSED,
310// 5: GLESv3 and GLESv2 initialized, 310// 5: GLESv3 and GLESv2 initialized,
311// 7: GLESv3 + GLESv2 + GLESv1 all initialized. 311// 7: GLESv3 + GLESv2 + GLESv1 all initialized.
312static int _evgl_api_ext_status = 0; 312static int _evgl_api_ext_status = 0;
313#define EVASGL_API_GLES2_EXT_INITIALIZED 0x1
314#define EVASGL_API_GLES1_EXT_INITIALIZED 0x2
315#define EVASGL_API_GLES3_EXT_INITIALIZED 0x4
316
313 317
314Eina_Bool 318Eina_Bool
315evgl_api_ext_init(void *getproc, const char *glueexts) 319_evgl_api_gles2_ext_init(void *getproc, const char *glueexts)
316{ 320{
317 const char *glexts; 321 const char *glexts;
318 fp_getproc gp = (fp_getproc)getproc; 322 fp_getproc gp = (fp_getproc)getproc;
@@ -476,19 +480,22 @@ evgl_api_ext_init(void *getproc, const char *glueexts)
476 eina_strbuf_free(sb); 480 eina_strbuf_free(sb);
477 eina_strbuf_free(sboff); 481 eina_strbuf_free(sboff);
478 482
479 _evgl_api_ext_status = 1; 483 _evgl_api_ext_status |= EVASGL_API_GLES2_EXT_INITIALIZED;
480 return EINA_TRUE; 484 return EINA_TRUE;
481} 485}
482 486
483void 487void
484evgl_api_ext_get(Evas_GL_API *gl_funcs) 488evgl_api_gles2_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char *glueexts)
485{ 489{
486 if (_evgl_api_ext_status < 1) 490 if (!(_evgl_api_ext_status & EVASGL_API_GLES2_EXT_INITIALIZED))
487 { 491 {
488 ERR("EVGL extension is not yet initialized."); 492 DBG("Initializing GLESv2 extensions...");
489 return; 493 if (!_evgl_api_gles2_ext_init(getproc, glueexts))
494 {
495 ERR("GLESv2 extensions initialization failed");
496 return;
497 }
490 } 498 }
491
492#define ORD(f) EVAS_API_OVERRIDE(f, gl_funcs, gl_ext_sym_) 499#define ORD(f) EVAS_API_OVERRIDE(f, gl_funcs, gl_ext_sym_)
493 500
494 ///////////////////////////////////////////////////////////////////////////////////////////////////// 501 /////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -541,23 +548,21 @@ evgl_api_ext_get(Evas_GL_API *gl_funcs)
541} 548}
542 549
543Eina_Bool 550Eina_Bool
544_evgl_api_gles1_ext_init(void) 551_evgl_api_gles1_ext_init(void *getproc, const char *glueexts)
545{ 552{
546 // Return if GLESv1 ext is already intiialised 553 const char *glexts;
547 if (_evgl_api_ext_status & 0x2) 554 fp_getproc gp = (fp_getproc)getproc;
548 return EINA_TRUE;
549
550#ifdef GL_GLES
551 int _curext_supported = 0; 555 int _curext_supported = 0;
552 Evas_GL_API *gles1_funcs; 556 Evas_GL_API *gles1_funcs;
553 const char *gles1_exts, *eglexts; 557 Eina_Strbuf *sb = eina_strbuf_new();
558
559#ifdef GL_GLES
554 EVGL_Resource *rsc; 560 EVGL_Resource *rsc;
555 EGLint context_version; 561 EGLint context_version;
556 EGLDisplay dpy = EGLDISPLAY_GET(); 562 EGLDisplay dpy = EGLDISPLAY_GET();
557 Eina_Strbuf *sb = eina_strbuf_new();
558 563
559 /* glGetString returns the information for the currently bound context 564 /* glGetString returns the information for the currently bound context
560 * So, update gles1_exts only if GLES1 context is currently bound. 565 * So, update glexts only if GLES1 context is currently bound.
561 * Check here if GLESv1 is current 566 * Check here if GLESv1 is current
562 */ 567 */
563 if (!(rsc=_evgl_tls_resource_get())) 568 if (!(rsc=_evgl_tls_resource_get()))
@@ -568,7 +573,7 @@ _evgl_api_gles1_ext_init(void)
568 573
569 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx) 574 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx)
570 { 575 {
571 DBG("Unable to initialize GLES1 extensions. Engine not initialised"); 576 DBG("Unable to initialize GLES1 extensions. Engine not initialized");
572 return EINA_FALSE; 577 return EINA_FALSE;
573 } 578 }
574 579
@@ -583,6 +588,7 @@ _evgl_api_gles1_ext_init(void)
583 DBG("GLESv1 context not bound"); 588 DBG("GLESv1 context not bound");
584 return EINA_FALSE; 589 return EINA_FALSE;
585 } 590 }
591#endif
586 592
587 gles1_funcs = _evgl_api_gles1_internal_get(); 593 gles1_funcs = _evgl_api_gles1_internal_get();
588 if (!gles1_funcs || !gles1_funcs->glGetString) 594 if (!gles1_funcs || !gles1_funcs->glGetString)
@@ -591,27 +597,20 @@ _evgl_api_gles1_ext_init(void)
591 return EINA_FALSE; 597 return EINA_FALSE;
592 } 598 }
593 599
594 gles1_exts = (const char *) gles1_funcs->glGetString(GL_EXTENSIONS); 600 glexts = (const char *) gles1_funcs->glGetString(GL_EXTENSIONS);
595 if (!gles1_exts) 601 if (!glexts)
596 { 602 {
597 ERR("GLESv1:glGetString(GL_EXTENSIONS) returned NULL!"); 603 ERR("GLESv1:glGetString(GL_EXTENSIONS) returned NULL!");
598 return EINA_FALSE; 604 return EINA_FALSE;
599 } 605 }
600 606
601 eglexts = eglQueryString(dpy, EGL_EXTENSIONS);
602 if (!eglexts)
603 {
604 ERR("eglQueryString(EGL_EXTENSIONS) returned NULL!");
605 eglexts = "";
606 }
607
608 ///////////////////////////////////////////////////////////////////////////////////////////////////// 607 /////////////////////////////////////////////////////////////////////////////////////////////////////
609 // Scanning supported extensions, sets the variables 608 // Scanning supported extensions, sets the variables
610 ///////////////////////////////////////////////////////////////////////////////////////////////////// 609 /////////////////////////////////////////////////////////////////////////////////////////////////////
611 610
612 // Preparing all the magic macros 611 // Preparing all the magic macros
613#define GETPROCADDR(sym) \ 612#define GETPROCADDR(sym) \
614 ((__typeof__((*drvfunc))) (eglGetProcAddress(sym))) 613 (((!(*drvfunc)) && (gp)) ? (__typeof__((*drvfunc)))gp(sym) : (__typeof__((*drvfunc)))dlsym(RTLD_DEFAULT, sym))
615 614
616#define _EVASGL_EXT_BEGIN(name) \ 615#define _EVASGL_EXT_BEGIN(name) \
617 { \ 616 { \
@@ -622,7 +621,7 @@ _evgl_api_gles1_ext_init(void)
622 } 621 }
623 622
624#define _EVASGL_EXT_CHECK_SUPPORT(name) \ 623#define _EVASGL_EXT_CHECK_SUPPORT(name) \
625 ((strstr(gles1_exts, name) != NULL) || (strstr(eglexts, name) != NULL)) 624 ((strstr(glexts, name) != NULL) || (strstr(glueexts, name) != NULL))
626 625
627#define _EVASGL_EXT_DISCARD_SUPPORT() \ 626#define _EVASGL_EXT_DISCARD_SUPPORT() \
628 *ext_support = 0; 627 *ext_support = 0;
@@ -743,27 +742,17 @@ _evgl_api_gles1_ext_init(void)
743 DBG("GLES1: List of supported extensions:\n%s", _gles1_ext_string); 742 DBG("GLES1: List of supported extensions:\n%s", _gles1_ext_string);
744 743
745 // GLESv1 version has been initialized! 744 // GLESv1 version has been initialized!
746 _evgl_api_ext_status |= 0x2; 745 _evgl_api_ext_status |= EVASGL_API_GLES1_EXT_INITIALIZED;
747 return EINA_TRUE; 746 return EINA_TRUE;
748#else
749 ERR("GLESv1 support is not implemented for GLX");
750 return EINA_FALSE;
751#endif
752} 747}
753 748
754void 749void
755evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs) 750evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char *glueexts)
756{ 751{
757 if (_evgl_api_ext_status < 1) 752 if (!(_evgl_api_ext_status & EVASGL_API_GLES1_EXT_INITIALIZED))
758 {
759 ERR("EVGL extension is not yet initialized.");
760 return;
761 }
762
763 if (!(_evgl_api_ext_status & 0x2))
764 { 753 {
765 DBG("Initializing GLESv1 extensions..."); 754 DBG("Initializing GLESv1 extensions...");
766 if (!_evgl_api_gles1_ext_init()) 755 if (!_evgl_api_gles1_ext_init(getproc, glueexts))
767 { 756 {
768 ERR("GLESv1 extensions initialization failed"); 757 ERR("GLESv1 extensions initialization failed");
769 return; 758 return;
@@ -821,16 +810,15 @@ evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs)
821} 810}
822 811
823Eina_Bool 812Eina_Bool
824_evgl_api_gles3_ext_init(void) 813_evgl_api_gles3_ext_init(void *getproc, const char *glueexts)
825{ 814{
826 if (_evgl_api_ext_status & 0x4) 815 const char *glexts;
827 return EINA_TRUE; 816 fp_getproc gp = (fp_getproc)getproc;
828
829#ifdef GL_GLES
830 Eina_Strbuf *sb = eina_strbuf_new();
831 int _curext_supported = 0; 817 int _curext_supported = 0;
832 Evas_GL_API *gles3_funcs; 818 Evas_GL_API *gles3_funcs;
833 const char *gles3_exts; 819 Eina_Strbuf *sb = eina_strbuf_new();
820
821#ifdef GL_GLES
834 EVGL_Resource *rsc; 822 EVGL_Resource *rsc;
835 EGLint context_version; 823 EGLint context_version;
836 EGLDisplay dpy = EGLDISPLAY_GET(); 824 EGLDisplay dpy = EGLDISPLAY_GET();
@@ -847,7 +835,7 @@ _evgl_api_gles3_ext_init(void)
847 835
848 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx) 836 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx)
849 { 837 {
850 DBG("Unable to initialize GLES3 extensions. Engine not initialised"); 838 DBG("Unable to initialize GLES3 extensions. Engine not initialized");
851 return EINA_FALSE; 839 return EINA_FALSE;
852 } 840 }
853 841
@@ -862,6 +850,7 @@ _evgl_api_gles3_ext_init(void)
862 DBG("GLESv3 context not bound"); 850 DBG("GLESv3 context not bound");
863 return EINA_FALSE; 851 return EINA_FALSE;
864 } 852 }
853#endif
865 854
866 gles3_funcs = _evgl_api_gles3_internal_get(); 855 gles3_funcs = _evgl_api_gles3_internal_get();
867 if (!gles3_funcs || !gles3_funcs->glGetString) 856 if (!gles3_funcs || !gles3_funcs->glGetString)
@@ -870,8 +859,8 @@ _evgl_api_gles3_ext_init(void)
870 return EINA_FALSE; 859 return EINA_FALSE;
871 } 860 }
872 861
873 gles3_exts = (const char *) gles3_funcs->glGetString(GL_EXTENSIONS); 862 glexts = (const char *) gles3_funcs->glGetString(GL_EXTENSIONS);
874 if (!gles3_exts) 863 if (!glexts)
875 { 864 {
876 ERR("GLESv3:glGetString(GL_EXTENSIONS) returned NULL!"); 865 ERR("GLESv3:glGetString(GL_EXTENSIONS) returned NULL!");
877 return EINA_FALSE; 866 return EINA_FALSE;
@@ -883,7 +872,7 @@ _evgl_api_gles3_ext_init(void)
883 872
884 // Preparing all the magic macros 873 // Preparing all the magic macros
885#define GETPROCADDR(sym) \ 874#define GETPROCADDR(sym) \
886 ((__typeof__((*drvfunc))) (eglGetProcAddress(sym))) 875 (((!(*drvfunc)) && (gp)) ? (__typeof__((*drvfunc)))gp(sym) : (__typeof__((*drvfunc)))dlsym(RTLD_DEFAULT, sym))
887 876
888#define _EVASGL_EXT_BEGIN(name) \ 877#define _EVASGL_EXT_BEGIN(name) \
889 { \ 878 { \
@@ -894,7 +883,7 @@ _evgl_api_gles3_ext_init(void)
894 } 883 }
895 884
896#define _EVASGL_EXT_CHECK_SUPPORT(name) \ 885#define _EVASGL_EXT_CHECK_SUPPORT(name) \
897 (strstr(gles3_exts, name) != NULL) 886 ((strstr(glexts, name) != NULL) || (strstr(glueexts, name) != NULL))
898 887
899#define _EVASGL_EXT_DISCARD_SUPPORT() \ 888#define _EVASGL_EXT_DISCARD_SUPPORT() \
900 *ext_support = 0; 889 *ext_support = 0;
@@ -1009,28 +998,17 @@ _evgl_api_gles3_ext_init(void)
1009 DBG("GLES3: List of supported extensions:\n%s", _gles3_ext_string); 998 DBG("GLES3: List of supported extensions:\n%s", _gles3_ext_string);
1010 999
1011 // GLESv3 version has been initialized! 1000 // GLESv3 version has been initialized!
1012 _evgl_api_ext_status |= 0x4; 1001 _evgl_api_ext_status |= EVASGL_API_GLES3_EXT_INITIALIZED;
1013 return EINA_TRUE; 1002 return EINA_TRUE;
1014
1015#else
1016 ERR("GLES3 is not supported with GLX (yet)!");
1017 return EINA_FALSE;
1018#endif
1019} 1003}
1020 1004
1021void 1005void
1022evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs) 1006evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char *glueexts)
1023{ 1007{
1024 if (_evgl_api_ext_status < 1) 1008 if (!(_evgl_api_ext_status & EVASGL_API_GLES3_EXT_INITIALIZED))
1025 {
1026 ERR("EVGL extension is not yet initialized.");
1027 return;
1028 }
1029
1030 if (!(_evgl_api_ext_status & 0x4))
1031 { 1009 {
1032 DBG("Initializing GLESv3 extensions..."); 1010 DBG("Initializing GLESv3 extensions...");
1033 if (!_evgl_api_gles3_ext_init()) 1011 if (!_evgl_api_gles3_ext_init(getproc, glueexts))
1034 { 1012 {
1035 ERR("GLESv3 extensions initialization failed"); 1013 ERR("GLESv3 extensions initialization failed");
1036 return; 1014 return;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.h b/src/modules/evas/engines/gl_common/evas_gl_api_ext.h
index 2f10e4c8a9..f61fe191be 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.h
@@ -93,10 +93,9 @@
93#define EXTENSION_SUPPORT_GLES1(name) (_gles1_ext_support_##name == 1) 93#define EXTENSION_SUPPORT_GLES1(name) (_gles1_ext_support_##name == 1)
94#define EXTENSION_SUPPORT_GLES3(name) (_gles3_ext_support_##name == 1) 94#define EXTENSION_SUPPORT_GLES3(name) (_gles3_ext_support_##name == 1)
95 95
96extern Eina_Bool evgl_api_ext_init(void *getproc, const char *glueexts); 96extern void evgl_api_gles2_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char *glueexts);
97extern void evgl_api_ext_get(Evas_GL_API *gl_funcs); 97extern void evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char *glueexts);
98extern void evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs); 98extern void evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char *glueexts);
99extern void evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs);
100extern const char *evgl_api_ext_string_get(Eina_Bool official, int version); 99extern const char *evgl_api_ext_string_get(Eina_Bool official, int version);
101 100
102#endif //_EVAS_GL_API_EXT_H 101#endif //_EVAS_GL_API_EXT_H
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
index c176bba246..09a9b75edd 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
@@ -724,6 +724,7 @@ _EVASGL_EXT_END()
724 724
725_EVASGL_EXT_BEGIN(framebuffer_object) 725_EVASGL_EXT_BEGIN(framebuffer_object)
726 _EVASGL_EXT_DRVNAME(GL_OES_framebuffer_object) 726 _EVASGL_EXT_DRVNAME(GL_OES_framebuffer_object)
727 _EVASGL_EXT_DRVNAME(GL_ARB_framebuffer_object)
727 728
728 _EVASGL_EXT_FUNCTION_BEGIN(GLboolean, glIsRenderbufferOES, (GLuint renderbuffer)) 729 _EVASGL_EXT_FUNCTION_BEGIN(GLboolean, glIsRenderbufferOES, (GLuint renderbuffer))
729 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glIsRenderbuffer") 730 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glIsRenderbuffer")
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
index 0d81392021..9f09fb5a00 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
@@ -3863,8 +3863,6 @@ _evgl_gles1_api_init(void)
3863 } 3863 }
3864 3864
3865 _evgl_load_gles1_apis(_gles1_handle, &_gles1_api); 3865 _evgl_load_gles1_apis(_gles1_handle, &_gles1_api);
3866 if (!_evgl_api_gles1_ext_init())
3867 WRN("Could not initialize OpenGL ES 1 extensions yet.");
3868 3866
3869 _initialized = EINA_TRUE; 3867 _initialized = EINA_TRUE;
3870 return EINA_TRUE; 3868 return EINA_TRUE;
@@ -4024,8 +4022,6 @@ _debug_gles1_api_get(Evas_GL_API *funcs)
4024 ORD(glVertexPointer); 4022 ORD(glVertexPointer);
4025 ORD(glViewport); 4023 ORD(glViewport);
4026#undef ORD 4024#undef ORD
4027
4028 evgl_api_gles1_ext_get(funcs);
4029} 4025}
4030 4026
4031static void 4027static void
@@ -4182,8 +4178,6 @@ _normal_gles1_api_get(Evas_GL_API *funcs)
4182 ORD(glVertexPointer); 4178 ORD(glVertexPointer);
4183 ORD(glViewport); 4179 ORD(glViewport);
4184#undef ORD 4180#undef ORD
4185
4186 evgl_api_gles1_ext_get(funcs);
4187} 4181}
4188 4182
4189void 4183void
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index bd597df729..8cccba8dde 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -10,8 +10,8 @@ typedef struct _GL_Format
10 10
11// Extended struct size based on the 314 functions found in gl31.h 11// Extended struct size based on the 314 functions found in gl31.h
12#define EVAS_GL_API_STRUCT_SIZE (sizeof(Evas_GL_API) + 300 * sizeof(void*)) 12#define EVAS_GL_API_STRUCT_SIZE (sizeof(Evas_GL_API) + 300 * sizeof(void*))
13static Evas_GL_API *gl_funcs = NULL;
14static Evas_GL_API *gles1_funcs = NULL; 13static Evas_GL_API *gles1_funcs = NULL;
14static Evas_GL_API *gles2_funcs = NULL;
15static Evas_GL_API *gles3_funcs = NULL; 15static Evas_GL_API *gles3_funcs = NULL;
16 16
17EVGL_Engine *evgl_engine = NULL; 17EVGL_Engine *evgl_engine = NULL;
@@ -1600,22 +1600,6 @@ evgl_engine_init(void *eng_data, const EVGL_Interface *efunc)
1600 1600
1601 evgl_engine->safe_extensions = eina_hash_string_small_new(NULL); 1601 evgl_engine->safe_extensions = eina_hash_string_small_new(NULL);
1602 1602
1603 // Initialize Extensions
1604 if (efunc->proc_address_get && efunc->ext_string_get)
1605 {
1606 if (!evgl_api_ext_init(efunc->proc_address_get, efunc->ext_string_get(eng_data)))
1607 {
1608 ERR("Extensions failed to load. This shouldn't happen, Evas GL load fails.");
1609 goto error;
1610 }
1611 }
1612 else
1613 ERR("Proc address get function not available. Extensions not initialized.");
1614
1615 if (efunc->ext_string_get)
1616 DBG("GLUE Extension String: %s", efunc->ext_string_get(eng_data));
1617 DBG("GL Extension String: %s", glGetString(GL_EXTENSIONS));
1618
1619 // Surface Caps 1603 // Surface Caps
1620 if (!_surface_cap_init(eng_data)) 1604 if (!_surface_cap_init(eng_data))
1621 { 1605 {
@@ -1664,9 +1648,6 @@ evgl_engine_init(void *eng_data, const EVGL_Interface *efunc)
1664 // Maint Thread ID (get tid not available in eina thread yet) 1648 // Maint Thread ID (get tid not available in eina thread yet)
1665 evgl_engine->main_tid = 0; 1649 evgl_engine->main_tid = 0;
1666 1650
1667 // Clear Function Pointers
1668 if (!gl_funcs) gl_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
1669
1670 return evgl_engine; 1651 return evgl_engine;
1671 1652
1672error: 1653error:
@@ -2263,7 +2244,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
2263 // to use fbo & egl image passing to evas 2244 // to use fbo & egl image passing to evas
2264 if (!ctx->extension_checked) 2245 if (!ctx->extension_checked)
2265 { 2246 {
2266 if (!evgl_api_get(ctx->version)) 2247 if (!evgl_api_get(eng_data, ctx->version))
2267 { 2248 {
2268 ERR("Unable to get the list of GL APIs for version %d", ctx->version); 2249 ERR("Unable to get the list of GL APIs for version %d", ctx->version);
2269 evas_gl_common_error_set(eng_data, EVAS_GL_NOT_INITIALIZED); 2250 evas_gl_common_error_set(eng_data, EVAS_GL_NOT_INITIALIZED);
@@ -2388,8 +2369,10 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
2388 else 2369 else
2389 { 2370 {
2390 Eina_Bool use_extension = EINA_FALSE; 2371 Eina_Bool use_extension = EINA_FALSE;
2372#ifdef GL_GLES
2391 if ((ctx->version == EVAS_GL_GLES_1_X) && (gles1_funcs)) 2373 if ((ctx->version == EVAS_GL_GLES_1_X) && (gles1_funcs))
2392 use_extension = EINA_TRUE; 2374 use_extension = EINA_TRUE;
2375#endif
2393 2376
2394 // Normal FBO Rendering 2377 // Normal FBO Rendering
2395 // Create FBO if it hasn't been created 2378 // Create FBO if it hasn't been created
@@ -2730,30 +2713,33 @@ evgl_get_pixels_post(void)
2730} 2713}
2731 2714
2732Evas_GL_API * 2715Evas_GL_API *
2733evgl_api_get(Evas_GL_Context_Version version) 2716evgl_api_get(void *eng_data, Evas_GL_Context_Version version)
2734{ 2717{
2735 if (version == EVAS_GL_GLES_2_X) 2718 if (version == EVAS_GL_GLES_2_X)
2736 { 2719 {
2737 _evgl_api_get(gl_funcs, evgl_engine->api_debug_mode); 2720 if (!gles2_funcs) gles2_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
2738 return gl_funcs; 2721
2722 _evgl_api_gles2_get(gles2_funcs, evgl_engine->api_debug_mode);
2723 evgl_api_gles2_ext_get(gles2_funcs, evgl_engine->funcs->proc_address_get, evgl_engine->funcs->ext_string_get(eng_data));
2724
2725 return gles2_funcs;
2739 } 2726 }
2740 else if (version == EVAS_GL_GLES_1_X) 2727 else if (version == EVAS_GL_GLES_1_X)
2741 { 2728 {
2742 if (!gles1_funcs) gles1_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE); 2729 if (!gles1_funcs) gles1_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
2743 2730
2744 _evgl_api_gles1_get(gles1_funcs, evgl_engine->api_debug_mode); 2731 _evgl_api_gles1_get(gles1_funcs, evgl_engine->api_debug_mode);
2732 evgl_api_gles1_ext_get(gles1_funcs, evgl_engine->funcs->proc_address_get, evgl_engine->funcs->ext_string_get(eng_data));
2733
2745 return gles1_funcs; 2734 return gles1_funcs;
2746 } 2735 }
2747 else if (version == EVAS_GL_GLES_3_X) 2736 else if (version == EVAS_GL_GLES_3_X)
2748 { 2737 {
2749 // Allocate gles3 funcs here, as this is called only if GLES_3 is supported
2750 if (!gles3_funcs) gles3_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE); 2738 if (!gles3_funcs) gles3_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
2751 2739
2752 if (!_evgl_api_gles3_get(gles3_funcs, evgl_engine->api_debug_mode)) 2740 _evgl_api_gles3_get(gles3_funcs, evgl_engine->api_debug_mode);
2753 { 2741 evgl_api_gles3_ext_get(gles3_funcs, evgl_engine->funcs->proc_address_get, evgl_engine->funcs->ext_string_get(eng_data));
2754 free(gles3_funcs); 2742
2755 gles3_funcs = NULL;
2756 }
2757 return gles3_funcs; 2743 return gles3_funcs;
2758 } 2744 }
2759 else return NULL; 2745 else return NULL;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.h b/src/modules/evas/engines/gl_common/evas_gl_core.h
index 9f34df6f90..3e4fda8549 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -63,7 +63,7 @@ int evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *
63 63
64const char *evgl_string_query(int name); 64const char *evgl_string_query(int name);
65int evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface *ns); 65int evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface *ns);
66Evas_GL_API *evgl_api_get(Evas_GL_Context_Version version); 66Evas_GL_API *evgl_api_get(void *eng_data, Evas_GL_Context_Version version);
67void evgl_safe_extension_add(const char *name, void *funcptr); 67void evgl_safe_extension_add(const char *name, void *funcptr);
68Eina_Bool evgl_safe_extension_get(const char *name, void **pfuncptr); 68Eina_Bool evgl_safe_extension_get(const char *name, void **pfuncptr);
69 69
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core_private.h b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
index 0a3d20e1a2..e87c477243 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
@@ -336,9 +336,9 @@ struct _EVGL_Engine
336extern EVGL_Engine *evgl_engine; 336extern EVGL_Engine *evgl_engine;
337 337
338// Internally used functions 338// Internally used functions
339extern void _evgl_api_get(Evas_GL_API *api, int debug); 339extern void _evgl_api_gles2_get(Evas_GL_API *api, Eina_Bool debug);
340extern void _evgl_api_gles1_get(Evas_GL_API *api, Eina_Bool debug); 340extern void _evgl_api_gles1_get(Evas_GL_API *api, Eina_Bool debug);
341extern Eina_Bool _evgl_api_gles3_get(Evas_GL_API *api, Eina_Bool debug); 341extern void _evgl_api_gles3_get(Evas_GL_API *api, Eina_Bool debug);
342extern EVGL_Resource *_evgl_tls_resource_get(void); 342extern EVGL_Resource *_evgl_tls_resource_get(void);
343extern EVGL_Resource *_evgl_tls_resource_create(void *data); 343extern EVGL_Resource *_evgl_tls_resource_create(void *data);
344extern void _evgl_tls_resource_destroy(void *data); 344extern void _evgl_tls_resource_destroy(void *data);
@@ -346,7 +346,9 @@ extern EVGL_Context *_evgl_current_context_get(void);
346extern int _evgl_not_in_pixel_get(void); 346extern int _evgl_not_in_pixel_get(void);
347extern int _evgl_direct_enabled(void); 347extern int _evgl_direct_enabled(void);
348extern EVGLNative_Context _evgl_native_context_get(Evas_GL_Context *ctx); 348extern EVGLNative_Context _evgl_native_context_get(Evas_GL_Context *ctx);
349Eina_Bool _evgl_api_gles1_ext_init(void); 349Eina_Bool _evgl_api_gles2_ext_init(void *getproc, const char *glueexts);
350Eina_Bool _evgl_api_gles1_ext_init(void *getproc, const char *glueexts);
351Eina_Bool _evgl_api_gles3_ext_init(void *getproc, const char *glueexts);
350Evas_GL_API* _evgl_api_gles1_internal_get(void); 352Evas_GL_API* _evgl_api_gles1_internal_get(void);
351Evas_GL_API* _evgl_api_gles3_internal_get(void); 353Evas_GL_API* _evgl_api_gles3_internal_get(void);
352 354
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 63fe2d8d53..9012ba18e2 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1532,7 +1532,7 @@ eng_gl_api_get(void *data, int version)
1532 ERR("Version not supported!"); 1532 ERR("Version not supported!");
1533 return NULL; 1533 return NULL;
1534 } 1534 }
1535 ret = evgl_api_get(version); 1535 ret = evgl_api_get(data, version);
1536 1536
1537 //Disable GLES3 support if symbols not present 1537 //Disable GLES3 support if symbols not present
1538 if ((!ret) && (version == EVAS_GL_GLES_3_X)) 1538 if ((!ret) && (version == EVAS_GL_GLES_3_X))
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index efe9e3ff33..63f2eebf95 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -540,13 +540,6 @@ evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version ver
540 (GLXContext)share_ctx, 540 (GLXContext)share_ctx,
541 1); 541 1);
542 } 542 }
543 else if ((version == EVAS_GL_GLES_1_X) || (version == EVAS_GL_GLES_3_X))
544 {
545 context = glXCreateContext(eng_get_ob(re)->info->info.display,
546 eng_get_ob(re)->visualinfo,
547 NULL,
548 1);
549 }
550 else 543 else
551 { 544 {
552 context = glXCreateContext(eng_get_ob(re)->info->info.display, 545 context = glXCreateContext(eng_get_ob(re)->info->info.display,