summaryrefslogtreecommitdiff
path: root/legacy/evas
diff options
context:
space:
mode:
Diffstat (limited to 'legacy/evas')
-rw-r--r--legacy/evas/m4/evas_check_engine.m434
-rw-r--r--legacy/evas/src/modules/engines/gl_common/Makefile.am5
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_common.h22
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_context.c154
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c494
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/Makefile.am3
6 files changed, 565 insertions, 147 deletions
diff --git a/legacy/evas/m4/evas_check_engine.m4 b/legacy/evas/m4/evas_check_engine.m4
index b1f60c7..b968602 100644
--- a/legacy/evas/m4/evas_check_engine.m4
+++ b/legacy/evas/m4/evas_check_engine.m4
@@ -113,16 +113,19 @@ if test "x$gl_flavor_gles" = "xyes" ; then
113fi 113fi
114 114
115if test "x${have_dep}" = "xyes" ; then 115if test "x${have_dep}" = "xyes" ; then
116 if test "x$2" = "xyes" ; then 116 PKG_CHECK_MODULES([GL_EET], [eet >= 1.4.0], [have_dep="yes"], [have_dep="no"])
117 x_libs="${x_libs} -lX11 -lXext -lXrender" 117 if test "x${have_dep}" = "xyes" ; then
118 else 118 if test "x$2" = "xyes" ; then
119 x_dir=${x_dir:-/usr/X11R6} 119 x_libs="${x_libs} -lX11 -lXext -lXrender"
120 x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}} 120 else
121 x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender" 121 x_dir=${x_dir:-/usr/X11R6}
122 fi 122 x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
123 x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
124 fi
123 evas_engine_[]$1[]_cflags="-I/usr/include ${x_cflags}" 125 evas_engine_[]$1[]_cflags="-I/usr/include ${x_cflags}"
124 evas_engine_[]$1[]_libs="${x_libs} -lGL $gl_pt_lib" 126 evas_engine_[]$1[]_libs="${x_libs} -lGL $gl_pt_lib"
125 evas_engine_gl_common_libs="-lGL $gl_pt_lib" 127 evas_engine_gl_common_libs="-lGL $gl_pt_lib"
128 fi
126else 129else
127 if test "x$2" = "xyes" ; then 130 if test "x$2" = "xyes" ; then
128 x_libs="${x_libs} -lX11 -lXext -lXrender" 131 x_libs="${x_libs} -lX11 -lXext -lXrender"
@@ -147,13 +150,16 @@ else
147 if test "x${have_egl}" = "xyes" ; then 150 if test "x${have_egl}" = "xyes" ; then
148 AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL ${x_libs} -lm $gl_pt_lib) 151 AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL ${x_libs} -lm $gl_pt_lib)
149 if test "x${have_glesv2}" = "xyes" ; then 152 if test "x${have_glesv2}" = "xyes" ; then
150 evas_engine_[]$1[]_cflags="${x_cflags}" 153 PKG_CHECK_MODULES([GL_EET], [eet >= 1.4.0], [have_dep="yes"], [have_dep="no"])
151 evas_engine_[]$1[]_libs="${x_libs} -lGLESv2 -lEGL -lm $gl_pt_lib" 154 if test "x${have_dep}" = "xyes" ; then
152 evas_engine_gl_common_libs="-lGLESv2 -lm $gl_pt_lib" 155 evas_engine_[]$1[]_cflags="${x_cflags}"
153 have_dep="yes" 156 evas_engine_[]$1[]_libs="${x_libs} -lGLESv2 -lEGL -lm $gl_pt_lib"
154 gl_flavor_gles="no" 157 evas_engine_gl_common_libs="-lGLESv2 -lm $gl_pt_lib"
155 AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support]) 158 have_dep="yes"
156 gles_variety_sgx="yes" 159 gl_flavor_gles="no"
160 AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support])
161 gles_variety_sgx="yes"
162 fi
157 fi 163 fi
158 fi 164 fi
159fi 165fi
diff --git a/legacy/evas/src/modules/engines/gl_common/Makefile.am b/legacy/evas/src/modules/engines/gl_common/Makefile.am
index ac74f13..2bc7c95 100644
--- a/legacy/evas/src/modules/engines/gl_common/Makefile.am
+++ b/legacy/evas/src/modules/engines/gl_common/Makefile.am
@@ -7,6 +7,7 @@ AM_CPPFLAGS = \
7-I$(top_srcdir)/src/lib/include \ 7-I$(top_srcdir)/src/lib/include \
8@FREETYPE_CFLAGS@ \ 8@FREETYPE_CFLAGS@ \
9@PIXMAN_CFLAGS@ \ 9@PIXMAN_CFLAGS@ \
10@GL_EET_CFLAGS@ \
10@EINA_CFLAGS@ 11@EINA_CFLAGS@
11 12
12if BUILD_ENGINE_GL_COMMON 13if BUILD_ENGINE_GL_COMMON
@@ -81,9 +82,7 @@ shader/filter_blur_nomul.h \
81shader/filter_blur_bgra.h \ 82shader/filter_blur_bgra.h \
82shader/filter_blur_bgra_nomul.h 83shader/filter_blur_bgra_nomul.h
83 84
84 85libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @GL_EET_LIBS@ @evas_engine_gl_common_libs@ @dlopen_libs@
85
86libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @evas_engine_gl_common_libs@ @dlopen_libs@
87endif 86endif
88 87
89EXTRA_DIST = \ 88EXTRA_DIST = \
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h b/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h
index 8474a7e..fb3b9d7 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h
@@ -12,6 +12,7 @@
12#include <math.h> 12#include <math.h>
13#include <sys/time.h> 13#include <sys/time.h>
14#include <unistd.h> 14#include <unistd.h>
15#include <Eet.h>
15 16
16#define GL_GLEXT_PROTOTYPES 17#define GL_GLEXT_PROTOTYPES
17 18
@@ -87,6 +88,18 @@
87#ifndef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 88#ifndef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC
88# define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x3208 89# define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x3208
89#endif 90#endif
91#ifndef GL_PROGRAM_BINARY_LENGTH
92# define GL_PROGRAM_BINARY_LENGTH 0x8741
93#endif
94#ifndef GL_NUM_PROGRAM_BINARY_FORMATS
95# define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
96#endif
97#ifndef GL_PROGRAM_BINARY_FORMATS
98# define GL_PROGRAM_BINARY_FORMATS 0x87FF
99#endif
100#ifndef GL_PROGRAM_BINARY_RETRIEVABLE_HINT
101# define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
102#endif
90 103
91#define SHAD_VERTEX 0 104#define SHAD_VERTEX 0
92#define SHAD_COLOR 1 105#define SHAD_COLOR 1
@@ -134,6 +147,7 @@ struct _Evas_GL_Shared
134 Eina_Bool tex_npo2 : 1; 147 Eina_Bool tex_npo2 : 1;
135 Eina_Bool tex_rect : 1; 148 Eina_Bool tex_rect : 1;
136 Eina_Bool sec_image_map : 1; 149 Eina_Bool sec_image_map : 1;
150 Eina_Bool bin_program : 1;
137 // tuning params - per gpu/cpu combo? 151 // tuning params - per gpu/cpu combo?
138#define MAX_CUTOUT 512 152#define MAX_CUTOUT 512
139#define DEF_CUTOUT 512 153#define DEF_CUTOUT 512
@@ -497,10 +511,7 @@ void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *g
497 Eina_Bool yuv); 511 Eina_Bool yuv);
498void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc); 512void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc);
499 513
500int evas_gl_common_shader_program_init(Evas_GL_Program *p, 514int evas_gl_common_shader_program_init(Evas_GL_Shared *shared);
501 Evas_GL_Program_Source *vert,
502 Evas_GL_Program_Source *frag,
503 const char *name);
504void evas_gl_common_shader_program_init_done(void); 515void evas_gl_common_shader_program_init_done(void);
505void evas_gl_common_shader_program_shutdown(Evas_GL_Program *p); 516void evas_gl_common_shader_program_shutdown(Evas_GL_Program *p);
506 517
@@ -559,6 +570,9 @@ extern void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b);
559extern void (*glsym_glBindFramebuffer) (GLenum a, GLuint b); 570extern void (*glsym_glBindFramebuffer) (GLenum a, GLuint b);
560extern void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e); 571extern void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e);
561extern void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); 572extern void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b);
573extern void (*glsym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei *c, GLenum *d, void *e);
574extern void (*glsym_glProgramBinary) (GLuint a, GLenum b, const void *c, GLint d);
575extern void (*glsym_glProgramParameteri) (GLuint a, GLuint b, GLint d);
562 576
563#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) 577#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
564extern void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e); 578extern void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e);
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c
index 83ec9cf..639277f 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c
@@ -11,6 +11,9 @@ void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b) = NULL;
11void (*glsym_glBindFramebuffer) (GLenum a, GLuint b) = NULL; 11void (*glsym_glBindFramebuffer) (GLenum a, GLuint b) = NULL;
12void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e) = NULL; 12void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e) = NULL;
13void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b) = NULL; 13void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b) = NULL;
14void (*glsym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei *c, GLenum *d, void *e) = NULL;
15void (*glsym_glProgramBinary) (GLuint a, GLenum b, const void *c, GLint d) = NULL;
16void (*glsym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL;
14 17
15#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) 18#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
16// just used for finding symbols :) 19// just used for finding symbols :)
@@ -71,6 +74,19 @@ gl_symbols(void)
71 FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersARB", glsym_func_void); 74 FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersARB", glsym_func_void);
72 FALLBAK(glsym_glDeleteFramebuffers, glsym_func_void); 75 FALLBAK(glsym_glDeleteFramebuffers, glsym_func_void);
73 76
77 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinary", glsym_func_void);
78 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryEXT", glsym_func_void);
79 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryARB", glsym_func_void);
80 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryOES", glsym_func_void);
81
82 FINDSYM(glsym_glProgramBinary, "glProgramBinary", glsym_func_void);
83 FINDSYM(glsym_glProgramBinary, "glProgramBinaryEXT", glsym_func_void);
84 FINDSYM(glsym_glProgramBinary, "glProgramBinaryARB", glsym_func_void);
85
86 FINDSYM(glsym_glProgramParameteri, "glProgramParameteri", glsym_func_void);
87 FINDSYM(glsym_glProgramParameteri, "glProgramParameteriEXT", glsym_func_void);
88 FINDSYM(glsym_glProgramParameteri, "glProgramParameteriARB", glsym_func_void);
89
74#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) 90#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
75#undef FINDSYM 91#undef FINDSYM
76#define FINDSYM(dst, sym, typ) \ 92#define FINDSYM(dst, sym, typ) \
@@ -97,6 +113,24 @@ gl_symbols(void)
97 FINDSYM(secsym_eglDestroyImage, "eglDestroyImageARB", secsym_func_uint); 113 FINDSYM(secsym_eglDestroyImage, "eglDestroyImageARB", secsym_func_uint);
98 FINDSYM(secsym_eglDestroyImage, "eglDestroyImageKHR", secsym_func_uint); 114 FINDSYM(secsym_eglDestroyImage, "eglDestroyImageKHR", secsym_func_uint);
99 115
116 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinary", glsym_func_void);
117 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryEXT", glsym_func_void);
118 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryARB", glsym_func_void);
119 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryOES", glsym_func_void);
120 FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryKHR", glsym_func_void);
121
122 FINDSYM(glsym_glProgramBinary, "glProgramBinary", glsym_func_void);
123 FINDSYM(glsym_glProgramBinary, "glProgramBinaryEXT", glsym_func_void);
124 FINDSYM(glsym_glProgramBinary, "glProgramBinaryARB", glsym_func_void);
125 FINDSYM(glsym_glProgramBinary, "glProgramBinaryOES", glsym_func_void);
126 FINDSYM(glsym_glProgramBinary, "glProgramBinaryKHR", glsym_func_void);
127
128 FINDSYM(glsym_glProgramParameteri, "glProgramParameteri", glsym_func_void);
129 FINDSYM(glsym_glProgramParameteri, "glProgramParameteriEXT", glsym_func_void);
130 FINDSYM(glsym_glProgramParameteri, "glProgramParameteriARB", glsym_func_void);
131 FINDSYM(glsym_glProgramParameteri, "glProgramParameteriOES", glsym_func_void);
132 FINDSYM(glsym_glProgramParameteri, "glProgramParameteriKHR", glsym_func_void);
133
100 FINDSYM(secsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", glsym_func_void); 134 FINDSYM(secsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", glsym_func_void);
101 135
102 FINDSYM(secsym_eglMapImageSEC, "eglMapImageSEC", secsym_func_void_ptr); 136 FINDSYM(secsym_eglMapImageSEC, "eglMapImageSEC", secsym_func_void_ptr);
@@ -607,6 +641,9 @@ evas_gl_common_context_new(void)
607 (strstr((char *)ext, "GL_EXT_texture_rectangle")) || 641 (strstr((char *)ext, "GL_EXT_texture_rectangle")) ||
608 (strstr((char *)ext, "GL_ARB_texture_rectangle"))) 642 (strstr((char *)ext, "GL_ARB_texture_rectangle")))
609 shared->info.tex_rect = 1; 643 shared->info.tex_rect = 1;
644 if ((strstr((char *)ext, "GL_ARB_get_program_binary")) ||
645 (strstr((char *)ext, "GL_OES_get_program_binary")))
646 shared->info.bin_program = 1;
610#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT 647#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
611 if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic"))) 648 if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic")))
612 glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, 649 glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
@@ -765,122 +802,7 @@ evas_gl_common_context_new(void)
765 glEnableVertexAttribArray(SHAD_COLOR); 802 glEnableVertexAttribArray(SHAD_COLOR);
766 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 803 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
767 804
768 if (!evas_gl_common_shader_program_init(&(shared->shader.rect), 805 if (!evas_gl_common_shader_program_init(shared)) goto error;
769 &(shader_rect_vert_src),
770 &(shader_rect_frag_src),
771 "rect")) goto error;
772 if (!evas_gl_common_shader_program_init(&(shared->shader.font),
773 &(shader_font_vert_src),
774 &(shader_font_frag_src),
775 "font")) goto error;
776 if (!evas_gl_common_shader_program_init(&(shared->shader.img),
777 &(shader_img_vert_src),
778 &(shader_img_frag_src),
779 "img")) goto error;
780 if (!evas_gl_common_shader_program_init(&(shared->shader.img_nomul),
781 &(shader_img_nomul_vert_src),
782 &(shader_img_nomul_frag_src),
783 "img_nomul")) goto error;
784 if (!evas_gl_common_shader_program_init(&(shared->shader.img_bgra),
785 &(shader_img_bgra_vert_src),
786 &(shader_img_bgra_frag_src),
787 "img_bgra")) goto error;
788 if (!evas_gl_common_shader_program_init(&(shared->shader.img_bgra_nomul),
789 &(shader_img_bgra_nomul_vert_src),
790 &(shader_img_bgra_nomul_frag_src),
791 "img_bgra_nomul")) goto error;
792 if (!evas_gl_common_shader_program_init(&(shared->shader.img_mask),
793 &(shader_img_mask_vert_src),
794 &(shader_img_mask_frag_src),
795 "img_mask")) goto error;
796 if (!evas_gl_common_shader_program_init(&(shared->shader.tex),
797 &(shader_tex_vert_src),
798 &(shader_tex_frag_src),
799 "tex")) goto error;
800 if (!evas_gl_common_shader_program_init(&(shared->shader.tex_nomul),
801 &(shader_tex_nomul_vert_src),
802 &(shader_tex_nomul_frag_src),
803 "tex_nomul")) goto error;
804 if (!evas_gl_common_shader_program_init(&(shared->shader.yuv),
805 &(shader_yuv_vert_src),
806 &(shader_yuv_frag_src),
807 "yuv")) goto error;
808 if (!evas_gl_common_shader_program_init(&(shared->shader.yuv_nomul),
809 &(shader_yuv_nomul_vert_src),
810 &(shader_yuv_nomul_frag_src),
811 "yuv_nomul")) goto error;
812
813 /* Most of the filters use the image fragment shader */
814 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_invert),
815 &(shader_img_vert_src),
816 &(shader_filter_invert_frag_src),
817 "filter_invert")) goto error;
818 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_invert_nomul),
819 &(shader_img_vert_src),
820 &(shader_filter_invert_nomul_frag_src),
821 "filter_invert_nomul")) goto error;
822 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_invert_bgra),
823 &(shader_img_vert_src),
824 &(shader_filter_invert_bgra_frag_src),
825 "filter_invert_bgra")) goto error;
826 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_invert_bgra_nomul),
827 &(shader_img_vert_src),
828 &(shader_filter_invert_bgra_nomul_frag_src),
829 "filter_invert_bgra_nomul")) goto error;
830
831 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_sepia),
832 &(shader_img_vert_src),
833 &(shader_filter_sepia_frag_src),
834 "filter_sepia")) goto error;
835 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_sepia_nomul),
836 &(shader_img_vert_src),
837 &(shader_filter_sepia_nomul_frag_src),
838 "filter_sepia_nomul")) goto error;
839 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_sepia_bgra),
840 &(shader_img_vert_src),
841 &(shader_filter_sepia_bgra_frag_src),
842 "filter_sepia_bgra")) goto error;
843 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_sepia_bgra_nomul),
844 &(shader_img_vert_src),
845 &(shader_filter_sepia_bgra_nomul_frag_src),
846 "filter_sepia_bgra_nomul")) goto error;
847
848 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_greyscale),
849 &(shader_img_vert_src),
850 &(shader_filter_greyscale_frag_src),
851 "filter_greyscale")) goto error;
852 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_greyscale_nomul),
853 &(shader_img_vert_src),
854 &(shader_filter_greyscale_nomul_frag_src),
855 "filter_greyscale_nomul")) goto error;
856 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_greyscale_bgra),
857 &(shader_img_vert_src),
858 &(shader_filter_greyscale_bgra_frag_src),
859 "filter_greyscale_bgra")) goto error;
860 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_greyscale_bgra_nomul),
861 &(shader_img_vert_src),
862 &(shader_filter_greyscale_bgra_nomul_frag_src),
863 "filter_greyscale_bgra_nomul")) goto error;
864#if 0
865 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_blur),
866 &(shader_filter_blur_vert_src),
867 &(shader_filter_blur_frag_src),
868 "filter_blur")) goto error;
869 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_blur_nomul),
870 &(shader_filter_blur_vert_src),
871 &(shader_filter_blur_nomul_frag_src),
872 "filter_blur_nomul")) goto error;
873 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_blur_bgra),
874 &(shader_filter_blur_vert_src),
875 &(shader_filter_blur_bgra_frag_src),
876 "filter_blur_bgra")) goto error;
877 if (!evas_gl_common_shader_program_init(&(shared->shader.filter_blur_bgra_nomul),
878 &(shader_filter_blur_vert_src),
879 &(shader_filter_blur_bgra_nomul_frag_src),
880 "filter_blur_bgra_nomul")) goto error;
881#endif
882
883
884 806
885 glUseProgram(shared->shader.yuv.prog); 807 glUseProgram(shared->shader.yuv.prog);
886 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 808 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c
index 2a5c69e..d1c0a72 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c
@@ -637,14 +637,210 @@ gl_compile_link_error(GLuint target, const char *action)
637 } 637 }
638} 638}
639 639
640int 640static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
641evas_gl_common_shader_program_init(Evas_GL_Program *p, 641
642 Evas_GL_Program_Source *vert, 642static Eina_Bool
643 Evas_GL_Program_Source *frag, 643_evas_gl_shader_file_is_dir(const char *file)
644 const char *name)
645{ 644{
646 GLint ok; 645 struct stat st;
646
647 if (stat(file, &st) < 0) return EINA_FALSE;
648 if (S_ISDIR(st.st_mode)) return EINA_TRUE;
649 return EINA_FALSE;
650}
651
652static Eina_Bool
653_evas_gl_shader_file_mkdir(const char *dir)
654{
655 /* evas gl shader only call this function when the dir is not exist */
656 if (mkdir(dir, default_mode) < 0) return EINA_FALSE;
657 return EINA_TRUE;
658}
659
660static Eina_Bool
661_evas_gl_shader_file_exists(const char *file)
662{
663 struct stat st;
664 if (!file) return EINA_FALSE;
665 if (stat(file, &st) < 0) return EINA_FALSE;
666
667 return EINA_TRUE;
668}
669
670static inline Eina_Bool
671_evas_gl_shader_file_mkpath_if_not_exists(const char *path)
672{
673 struct stat st;
674
675 if (stat(path, &st) < 0)
676 return _evas_gl_shader_file_mkdir(path);
677 else if (!S_ISDIR(st.st_mode))
678 return EINA_FALSE;
679 else
680 return EINA_TRUE;
681}
682
683static Eina_Bool
684_evas_gl_shader_file_mkpath(const char *path)
685{
686 char ss[PATH_MAX];
687 unsigned int i;
688
689 if (_evas_gl_shader_file_is_dir(path)) return EINA_TRUE;
690
691 for (i = 0; path[i]; ss[i] = path[i], i++)
692 {
693 if (i == sizeof(ss) - 1) return EINA_FALSE;
694 if ((path[i] == '/') && (i > 0))
695 {
696 ss[i] = 0;
697 if (!_evas_gl_shader_file_mkpath_if_not_exists(ss))
698 return EINA_FALSE;
699 }
700 }
701 ss[i] = 0;
702 return _evas_gl_shader_file_mkpath_if_not_exists(ss);
703}
704
705static int
706_evas_gl_shader_dir_check(char *bin_shader_dir, int num)
707{
708 char *home = NULL;
709 char *subdir = ".cache/evas_gl_common_shaders";
710
711 home = getenv("HOME");
712 if ((!home) || (!home[0])) return 0;
713
714 snprintf(bin_shader_dir, num, "%s/%s", home, subdir);
715 return _evas_gl_shader_file_exists(bin_shader_dir);
716}
717
718static int
719_evas_gl_shader_file_check(const char *bin_shader_dir, char *bin_shader_file, int dir_num)
720{
721 char before_name[PATH_MAX];
722 char after_name[PATH_MAX];
723 int new_path_len = 0;
724 int i = 0, j = 0;
725
726 char *vendor = NULL;
727 char *driver = NULL;
728 char *version = NULL;
647 729
730 vendor = (char *)glGetString(GL_VENDOR);
731 driver = (char *)glGetString(GL_RENDERER);
732 version = (char *)glGetString(GL_VERSION);
733
734 new_path_len = snprintf(before_name, sizeof(before_name), "%s::%s::%s::%s::binary_shader.eet", vendor, version, driver, MODULE_ARCH);
735
736 /* remove '/' from file name */
737 for (i = 0; i < new_path_len; i++)
738 {
739 if (before_name[i] != '/')
740 {
741 after_name[j] = before_name[i];
742 j++;
743 }
744 }
745 after_name[j] = 0;
746
747 snprintf(bin_shader_file, dir_num, "%s/%s", bin_shader_dir, after_name);
748
749 return _evas_gl_shader_file_exists(bin_shader_file);
750}
751
752static int
753_evas_gl_common_shader_program_binary_init(Evas_GL_Program *p,
754 const char *pname,
755 Eet_File *ef)
756{
757 int res = 0, num = 0, length = 0;
758 int *formats = NULL;
759 void *data = NULL;
760
761 if (!ef) return res;
762
763 data = eet_read(ef, pname, &length);
764 if ((!data) || (length <= 0)) goto finish;
765
766 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num);
767 if (num <= 0) goto finish;
768
769 formats = calloc(num, sizeof(int));
770 if (!formats) goto finish;
771
772 glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, formats);
773 if (!formats[0]) goto finish;
774
775 p->prog = glCreateProgram();
776
777#if 0
778 // TOOD: invalid rendering error occurs when attempting to use a glProgramBinary.
779 // in order to render correctly we should create a dummy vertex shader.
780 p->vert = glCreateShader(GL_VERTEX_SHADER);
781 glAttachShader(p->prog, p->vert);
782 p->frag = glCreateShader(GL_FRAGMENT_SHADER);
783 glAttachShader(p->prog, p->frag);
784#endif
785 glsym_glProgramBinary(p->prog, formats[0], data, length);
786
787 glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
788 glBindAttribLocation(p->prog, SHAD_COLOR, "color");
789 glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
790 glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
791 glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
792 glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
793 res = 1;
794
795finish:
796 if (formats) free(formats);
797 if (data) free(data);
798 if ((!res) && (p->prog))
799 {
800 glDeleteProgram(p->prog);
801 p->prog = 0;
802 }
803 return res;
804}
805
806static int
807_evas_gl_common_shader_program_binary_save(Evas_GL_Program *p,
808 const char *pname,
809 Eet_File *ef)
810{
811 void* data = NULL;
812 GLenum format;
813 int length = 0;
814
815 if (!glsym_glGetProgramBinary) return 0;
816
817 glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length);
818 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
819 if (length <= 0) return 0;
820
821 data = malloc(length);
822 if (!data) return 0;
823
824 glsym_glGetProgramBinary(p->prog, length, NULL, &format, data);
825 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
826
827 if (eet_write(ef, pname, data, length, 0) < 0)
828 {
829 if (data) free(data);
830 return 0;
831 }
832 if (data) free(data);
833 return 1;
834}
835
836static int
837_evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
838 Evas_GL_Program_Source *vert,
839 Evas_GL_Program_Source *frag,
840 const char *name)
841{
842 GLint ok;
843
648 p->vert = glCreateShader(GL_VERTEX_SHADER); 844 p->vert = glCreateShader(GL_VERTEX_SHADER);
649 p->frag = glCreateShader(GL_FRAGMENT_SHADER); 845 p->frag = glCreateShader(GL_FRAGMENT_SHADER);
650#if defined (GLES_VARIETY_S3C6410) 846#if defined (GLES_VARIETY_S3C6410)
@@ -683,6 +879,12 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p,
683 } 879 }
684#endif 880#endif
685 p->prog = glCreateProgram(); 881 p->prog = glCreateProgram();
882#if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX)
883#else
884 if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri))
885 glsym_glProgramParameteri(p->prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT,
886 GL_TRUE);
887#endif
686 glAttachShader(p->prog, p->vert); 888 glAttachShader(p->prog, p->vert);
687 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 889 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
688 glAttachShader(p->prog, p->frag); 890 glAttachShader(p->prog, p->frag);
@@ -716,6 +918,280 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p,
716 return 1; 918 return 1;
717} 919}
718 920
921static int
922_evas_gl_common_shader_source_init(Evas_GL_Shared *shared)
923{
924 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.rect),
925 &(shader_rect_vert_src),
926 &(shader_rect_frag_src),
927 "rect")) return 0;
928 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.font),
929 &(shader_font_vert_src),
930 &(shader_font_frag_src),
931 "font")) return 0;
932 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img),
933 &(shader_img_vert_src),
934 &(shader_img_frag_src),
935 "img")) return 0;
936 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_nomul),
937 &(shader_img_nomul_vert_src),
938 &(shader_img_nomul_frag_src),
939 "img_nomul")) return 0;
940 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_bgra),
941 &(shader_img_bgra_vert_src),
942 &(shader_img_bgra_frag_src),
943 "img_bgra")) return 0;
944 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_bgra_nomul),
945 &(shader_img_bgra_nomul_vert_src),
946 &(shader_img_bgra_nomul_frag_src),
947 "img_bgra_nomul")) return 0;
948 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_mask),
949 &(shader_img_mask_vert_src),
950 &(shader_img_mask_frag_src),
951 "img_mask")) return 0;
952 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.tex),
953 &(shader_tex_vert_src),
954 &(shader_tex_frag_src),
955 "tex")) return 0;
956 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.tex_nomul),
957 &(shader_tex_nomul_vert_src),
958 &(shader_tex_nomul_frag_src),
959 "tex_nomul")) return 0;
960 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.yuv),
961 &(shader_yuv_vert_src),
962 &(shader_yuv_frag_src),
963 "yuv")) return 0;
964 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.yuv_nomul),
965 &(shader_yuv_nomul_vert_src),
966 &(shader_yuv_nomul_frag_src),
967 "yuv_nomul")) return 0;
968
969 /* Most of the filters use the image fragment shader */
970 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert),
971 &(shader_img_vert_src),
972 &(shader_filter_invert_frag_src),
973 "filter_invert")) return 0;
974 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert_nomul),
975 &(shader_img_vert_src),
976 &(shader_filter_invert_nomul_frag_src),
977 "filter_invert_nomul")) return 0;
978 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert_bgra),
979 &(shader_img_vert_src),
980 &(shader_filter_invert_bgra_frag_src),
981 "filter_invert_bgra")) return 0;
982 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert_bgra_nomul),
983 &(shader_img_vert_src),
984 &(shader_filter_invert_bgra_nomul_frag_src),
985 "filter_invert_bgra_nomul")) return 0;
986
987 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia),
988 &(shader_img_vert_src),
989 &(shader_filter_sepia_frag_src),
990 "filter_sepia")) return 0;
991 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia_nomul),
992 &(shader_img_vert_src),
993 &(shader_filter_sepia_nomul_frag_src),
994 "filter_sepia_nomul")) return 0;
995 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia_bgra),
996 &(shader_img_vert_src),
997 &(shader_filter_sepia_bgra_frag_src),
998 "filter_sepia_bgra")) return 0;
999 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia_bgra_nomul),
1000 &(shader_img_vert_src),
1001 &(shader_filter_sepia_bgra_nomul_frag_src),
1002 "filter_sepia_bgra_nomul")) return 0;
1003
1004 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale),
1005 &(shader_img_vert_src),
1006 &(shader_filter_greyscale_frag_src),
1007 "filter_greyscale")) return 0;
1008 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale_nomul),
1009 &(shader_img_vert_src),
1010 &(shader_filter_greyscale_nomul_frag_src),
1011 "filter_greyscale_nomul")) return 0;
1012 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale_bgra),
1013 &(shader_img_vert_src),
1014 &(shader_filter_greyscale_bgra_frag_src),
1015 "filter_greyscale_bgra")) return 0;
1016 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale_bgra_nomul),
1017 &(shader_img_vert_src),
1018 &(shader_filter_greyscale_bgra_nomul_frag_src),
1019 "filter_greyscale_bgra_nomul")) return 0;
1020#if 0
1021 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur),
1022 &(shader_filter_blur_vert_src),
1023 &(shader_filter_blur_frag_src),
1024 "filter_blur")) return 0;
1025 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur_nomul),
1026 &(shader_filter_blur_vert_src),
1027 &(shader_filter_blur_nomul_frag_src),
1028 "filter_blur_nomul")) return 0;
1029 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur_bgra),
1030 &(shader_filter_blur_vert_src),
1031 &(shader_filter_blur_bgra_frag_src),
1032 "filter_blur_bgra")) return 0;
1033 if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur_bgra_nomul),
1034 &(shader_filter_blur_vert_src),
1035 &(shader_filter_blur_bgra_nomul_frag_src),
1036 "filter_blur_bgra_nomul")) return 0;
1037#endif
1038
1039 return 1;
1040}
1041
1042static int
1043_evas_gl_common_shader_binary_init(Evas_GL_Shared *shared)
1044{
1045 /* check eet */
1046 Eet_File *et = NULL;
1047
1048 char bin_dir_path[PATH_MAX];
1049 char bin_file_path[PATH_MAX];
1050
1051 if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path)))
1052 return 0;
1053
1054 if (!_evas_gl_shader_file_check(bin_dir_path, bin_file_path,
1055 sizeof(bin_dir_path)))
1056 return 0;
1057
1058 /* use eet */
1059 if (!eet_init()) return 0;
1060 et = eet_open(bin_file_path, EET_FILE_MODE_READ);
1061 if (!et) goto error;
1062
1063 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.rect), "rect", et)) goto error;
1064 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.font), "font", et)) goto error;
1065 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img), "img", et)) goto error;
1066 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_nomul), "img_nomul", et)) goto error;
1067 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_bgra), "img_bgra", et)) goto error;
1068 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_bgra_nomul), "img_bgra_nomul", et)) goto error;
1069 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_mask), "img_mask", et)) goto error;
1070 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.tex), "tex", et)) goto error;
1071 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.tex_nomul),"tex_nomul", et)) goto error;
1072 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.yuv), "yuv", et)) goto error;
1073 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.yuv_nomul), "yuv_nomul", et)) goto error;
1074
1075 /* Most of the filters use the image fragment shader */
1076 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert), "filter_invert", et)) goto error;
1077 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert_nomul), "filter_invert_nomul", et)) goto error;
1078 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert_bgra), "filter_invert_bgra", et)) goto error;
1079 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert_bgra_nomul), "filter_invert_bgra_nomul", et)) goto error;
1080
1081 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia), "filter_sepia", et)) goto error;
1082 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia_nomul), "filter_sepia_nomul", et)) goto error;
1083 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia_bgra), "filter_sepia_bgra", et)) goto error;
1084 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia_bgra_nomul), "filter_sepia_bgra_nomul", et)) goto error;
1085
1086 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale), "filter_greyscale", et)) goto error;
1087 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale_nomul), "filter_greyscale_nomul", et)) goto error;
1088 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale_bgra), "filter_greyscale_bgra", et)) goto error;
1089 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale_bgra_nomul), "filter_greyscale_bgra_nomul", et)) goto error;
1090#if 0
1091 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur), "filter_blur", et)) goto error;
1092 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur_nomul), "filter_blur_nomul", et)) goto error;
1093 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur_bgra), "filter_blur_bgra", et)) goto error;
1094 if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur_bgra_nomul), "filter_blur_bgra_nomul", et)) goto error;
1095#endif
1096
1097 if (et) eet_close(et);
1098 eet_shutdown();
1099 return 1;
1100
1101error:
1102 if (et) eet_close(et);
1103 eet_shutdown();
1104 return 0;
1105}
1106
1107static int
1108_evas_gl_common_shader_binary_save(Evas_GL_Shared *shared)
1109{
1110 /* check eet */
1111 Eet_File *et = NULL; //check eet file
1112 int tmpfd;
1113 int res = 0;
1114 char bin_dir_path[PATH_MAX];
1115 char bin_file_path[PATH_MAX];
1116 char tmp_file[PATH_MAX];
1117
1118 if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path)))
1119 res = _evas_gl_shader_file_mkpath(bin_dir_path);
1120 if (!res) return 0; /* we can't make directory */
1121
1122 _evas_gl_shader_file_check(bin_dir_path, bin_file_path,
1123 sizeof(bin_dir_path));
1124
1125 /* use mkstemp for writing */
1126 snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", bin_file_path);
1127 tmpfd = mkstemp(tmp_file);
1128 if (tmpfd < 0) goto error;
1129 close(tmpfd);
1130
1131 /* use eet */
1132 if (!eet_init()) goto error;
1133
1134 et = eet_open(tmp_file, EET_FILE_MODE_WRITE);
1135 if (!et) goto error;
1136
1137 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.rect), "rect", et)) goto error;
1138 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.font), "font", et)) goto error;
1139 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img), "img", et)) goto error;
1140 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_nomul), "img_nomul", et)) goto error;
1141 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_bgra), "img_bgra", et)) goto error;
1142 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_bgra_nomul), "img_bgra_nomul", et)) goto error;
1143 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_mask), "img_mask", et)) goto error;
1144 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.tex), "tex", et)) goto error;
1145 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.tex_nomul),"tex_nomul", et)) goto error;
1146 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.yuv), "yuv", et)) goto error;
1147 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.yuv_nomul), "yuv_nomul", et)) goto error;
1148 /* Most of the filters use the image fragment shader */
1149 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert), "filter_invert", et)) goto error;
1150 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert_nomul), "filter_invert_nomul", et)) goto error;
1151 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert_bgra), "filter_invert_bgra", et)) goto error;
1152 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert_bgra_nomul), "filter_invert_bgra_nomul", et)) goto error;
1153
1154 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia), "filter_sepia", et)) goto error;
1155 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia_nomul), "filter_sepia_nomul", et)) goto error;
1156 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia_bgra), "filter_sepia_bgra", et)) goto error;
1157 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia_bgra_nomul), "filter_sepia_bgra_nomul", et)) goto error;
1158
1159 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale), "filter_greyscale", et)) goto error;
1160 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale_nomul), "filter_greyscale_nomul", et)) goto error;
1161 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale_bgra), "filter_greyscale_bgra", et)) goto error;
1162 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale_bgra_nomul), "filter_greyscale_bgra_nomul", et)) goto error;
1163#if 0
1164 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur), "filter_blur", et)) goto error;
1165 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur_nomul), "filter_blur_nomul", et)) goto error;
1166 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur_bgra), "filter_blur_bgra", et)) goto error;
1167 if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur_bgra_nomul), "filter_blur_bgra_nomul", et)) goto error;
1168#endif
1169
1170 if (eet_close(et) != EET_ERROR_NONE) goto error;
1171 if (rename(tmp_file,bin_file_path) < 0) goto error;
1172 eet_shutdown();
1173 return 1;
1174
1175error:
1176 if (et) eet_close(et);
1177 if (_evas_gl_shader_file_exists(tmp_file)) unlink(tmp_file);
1178 eet_shutdown();
1179 return 0;
1180}
1181
1182int
1183evas_gl_common_shader_program_init(Evas_GL_Shared *shared)
1184{
1185 // gl support binary shader and get env of binary shader path
1186 if (shared->info.bin_program && _evas_gl_common_shader_binary_init(shared)) return 1;
1187 /* compile all shader.*/
1188 if (!_evas_gl_common_shader_source_init(shared)) return 0;
1189 /* sucess compile all shader. if gl support binary shader, we need to save */
1190 if (shared->info.bin_program) _evas_gl_common_shader_binary_save(shared);
1191
1192 return 1;
1193}
1194
719void 1195void
720evas_gl_common_shader_program_init_done(void) 1196evas_gl_common_shader_program_init_done(void)
721{ 1197{
@@ -727,7 +1203,7 @@ evas_gl_common_shader_program_init_done(void)
727void 1203void
728evas_gl_common_shader_program_shutdown(Evas_GL_Program *p) 1204evas_gl_common_shader_program_shutdown(Evas_GL_Program *p)
729{ 1205{
730 glDeleteShader(p->vert); 1206 if (p->vert) glDeleteShader(p->vert);
731 glDeleteShader(p->frag); 1207 if (p->frag) glDeleteShader(p->frag);
732 glDeleteProgram(p->prog); 1208 if (p->prog) glDeleteProgram(p->prog);
733} 1209}
diff --git a/legacy/evas/src/modules/engines/gl_x11/Makefile.am b/legacy/evas/src/modules/engines/gl_x11/Makefile.am
index 3701a0d..ee5bf04 100644
--- a/legacy/evas/src/modules/engines/gl_x11/Makefile.am
+++ b/legacy/evas/src/modules/engines/gl_x11/Makefile.am
@@ -9,6 +9,7 @@ AM_CPPFLAGS = \
9@FREETYPE_CFLAGS@ \ 9@FREETYPE_CFLAGS@ \
10@PIXMAN_CFLAGS@ \ 10@PIXMAN_CFLAGS@ \
11@EINA_CFLAGS@ \ 11@EINA_CFLAGS@ \
12@GL_EET_CFLAGS@ \
12@evas_engine_gl_x11_cflags@ 13@evas_engine_gl_x11_cflags@
13 14
14if BUILD_ENGINE_GL_X11 15if BUILD_ENGINE_GL_X11
@@ -29,7 +30,7 @@ pkgdir = $(libdir)/evas/modules/engines/gl_x11/$(MODULE_ARCH)
29pkg_LTLIBRARIES = module.la 30pkg_LTLIBRARIES = module.la
30 31
31module_la_SOURCES = $(GL_X11_SOURCES) 32module_la_SOURCES = $(GL_X11_SOURCES)
32module_la_LIBADD = @EINA_LIBS@ $(GL_X11_LIBADD) $(top_builddir)/src/lib/libevas.la @dlopen_libs@ 33module_la_LIBADD = @EINA_LIBS@ @GL_EET_LIBS@ $(GL_X11_LIBADD) $(top_builddir)/src/lib/libevas.la @dlopen_libs@
33module_la_LDFLAGS = -module -avoid-version 34module_la_LDFLAGS = -module -avoid-version
34module_la_LIBTOOLFLAGS = --tag=disable-static 35module_la_LIBTOOLFLAGS = --tag=disable-static
35 36