summaryrefslogtreecommitdiff
path: root/legacy/evas
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2009-11-21 10:51:51 +0000
committerCarsten Haitzler <raster@rasterman.com>2009-11-21 10:51:51 +0000
commita6dea7be9b74acbde42e9e9aca1d788ec9aeb4ef (patch)
tree6932e3e90b6af8a4e8f9edf0809f281afdc93113 /legacy/evas
parent1cf4a25eed271ad0f98339984d61ceef6e175798 (diff)
find gl symbols runtime - some gl's support the feature but havent
standardised symbols! (bad gl! bad!) SVN revision: 43857
Diffstat (limited to 'legacy/evas')
-rw-r--r--legacy/evas/src/modules/engines/gl_common/Makefile.am2
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_common.h10
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_context.c46
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_private.h2
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c12
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_engine.h2
6 files changed, 63 insertions, 11 deletions
diff --git a/legacy/evas/src/modules/engines/gl_common/Makefile.am b/legacy/evas/src/modules/engines/gl_common/Makefile.am
index 41f78e53ca..fc4ec02eba 100644
--- a/legacy/evas/src/modules/engines/gl_common/Makefile.am
+++ b/legacy/evas/src/modules/engines/gl_common/Makefile.am
@@ -48,7 +48,7 @@ evas_gl_font.c
48#evas_gl_polygon.c \ 48#evas_gl_polygon.c \
49# 49#
50 50
51libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @evas_engine_gl_common_libs@ 51libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @evas_engine_gl_common_libs@ @dlopen_libs@
52endif 52endif
53 53
54EXTRA_DIST = \ 54EXTRA_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 e155ede702..d0f0bd40ce 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
@@ -21,17 +21,18 @@
21 21
22#ifdef BUILD_ENGINE_GL_QUARTZ 22#ifdef BUILD_ENGINE_GL_QUARTZ
23# include <OpenGL/gl.h> 23# include <OpenGL/gl.h>
24# include <OpenGL/glext.h>
24#else 25#else
25# if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) 26# if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
26# if defined(GLES_VARIETY_S3C6410) 27# if defined(GLES_VARIETY_S3C6410)
27# include <GLES2/gl2.h> 28# include <GLES2/gl2.h>
28//// this changed. this was the old style. above the new style
29//# include <GLES/gl.h>
30# elif defined(GLES_VARIETY_SGX) 29# elif defined(GLES_VARIETY_SGX)
31# include <GLES2/gl2.h> 30# include <GLES2/gl2.h>
31# include <GLES2/gl2ext.h>
32# endif 32# endif
33# else 33# else
34# include <GL/gl.h> 34# include <GL/gl.h>
35# include <GL/glext.h>
35# endif 36# endif
36#endif 37#endif
37 38
@@ -293,6 +294,11 @@ void evas_gl_font_texture_free(Evas_GL_Texture *ft);
293void evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y); 294void evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y);
294 295
295 296
297void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b);
298void (*glsym_glBindFramebuffer) (GLenum a, GLuint b);
299void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e);
300void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b);
301
296 302
297 303
298 304
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 ae470c8118..aa51cc096b 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
@@ -1,5 +1,44 @@
1#include "evas_gl_private.h" 1#include "evas_gl_private.h"
2 2
3static int sym_done = 0;
4
5void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b) = NULL;
6void (*glsym_glBindFramebuffer) (GLenum a, GLuint b) = NULL;
7void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e) = NULL;
8void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b) = NULL;
9
10static void
11sym_missing(void)
12{
13 printf("EVAS ERROR - GL symbols missing!\n");
14}
15
16static void
17gl_symbols(void)
18{
19 if (sym_done) return;
20 sym_done = 1;
21
22#define FINDSYM(dst, sym) if (!dst) dst = dlsym(RTLD_DEFAULT, sym)
23#define FALLBAK(dst) if (!dst) dst = (void *)sym_missing;
24
25 FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffers");
26 FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffersEXT");
27 FALLBAK(glsym_glGenFramebuffers);
28
29 FINDSYM(glsym_glBindFramebuffer, "glBindFramebuffer");
30 FINDSYM(glsym_glBindFramebuffer, "glBindFramebufferEXT");
31 FALLBAK(glsym_glBindFramebuffer);
32
33 FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2D");
34 FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2DEXT");
35 FALLBAK(glsym_glFramebufferTexture2D);
36
37 FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffers");
38 FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersEXT");
39 FALLBAK(glsym_glDeleteFramebuffers);
40}
41
3static void shader_array_flush(Evas_GL_Context *gc); 42static void shader_array_flush(Evas_GL_Context *gc);
4 43
5static Evas_GL_Context *_evas_gl_common_context = NULL; 44static Evas_GL_Context *_evas_gl_common_context = NULL;
@@ -118,6 +157,7 @@ evas_gl_common_context_new(void)
118{ 157{
119 Evas_GL_Context *gc; 158 Evas_GL_Context *gc;
120 159
160 gl_symbols();
121#if 1 161#if 1
122 if (_evas_gl_common_context) 162 if (_evas_gl_common_context)
123 { 163 {
@@ -315,9 +355,9 @@ evas_gl_common_context_target_surface_set(Evas_GL_Context *gc,
315# endif 355# endif
316#endif 356#endif
317 if (gc->shader.surface == gc->def_surface) 357 if (gc->shader.surface == gc->def_surface)
318 glBindFramebuffer(GL_FRAMEBUFFER, 0); 358 glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
319 else 359 else
320 glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb); 360 glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb);
321 _evas_gl_common_viewport_set(gc); 361 _evas_gl_common_viewport_set(gc);
322} 362}
323 363
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_private.h b/legacy/evas/src/modules/engines/gl_common/evas_gl_private.h
index 7fd3af4f19..a7d6378ddd 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_private.h
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_private.h
@@ -2,4 +2,6 @@
2#define _EVAS_GL_PRIVATE_H 2#define _EVAS_GL_PRIVATE_H
3#include "evas_gl_common.h" 3#include "evas_gl_common.h"
4 4
5#include <dlfcn.h> /* dlopen,dlclose,etc */
6
5#endif 7#endif
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c
index de27fb393e..61a9dbfab7 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c
@@ -290,10 +290,12 @@ _pool_tex_render_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma
290 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 290 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
291 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 291 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
292 _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); 292 _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
293 glGenFramebuffers(1, &(pt->fb)); 293
294 glBindFramebuffer(GL_FRAMEBUFFER, pt->fb); 294 glsym_glGenFramebuffers(1, &(pt->fb));
295 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pt->texture, 0); 295 glsym_glBindFramebuffer(GL_FRAMEBUFFER, pt->fb);
296 glBindFramebuffer(GL_FRAMEBUFFER, 0); 296 glsym_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pt->texture, 0);
297 glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
298
297 glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); 299 glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
298 return pt; 300 return pt;
299} 301}
@@ -389,7 +391,7 @@ pt_unref(Evas_GL_Texture_Pool *pt)
389 pt->gc->shared->tex.atlas [pt->slot][pt->fslot] = 391 pt->gc->shared->tex.atlas [pt->slot][pt->fslot] =
390 eina_list_remove(pt->gc->shared->tex.atlas[pt->slot][pt->fslot], pt); 392 eina_list_remove(pt->gc->shared->tex.atlas[pt->slot][pt->fslot], pt);
391 glDeleteTextures(1, &(pt->texture)); 393 glDeleteTextures(1, &(pt->texture));
392 if (pt->fb) glDeleteFramebuffers(1, &(pt->fb)); 394 if (pt->fb) glsym_glDeleteFramebuffers(1, &(pt->fb));
393 free(pt); 395 free(pt);
394} 396}
395 397
diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_engine.h b/legacy/evas/src/modules/engines/gl_x11/evas_engine.h
index 579a06368d..734c0abd3c 100644
--- a/legacy/evas/src/modules/engines/gl_x11/evas_engine.h
+++ b/legacy/evas/src/modules/engines/gl_x11/evas_engine.h
@@ -24,6 +24,7 @@
24# define SUPPORT_X11 1 24# define SUPPORT_X11 1
25# include <EGL/egl.h> 25# include <EGL/egl.h>
26# include <GLES2/gl2.h> 26# include <GLES2/gl2.h>
27# include <GLES2/gl2ext.h>
27# include <X11/Xlib.h> 28# include <X11/Xlib.h>
28# include <X11/Xatom.h> 29# include <X11/Xatom.h>
29# include <X11/Xutil.h> 30# include <X11/Xutil.h>
@@ -36,6 +37,7 @@
36# include <X11/Xutil.h> 37# include <X11/Xutil.h>
37# include <X11/extensions/Xrender.h> 38# include <X11/extensions/Xrender.h>
38# include <GL/gl.h> 39# include <GL/gl.h>
40# include <GL/glext.h>
39# include <GL/glx.h> 41# include <GL/glx.h>
40# endif 42# endif
41#endif 43#endif