I'm attaching a patch for the initial version of the GL Fastpath

addition to evas gl backend.

Working on different mobile devices, we've noticed that the cost of context
switch (MakeCurrent) in GL can be very expensive depending on the driver
implementation.  To minimize the poorly written driver's context switch
overhead, I've implemented a state tracking layer on top of the driver
implemented GL.

Essentially, this layer wraps all the GL/Glue(GLX/EGL) APIs and manages its own
state changes.  Internally, only one real GL context is created and logical
contexts are created every time a user requests context creation.  The logical
contexts keep track of its states and sets only the necessary states
(the ones that are different than the current ones)
when there is a MakeCurrent request.  The real MakeCurrent gets called when
there is a Surface/Window change request.

The GL library is dlopened and all the APIs are dlsym'ed and wrapped
accordingly.  All the GL functions are in evas_gl_core.{h,c}.

Here's a very simply flow of the code.
   - all the APIs are exported as function pointers (*glsym_glBegin),
     (*glsm_eglCreatContext), and etc.
   - all the native GL/Glue(GLX/EGL) APIs are dlsym'ed as _sym_glBegin,
     _sym_eglCreateContext, and etc.
   - all the fastpath APIs are implmemnted as fpgl_glBegin,
     fpgl_eglCreateContext, and etc.
   - if faspath is seletected, the exported APIs are set accordingly
     ie. glsym_glBegin = fpgl_glBegin;
   - default mode is the regular gl symbols are directly set.
     ie. glsym_glBegin = _sym_glBegin;
             
I have an Environment variable where you can set it to three different Modes

EVAS_GL_FASTPATH = 0    // Default mode. Regular GL symbols are directly loaded
EVAS_GL_FASTPATH = 1    // Fastpath mode. Takes the path described above.
EVAS_GL_FASTPATH = 2    // Wrapped mode.  All the regular GL functions are
                           wrapped once.  This can be used for various
purposes

Since all the GL symbols are now loaded in this library, I took out all
the gl symbol loading parts in the evas gl backend as you'll see in the patch.
The changes to the engine and the backend itself is pretty minor.

There are still some known issues to hammer out but I thought we're at a good
place for an initial version so that my source doesn't diverge too much.

Known Issues and To Do's
* Current GL Fastpath version doesn't support multiple threads. Instead of
  having one global real context, I would need to do it for each thread. I'll
  get on this soon.
  
  * Issues running Evas GL on certain conditions.  When running the elementary
  test (with gl engine), if you run ELMGLview test that runs in ON_DEMAND mode,
  everything works fine. BUT, when you run the ELMGLView test in ALWAYS
    mode, the subsequent elm tests shows blank screen. When you destroy the
  GLView window, everything else comes on fine.
  
  * Resource protection code.  This actually applies to Evas GL code in general
  as well. Since all the resources are shared among all the contexts that get
  created, I would like to eventually have a resource protecting mechanism that
  prevents access to resources outside of its context unless specifically
  specified.
  
  I'm attaching three files
     - evas_gl_core.h, evas_gl_core.c, fastpath.patch
     
  To get the code running...
     - copy evas_gl_core.{c,h} to src/modules/engine/gl_common/
     - apply the fastpath.patch
     - compile/install evas
     - to run with fastpath GL (ie. % EVAS_GL_FASTPATH=1 ./evasgl_sample1)



SVN revision: 65891
This commit is contained in:
Carsten Haitzler 2011-12-05 08:54:14 +00:00
parent 39467c29b6
commit 5967841988
11 changed files with 8010 additions and 1377 deletions

View File

@ -14,6 +14,8 @@ if BUILD_ENGINE_GL_COMMON
noinst_LTLIBRARIES = libevas_engine_gl_common.la
libevas_engine_gl_common_la_SOURCES = \
evas_gl_core.h \
evas_gl_core.c \
evas_gl_private.h \
evas_gl_common.h \
evas_gl_context.c \

View File

@ -12,6 +12,7 @@
#include <sys/time.h>
#include <unistd.h>
#include <Eet.h>
#include "evas_gl_core.h"
#define GL_GLEXT_PROTOTYPES
@ -28,14 +29,14 @@
# else
# if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
# if defined(GLES_VARIETY_S3C6410)
# include <GLES2/gl2.h>
//# include <GLES2/gl2.h>
# elif defined(GLES_VARIETY_SGX)
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
//# include <GLES2/gl2.h>
//# include <GLES2/gl2ext.h>
# endif
# else
# include <GL/gl.h>
# include <GL/glext.h>
//# include <GL/gl.h>
//# include <GL/glext.h>
# endif
# endif
#endif
@ -624,29 +625,12 @@ Filtered_Image *evas_gl_common_image_filtered_save(Evas_GL_Image *im, Evas_GL_
void evas_gl_common_image_filtered_free(Evas_GL_Image *im, Filtered_Image *);
#endif
extern void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b);
extern void (*glsym_glBindFramebuffer) (GLenum a, GLuint b);
extern void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e);
extern void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b);
extern void (*glsym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei *c, GLenum *d, void *e);
extern void (*glsym_glProgramBinary) (GLuint a, GLenum b, const void *c, GLint d);
extern void (*glsym_glProgramParameteri) (GLuint a, GLuint b, GLint d);
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
extern void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e);
extern unsigned int (*secsym_eglDestroyImage) (void *a, void *b);
extern void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b);
extern void *(*secsym_eglMapImageSEC) (void *a, void *b);
extern unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b);
extern unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d);
#endif
//#define GL_ERRORS 1
#ifdef GL_ERRORS
# define GLERR(fn, fl, ln, op) \
{ \
int __gl_err = glGetError(); \
int __gl_err = glsym_glGetError(); \
if (__gl_err != GL_NO_ERROR) glerr(__gl_err, fl, fn, ln, op); \
}
#else

View File

@ -12,142 +12,8 @@
static int sym_done = 0;
int _evas_engine_GL_common_log_dom = -1;
typedef void (*glsym_func_void) ();
void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b) = NULL;
void (*glsym_glBindFramebuffer) (GLenum a, GLuint b) = NULL;
void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e) = NULL;
void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b) = NULL;
void (*glsym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei *c, GLenum *d, void *e) = NULL;
void (*glsym_glProgramBinary) (GLuint a, GLenum b, const void *c, GLint d) = NULL;
void (*glsym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL;
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
// just used for finding symbols :)
typedef void (*_eng_fn) (void);
typedef _eng_fn (*secsym_func_eng_fn) ();
typedef unsigned int (*secsym_func_uint) ();
typedef void *(*secsym_func_void_ptr) ();
static _eng_fn (*secsym_eglGetProcAddress) (const char *a) = NULL;
void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e) = NULL;
unsigned int (*secsym_eglDestroyImage) (void *a, void *b) = NULL;
void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
void *(*secsym_eglMapImageSEC) (void *a, void *b) = NULL;
unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b) = NULL;
unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL;
#endif
static int dbgflushnum = -1;
static void
sym_missing(void)
{
ERR("GL symbols missing!");
}
static void
gl_symbols(void)
{
if (sym_done) return;
sym_done = 1;
/* FIXME: If using the SDL engine, we should use SDL_GL_GetProcAddress
* instead of dlsym
* if (!dst) dst = (typ)SDL_GL_GetProcAddress(sym)
*/
#define FINDSYM(dst, sym, typ) if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
#define FALLBAK(dst, typ) if (!dst) dst = (typ)sym_missing;
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffers", glsym_func_void);
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffersEXT", glsym_func_void);
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffersARB", glsym_func_void);
FALLBAK(glsym_glGenFramebuffers, glsym_func_void);
FINDSYM(glsym_glBindFramebuffer, "glBindFramebuffer", glsym_func_void);
FINDSYM(glsym_glBindFramebuffer, "glBindFramebufferEXT", glsym_func_void);
FINDSYM(glsym_glBindFramebuffer, "glBindFramebufferARB", glsym_func_void);
FALLBAK(glsym_glBindFramebuffer, glsym_func_void);
FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2D", glsym_func_void);
FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2DEXT", glsym_func_void);
FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2DARB", glsym_func_void);
FALLBAK(glsym_glFramebufferTexture2D, glsym_func_void);
FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffers", glsym_func_void);
FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersEXT", glsym_func_void);
FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersARB", glsym_func_void);
FALLBAK(glsym_glDeleteFramebuffers, glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinary", glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryEXT", glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryARB", glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryOES", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinary", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinaryEXT", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinaryARB", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteri", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriEXT", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriARB", glsym_func_void);
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
#undef FINDSYM
#define FINDSYM(dst, sym, typ) \
if ((!dst) && (secsym_eglGetProcAddress)) dst = (typ)secsym_eglGetProcAddress(sym); \
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
// yes - gl core looking for egl stuff. i know it's odd. a reverse-layer thing
// but it will work as the egl/glx layer calls gl core common stuff and thus
// these symbols will work. making the glx/egl + x11 layer do this kind-of is
// wrong as this is not x11 (output) layer specific like the native surface
// stuff. this is generic zero-copy textures for gl
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddress", secsym_func_eng_fn);
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressEXT", secsym_func_eng_fn);
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressARB", secsym_func_eng_fn);
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressKHR", secsym_func_eng_fn);
FINDSYM(secsym_eglCreateImage, "eglCreateImage", secsym_func_void_ptr);
FINDSYM(secsym_eglCreateImage, "eglCreateImageEXT", secsym_func_void_ptr);
FINDSYM(secsym_eglCreateImage, "eglCreateImageARB", secsym_func_void_ptr);
FINDSYM(secsym_eglCreateImage, "eglCreateImageKHR", secsym_func_void_ptr);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImage", secsym_func_uint);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageEXT", secsym_func_uint);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageARB", secsym_func_uint);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageKHR", secsym_func_uint);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinary", glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryEXT", glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryARB", glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryOES", glsym_func_void);
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryKHR", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinary", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinaryEXT", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinaryARB", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinaryOES", glsym_func_void);
FINDSYM(glsym_glProgramBinary, "glProgramBinaryKHR", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteri", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriEXT", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriARB", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriOES", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriKHR", glsym_func_void);
FINDSYM(secsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", glsym_func_void);
FINDSYM(secsym_eglMapImageSEC, "eglMapImageSEC", secsym_func_void_ptr);
FINDSYM(secsym_eglUnmapImageSEC, "eglUnmapImageSEC", secsym_func_uint);
FINDSYM(secsym_eglGetImageAttribSEC, "eglGetImageAttribSEC", secsym_func_uint);
#endif
}
static void shader_array_flush(Evas_Engine_GL_Context *gc);
static Evas_Engine_GL_Context *_evas_gl_common_context = NULL;
@ -249,11 +115,11 @@ _evas_gl_common_version_check()
int minor;
/*
* glGetString returns a string describing the current GL connection.
* glsym_glGetString returns a string describing the current GL connection.
* GL_VERSION is used to get the version of the connection
*/
version = (char *)glGetString(GL_VERSION);
version = (char *)glsym_glGetString(GL_VERSION);
/*
* OpengL ES
@ -300,7 +166,7 @@ _evas_gl_common_version_check()
* version number and the vendor-specific information.
*/
/* glGetString() returns a static string, and we are going to */
/* glsym_glGetString() returns a static string, and we are going to */
/* modify it, so we get a copy first */
version = strdup(version);
if (!version)
@ -371,9 +237,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
if (foc == 0)
{
if ((rot == 0) || (rot == 180))
glViewport(0, 0, w, h);
glsym_glViewport(0, 0, w, h);
else
glViewport(0, 0, h, w);
glsym_glViewport(0, 0, h, w);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// std matrix
if (m == 1)
@ -436,9 +302,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
if (m == -1) ay = vy * 2;
if ((rot == 0) || (rot == 180))
glViewport(-2 * vx, -2 * vy, vw, vh);
glsym_glViewport(-2 * vx, -2 * vy, vw, vh);
else
glViewport(-2 * vy, -2 * vx, vh, vw);
glsym_glViewport(-2 * vy, -2 * vx, vh, vw);
if (m == 1)
matrix_ortho(proj, 0, vw, 0, vh,
-1000000.0, 1000000.0,
@ -455,15 +321,15 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
for (i = 0; i < SHADER_LAST; ++i)
{
glUseProgram(gc->shared->shader[i].prog);
glsym_glUseProgram(gc->shared->shader[i].prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader[i].prog, "mvp"), 1, GL_FALSE, proj);
glsym_glUniformMatrix4fv(glsym_glGetUniformLocation(gc->shared->shader[i].prog, "mvp"), 1, GL_FALSE, proj);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
if (gc->state.current.cur_prog == PRG_INVALID)
glUseProgram(gc->shared->shader[0].prog);
else glUseProgram(gc->state.current.cur_prog);
glsym_glUseProgram(gc->shared->shader[0].prog);
else glsym_glUseProgram(gc->state.current.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
@ -486,8 +352,6 @@ evas_gl_common_context_new(void)
gc = calloc(1, sizeof(Evas_Engine_GL_Context));
if (!gc) return NULL;
gl_symbols();
gc->references = 1;
_evas_gl_common_context = gc;
@ -500,7 +364,7 @@ evas_gl_common_context_new(void)
const GLubyte *ext;
shared = calloc(1, sizeof(Evas_GL_Shared));
ext = glGetString(GL_EXTENSIONS);
ext = glsym_glGetString(GL_EXTENSIONS);
if (ext)
{
if (getenv("EVAS_GL_INFO"))
@ -518,7 +382,7 @@ evas_gl_common_context_new(void)
shared->info.bin_program = 1;
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic")))
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
glsym_glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
&(shared->info.anisotropic));
#endif
#ifdef GL_BGRA
@ -536,24 +400,24 @@ evas_gl_common_context_new(void)
{
// test for all needed symbols - be "conservative" and
// need all of it
if ((secsym_eglCreateImage) &&
(secsym_eglDestroyImage) &&
(secsym_glEGLImageTargetTexture2DOES) &&
(secsym_eglMapImageSEC) &&
(secsym_eglUnmapImageSEC) &&
(secsym_eglGetImageAttribSEC))
if ((glsym_eglCreateImage) &&
(glsym_eglDestroyImage) &&
(glsym_glEGLImageTargetTexture2DOES) &&
(glsym_eglMapImageSEC) &&
(glsym_eglUnmapImageSEC) &&
(glsym_eglGetImageAttribSEC))
shared->info.sec_image_map = 1;
}
#endif
}
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,
glsym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,
&(shared->info.max_texture_units));
glGetIntegerv(GL_MAX_TEXTURE_SIZE,
glsym_glGetIntegerv(GL_MAX_TEXTURE_SIZE,
&(shared->info.max_texture_size));
shared->info.max_vertex_elements = 6 * 100000;
#ifdef GL_MAX_ELEMENTS_VERTICES
/* only applies to glDrawRangeElements. don't really need to get it.
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES,
/* only applies to glsym_glDrawRangeElements. don't really need to get it.
glsym_glGetIntegerv(GL_MAX_ELEMENTS_VERTICES,
&(shared->info.max_vertex_elements));
*/
#endif
@ -573,7 +437,7 @@ evas_gl_common_context_new(void)
shared->info.tune.atlas.slot_size = DEF_ATLAS_SLOT;
// per gpu hacks. based on impirical measurement of some known gpu's
s = (const char *)glGetString(GL_RENDERER);
s = (const char *)glsym_glGetString(GL_RENDERER);
if (s)
{
if (strstr(s, "PowerVR SGX 540"))
@ -646,47 +510,47 @@ evas_gl_common_context_new(void)
(int)shared->info.tune.atlas.slot_size
);
glDisable(GL_DEPTH_TEST);
glsym_glDisable(GL_DEPTH_TEST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glEnable(GL_DITHER);
glsym_glEnable(GL_DITHER);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDisable(GL_BLEND);
glsym_glDisable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// no dest alpha
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
glDepthMask(GL_FALSE);
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
glsym_glDepthMask(GL_FALSE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
#endif
glEnableVertexAttribArray(SHAD_VERTEX);
glsym_glEnableVertexAttribArray(SHAD_VERTEX);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glEnableVertexAttribArray(SHAD_COLOR);
glsym_glEnableVertexAttribArray(SHAD_COLOR);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!evas_gl_common_shader_program_init(shared)) goto error;
#define SHADER_TEXTURE_ADD(Shared, Shader, Name) \
glUseProgram(Shared->shader[SHADER_##Shader].prog); \
glsym_glUseProgram(Shared->shader[SHADER_##Shader].prog); \
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); \
glUniform1i(glGetUniformLocation(Shared->shader[SHADER_##Shader].prog, #Name), Shared->shader[SHADER_##Shader].tex_count++); \
glsym_glUniform1i(glsym_glGetUniformLocation(Shared->shader[SHADER_##Shader].prog, #Name), Shared->shader[SHADER_##Shader].tex_count++); \
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
SHADER_TEXTURE_ADD(shared, YUV, tex);
@ -713,8 +577,8 @@ evas_gl_common_context_new(void)
SHADER_TEXTURE_ADD(shared, IMG_MASK, texm);
if (gc->state.current.cur_prog == PRG_INVALID)
glUseProgram(gc->shared->shader[0].prog);
else glUseProgram(gc->state.current.cur_prog);
glsym_glUseProgram(gc->shared->shader[0].prog);
else glsym_glUseProgram(gc->state.current.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
evas_gl_common_shader_program_init_done();
@ -723,8 +587,8 @@ evas_gl_common_context_new(void)
//
// in code:
// GLuint texes[8];
// GLint loc = glGetUniformLocation(prog, "tex");
// glUniform1iv(loc, 8, texes);
// GLint loc = glsym_glGetUniformLocation(prog, "tex");
// glsym_glUniform1iv(loc, 8, texes);
shared->native_pm_hash = eina_hash_int32_new(NULL);
shared->native_tex_hash = eina_hash_int32_new(NULL);
@ -863,53 +727,53 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
}
gc->change.size = 1;
glDisable(GL_SCISSOR_TEST);
glsym_glDisable(GL_SCISSOR_TEST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glScissor(0, 0, 0, 0);
glsym_glScissor(0, 0, 0, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDisable(GL_DEPTH_TEST);
glsym_glDisable(GL_DEPTH_TEST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glEnable(GL_DITHER);
glsym_glEnable(GL_DITHER);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDisable(GL_BLEND);
glsym_glDisable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// no dest alpha
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
glDepthMask(GL_FALSE);
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
glsym_glDepthMask(GL_FALSE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
#endif
glEnableVertexAttribArray(SHAD_VERTEX);
glsym_glEnableVertexAttribArray(SHAD_VERTEX);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glEnableVertexAttribArray(SHAD_COLOR);
glsym_glEnableVertexAttribArray(SHAD_COLOR);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (gc->state.current.cur_prog == PRG_INVALID)
glUseProgram(gc->shared->shader[0].prog);
else glUseProgram(gc->state.current.cur_prog);
glsym_glUseProgram(gc->shared->shader[0].prog);
else glsym_glUseProgram(gc->state.current.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glActiveTexture(GL_TEXTURE0);
glsym_glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_evas_gl_common_viewport_set(gc);
@ -2314,19 +2178,19 @@ scissor_rot(Evas_Engine_GL_Context *gc __UNUSED__,
switch (rot)
{
case 0: // UP this way: ^
glScissor(cx, cy, cw, ch);
glsym_glScissor(cx, cy, cw, ch);
break;
case 90: // UP this way: <
glScissor(gh - (cy + ch), cx, ch, cw);
glsym_glScissor(gh - (cy + ch), cx, ch, cw);
break;
case 180: // UP this way: v
glScissor(gw - (cx + cw), gh - (cy + ch), cw, ch);
glsym_glScissor(gw - (cx + cw), gh - (cy + ch), cw, ch);
break;
case 270: // UP this way: >
glScissor(cy, gw - (cx + cw), ch, cw);
glsym_glScissor(cy, gw - (cx + cw), ch, cw);
break;
default: // assume up is up
glScissor(cx, cy, cw, ch);
glsym_glScissor(cx, cy, cw, ch);
break;
}
}
@ -2355,7 +2219,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
GLERR(__FUNCTION__, __FILE__, __LINE__, "<flush err>");
if (gc->pipe[i].shader.cur_prog != gc->state.current.cur_prog)
{
glUseProgram(gc->pipe[i].shader.cur_prog);
glsym_glUseProgram(gc->pipe[i].shader.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
@ -2364,18 +2228,18 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#if 0
if (gc->pipe[i].shader.cur_tex)
{
glEnable(GL_TEXTURE_2D);
glsym_glEnable(GL_TEXTURE_2D);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else
{
glDisable(GL_TEXTURE_2D);
glsym_glDisable(GL_TEXTURE_2D);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
#endif
glActiveTexture(GL_TEXTURE0);
glsym_glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
if (gc->pipe[i].array.im)
@ -2383,7 +2247,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].array.im->tex->pt->dyn.img)
{
secsym_glEGLImageTargetTexture2DOES
glsym_glEGLImageTargetTexture2DOES
(GL_TEXTURE_2D, gc->pipe[i].array.im->tex->pt->dyn.img);
}
else
@ -2402,12 +2266,12 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
switch (gc->pipe[i].shader.render_op)
{
case EVAS_RENDER_BLEND: /**< default op: d = d*(1-sa) + s */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
break;
case EVAS_RENDER_COPY: /**< d = s */
gc->pipe[i].shader.blend = 0;
glBlendFunc(GL_ONE, GL_ONE);
glsym_glBlendFunc(GL_ONE, GL_ONE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
break;
// FIXME: fix blend funcs below!
@ -2422,7 +2286,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
case EVAS_RENDER_MASK: /**< d = d*sa */
case EVAS_RENDER_MUL: /**< d = d*s */
default:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
break;
}
@ -2431,12 +2295,12 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
{
if (gc->pipe[i].shader.blend)
{
glEnable(GL_BLEND);
glsym_glEnable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else
{
glDisable(GL_BLEND);
glsym_glDisable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -2448,17 +2312,17 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic);
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else
@ -2466,17 +2330,17 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -2487,7 +2351,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
{
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
if (fbo) cy = gc->pipe[i].shader.cy;
glEnable(GL_SCISSOR_TEST);
glsym_glEnable(GL_SCISSOR_TEST);
if (!fbo)
scissor_rot(gc, gc->rot, gw, gh,
gc->pipe[i].shader.cx,
@ -2495,14 +2359,14 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
else
glScissor(gc->pipe[i].shader.cx, cy,
glsym_glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
setclip = 1;
}
else
{
glDisable(GL_SCISSOR_TEST);
glScissor(0, 0, 0, 0);
glsym_glDisable(GL_SCISSOR_TEST);
glsym_glScissor(0, 0, 0, 0);
}
}
if ((gc->pipe[i].shader.clip) && (!setclip))
@ -2521,112 +2385,112 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
else
glScissor(gc->pipe[i].shader.cx, cy,
glsym_glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
}
}
glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->pipe[i].array.vertex);
glsym_glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->pipe[i].array.vertex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->pipe[i].array.color);
glsym_glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->pipe[i].array.color);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (gc->pipe[i].array.use_texuv)
{
glEnableVertexAttribArray(SHAD_TEXUV);
glsym_glEnableVertexAttribArray(SHAD_TEXUV);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv);
glsym_glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else
{
glDisableVertexAttribArray(SHAD_TEXUV);
glsym_glDisableVertexAttribArray(SHAD_TEXUV);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
if (gc->pipe[i].array.line)
{
glDisableVertexAttribArray(SHAD_TEXUV);
glsym_glDisableVertexAttribArray(SHAD_TEXUV);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDisableVertexAttribArray(SHAD_TEXUV2);
glsym_glDisableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDisableVertexAttribArray(SHAD_TEXUV3);
glsym_glDisableVertexAttribArray(SHAD_TEXUV3);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDrawArrays(GL_LINES, 0, gc->pipe[i].array.num);
glsym_glDrawArrays(GL_LINES, 0, gc->pipe[i].array.num);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else
{
if (gc->pipe[i].array.use_texm)
{
glEnableVertexAttribArray(SHAD_TEXM);
glsym_glEnableVertexAttribArray(SHAD_TEXM);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glVertexAttribPointer(SHAD_TEXM, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texm);
glsym_glVertexAttribPointer(SHAD_TEXM, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texm);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glActiveTexture(GL_TEXTURE1);
glsym_glActiveTexture(GL_TEXTURE1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glActiveTexture(GL_TEXTURE0);
glsym_glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else
{
glDisableVertexAttribArray(SHAD_TEXM);
glsym_glDisableVertexAttribArray(SHAD_TEXM);
}
if ((gc->pipe[i].array.use_texuv2) && (gc->pipe[i].array.use_texuv3))
{
glEnableVertexAttribArray(SHAD_TEXUV2);
glsym_glEnableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glEnableVertexAttribArray(SHAD_TEXUV3);
glsym_glEnableVertexAttribArray(SHAD_TEXUV3);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
glsym_glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv3);
glsym_glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv3);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glActiveTexture(GL_TEXTURE1);
glsym_glActiveTexture(GL_TEXTURE1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].shader.cur_texu_dyn)
secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn);
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn);
#endif
glActiveTexture(GL_TEXTURE2);
glsym_glActiveTexture(GL_TEXTURE2);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].shader.cur_texv_dyn)
secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv_dyn);
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv_dyn);
#endif
glActiveTexture(GL_TEXTURE0);
glsym_glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else if (gc->pipe[i].array.use_texuv2)
{
glEnableVertexAttribArray(SHAD_TEXUV2);
glsym_glEnableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
glsym_glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glActiveTexture(GL_TEXTURE1);
glsym_glActiveTexture(GL_TEXTURE1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].shader.cur_texu_dyn)
secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn);
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn);
#endif
glActiveTexture(GL_TEXTURE0);
glsym_glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
else
{
glDisableVertexAttribArray(SHAD_TEXUV2);
glsym_glDisableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDisableVertexAttribArray(SHAD_TEXUV3);
glsym_glDisableVertexAttribArray(SHAD_TEXUV3);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
if (dbgflushnum)
@ -2644,7 +2508,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
types[gc->pipe[i].region.type]
);
}
glDrawArrays(GL_TRIANGLES, 0, gc->pipe[i].array.num);
glsym_glDrawArrays(GL_TRIANGLES, 0, gc->pipe[i].array.num);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
if (gc->pipe[i].array.im)
@ -2703,6 +2567,8 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
Eina_Bool
evas_gl_common_module_open(void)
{
if (!init_gl()) return EINA_FALSE;
if (_evas_engine_GL_common_log_dom < 0)
_evas_engine_GL_common_log_dom = eina_log_domain_register
("evas-gl_common", EVAS_DEFAULT_LOG_COLOR);
@ -2717,6 +2583,8 @@ evas_gl_common_module_open(void)
void
evas_gl_common_module_close(void)
{
free_gl();
if (_evas_engine_GL_common_log_dom < 0) return;
eina_log_domain_unregister(_evas_engine_GL_common_log_dom);
_evas_engine_GL_common_log_dom = -1;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int
r = g = b = a = 255;
}
glFlush();
glsym_glFlush();
c = gc->dc->clip.use;
cx = gc->dc->clip.x; cy = gc->dc->clip.y;

View File

@ -770,26 +770,26 @@ gl_compile_link_error(GLuint target, const char *action)
char *logtxt;
/* Shader info log */
glGetShaderiv(target, GL_INFO_LOG_LENGTH, &loglen);
glsym_glGetShaderiv(target, GL_INFO_LOG_LENGTH, &loglen);
if (loglen > 0)
{
logtxt = calloc(loglen, sizeof(char));
if (logtxt)
{
glGetShaderInfoLog(target, loglen, &chars, logtxt);
glsym_glGetShaderInfoLog(target, loglen, &chars, logtxt);
ERR("Failed to %s: %s", action, logtxt);
free(logtxt);
}
}
/* Program info log */
glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen);
glsym_glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen);
if (loglen > 0)
{
logtxt = calloc(loglen, sizeof(char));
if (logtxt)
{
glGetProgramInfoLog(target, loglen, &chars, logtxt);
glsym_glGetProgramInfoLog(target, loglen, &chars, logtxt);
ERR("Failed to %s: %s", action, logtxt);
free(logtxt);
}
@ -885,9 +885,9 @@ _evas_gl_shader_file_check(const char *bin_shader_dir, char *bin_shader_file, in
char *driver = NULL;
char *version = NULL;
vendor = (char *)glGetString(GL_VENDOR);
driver = (char *)glGetString(GL_RENDERER);
version = (char *)glGetString(GL_VERSION);
vendor = (char *)glsym_glGetString(GL_VENDOR);
driver = (char *)glsym_glGetString(GL_RENDERER);
version = (char *)glsym_glGetString(GL_VERSION);
new_path_len = snprintf(before_name, sizeof(before_name), "%s::%s::%s::%s::binary_shader.eet", vendor, version, driver, MODULE_ARCH);
@ -922,27 +922,27 @@ _evas_gl_common_shader_program_binary_init(Evas_GL_Program *p,
data = eet_read(ef, pname, &length);
if ((!data) || (length <= 0)) goto finish;
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num);
glsym_glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num);
if (num <= 0) goto finish;
formats = calloc(num, sizeof(int));
if (!formats) goto finish;
glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, formats);
glsym_glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, formats);
if (!formats[0]) goto finish;
p->prog = glCreateProgram();
p->prog = glsym_glCreateProgram();
glsym_glProgramBinary(p->prog, formats[0], data, length);
glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
glBindAttribLocation(p->prog, SHAD_COLOR, "color");
glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
glsym_glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
glsym_glBindAttribLocation(p->prog, SHAD_COLOR, "color");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
glsym_glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
glsym_glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok)
{
@ -958,7 +958,7 @@ finish:
if (data) free(data);
if ((!res) && (p->prog))
{
glDeleteProgram(p->prog);
glsym_glDeleteProgram(p->prog);
p->prog = 0;
}
return res;
@ -975,7 +975,7 @@ _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p,
if (!glsym_glGetProgramBinary) return 0;
glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length);
glsym_glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (length <= 0) return 0;
@ -1008,21 +1008,21 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
{
GLint ok;
p->vert = glCreateShader(GL_VERTEX_SHADER);
p->frag = glCreateShader(GL_FRAGMENT_SHADER);
p->vert = glsym_glCreateShader(GL_VERTEX_SHADER);
p->frag = glsym_glCreateShader(GL_FRAGMENT_SHADER);
#if defined (GLES_VARIETY_S3C6410)
glShaderBinary(1, &(p->vert), 0, vert->bin, vert->bin_size);
glsym_glShaderBinary(1, &(p->vert), 0, vert->bin, vert->bin_size);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size);
glsym_glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#else
glShaderSource(p->vert, 1,
glsym_glShaderSource(p->vert, 1,
(const char **)&(vert->src), NULL);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glCompileShader(p->vert);
glsym_glCompileShader(p->vert);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
ok = 0;
glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok);
glsym_glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok)
{
@ -1030,13 +1030,13 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
ERR("Abort compile of shader vert (%s): %s", name, vert->src);
return 0;
}
glShaderSource(p->frag, 1,
glsym_glShaderSource(p->frag, 1,
(const char **)&(frag->src), NULL);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glCompileShader(p->frag);
glsym_glCompileShader(p->frag);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
ok = 0;
glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok);
glsym_glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok)
{
@ -1045,35 +1045,35 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
return 0;
}
#endif
p->prog = glCreateProgram();
p->prog = glsym_glCreateProgram();
#if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX)
#else
if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri))
glsym_glProgramParameteri(p->prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT,
GL_TRUE);
#endif
glAttachShader(p->prog, p->vert);
glsym_glAttachShader(p->prog, p->vert);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glAttachShader(p->prog, p->frag);
glsym_glAttachShader(p->prog, p->frag);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
glsym_glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_COLOR, "color");
glsym_glBindAttribLocation(p->prog, SHAD_COLOR, "color");
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
glsym_glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glLinkProgram(p->prog);
glsym_glLinkProgram(p->prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
ok = 0;
glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
glsym_glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok)
{
@ -1249,14 +1249,14 @@ void
evas_gl_common_shader_program_init_done(void)
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glReleaseShaderCompiler();
glsym_glReleaseShaderCompiler();
#endif
}
void
evas_gl_common_shader_program_shutdown(Evas_GL_Program *p)
{
if (p->vert) glDeleteShader(p->vert);
if (p->frag) glDeleteShader(p->frag);
if (p->prog) glDeleteProgram(p->prog);
if (p->vert) glsym_glDeleteShader(p->vert);
if (p->frag) glsym_glDeleteShader(p->frag);
if (p->prog) glsym_glDeleteProgram(p->prog);
}

View File

@ -110,7 +110,7 @@ static void
_tex_2d(int intfmt, int w, int h, int fmt, int type)
{
int intfmtret = -1;
glTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL);
glsym_glTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_TEXTURE_INTERNAL_FORMAT
// this is not in opengles!!! hrrrm
@ -127,7 +127,7 @@ _tex_2d(int intfmt, int w, int h, int fmt, int type)
static void
_tex_sub_2d(int x, int y, int w, int h, int fmt, int type, const void *pix)
{
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix);
glsym_glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
@ -166,20 +166,20 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum fo
_print_tex_count();
glGenTextures(1, &(pt->texture));
glsym_glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt;
}
@ -382,17 +382,17 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
_print_tex_count();
glGenTextures(1, &(pt->texture));
glsym_glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
@ -405,7 +405,7 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt;
}
@ -442,9 +442,9 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
_print_tex_count();
glGenTextures(1, &(pt->texture));
glsym_glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(im->native.target, pt->texture);
glsym_glBindTexture(im->native.target, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
@ -456,17 +456,17 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
}
#endif
glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(im->native.target, 0);
glsym_glBindTexture(im->native.target, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(im->native.target, gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(im->native.target, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt;
}
@ -522,17 +522,17 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
_print_tex_count();
glGenTextures(1, &(pt->texture));
glsym_glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
egldisplay = pt->gc->egldisp;
@ -542,45 +542,45 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
// FIXME: seems a bit slower than i'd like - maybe too many flushes?
// FIXME: YCbCr no support as yet
pt->dyn.img = secsym_eglCreateImage(egldisplay,
pt->dyn.img = glsym_eglCreateImage(egldisplay,
EGL_NO_CONTEXT,
EGL_MAP_GL_TEXTURE_2D_SEC,
0, attr);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!pt->dyn.img)
{
glBindTexture(GL_TEXTURE_2D, 0);
glsym_glBindTexture(GL_TEXTURE_2D, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDeleteTextures(1, &(pt->texture));
glsym_glDeleteTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
free(pt);
return NULL;
}
if (secsym_eglGetImageAttribSEC(egldisplay,
if (glsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img,
EGL_MAP_GL_TEXTURE_WIDTH_SEC,
&(pt->dyn.w)) != EGL_TRUE) goto error;
if (secsym_eglGetImageAttribSEC(egldisplay,
if (glsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img,
EGL_MAP_GL_TEXTURE_HEIGHT_SEC,
&(pt->dyn.h)) != EGL_TRUE) goto error;
if (secsym_eglGetImageAttribSEC(egldisplay,
if (glsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img,
EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC,
&(pt->dyn.stride)) != EGL_TRUE) goto error;
if (secsym_eglGetImageAttribSEC(egldisplay,
if (glsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img,
EGL_MAP_GL_TEXTURE_FORMAT_SEC,
&(fmt)) != EGL_TRUE) goto error;
if (secsym_eglGetImageAttribSEC(egldisplay,
if (glsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img,
EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC,
&(pixtype)) != EGL_TRUE) goto error;
if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) goto error;
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#else
gc = NULL;
@ -594,12 +594,12 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
/* ERROR HANDLING */
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
error:
secsym_eglDestroyImage(egldisplay, pt->dyn.img);
glsym_eglDestroyImage(egldisplay, pt->dyn.img);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
pt->dyn.img = NULL;
glBindTexture(GL_TEXTURE_2D, 0);
glsym_glBindTexture(GL_TEXTURE_2D, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glDeleteTextures(1, &(pt->texture));
glsym_glDeleteTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
free(pt);
return NULL;
@ -648,8 +648,8 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
if (pt->dyn.img)
{
if (pt->dyn.checked_out > 0)
secsym_eglUnmapImageSEC(pt->gc->egldisp, pt->dyn.img);
secsym_eglDestroyImage(pt->gc->egldisp, pt->dyn.img);
glsym_eglUnmapImageSEC(pt->gc->egldisp, pt->dyn.img);
glsym_eglDestroyImage(pt->gc->egldisp, pt->dyn.img);
pt->dyn.img = NULL;
pt->dyn.data = NULL;
pt->dyn.w = 0;
@ -659,7 +659,7 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
}
#endif
glDeleteTextures(1, &(pt->texture));
glsym_glDeleteTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (pt->fb)
{
@ -851,13 +851,13 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
if (!im->image.data) return;
fmt = tex->pt->format;
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#endif
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h);
@ -946,7 +946,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
#endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -1030,19 +1030,19 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels,
unsigned int w, unsigned int h, int fh __UNUSED__)
{
if (!tex->pt) return;
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#endif
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat,
pixels);
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -1109,32 +1109,32 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
if (!tex->pt) return;
// FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2
#ifdef GL_UNPACK_ROW_LENGTH
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat);
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]);
glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]);
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat);
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]);
#else
unsigned int y;
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w)
@ -1145,7 +1145,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
_tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2))
@ -1156,7 +1156,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
_tex_sub_2d(0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat);
if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2))
@ -1169,7 +1169,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
#endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -1316,9 +1316,9 @@ evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
tex->pt = tex->double_buffer.pt[tex->double_buffer.source];
tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source];
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w * 4)
@ -1329,7 +1329,7 @@ evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
_tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h, tex->ptuv->format, tex->ptuv->dataformat);
#if 0
@ -1348,7 +1348,7 @@ evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -1364,26 +1364,26 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
// FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2
#ifdef GL_UNPACK_ROW_LENGTH
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat);
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]);
#else
unsigned int y;
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w)
@ -1394,7 +1394,7 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
_tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2))
@ -1407,7 +1407,7 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
#endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -1433,7 +1433,7 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi
char *texture_addr;
char *tmp;
texture_addr = secsym_eglMapImageSEC(tex->gc->egldisp, tex->pt->dyn.img);
texture_addr = glsym_eglMapImageSEC(tex->gc->egldisp, tex->pt->dyn.img);
/* Iterate each Y macroblock like we do in evas_convert_yuv.c */
for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++)
@ -1488,9 +1488,9 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi
}
}
secsym_eglUnmapImageSEC(tex->gc->egldisp, tex->pt->dyn.img);
glsym_eglUnmapImageSEC(tex->gc->egldisp, tex->pt->dyn.img);
texture_addr = secsym_eglMapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img);
texture_addr = glsym_eglMapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img);
/* Iterate each UV macroblock like we do in evas_convert_yuv.c */
base_h = (mb_h >> 1) + (mb_h & 0x1);
@ -1555,15 +1555,15 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi
}
}
secsym_eglUnmapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img);
glsym_eglUnmapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img);
return ;
}
#endif
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// We are telling the driver to not swizzle back the buffer as we are going to replace all pixel
@ -1610,7 +1610,7 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi
_tex_sub_2d(x, ry, 64, 32, tex->pt->format, tex->pt->dataformat, rows[mb_y] + rmb_x);
}
glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w, h, tex->ptuv->format, tex->ptuv->dataformat);

View File

@ -110,50 +110,18 @@ static Eina_TLS resource_key;
static Eina_List *resource_list;
LK(resource_lock);
typedef void (*_eng_fn) (void);
typedef _eng_fn (*glsym_func_eng_fn) ();
typedef void (*glsym_func_void) ();
typedef void *(*glsym_func_void_ptr) ();
typedef int (*glsym_func_int) ();
typedef unsigned int (*glsym_func_uint) ();
typedef unsigned char (*glsym_func_uchar) ();
typedef unsigned char *(*glsym_func_uchar_ptr) ();
typedef const char *(*glsym_func_const_char_ptr) ();
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
#ifndef EGL_NATIVE_PIXMAP_KHR
# define EGL_NATIVE_PIXMAP_KHR 0x30b0
#endif
_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
void (*glsym_eglBindTexImage) (EGLDisplay a, EGLSurface b, int c) = NULL;
void (*glsym_eglReleaseTexImage) (EGLDisplay a, EGLSurface b, int c) = NULL;
void *(*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const int *e) = NULL;
void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
void (*glsym_glEGLImageTargetRenderbufferStorageOES) (int a, void *b) = NULL;
void *(*glsym_eglMapImageSEC) (void *a, void *b) = NULL;
unsigned int (*glsym_eglUnmapImageSEC) (void *a, void *b) = NULL;
const char *(*glsym_eglQueryString) (EGLDisplay a, int name) = NULL;
unsigned int (*glsym_eglLockSurface) (EGLDisplay a, EGLSurface b, const int *attrib_list) = NULL;
unsigned int (*glsym_eglUnlockSurface) (EGLDisplay a, EGLSurface b) = NULL;
#else
typedef XID (*glsym_func_xid) ();
_eng_fn (*glsym_glXGetProcAddress) (const char *a) = NULL;
void (*glsym_glXBindTexImage) (Display *a, GLXDrawable b, int c, int *d) = NULL;
void (*glsym_glXReleaseTexImage) (Display *a, GLXDrawable b, int c) = NULL;
int (*glsym_glXGetVideoSync) (unsigned int *a) = NULL;
int (*glsym_glXWaitVideoSync) (int a, int b, unsigned int *c) = NULL;
XID (*glsym_glXCreatePixmap) (Display *a, void *b, Pixmap c, const int *d) = NULL;
void (*glsym_glXDestroyPixmap) (Display *a, XID b) = NULL;
void (*glsym_glXQueryDrawable) (Display *a, XID b, int c, unsigned int *d) = NULL;
int (*glsym_glXSwapIntervalSGI) (int a) = NULL;
void (*glsym_glXSwapIntervalEXT) (Display *s, GLXDrawable b, int c) = NULL;
const char *(*glsym_glXQueryExtensionsString) (Display *a, int screen) = NULL;
#endif
// GLES2 Extensions
@ -327,90 +295,10 @@ _sym_init(void)
#define FINDSYM(dst, sym, typ) \
if ((!dst) && (glsym_eglGetProcAddress)) dst = (typ)glsym_eglGetProcAddress(sym); \
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn);
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn);
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressKHR", glsym_func_eng_fn);
FINDSYM(glsym_eglBindTexImage, "eglBindTexImage", glsym_func_void);
FINDSYM(glsym_eglBindTexImage, "eglBindTexImageEXT", glsym_func_void);
FINDSYM(glsym_eglBindTexImage, "eglBindTexImageARB", glsym_func_void);
FINDSYM(glsym_eglBindTexImage, "eglBindTexImageKHR", glsym_func_void);
FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImage", glsym_func_void);
FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageEXT", glsym_func_void);
FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageARB", glsym_func_void);
FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageKHR", glsym_func_void);
FINDSYM(glsym_eglCreateImage, "eglCreateImage", glsym_func_void_ptr);
FINDSYM(glsym_eglCreateImage, "eglCreateImageEXT", glsym_func_void_ptr);
FINDSYM(glsym_eglCreateImage, "eglCreateImageARB", glsym_func_void_ptr);
FINDSYM(glsym_eglCreateImage, "eglCreateImageKHR", glsym_func_void_ptr);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImage", glsym_func_void);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageEXT", glsym_func_void);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageARB", glsym_func_void);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", glsym_func_void);
FINDSYM(glsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", glsym_func_void);
FINDSYM(glsym_glEGLImageTargetRenderbufferStorageOES, "glEGLImageTargetRenderbufferStorageOES", glsym_func_void);
FINDSYM(glsym_eglMapImageSEC, "eglMapImageSEC", glsym_func_void_ptr);
FINDSYM(glsym_eglUnmapImageSEC, "eglUnmapImageSEC", glsym_func_uint);
FINDSYM(glsym_eglQueryString, "eglQueryString", glsym_func_const_char_ptr);
FINDSYM(glsym_eglLockSurface, "eglLockSurface", glsym_func_uint);
FINDSYM(glsym_eglLockSurface, "eglLockSurfaceEXT", glsym_func_uint);
FINDSYM(glsym_eglLockSurface, "eglLockSurfaceARB", glsym_func_uint);
FINDSYM(glsym_eglLockSurface, "eglLockSurfaceKHR", glsym_func_uint);
FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurface", glsym_func_uint);
FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurfaceEXT", glsym_func_uint);
FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurfaceARB", glsym_func_uint);
FINDSYM(glsym_eglUnlockSurface, "eglUnlockSurfaceKHR", glsym_func_uint);
#else
#define FINDSYM(dst, sym, typ) \
if ((!dst) && (glsym_glXGetProcAddress)) dst = (typ)glsym_glXGetProcAddress(sym); \
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress", glsym_func_eng_fn);
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT", glsym_func_eng_fn);
FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB", glsym_func_eng_fn);
FINDSYM(glsym_glXBindTexImage, "glXBindTexImage", glsym_func_void);
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageEXT", glsym_func_void);
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageARB", glsym_func_void);
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImage", glsym_func_void);
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImageEXT", glsym_func_void);
FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImageARB", glsym_func_void);
FINDSYM(glsym_glXGetVideoSync, "glXGetVideoSyncSGI", glsym_func_int);
FINDSYM(glsym_glXWaitVideoSync, "glXWaitVideoSyncSGI", glsym_func_int);
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmap", glsym_func_xid);
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapEXT", glsym_func_xid);
FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapARB", glsym_func_xid);
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmap", glsym_func_void);
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapEXT", glsym_func_void);
FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapARB", glsym_func_void);
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawable", glsym_func_void);
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableEXT", glsym_func_void);
FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableARB", glsym_func_void);
FINDSYM(glsym_glXSwapIntervalSGI, "glXSwapIntervalMESA", glsym_func_int);
FINDSYM(glsym_glXSwapIntervalSGI, "glXSwapIntervalSGI", glsym_func_int);
FINDSYM(glsym_glXSwapIntervalEXT, "glXSwapIntervalEXT", glsym_func_void);
FINDSYM(glsym_glXQueryExtensionsString, "glXQueryExtensionsString", glsym_func_const_char_ptr);
#endif
//----------- GLES 2.0 Extensions ------------//
@ -565,7 +453,7 @@ _extensions_init(Render_Engine *re)
memset(_evasgl_ext_string, 0, 1024);
// GLES 2.0 Extensions
glexts = (const char*)glGetString(GL_EXTENSIONS);
glexts = (const char*)glsym_glGetString(GL_EXTENSIONS);
DBG("--------GLES 2.0 Extensions--------");
for (i = 0; _gl_ext_entries[i].name != NULL; i++)
@ -586,7 +474,7 @@ _extensions_init(Render_Engine *re)
// EGL Extensions
evasglexts = glsym_eglQueryString(re->win->egl_disp, EGL_EXTENSIONS);
#else
evasglexts = glXQueryExtensionsString(re->info->info.display,
evasglexts = glsym_glXQueryExtensionsString(re->info->info.display,
re->info->info.screen);
#endif
@ -647,7 +535,7 @@ xrdb_user_query(const char *name, const char *cls, char **type, XrmValue *val)
if (!xrdb_user.db) return EINA_FALSE;
return XrmGetResource(xrdb_user.db, name, cls, type, val);
failed:
failed:
if (xrdb_user.db)
{
XrmDestroyDatabase(xrdb_user.db);
@ -677,8 +565,8 @@ static void
eng_info_free(Evas *e __UNUSED__, void *info)
{
Evas_Engine_Info_GL_X11 *in;
// dont free! why bother? its not worth it
// eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
// dont free! why bother? its not worth it
// eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
in = (Evas_Engine_Info_GL_X11 *)info;
free(in);
}
@ -720,7 +608,7 @@ _create_internal_glue_resources(void *data)
context_attrs[2] = EGL_NONE;
// Create resource surface for EGL
rsc->surface = eglCreateWindowSurface(re->win->egl_disp,
rsc->surface = glsym_eglCreateWindowSurface(re->win->egl_disp,
re->win->egl_config,
(EGLNativeWindowType)DefaultRootWindow(re->info->info.display),
NULL);
@ -732,7 +620,7 @@ _create_internal_glue_resources(void *data)
}
// Create a resource context for EGL
rsc->context = eglCreateContext(re->win->egl_disp,
rsc->context = glsym_eglCreateContext(re->win->egl_disp,
re->win->egl_config,
re->win->egl_context[0], // Evas' GL Context
context_attrs);
@ -758,7 +646,7 @@ _create_internal_glue_resources(void *data)
#else
// GLX
rsc->context = glXCreateContext(re->info->info.display,
rsc->context = glsym_glXCreateContext(re->info->info.display,
re->win->visualinfo,
re->win->context, // Evas' GL Context
1);
@ -801,8 +689,8 @@ _destroy_internal_glue_resources(void *data)
LKL(resource_lock);
EINA_LIST_FOREACH(resource_list, l, rsc)
{
if (rsc->surface) eglDestroySurface(re->win->egl_disp, rsc->surface);
if (rsc->context) eglDestroyContext(re->win->egl_disp, rsc->context);
if (rsc->surface) glsym_eglDestroySurface(re->win->egl_disp, rsc->surface);
if (rsc->context) glsym_eglDestroyContext(re->win->egl_disp, rsc->context);
free(rsc);
}
eina_list_free(resource_list);
@ -818,7 +706,7 @@ _destroy_internal_glue_resources(void *data)
{
if (rsc)
{
glXDestroyContext(re->info->info.display, rsc->context);
glsym_glXDestroyContext(re->info->info.display, rsc->context);
free(rsc);
}
}
@ -847,7 +735,7 @@ eng_setup(Evas *e, void *in)
#else
int eb, evb;
if (!glXQueryExtension(info->info.display, &eb, &evb)) return 0;
if (!glsym_glXQueryExtension(info->info.display, &eb, &evb)) return 0;
#endif
re = calloc(1, sizeof(Render_Engine));
if (!re) return 0;
@ -1059,20 +947,9 @@ eng_output_free(void *data)
if (re)
{
// NOTE: XrmGetDatabase() result is shared per connection, do not free it.
// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
// NOTE: XrmGetDatabase() result is shared per connection, do not free it.
// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
#if 0
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
// Destroy the resource surface
// Only required for EGL case
if (re->surface)
eglDestroySurface(re->win->egl_disp, re->surface);
#endif
// Destroy the resource context
_destroy_internal_context(re, context);
#endif
if (re->win)
{
if ((initted == 1) && (gl_wins == 1))
@ -1170,7 +1047,7 @@ eng_output_redraws_clear(void *data)
re = (Render_Engine *)data;
evas_common_tilebuf_clear(re->tb);
/* re->win->draw.redraw = 0;*/
// INF("GL: finish update cycle!");
// INF("GL: finish update cycle!");
}
/* vsync games - not for now though */
@ -1278,7 +1155,7 @@ eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x
if (s) safe_native = atoi(s);
else
{
s = (const char *)glGetString(GL_RENDERER);
s = (const char *)glsym_glGetString(GL_RENDERER);
if (s)
{
if (strstr(s, "PowerVR SGX 540") ||
@ -1296,21 +1173,21 @@ eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x
pt = t0;
#endif
// previous rendering should be done and swapped
if (!safe_native) eglWaitNative(EGL_CORE_NATIVE_ENGINE);
if (!safe_native) glsym_eglWaitNative(EGL_CORE_NATIVE_ENGINE);
#ifdef FRAMECOUNT
double t1 = get_time();
tb = t1 - t0;
printf("... %1.5f -> %1.5f | ", ta, tb);
#endif
// if (eglGetError() != EGL_SUCCESS)
// {
// printf("Error: eglWaitNative(EGL_CORE_NATIVE_ENGINE) fail.\n");
// }
// if (glsym_eglGetError() != EGL_SUCCESS)
// {
// printf("Error: glsym_eglWaitNative(EGL_CORE_NATIVE_ENGINE) fail.\n");
// }
#else
// previous rendering should be done and swapped
if (!safe_native) glXWaitX();
if (!safe_native) glsym_glXWaitX();
#endif
//x// printf("frame -> push\n");
//x// printf("frame -> push\n");
}
static void
@ -1321,7 +1198,7 @@ eng_output_flush(void *data)
re = (Render_Engine *)data;
if (!_re_wincheck(re)) return;
if (!re->win->draw.drew) return;
//x// printf("frame -> flush\n");
//x// printf("frame -> flush\n");
re->win->draw.drew = 0;
eng_window_use(re->win);
@ -1331,16 +1208,16 @@ eng_output_flush(void *data)
#endif
if (!re->vsync)
{
if (re->info->vsync) eglSwapInterval(re->win->egl_disp, 1);
else eglSwapInterval(re->win->egl_disp, 0);
if (re->info->vsync) glsym_eglSwapInterval(re->win->egl_disp, 1);
else glsym_eglSwapInterval(re->win->egl_disp, 0);
re->vsync = 1;
}
if (re->info->callback.pre_swap)
{
re->info->callback.pre_swap(re->info->callback.data, re->evas);
}
eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]);
if (!safe_native) eglWaitGL();
glsym_eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]);
if (!safe_native) glsym_eglWaitGL();
if (re->info->callback.post_swap)
{
re->info->callback.post_swap(re->info->callback.data, re->evas);
@ -1349,10 +1226,10 @@ eng_output_flush(void *data)
double t1 = get_time();
printf("%1.5f\n", t1 - t0);
#endif
// if (eglGetError() != EGL_SUCCESS)
// {
// printf("Error: eglSwapBuffers() fail.\n");
// }
// if (glsym_eglGetError() != EGL_SUCCESS)
// {
// printf("Error: glsym_eglSwapBuffers() fail.\n");
// }
#else
#ifdef VSYNC_TO_SCREEN
if ((re->info->vsync)/* || (1)*/)
@ -1391,26 +1268,26 @@ eng_output_flush(void *data)
{
re->info->callback.pre_swap(re->info->callback.data, re->evas);
}
/*
/*
if ((1)
// (re->win->draw.x1 == 0) &&
// (re->win->draw.y1 == 0) &&
// (re->win->draw.x2 == (re->win->w - 1)) &&
// (re->win->draw.y2 == (re->win->h - 1))
// (re->win->draw.x1 == 0) &&
// (re->win->draw.y1 == 0) &&
// (re->win->draw.x2 == (re->win->w - 1)) &&
// (re->win->draw.y2 == (re->win->h - 1))
)
*/
{
glXSwapBuffers(re->win->disp, re->win->win);
if (!safe_native) glXWaitGL();
glsym_glXSwapBuffers(re->win->disp, re->win->win);
if (!safe_native) glsym_glXWaitGL();
}
/*
/*
else
{
// FIXME: this doesn't work.. why oh why?
// FIXME: this doesn't work.. why oh why?
int sx, sy, sw, sh;
// fimxe - reset when done
// glEnable(GL_SCISSOR_TEST);
// glEnable(GL_SCISSOR_TEST);
glDrawBuffer(GL_FRONT);
sx = re->win->draw.x1;
@ -1419,12 +1296,12 @@ eng_output_flush(void *data)
sh = (re->win->draw.y2 - re->win->draw.y1) + 1;
sy = re->win->h - sy - sh;
// glScissor(sx, sy, sw, sh);
// glScissor(sx, sy, sw, sh);
glRasterPos2i(sx, re->win->h - sy);
glCopyPixels(sx, sy, sw, sh, GL_COLOR);
glRasterPos2i(0, 0);
// glDisable(GL_SCISSOR_TEST);
// glDisable(GL_SCISSOR_TEST);
glDrawBuffer(GL_BACK);
glFlush();
}
@ -1459,20 +1336,20 @@ eng_output_dump(void *data)
static void
eng_context_cutout_add(void *data __UNUSED__, void *context, int x, int y, int w, int h)
{
// Render_Engine *re;
//
// re = (Render_Engine *)data;
// re->win->gl_context->dc = context;
// Render_Engine *re;
//
// re = (Render_Engine *)data;
// re->win->gl_context->dc = context;
evas_common_draw_context_add_cutout(context, x, y, w, h);
}
static void
eng_context_cutout_clear(void *data __UNUSED__, void *context)
{
// Render_Engine *re;
//
// re = (Render_Engine *)data;
// re->win->gl_context->dc = context;
// Render_Engine *re;
//
// re = (Render_Engine *)data;
// re->win->gl_context->dc = context;
evas_common_draw_context_clear_cutouts(context);
}
@ -1533,10 +1410,10 @@ eng_polygon_draw(void *data, void *context, void *surface __UNUSED__, void *poly
static int
eng_image_alpha_get(void *data __UNUSED__, void *image)
{
// Render_Engine *re;
// Render_Engine *re;
Evas_GL_Image *im;
// re = (Render_Engine *)data;
// re = (Render_Engine *)data;
if (!image) return 1;
im = image;
return im->alpha;
@ -1545,10 +1422,10 @@ eng_image_alpha_get(void *data __UNUSED__, void *image)
static int
eng_image_colorspace_get(void *data __UNUSED__, void *image)
{
// Render_Engine *re;
// Render_Engine *re;
Evas_GL_Image *im;
// re = (Render_Engine *)data;
// re = (Render_Engine *)data;
if (!image) return EVAS_COLORSPACE_ARGB8888;
im = image;
return im->cs.space;
@ -1610,34 +1487,34 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
else
evas_gl_common_image_dirty(im, 0, 0, 0, 0);
return evas_gl_common_image_alpha_set(im, has_alpha ? 1 : 0);
// im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
// return image;
// im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
// return image;
}
static void *
eng_image_border_set(void *data __UNUSED__, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__)
{
// Render_Engine *re;
//
// re = (Render_Engine *)data;
// Render_Engine *re;
//
// re = (Render_Engine *)data;
return image;
}
static void
eng_image_border_get(void *data __UNUSED__, void *image __UNUSED__, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__)
{
// Render_Engine *re;
//
// re = (Render_Engine *)data;
// Render_Engine *re;
//
// re = (Render_Engine *)data;
}
static char *
eng_image_comment_get(void *data __UNUSED__, void *image, char *key __UNUSED__)
{
// Render_Engine *re;
// Render_Engine *re;
Evas_GL_Image *im;
// re = (Render_Engine *)data;
// re = (Render_Engine *)data;
if (!image) return NULL;
im = image;
if (!im->im) return NULL;
@ -1647,10 +1524,10 @@ eng_image_comment_get(void *data __UNUSED__, void *image, char *key __UNUSED__)
static char *
eng_image_format_get(void *data __UNUSED__, void *image)
{
// Render_Engine *re;
// Render_Engine *re;
Evas_GL_Image *im;
// re = (Render_Engine *)data;
// re = (Render_Engine *)data;
im = image;
return NULL;
}
@ -1746,7 +1623,7 @@ _native_bind_cb(void *data, void *image)
if (glsym_glEGLImageTargetTexture2DOES)
{
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface);
if (eglGetError() != EGL_SUCCESS)
if (glsym_eglGetError() != EGL_SUCCESS)
ERR("glEGLImageTargetTexture2DOES() failed.");
}
else
@ -1769,7 +1646,7 @@ _native_bind_cb(void *data, void *image)
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
{
glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id);
glsym_glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
return;
@ -1803,7 +1680,7 @@ _native_unbind_cb(void *data, void *image)
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
{
glBindTexture(GL_TEXTURE_2D, 0);
glsym_glBindTexture(GL_TEXTURE_2D, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
return;
@ -1829,11 +1706,11 @@ _native_free_cb(void *data, void *image)
{
glsym_eglDestroyImage(re->win->egl_disp,
n->egl_surface);
if (eglGetError() != EGL_SUCCESS)
ERR("eglDestroyImage() failed.");
if (glsym_eglGetError() != EGL_SUCCESS)
ERR("glsym_eglDestroyImage() failed.");
}
else
ERR("Try eglDestroyImage on EGL with no support");
ERR("Try glsym_eglDestroyImage on EGL with no support");
}
#else
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
@ -1973,7 +1850,6 @@ eng_image_native_set(void *data, void *image, void *native)
return im2;
}
}
}
im2 = evas_gl_common_image_new_from_data(re->win->gl_context,
im->w, im->h, NULL, im->alpha,
@ -2012,9 +1888,9 @@ eng_image_native_set(void *data, void *image, void *native)
config_attrs[i++] = EGL_PIXMAP_BIT;
config_attrs[i++] = EGL_NONE;
if (!eglChooseConfig(re->win->egl_disp, config_attrs,
if (!glsym_eglChooseConfig(re->win->egl_disp, config_attrs,
&egl_config, 1, &num_config))
ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i", (unsigned int)pm, num_config);
ERR("glsym_eglChooseConfig() failed for pixmap 0x%x, num_config = %i", (unsigned int)pm, num_config);
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
n->pixmap = pm;
n->visual = vis;
@ -2025,9 +1901,9 @@ eng_image_native_set(void *data, void *image, void *native)
(void *)pm,
NULL);
else
ERR("Try eglCreateImage on EGL with no support");
ERR("Try glsym_eglCreateImage on EGL with no support");
if (!n->egl_surface)
ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm);
ERR("glsym_eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm);
im->native.yinvert = 1;
im->native.loose = 0;
im->native.data = n;
@ -2109,8 +1985,8 @@ eng_image_native_set(void *data, void *image, void *native)
ERR("Try glXCreatePixmap on GLX with no support");
if (n->glx_pixmap)
{
// printf("%p: new native texture for %x | %4i x %4i @ %2i = %p\n",
// n, pm, w, h, depth, n->glx_pixmap);
// printf("%p: new native texture for %x | %4i x %4i @ %2i = %p\n",
// n, pm, w, h, depth, n->glx_pixmap);
if (!target)
{
ERR("no target :(");
@ -2853,15 +2729,15 @@ _create_rt_buffers(Render_Engine *data __UNUSED__,
Render_Engine_GL_Surface *sfc)
{
// Render Target texture
glGenTextures(1, &sfc->rt_tex );
glsym_glGenTextures(1, &sfc->rt_tex );
// Depth RenderBuffer - Create storage here...
if (sfc->depth_bits != EVAS_GL_DEPTH_NONE)
glGenRenderbuffers(1, &sfc->rb_depth);
glsym_glGenRenderbuffers(1, &sfc->rb_depth);
// Stencil RenderBuffer - Create Storage here...
if (sfc->stencil_bits != EVAS_GL_STENCIL_NONE)
glGenRenderbuffers(1, &sfc->rb_stencil);
glsym_glGenRenderbuffers(1, &sfc->rb_stencil);
return 1;
}
@ -2874,45 +2750,45 @@ _attach_fbo_surface(Render_Engine *data __UNUSED__,
int fb_status;
// Initialize Texture
glBindTexture(GL_TEXTURE_2D, sfc->rt_tex );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sfc->w, sfc->h, 0,
glsym_glBindTexture(GL_TEXTURE_2D, sfc->rt_tex );
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glsym_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sfc->w, sfc->h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindTexture(GL_TEXTURE_2D, 0);
glsym_glBindTexture(GL_TEXTURE_2D, 0);
// Attach texture to FBO
glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
glsym_glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo);
glsym_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, sfc->rt_tex, 0);
// Depth RenderBuffer - Attach it to FBO
if (sfc->depth_bits != EVAS_GL_DEPTH_NONE)
{
glBindRenderbuffer(GL_RENDERBUFFER, sfc->rb_depth);
glRenderbufferStorage(GL_RENDERBUFFER, sfc->rb_depth_fmt,
glsym_glBindRenderbuffer(GL_RENDERBUFFER, sfc->rb_depth);
glsym_glRenderbufferStorage(GL_RENDERBUFFER, sfc->rb_depth_fmt,
sfc->w, sfc->h);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
glsym_glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, sfc->rb_depth);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glsym_glBindRenderbuffer(GL_RENDERBUFFER, 0);
}
// Stencil RenderBuffer - Attach it to FBO
if (sfc->stencil_bits != EVAS_GL_STENCIL_NONE)
{
glBindRenderbuffer(GL_RENDERBUFFER, sfc->rb_stencil);
glRenderbufferStorage(GL_RENDERBUFFER, sfc->rb_stencil_fmt,
glsym_glBindRenderbuffer(GL_RENDERBUFFER, sfc->rb_stencil);
glsym_glRenderbufferStorage(GL_RENDERBUFFER, sfc->rb_stencil_fmt,
sfc->w, sfc->h);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
glsym_glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, sfc->rb_stencil);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glsym_glBindRenderbuffer(GL_RENDERBUFFER, 0);
}
// Check FBO for completeness
fb_status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
fb_status = glsym_glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (fb_status != GL_FRAMEBUFFER_COMPLETE)
{
ERR("FBO not complete!");
@ -2973,9 +2849,9 @@ eng_gl_surface_create(void *data, void *config, int w, int h)
// make_current called, the user can't call native_surface_get() right
// after the surface is created. hence this is done here using evas' context.
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
ret = eglMakeCurrent(re->win->egl_disp, rsc->surface, rsc->surface, rsc->context);
ret = glsym_eglMakeCurrent(re->win->egl_disp, rsc->surface, rsc->surface, rsc->context);
#else
ret = glXMakeCurrent(re->info->info.display, re->win->win, rsc->context);
ret = glsym_glXMakeCurrent(re->info->info.display, re->win->win, rsc->context);
#endif
if (!ret)
{
@ -2993,9 +2869,9 @@ eng_gl_surface_create(void *data, void *config, int w, int h)
}
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
ret = glsym_eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
#else
ret = glXMakeCurrent(re->info->info.display, None, NULL);
ret = glsym_glXMakeCurrent(re->info->info.display, None, NULL);
#endif
if (!ret)
{
@ -3023,9 +2899,9 @@ eng_gl_surface_destroy(void *data, void *surface)
if ((rsc = eina_tls_get(resource_key)) == EINA_FALSE) return 0;
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
ret = eglMakeCurrent(re->win->egl_disp, rsc->surface, rsc->surface, rsc->context);
ret = glsym_eglMakeCurrent(re->win->egl_disp, rsc->surface, rsc->surface, rsc->context);
#else
ret = glXMakeCurrent(re->info->info.display, re->win->win, rsc->context);
ret = glsym_glXMakeCurrent(re->info->info.display, re->win->win, rsc->context);
#endif
if (!ret)
{
@ -3035,18 +2911,18 @@ eng_gl_surface_destroy(void *data, void *surface)
// Delete FBO/RBO and Texture here
if (sfc->rt_tex)
glDeleteTextures(1, &sfc->rt_tex);
glsym_glDeleteTextures(1, &sfc->rt_tex);
if (sfc->rb_depth)
glDeleteRenderbuffers(1, &sfc->rb_depth);
glsym_glDeleteRenderbuffers(1, &sfc->rb_depth);
if (sfc->rb_stencil)
glDeleteRenderbuffers(1, &sfc->rb_stencil);
glsym_glDeleteRenderbuffers(1, &sfc->rb_stencil);
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
ret = glsym_eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
#else
ret = glXMakeCurrent(re->info->info.display, None, NULL);
ret = glsym_glXMakeCurrent(re->info->info.display, None, NULL);
#endif
if (!ret)
{
@ -3088,14 +2964,14 @@ eng_gl_context_create(void *data, void *share_context)
if (share_ctx)
{
ctx->context = eglCreateContext(re->win->egl_disp,
ctx->context = glsym_eglCreateContext(re->win->egl_disp,
re->win->egl_config,
share_ctx->context, // Share Context
context_attrs);
}
else
{
ctx->context = eglCreateContext(re->win->egl_disp,
ctx->context = glsym_eglCreateContext(re->win->egl_disp,
re->win->egl_config,
re->win->egl_context[0], // Evas' GL Context
context_attrs);
@ -3103,21 +2979,21 @@ eng_gl_context_create(void *data, void *share_context)
if (!ctx->context)
{
ERR("eglCreateContext() fail. code=%#x", eglGetError());
ERR("glsym_eglCreateContext() fail. code=%#x", glsym_eglGetError());
return NULL;
}
#else
// GLX
if (share_context)
{
ctx->context = glXCreateContext(re->info->info.display,
ctx->context = glsym_glXCreateContext(re->info->info.display,
re->win->visualinfo,
share_ctx->context, // Share Context
1);
}
else
{
ctx->context = glXCreateContext(re->info->info.display,
ctx->context = glsym_glXCreateContext(re->info->info.display,
re->win->visualinfo,
re->win->context, // Evas' GL Context
1);
@ -3154,10 +3030,10 @@ eng_gl_context_destroy(void *data, void *context)
// 1. Do a make current with the given context
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
ret = eglMakeCurrent(re->win->egl_disp, rsc->surface,
ret = glsym_eglMakeCurrent(re->win->egl_disp, rsc->surface,
rsc->surface, ctx->context);
#else
ret = glXMakeCurrent(re->info->info.display, re->win->win,
ret = glsym_glXMakeCurrent(re->info->info.display, re->win->win,
ctx->context);
#endif
if (!ret)
@ -3168,22 +3044,22 @@ eng_gl_context_destroy(void *data, void *context)
// 2. Delete the FBO
if (ctx->context_fbo)
glDeleteFramebuffers(1, &ctx->context_fbo);
glsym_glDeleteFramebuffers(1, &ctx->context_fbo);
// 3. Destroy the Context
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
eglDestroyContext(re->win->egl_disp, ctx->context);
glsym_eglDestroyContext(re->win->egl_disp, ctx->context);
ctx->context = EGL_NO_CONTEXT;
ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE,
ret = glsym_eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT);
#else
glXDestroyContext(re->info->info.display, ctx->context);
glsym_glXDestroyContext(re->info->info.display, ctx->context);
ctx->context = 0;
ret = glXMakeCurrent(re->info->info.display, None, NULL);
ret = glsym_glXMakeCurrent(re->info->info.display, None, NULL);
#endif
if (!ret)
{
@ -3216,10 +3092,10 @@ eng_gl_make_current(void *data __UNUSED__, void *surface, void *context)
if ((!sfc) || (!ctx))
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE,
ret = glsym_eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT);
#else
ret = glXMakeCurrent(re->info->info.display, None, NULL);
ret = glsym_glXMakeCurrent(re->info->info.display, None, NULL);
#endif
if (!ret)
{
@ -3237,15 +3113,15 @@ eng_gl_make_current(void *data __UNUSED__, void *surface, void *context)
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if ((rsc = eina_tls_get(resource_key)) == EINA_FALSE) return 0;
if ((eglGetCurrentContext() != ctx->context) ||
(eglGetCurrentSurface(EGL_READ) != rsc->surface) ||
(eglGetCurrentSurface(EGL_DRAW) != rsc->surface) )
if ((glsym_eglGetCurrentContext() != ctx->context) ||
(glsym_eglGetCurrentSurface(EGL_READ) != rsc->surface) ||
(glsym_eglGetCurrentSurface(EGL_DRAW) != rsc->surface) )
{
// Flush remainder of what's in Evas' pipeline
if (re->win) eng_window_use(NULL);
// Do a make current
ret = eglMakeCurrent(re->win->egl_disp, rsc->surface,
ret = glsym_eglMakeCurrent(re->win->egl_disp, rsc->surface,
rsc->surface, ctx->context);
if (!ret)
{
@ -3254,14 +3130,14 @@ eng_gl_make_current(void *data __UNUSED__, void *surface, void *context)
}
}
#else
if ((glXGetCurrentContext() != ctx->context) ||
(glXGetCurrentDrawable() != re->win->win) )
if ((glsym_glXGetCurrentContext() != ctx->context) ||
(glsym_glXGetCurrentDrawable() != re->win->win) )
{
// Flush remainder of what's in Evas' pipeline
if (re->win) eng_window_use(NULL);
// Do a make current
ret = glXMakeCurrent(re->info->info.display, re->win->win, ctx->context);
ret = glsym_glXMakeCurrent(re->info->info.display, re->win->win, ctx->context);
if (!ret)
{
ERR("xxxMakeCurrent() failed!");
@ -3273,7 +3149,7 @@ eng_gl_make_current(void *data __UNUSED__, void *surface, void *context)
// Create FBO if not already created
if (!ctx->initialized)
{
glGenFramebuffers(1, &ctx->context_fbo);
glsym_glGenFramebuffers(1, &ctx->context_fbo);
ctx->initialized = 1;
}
@ -3288,10 +3164,10 @@ eng_gl_make_current(void *data __UNUSED__, void *surface, void *context)
if (ctx->current_fbo)
// Bind to the previously bound buffer
glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
glsym_glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
else
// Bind FBO
glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo);
glsym_glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo);
sfc->fbo_attached = 1;
}
@ -3357,7 +3233,7 @@ evgl_glGetString(GLenum name)
if (name == GL_EXTENSIONS)
return (GLubyte *)_gl_ext_string; //glGetString(GL_EXTENSIONS);
else
return glGetString(name);
return glsym_glGetString(name);
}
static void
@ -3370,13 +3246,13 @@ evgl_glBindFramebuffer(GLenum target, GLuint framebuffer)
{
if (ctx)
{
glBindFramebuffer(target, ctx->context_fbo);
glsym_glBindFramebuffer(target, ctx->context_fbo);
ctx->current_fbo = 0;
}
}
else
{
glBindFramebuffer(target, framebuffer);
glsym_glBindFramebuffer(target, framebuffer);
// Save this for restore when doing make current
if (ctx)
@ -3389,16 +3265,16 @@ evgl_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
{
// Add logic to take care when renderbuffer=0
// On a second thought we don't need this
glBindRenderbuffer(target, renderbuffer);
glsym_glBindRenderbuffer(target, renderbuffer);
}
static void
evgl_glClearDepthf(GLclampf depth)
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glClearDepthf(depth);
glsym_glClearDepthf(depth);
#else
glClearDepth(depth);
glsym_glClearDepthf(depth);
#endif
}
@ -3406,9 +3282,9 @@ static void
evgl_glDepthRangef(GLclampf zNear, GLclampf zFar)
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glDepthRangef(zNear, zFar);
glsym_glDepthRangef(zNear, zFar);
#else
glDepthRange(zNear, zFar);
glsym_glDepthRangef(zNear, zFar);
#endif
}
@ -3416,7 +3292,7 @@ static void
evgl_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
glsym_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
#else
if (range)
{
@ -3436,7 +3312,7 @@ static void
evgl_glReleaseShaderCompiler(void)
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glReleaseShaderCompiler();
glsym_glReleaseShaderCompiler();
#else
#endif
}
@ -3445,9 +3321,9 @@ static void
evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glShaderBinary(n, shaders, binaryformat, binary, length);
glsym_glShaderBinary(n, shaders, binaryformat, binary, length);
#else
// FIXME: need to dlsym/getprocaddress for this
// FIXME: need to dlsym/getprocaddress for this
return;
n = binaryformat = length = 0;
shaders = binary = 0;
@ -3507,7 +3383,7 @@ eng_gl_api_get(void *data)
gl_funcs.version = EVAS_GL_API_VERSION;
#define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, )
#define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, glsym_)
// GLES 2.0
ORD(glActiveTexture);
ORD(glAttachShader);
@ -3524,7 +3400,7 @@ eng_gl_api_get(void *data)
ORD(glCheckFramebufferStatus);
ORD(glClear);
ORD(glClearColor);
// ORD(glClearDepthf);
// ORD(glClearDepthf);
ORD(glClearStencil);
ORD(glColorMask);
ORD(glCompileShader);
@ -3543,7 +3419,7 @@ eng_gl_api_get(void *data)
ORD(glDeleteTextures);
ORD(glDepthFunc);
ORD(glDepthMask);
// ORD(glDepthRangef);
// ORD(glDepthRangef);
ORD(glDetachShader);
ORD(glDisable);
ORD(glDisableVertexAttribArray);
@ -3576,9 +3452,9 @@ eng_gl_api_get(void *data)
ORD(glGetRenderbufferParameteriv);
ORD(glGetShaderiv);
ORD(glGetShaderInfoLog);
// ORD(glGetShaderPrecisionFormat);
// ORD(glGetShaderPrecisionFormat);
ORD(glGetShaderSource);
// ORD(glGetString);
// ORD(glGetString);
ORD(glGetTexParameterfv);
ORD(glGetTexParameteriv);
ORD(glGetUniformfv);
@ -3600,11 +3476,11 @@ eng_gl_api_get(void *data)
ORD(glPixelStorei);
ORD(glPolygonOffset);
ORD(glReadPixels);
// ORD(glReleaseShaderCompiler);
// ORD(glReleaseShaderCompiler);
ORD(glRenderbufferStorage);
ORD(glSampleCoverage);
ORD(glScissor);
// ORD(glShaderBinary);
// ORD(glShaderBinary);
ORD(glShaderSource);
ORD(glStencilFunc);
ORD(glStencilFuncSeparate);
@ -3703,7 +3579,7 @@ eng_gl_api_get(void *data)
ORD(glExtGetProgramBinarySourceQCOM);
#undef ORD
// Override functions wrapped by Evas_GL
// Override functions wrapped by Evas_GL
#define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_)
ORD(glBindFramebuffer);
ORD(glBindRenderbuffer);
@ -3859,7 +3735,7 @@ module_open(Evas_Module *em)
/* store it for later use */
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
ORD(info);
ORD(info_free);
ORD(setup);

View File

@ -12,8 +12,8 @@
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
# if defined(GLES_VARIETY_S3C6410)
# include <EGL/egl.h>
# include <GLES2/gl2.h>
//# include <EGL/egl.h>
//# include <GLES2/gl2.h>
# include <X11/Xlib.h>
# include <X11/Xatom.h>
# include <X11/Xutil.h>
@ -21,9 +21,9 @@
# include <X11/Xresource.h> // xres - dpi
# elif defined(GLES_VARIETY_SGX)
# define SUPPORT_X11 1
# include <EGL/egl.h>
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
//# include <EGL/egl.h>
//# include <GLES2/gl2.h>
//# include <GLES2/gl2ext.h>
# include <X11/Xlib.h>
# include <X11/Xatom.h>
# include <X11/Xutil.h>
@ -36,9 +36,9 @@
# include <X11/Xutil.h>
# include <X11/extensions/Xrender.h>
# include <X11/Xresource.h> // xres - dpi
# include <GL/gl.h>
# include <GL/glext.h>
# include <GL/glx.h>
//# include <GL/gl.h>
//# include <GL/glext.h>
//# include <GL/glx.h>
#endif
extern int _evas_engine_GL_X11_log_dom ;

View File

@ -71,17 +71,17 @@ eng_window_new(Display *disp,
vi_use = _evas_gl_x11_rgba_vi;
}
#else
//#ifdef NEWGL
//#ifdef NEWGL
if (_evas_gl_x11_rgba_vi)
{
vi_use = _evas_gl_x11_rgba_vi;
}
//#endif
//#endif
#endif
}
gw->visualinfo = vi_use;
// EGL / GLES
// EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
context_attrs[1] = 2;
@ -130,14 +130,14 @@ eng_window_new(Display *disp,
config_attrs[n++] = EGL_RENDERABLE_TYPE;
config_attrs[n++] = EGL_OPENGL_ES2_BIT;
#if 0
// FIXME: n900 - omap3 sgx libs break here
// FIXME: n900 - omap3 sgx libs break here
config_attrs[n++] = EGL_RED_SIZE;
config_attrs[n++] = 1;
config_attrs[n++] = EGL_GREEN_SIZE;
config_attrs[n++] = 1;
config_attrs[n++] = EGL_BLUE_SIZE;
config_attrs[n++] = 1;
// FIXME: end n900 breakage
// FIXME: end n900 breakage
#endif
if (gw->alpha)
{
@ -156,68 +156,68 @@ eng_window_new(Display *disp,
config_attrs[n++] = EGL_NONE;
# endif
gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp));
gw->egl_disp = glsym_eglGetDisplay((EGLNativeDisplayType)(gw->disp));
if (!gw->egl_disp)
{
ERR("eglGetDisplay() fail. code=%#x", eglGetError());
ERR("glsym_eglGetDisplay() fail. code=%#x", glsym_eglGetError());
eng_window_free(gw);
return NULL;
}
if (!eglInitialize(gw->egl_disp, &major_version, &minor_version))
if (!glsym_eglInitialize(gw->egl_disp, &major_version, &minor_version))
{
ERR("eglInitialize() fail. code=%#x", eglGetError());
ERR("glsym_eglInitialize() fail. code=%#x", glsym_eglGetError());
eng_window_free(gw);
return NULL;
}
eglBindAPI(EGL_OPENGL_ES_API);
if (eglGetError() != EGL_SUCCESS)
glsym_eglBindAPI(EGL_OPENGL_ES_API);
if (glsym_eglGetError() != EGL_SUCCESS)
{
ERR("eglBindAPI() fail. code=%#x", eglGetError());
ERR("glsym_eglBindAPI() fail. code=%#x", glsym_eglGetError());
eng_window_free(gw);
return NULL;
}
num_config = 0;
if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config,
if (!glsym_eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config,
1, &num_config) || (num_config != 1))
{
ERR("eglChooseConfig() fail. code=%#x", eglGetError());
ERR("glsym_eglChooseConfig() fail. code=%#x", glsym_eglGetError());
eng_window_free(gw);
return NULL;
}
gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
gw->egl_surface[0] = glsym_eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
(EGLNativeWindowType)gw->win,
NULL);
if (gw->egl_surface[0] == EGL_NO_SURFACE)
{
ERR("eglCreateWindowSurface() fail for %#x. code=%#x",
(unsigned int)gw->win, eglGetError());
ERR("glsym_eglCreateWindowSurface() fail for %#x. code=%#x",
(unsigned int)gw->win, glsym_eglGetError());
eng_window_free(gw);
return NULL;
}
if (context == EGL_NO_CONTEXT)
context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL,
context = glsym_eglCreateContext(gw->egl_disp, gw->egl_config, NULL,
context_attrs);
gw->egl_context[0] = context;
if (gw->egl_context[0] == EGL_NO_CONTEXT)
{
ERR("eglCreateContext() fail. code=%#x", eglGetError());
ERR("glsym_eglCreateContext() fail. code=%#x", glsym_eglGetError());
eng_window_free(gw);
return NULL;
}
if (eglMakeCurrent(gw->egl_disp,
if (glsym_eglMakeCurrent(gw->egl_disp,
gw->egl_surface[0],
gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE)
{
ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
ERR("glsym_eglMakeCurrent() fail. code=%#x", glsym_eglGetError());
eng_window_free(gw);
return NULL;
}
vendor = glGetString(GL_VENDOR);
renderer = glGetString(GL_RENDERER);
version = glGetString(GL_VERSION);
vendor = glsym_glGetString(GL_VENDOR);
renderer = glsym_glGetString(GL_RENDERER);
version = glsym_glGetString(GL_VERSION);
if (!vendor) vendor = (unsigned char *)"-UNKNOWN-";
if (!renderer) renderer = (unsigned char *)"-UNKNOWN-";
if (!version) version = (unsigned char *)"-UNKNOWN-";
@ -227,42 +227,42 @@ eng_window_new(Display *disp,
fprintf(stderr, "renderer: %s\n", renderer);
fprintf(stderr, "version: %s\n", version);
}
// GLX
// GLX
#else
if (!context)
{
#ifdef NEWGL
if (indirect)
context = glXCreateNewContext(gw->disp, fbconf,
context = glsym_glXCreateNewContext(gw->disp, fbconf,
GLX_RGBA_TYPE, NULL,
GL_FALSE);
else
context = glXCreateNewContext(gw->disp, fbconf,
context = glsym_glXCreateNewContext(gw->disp, fbconf,
GLX_RGBA_TYPE, NULL,
GL_TRUE);
#else
if (indirect)
context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_FALSE);
context = glsym_glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_FALSE);
else
context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_TRUE);
context = glsym_glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_TRUE);
#endif
}
#ifdef NEWGL
if ((gw->alpha) && (!rgba_context))
{
if (indirect)
rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
rgba_context = glsym_glXCreateNewContext(gw->disp, rgba_fbconf,
GLX_RGBA_TYPE, context,
GL_FALSE);
else
rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
rgba_context = glsym_glXCreateNewContext(gw->disp, rgba_fbconf,
GLX_RGBA_TYPE, context,
GL_TRUE);
}
if (gw->alpha)
gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
gw->glxwin = glsym_glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
else
gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
gw->glxwin = glsym_glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
if (!gw->glxwin)
{
eng_window_free(gw);
@ -288,19 +288,19 @@ eng_window_new(Display *disp,
if (gw->glxwin)
{
if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
if (!glsym_glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
gw->context))
{
printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
printf("Error: glsym_glXMakeContextCurrent(%p, %p, %p, %p)\n", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
eng_window_free(gw);
return NULL;
}
}
else
{
if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
if (!glsym_glXMakeCurrent(gw->disp, gw->win, gw->context))
{
printf("Error: glXMakeCurrent(%p, 0x%x, %p) failed\n", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
printf("Error: glsym_glXMakeCurrent(%p, 0x%x, %p) failed\n", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
eng_window_free(gw);
return NULL;
}
@ -308,9 +308,9 @@ eng_window_new(Display *disp,
// FIXME: move this up to context creation
vendor = glGetString(GL_VENDOR);
renderer = glGetString(GL_RENDERER);
version = glGetString(GL_VERSION);
vendor = glsym_glGetString(GL_VENDOR);
renderer = glsym_glGetString(GL_RENDERER);
version = glsym_glGetString(GL_VERSION);
if (getenv("EVAS_GL_INFO"))
{
fprintf(stderr, "vendor: %s\n", vendor);
@ -416,10 +416,10 @@ eng_window_new(Display *disp,
// noothing yet. add more cases and options over time
}
fbc = glXGetFBConfigs(gw->disp, screen, &num);
fbc = glsym_glXGetFBConfigs(gw->disp, screen, &num);
if (!fbc)
{
ERR("glXGetFBConfigs() returned no fb configs");
ERR("glsym_glXGetFBConfigs() returned no fb configs");
eng_window_free(gw);
return NULL;
}
@ -432,15 +432,15 @@ eng_window_new(Display *disp,
int alph, val, dbuf, stencil, tdepth;
int rgba;
vi = glXGetVisualFromFBConfig(gw->disp, fbc[j]);
vi = glsym_glXGetVisualFromFBConfig(gw->disp, fbc[j]);
if (!vi) continue;
vd = vi->depth;
XFree(vi);
if (vd != i) continue;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph);
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val);
if ((val != i) && ((val - alph) != i)) continue;
@ -449,7 +449,7 @@ eng_window_new(Display *disp,
if (i == 32)
{
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
if (val)
{
rgba = 1;
@ -459,34 +459,34 @@ eng_window_new(Display *disp,
if (!val)
{
if (rgba) continue;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
if (!val) continue;
gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
}
dbuf = 0x7fff;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val);
if (val > dbuf) continue;
dbuf = val;
stencil = 0x7fff;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val);
if (val > stencil) continue;
stencil = val;
tdepth = 0x7fff;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val);
if (val > tdepth) continue;
tdepth = val;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
if (val < 0) continue;
gw->depth_cfg[i].mipmap = val;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val);
gw->depth_cfg[i].yinvert = val;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val);
glsym_glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val);
gw->depth_cfg[i].tex_target = val;
gw->depth_cfg[i].fbc = fbc[j];
@ -530,20 +530,20 @@ eng_window_free(Evas_GL_X11_Window *gw)
}
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gw->egl_surface[0] != EGL_NO_SURFACE)
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
glsym_eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
if (ref == 0)
{
if (context) eglDestroyContext(gw->egl_disp, context);
eglTerminate(gw->egl_disp);
if (context) glsym_eglDestroyContext(gw->egl_disp, context);
glsym_eglTerminate(gw->egl_disp);
context = EGL_NO_CONTEXT;
}
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
glsym_eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
#else
if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin);
if (gw->glxwin) glsym_glXDestroyWindow(gw->disp, gw->glxwin);
if (ref == 0)
{
if (context) glXDestroyContext(gw->disp, context);
if (rgba_context) glXDestroyContext(gw->disp, rgba_context);
if (context) glsym_glXDestroyContext(gw->disp, context);
if (rgba_context) glsym_glXDestroyContext(gw->disp, rgba_context);
context = 0;
rgba_context = 0;
fbconf = 0;
@ -561,18 +561,18 @@ eng_window_use(Evas_GL_X11_Window *gw)
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (_evas_gl_x11_window)
{
if ((eglGetCurrentContext() !=
if ((glsym_eglGetCurrentContext() !=
_evas_gl_x11_window->egl_context[0]) ||
(eglGetCurrentSurface(EGL_READ) !=
(glsym_eglGetCurrentSurface(EGL_READ) !=
_evas_gl_x11_window->egl_surface[0]) ||
(eglGetCurrentSurface(EGL_DRAW) !=
(glsym_eglGetCurrentSurface(EGL_DRAW) !=
_evas_gl_x11_window->egl_surface[0]))
force_use = EINA_TRUE;
}
#else
if (_evas_gl_x11_window)
{
if (glXGetCurrentContext() != _evas_gl_x11_window->context)
if (glsym_glXGetCurrentContext() != _evas_gl_x11_window->context)
force_use = EINA_TRUE;
}
#endif
@ -586,33 +586,33 @@ eng_window_use(Evas_GL_X11_Window *gw)
_evas_gl_x11_window = gw;
if (gw)
{
// EGL / GLES
// EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gw->egl_surface[0] != EGL_NO_SURFACE)
{
if (eglMakeCurrent(gw->egl_disp,
if (glsym_eglMakeCurrent(gw->egl_disp,
gw->egl_surface[0],
gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE)
{
ERR("eglMakeCurrent() failed!");
ERR("glsym_eglMakeCurrent() failed!");
}
}
// GLX
// GLX
#else
if (gw->glxwin)
{
if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
if (!glsym_glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
gw->context))
{
ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
ERR("glsym_glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
}
}
else
{
if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
if (!glsym_glXMakeCurrent(gw->disp, gw->win, gw->context))
{
ERR("glXMakeCurrent(%p, 0x%x, %p) failed", gw->disp, (unsigned int)gw->win, (void *)gw->context);
ERR("glsym_glXMakeCurrent(%p, 0x%x, %p) failed", gw->disp, (unsigned int)gw->win, (void *)gw->context);
}
}
#endif
@ -633,16 +633,16 @@ eng_window_unsurf(Evas_GL_X11_Window *gw)
evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
if (_evas_gl_x11_window == gw)
{
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
glsym_eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (gw->egl_surface[0] != EGL_NO_SURFACE)
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
glsym_eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
gw->egl_surface[0] = EGL_NO_SURFACE;
_evas_gl_x11_window = NULL;
}
#else
if (gw->glxwin)
{
glXDestroyWindow(gw->disp, gw->glxwin);
glsym_glXDestroyWindow(gw->disp, gw->glxwin);
}
else
{
@ -658,37 +658,37 @@ eng_window_resurf(Evas_GL_X11_Window *gw)
if (getenv("EVAS_GL_INFO"))
printf("resurf %p\n", gw);
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
gw->egl_surface[0] = glsym_eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
(EGLNativeWindowType)gw->win,
NULL);
if (gw->egl_surface[0] == EGL_NO_SURFACE)
{
ERR("eglCreateWindowSurface() fail for %#x. code=%#x",
(unsigned int)gw->win, eglGetError());
ERR("glsym_eglCreateWindowSurface() fail for %#x. code=%#x",
(unsigned int)gw->win, glsym_eglGetError());
return;
}
if (eglMakeCurrent(gw->egl_disp,
if (glsym_eglMakeCurrent(gw->egl_disp,
gw->egl_surface[0],
gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE)
{
ERR("eglMakeCurrent() failed!");
ERR("glsym_eglMakeCurrent() failed!");
}
#else
#ifdef NEWGL
if (gw->alpha)
gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
gw->glxwin = glsym_glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
else
gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
gw->glxwin = glsym_glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
if (!glsym_glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
gw->context))
{
ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
ERR("glsym_glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
}
#else
if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
if (!glsym_glXMakeCurrent(gw->disp, gw->win, gw->context))
{
ERR("glXMakeCurrent(%p, 0x%x, %p) failed", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
ERR("glsym_glXMakeCurrent(%p, 0x%x, %p) failed", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
}
#endif
#endif
@ -704,7 +704,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
{
int alpha;
// EGL / GLES
// EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
for (alpha = 0; alpha < 2; alpha++)
{
@ -751,7 +751,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
_evas_gl_x11_vi);
}
}
// GLX
// GLX
#else
for (alpha = 0; alpha < 2; alpha++)
{
@ -794,12 +794,12 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
config_attrs[i++] = GLX_NONE;//GLX_NONE;//GLX_TRANSPARENT_INDEX//GLX_TRANSPARENT_RGB;
config_attrs[i++] = 0;
configs = glXChooseFBConfig(einfo->info.display,
configs = glsym_glXChooseFBConfig(einfo->info.display,
einfo->info.screen,
config_attrs, &num);
if ((!configs) || (num < 1))
{
ERR("glXChooseFBConfig returned no configs");
ERR("glsym_glXChooseFBConfig returned no configs");
return NULL;
}
for (i = 0; i < num; i++)
@ -807,7 +807,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
XVisualInfo *visinfo;
XRenderPictFormat *format = NULL;
visinfo = glXGetVisualFromFBConfig(einfo->info.display,
visinfo = glsym_glXGetVisualFromFBConfig(einfo->info.display,
configs[i]);
if (!visinfo) continue;
if (!alpha)
@ -846,13 +846,13 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
if (!_evas_gl_x11_vi) return NULL;
if (einfo->info.destination_alpha)
{
// EGL / GLES
// EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
#else
//# ifdef NEWGL
//# ifdef NEWGL
if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
//# endif
//# endif
#endif
}
return _evas_gl_x11_vi->visual;