sorry sungwoo - going to have to back this dlopen/dlsym styuff out.

intel drivers don;'t like it for some odd reason - i'm trying to track
it down but i can't sanely try middlegrounds right now (eg dont
dlopen/dlsym but actually directly assign symbols etc.), so back out
and let's figure this out before it goes back in :(



SVN revision: 66308
This commit is contained in:
Carsten Haitzler 2011-12-18 05:03:24 +00:00
parent ac49da31df
commit dbc5afdee2
11 changed files with 1373 additions and 8016 deletions

View File

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

View File

@ -12,7 +12,6 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <Eet.h> #include <Eet.h>
#include "evas_gl_core.h"
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
@ -29,14 +28,14 @@
# else # else
# if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) # if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
# if defined(GLES_VARIETY_S3C6410) # if defined(GLES_VARIETY_S3C6410)
//# include <GLES2/gl2.h> # include <GLES2/gl2.h>
# elif defined(GLES_VARIETY_SGX) # elif defined(GLES_VARIETY_SGX)
//# include <GLES2/gl2.h> # include <GLES2/gl2.h>
//# include <GLES2/gl2ext.h> # include <GLES2/gl2ext.h>
# endif # endif
# else # else
//# include <GL/gl.h> # include <GL/gl.h>
//# include <GL/glext.h> # include <GL/glext.h>
# endif # endif
# endif # endif
#endif #endif
@ -625,12 +624,29 @@ 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 *); void evas_gl_common_image_filtered_free(Evas_GL_Image *im, Filtered_Image *);
#endif #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 //#define GL_ERRORS 1
#ifdef GL_ERRORS #ifdef GL_ERRORS
# define GLERR(fn, fl, ln, op) \ # define GLERR(fn, fl, ln, op) \
{ \ { \
int __gl_err = glsym_glGetError(); \ int __gl_err = glGetError(); \
if (__gl_err != GL_NO_ERROR) glerr(__gl_err, fl, fn, ln, op); \ if (__gl_err != GL_NO_ERROR) glerr(__gl_err, fl, fn, ln, op); \
} }
#else #else

View File

@ -9,10 +9,145 @@
#define PRG_INVALID 0xffffffff #define PRG_INVALID 0xffffffff
#define GLPIPES 1 #define GLPIPES 1
static int sym_done = 0;
int _evas_engine_GL_common_log_dom = -1; 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 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 void shader_array_flush(Evas_Engine_GL_Context *gc);
static Evas_Engine_GL_Context *_evas_gl_common_context = NULL; static Evas_Engine_GL_Context *_evas_gl_common_context = NULL;
@ -114,11 +249,11 @@ _evas_gl_common_version_check()
int minor; int minor;
/* /*
* glsym_glGetString returns a string describing the current GL connection. * glGetString returns a string describing the current GL connection.
* GL_VERSION is used to get the version of the connection * GL_VERSION is used to get the version of the connection
*/ */
version = (char *)glsym_glGetString(GL_VERSION); version = (char *)glGetString(GL_VERSION);
/* /*
* OpengL ES * OpengL ES
@ -165,7 +300,7 @@ _evas_gl_common_version_check()
* version number and the vendor-specific information. * version number and the vendor-specific information.
*/ */
/* glsym_glGetString() returns a static string, and we are going to */ /* glGetString() returns a static string, and we are going to */
/* modify it, so we get a copy first */ /* modify it, so we get a copy first */
version = strdup(version); version = strdup(version);
if (!version) if (!version)
@ -236,9 +371,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
if (foc == 0) if (foc == 0)
{ {
if ((rot == 0) || (rot == 180)) if ((rot == 0) || (rot == 180))
glsym_glViewport(0, 0, w, h); glViewport(0, 0, w, h);
else else
glsym_glViewport(0, 0, h, w); glViewport(0, 0, h, w);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// std matrix // std matrix
if (m == 1) if (m == 1)
@ -301,9 +436,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
if (m == -1) ay = vy * 2; if (m == -1) ay = vy * 2;
if ((rot == 0) || (rot == 180)) if ((rot == 0) || (rot == 180))
glsym_glViewport(-2 * vx, -2 * vy, vw, vh); glViewport(-2 * vx, -2 * vy, vw, vh);
else else
glsym_glViewport(-2 * vy, -2 * vx, vh, vw); glViewport(-2 * vy, -2 * vx, vh, vw);
if (m == 1) if (m == 1)
matrix_ortho(proj, 0, vw, 0, vh, matrix_ortho(proj, 0, vw, 0, vh,
-1000000.0, 1000000.0, -1000000.0, 1000000.0,
@ -320,15 +455,15 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
for (i = 0; i < SHADER_LAST; ++i) for (i = 0; i < SHADER_LAST; ++i)
{ {
glsym_glUseProgram(gc->shared->shader[i].prog); glUseProgram(gc->shared->shader[i].prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glUniformMatrix4fv(glsym_glGetUniformLocation(gc->shared->shader[i].prog, "mvp"), 1, GL_FALSE, proj); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader[i].prog, "mvp"), 1, GL_FALSE, proj);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
if (gc->state.current.cur_prog == PRG_INVALID) if (gc->state.current.cur_prog == PRG_INVALID)
glsym_glUseProgram(gc->shared->shader[0].prog); glUseProgram(gc->shared->shader[0].prog);
else glsym_glUseProgram(gc->state.current.cur_prog); else glUseProgram(gc->state.current.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
@ -351,6 +486,8 @@ evas_gl_common_context_new(void)
gc = calloc(1, sizeof(Evas_Engine_GL_Context)); gc = calloc(1, sizeof(Evas_Engine_GL_Context));
if (!gc) return NULL; if (!gc) return NULL;
gl_symbols();
gc->references = 1; gc->references = 1;
_evas_gl_common_context = gc; _evas_gl_common_context = gc;
@ -363,7 +500,7 @@ evas_gl_common_context_new(void)
const GLubyte *ext; const GLubyte *ext;
shared = calloc(1, sizeof(Evas_GL_Shared)); shared = calloc(1, sizeof(Evas_GL_Shared));
ext = glsym_glGetString(GL_EXTENSIONS); ext = glGetString(GL_EXTENSIONS);
if (ext) if (ext)
{ {
if (getenv("EVAS_GL_INFO")) if (getenv("EVAS_GL_INFO"))
@ -381,7 +518,7 @@ evas_gl_common_context_new(void)
shared->info.bin_program = 1; shared->info.bin_program = 1;
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic"))) if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic")))
glsym_glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
&(shared->info.anisotropic)); &(shared->info.anisotropic));
#endif #endif
#ifdef GL_BGRA #ifdef GL_BGRA
@ -399,24 +536,24 @@ evas_gl_common_context_new(void)
{ {
// test for all needed symbols - be "conservative" and // test for all needed symbols - be "conservative" and
// need all of it // need all of it
if ((glsym_eglCreateImage) && if ((secsym_eglCreateImage) &&
(glsym_eglDestroyImage) && (secsym_eglDestroyImage) &&
(glsym_glEGLImageTargetTexture2DOES) && (secsym_glEGLImageTargetTexture2DOES) &&
(glsym_eglMapImageSEC) && (secsym_eglMapImageSEC) &&
(glsym_eglUnmapImageSEC) && (secsym_eglUnmapImageSEC) &&
(glsym_eglGetImageAttribSEC)) (secsym_eglGetImageAttribSEC))
shared->info.sec_image_map = 1; shared->info.sec_image_map = 1;
} }
#endif #endif
} }
glsym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,
&(shared->info.max_texture_units)); &(shared->info.max_texture_units));
glsym_glGetIntegerv(GL_MAX_TEXTURE_SIZE, glGetIntegerv(GL_MAX_TEXTURE_SIZE,
&(shared->info.max_texture_size)); &(shared->info.max_texture_size));
shared->info.max_vertex_elements = 6 * 100000; shared->info.max_vertex_elements = 6 * 100000;
#ifdef GL_MAX_ELEMENTS_VERTICES #ifdef GL_MAX_ELEMENTS_VERTICES
/* only applies to glsym_glDrawRangeElements. don't really need to get it. /* only applies to glDrawRangeElements. don't really need to get it.
glsym_glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, glGetIntegerv(GL_MAX_ELEMENTS_VERTICES,
&(shared->info.max_vertex_elements)); &(shared->info.max_vertex_elements));
*/ */
#endif #endif
@ -436,7 +573,7 @@ evas_gl_common_context_new(void)
shared->info.tune.atlas.slot_size = DEF_ATLAS_SLOT; shared->info.tune.atlas.slot_size = DEF_ATLAS_SLOT;
// per gpu hacks. based on impirical measurement of some known gpu's // per gpu hacks. based on impirical measurement of some known gpu's
s = (const char *)glsym_glGetString(GL_RENDERER); s = (const char *)glGetString(GL_RENDERER);
if (s) if (s)
{ {
if (strstr(s, "PowerVR SGX 540")) if (strstr(s, "PowerVR SGX 540"))
@ -509,47 +646,47 @@ evas_gl_common_context_new(void)
(int)shared->info.tune.atlas.slot_size (int)shared->info.tune.atlas.slot_size
); );
glsym_glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glEnable(GL_DITHER); glEnable(GL_DITHER);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDisable(GL_BLEND); glDisable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// no dest alpha // no dest alpha
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? // glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
glsym_glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0) if (shared->info.anisotropic > 0.0)
{ {
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
#endif #endif
glsym_glEnableVertexAttribArray(SHAD_VERTEX); glEnableVertexAttribArray(SHAD_VERTEX);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glEnableVertexAttribArray(SHAD_COLOR); glEnableVertexAttribArray(SHAD_COLOR);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!evas_gl_common_shader_program_init(shared)) goto error; if (!evas_gl_common_shader_program_init(shared)) goto error;
#define SHADER_TEXTURE_ADD(Shared, Shader, Name) \ #define SHADER_TEXTURE_ADD(Shared, Shader, Name) \
glsym_glUseProgram(Shared->shader[SHADER_##Shader].prog); \ glUseProgram(Shared->shader[SHADER_##Shader].prog); \
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); \ GLERR(__FUNCTION__, __FILE__, __LINE__, ""); \
glsym_glUniform1i(glsym_glGetUniformLocation(Shared->shader[SHADER_##Shader].prog, #Name), Shared->shader[SHADER_##Shader].tex_count++); \ glUniform1i(glGetUniformLocation(Shared->shader[SHADER_##Shader].prog, #Name), Shared->shader[SHADER_##Shader].tex_count++); \
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
SHADER_TEXTURE_ADD(shared, YUV, tex); SHADER_TEXTURE_ADD(shared, YUV, tex);
@ -576,8 +713,8 @@ evas_gl_common_context_new(void)
SHADER_TEXTURE_ADD(shared, IMG_MASK, texm); SHADER_TEXTURE_ADD(shared, IMG_MASK, texm);
if (gc->state.current.cur_prog == PRG_INVALID) if (gc->state.current.cur_prog == PRG_INVALID)
glsym_glUseProgram(gc->shared->shader[0].prog); glUseProgram(gc->shared->shader[0].prog);
else glsym_glUseProgram(gc->state.current.cur_prog); else glUseProgram(gc->state.current.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
evas_gl_common_shader_program_init_done(); evas_gl_common_shader_program_init_done();
@ -586,8 +723,8 @@ evas_gl_common_context_new(void)
// //
// in code: // in code:
// GLuint texes[8]; // GLuint texes[8];
// GLint loc = glsym_glGetUniformLocation(prog, "tex"); // GLint loc = glGetUniformLocation(prog, "tex");
// glsym_glUniform1iv(loc, 8, texes); // glUniform1iv(loc, 8, texes);
shared->native_pm_hash = eina_hash_int32_new(NULL); shared->native_pm_hash = eina_hash_int32_new(NULL);
shared->native_tex_hash = eina_hash_int32_new(NULL); shared->native_tex_hash = eina_hash_int32_new(NULL);
@ -726,53 +863,53 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
} }
gc->change.size = 1; gc->change.size = 1;
glsym_glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glScissor(0, 0, 0, 0); glScissor(0, 0, 0, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glEnable(GL_DITHER); glEnable(GL_DITHER);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDisable(GL_BLEND); glDisable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// no dest alpha // no dest alpha
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
// glsym_glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? // glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
glsym_glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0) if (shared->info.anisotropic > 0.0)
{ {
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
#endif #endif
glsym_glEnableVertexAttribArray(SHAD_VERTEX); glEnableVertexAttribArray(SHAD_VERTEX);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glEnableVertexAttribArray(SHAD_COLOR); glEnableVertexAttribArray(SHAD_COLOR);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (gc->state.current.cur_prog == PRG_INVALID) if (gc->state.current.cur_prog == PRG_INVALID)
glsym_glUseProgram(gc->shared->shader[0].prog); glUseProgram(gc->shared->shader[0].prog);
else glsym_glUseProgram(gc->state.current.cur_prog); else glUseProgram(gc->state.current.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_evas_gl_common_viewport_set(gc); _evas_gl_common_viewport_set(gc);
@ -2177,19 +2314,19 @@ scissor_rot(Evas_Engine_GL_Context *gc __UNUSED__,
switch (rot) switch (rot)
{ {
case 0: // UP this way: ^ case 0: // UP this way: ^
glsym_glScissor(cx, cy, cw, ch); glScissor(cx, cy, cw, ch);
break; break;
case 90: // UP this way: < case 90: // UP this way: <
glsym_glScissor(gh - (cy + ch), cx, ch, cw); glScissor(gh - (cy + ch), cx, ch, cw);
break; break;
case 180: // UP this way: v case 180: // UP this way: v
glsym_glScissor(gw - (cx + cw), gh - (cy + ch), cw, ch); glScissor(gw - (cx + cw), gh - (cy + ch), cw, ch);
break; break;
case 270: // UP this way: > case 270: // UP this way: >
glsym_glScissor(cy, gw - (cx + cw), ch, cw); glScissor(cy, gw - (cx + cw), ch, cw);
break; break;
default: // assume up is up default: // assume up is up
glsym_glScissor(cx, cy, cw, ch); glScissor(cx, cy, cw, ch);
break; break;
} }
} }
@ -2218,7 +2355,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
GLERR(__FUNCTION__, __FILE__, __LINE__, "<flush err>"); GLERR(__FUNCTION__, __FILE__, __LINE__, "<flush err>");
if (gc->pipe[i].shader.cur_prog != gc->state.current.cur_prog) if (gc->pipe[i].shader.cur_prog != gc->state.current.cur_prog)
{ {
glsym_glUseProgram(gc->pipe[i].shader.cur_prog); glUseProgram(gc->pipe[i].shader.cur_prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
@ -2227,18 +2364,18 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#if 0 #if 0
if (gc->pipe[i].shader.cur_tex) if (gc->pipe[i].shader.cur_tex)
{ {
glsym_glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else else
{ {
glsym_glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
#endif #endif
glsym_glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
if (gc->pipe[i].array.im) if (gc->pipe[i].array.im)
@ -2246,7 +2383,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].array.im->tex->pt->dyn.img) if (gc->pipe[i].array.im->tex->pt->dyn.img)
{ {
glsym_glEGLImageTargetTexture2DOES secsym_glEGLImageTargetTexture2DOES
(GL_TEXTURE_2D, gc->pipe[i].array.im->tex->pt->dyn.img); (GL_TEXTURE_2D, gc->pipe[i].array.im->tex->pt->dyn.img);
} }
else else
@ -2265,12 +2402,12 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
switch (gc->pipe[i].shader.render_op) switch (gc->pipe[i].shader.render_op)
{ {
case EVAS_RENDER_BLEND: /**< default op: d = d*(1-sa) + s */ case EVAS_RENDER_BLEND: /**< default op: d = d*(1-sa) + s */
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
break; break;
case EVAS_RENDER_COPY: /**< d = s */ case EVAS_RENDER_COPY: /**< d = s */
gc->pipe[i].shader.blend = 0; gc->pipe[i].shader.blend = 0;
glsym_glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
break; break;
// FIXME: fix blend funcs below! // FIXME: fix blend funcs below!
@ -2285,7 +2422,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
case EVAS_RENDER_MASK: /**< d = d*sa */ case EVAS_RENDER_MASK: /**< d = d*sa */
case EVAS_RENDER_MUL: /**< d = d*s */ case EVAS_RENDER_MUL: /**< d = d*s */
default: default:
glsym_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
break; break;
} }
@ -2294,12 +2431,12 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
{ {
if (gc->pipe[i].shader.blend) if (gc->pipe[i].shader.blend)
{ {
glsym_glEnable(GL_BLEND); glEnable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else else
{ {
glsym_glDisable(GL_BLEND); glDisable(GL_BLEND);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -2311,17 +2448,17 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0) if (shared->info.anisotropic > 0.0)
{ {
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
#endif #endif
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else else
@ -2329,17 +2466,17 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if (shared->info.anisotropic > 0.0) if (shared->info.anisotropic > 0.0)
{ {
glsym_glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
#endif #endif
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -2350,7 +2487,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
{ {
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch; cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
if (fbo) cy = gc->pipe[i].shader.cy; if (fbo) cy = gc->pipe[i].shader.cy;
glsym_glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
if (!fbo) if (!fbo)
scissor_rot(gc, gc->rot, gw, gh, scissor_rot(gc, gc->rot, gw, gh,
gc->pipe[i].shader.cx, gc->pipe[i].shader.cx,
@ -2358,14 +2495,14 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
gc->pipe[i].shader.cw, gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch); gc->pipe[i].shader.ch);
else else
glsym_glScissor(gc->pipe[i].shader.cx, cy, glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch); gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
setclip = 1; setclip = 1;
} }
else else
{ {
glsym_glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
glsym_glScissor(0, 0, 0, 0); glScissor(0, 0, 0, 0);
} }
} }
if ((gc->pipe[i].shader.clip) && (!setclip)) if ((gc->pipe[i].shader.clip) && (!setclip))
@ -2384,112 +2521,112 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
gc->pipe[i].shader.cw, gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch); gc->pipe[i].shader.ch);
else else
glsym_glScissor(gc->pipe[i].shader.cx, cy, glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch); gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
} }
} }
glsym_glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->pipe[i].array.vertex); glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->pipe[i].array.vertex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->pipe[i].array.color); glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->pipe[i].array.color);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (gc->pipe[i].array.use_texuv) if (gc->pipe[i].array.use_texuv)
{ {
glsym_glEnableVertexAttribArray(SHAD_TEXUV); glEnableVertexAttribArray(SHAD_TEXUV);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv); glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else else
{ {
glsym_glDisableVertexAttribArray(SHAD_TEXUV); glDisableVertexAttribArray(SHAD_TEXUV);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
if (gc->pipe[i].array.line) if (gc->pipe[i].array.line)
{ {
glsym_glDisableVertexAttribArray(SHAD_TEXUV); glDisableVertexAttribArray(SHAD_TEXUV);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDisableVertexAttribArray(SHAD_TEXUV2); glDisableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDisableVertexAttribArray(SHAD_TEXUV3); glDisableVertexAttribArray(SHAD_TEXUV3);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDrawArrays(GL_LINES, 0, gc->pipe[i].array.num); glDrawArrays(GL_LINES, 0, gc->pipe[i].array.num);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else else
{ {
if (gc->pipe[i].array.use_texm) if (gc->pipe[i].array.use_texm)
{ {
glsym_glEnableVertexAttribArray(SHAD_TEXM); glEnableVertexAttribArray(SHAD_TEXM);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glVertexAttribPointer(SHAD_TEXM, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texm); glVertexAttribPointer(SHAD_TEXM, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texm);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else else
{ {
glsym_glDisableVertexAttribArray(SHAD_TEXM); glDisableVertexAttribArray(SHAD_TEXM);
} }
if ((gc->pipe[i].array.use_texuv2) && (gc->pipe[i].array.use_texuv3)) if ((gc->pipe[i].array.use_texuv2) && (gc->pipe[i].array.use_texuv3))
{ {
glsym_glEnableVertexAttribArray(SHAD_TEXUV2); glEnableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glEnableVertexAttribArray(SHAD_TEXUV3); glEnableVertexAttribArray(SHAD_TEXUV3);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2); glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv3); glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv3);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].shader.cur_texu_dyn) if (gc->pipe[i].shader.cur_texu_dyn)
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn); secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn);
#endif #endif
glsym_glActiveTexture(GL_TEXTURE2); glActiveTexture(GL_TEXTURE2);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].shader.cur_texv_dyn) if (gc->pipe[i].shader.cur_texv_dyn)
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv_dyn); secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv_dyn);
#endif #endif
glsym_glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else if (gc->pipe[i].array.use_texuv2) else if (gc->pipe[i].array.use_texuv2)
{ {
glsym_glEnableVertexAttribArray(SHAD_TEXUV2); glEnableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2); glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gc->pipe[i].shader.cur_texu_dyn) if (gc->pipe[i].shader.cur_texu_dyn)
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn); secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn);
#endif #endif
glsym_glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
else else
{ {
glsym_glDisableVertexAttribArray(SHAD_TEXUV2); glDisableVertexAttribArray(SHAD_TEXUV2);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDisableVertexAttribArray(SHAD_TEXUV3); glDisableVertexAttribArray(SHAD_TEXUV3);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
if (dbgflushnum) if (dbgflushnum)
@ -2507,7 +2644,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
types[gc->pipe[i].region.type] types[gc->pipe[i].region.type]
); );
} }
glsym_glDrawArrays(GL_TRIANGLES, 0, gc->pipe[i].array.num); glDrawArrays(GL_TRIANGLES, 0, gc->pipe[i].array.num);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
if (gc->pipe[i].array.im) if (gc->pipe[i].array.im)
@ -2566,8 +2703,6 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
Eina_Bool Eina_Bool
evas_gl_common_module_open(void) evas_gl_common_module_open(void)
{ {
if (!init_gl()) return EINA_FALSE;
if (_evas_engine_GL_common_log_dom < 0) if (_evas_engine_GL_common_log_dom < 0)
_evas_engine_GL_common_log_dom = eina_log_domain_register _evas_engine_GL_common_log_dom = eina_log_domain_register
("evas-gl_common", EVAS_DEFAULT_LOG_COLOR); ("evas-gl_common", EVAS_DEFAULT_LOG_COLOR);
@ -2582,8 +2717,6 @@ evas_gl_common_module_open(void)
void void
evas_gl_common_module_close(void) evas_gl_common_module_close(void)
{ {
free_gl();
if (_evas_engine_GL_common_log_dom < 0) return; if (_evas_engine_GL_common_log_dom < 0) return;
eina_log_domain_unregister(_evas_engine_GL_common_log_dom); eina_log_domain_unregister(_evas_engine_GL_common_log_dom);
_evas_engine_GL_common_log_dom = -1; _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; r = g = b = a = 255;
} }
glsym_glFlush(); glFlush();
c = gc->dc->clip.use; c = gc->dc->clip.use;
cx = gc->dc->clip.x; cy = gc->dc->clip.y; 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; char *logtxt;
/* Shader info log */ /* Shader info log */
glsym_glGetShaderiv(target, GL_INFO_LOG_LENGTH, &loglen); glGetShaderiv(target, GL_INFO_LOG_LENGTH, &loglen);
if (loglen > 0) if (loglen > 0)
{ {
logtxt = calloc(loglen, sizeof(char)); logtxt = calloc(loglen, sizeof(char));
if (logtxt) if (logtxt)
{ {
glsym_glGetShaderInfoLog(target, loglen, &chars, logtxt); glGetShaderInfoLog(target, loglen, &chars, logtxt);
ERR("Failed to %s: %s", action, logtxt); ERR("Failed to %s: %s", action, logtxt);
free(logtxt); free(logtxt);
} }
} }
/* Program info log */ /* Program info log */
glsym_glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen); glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen);
if (loglen > 0) if (loglen > 0)
{ {
logtxt = calloc(loglen, sizeof(char)); logtxt = calloc(loglen, sizeof(char));
if (logtxt) if (logtxt)
{ {
glsym_glGetProgramInfoLog(target, loglen, &chars, logtxt); glGetProgramInfoLog(target, loglen, &chars, logtxt);
ERR("Failed to %s: %s", action, logtxt); ERR("Failed to %s: %s", action, logtxt);
free(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 *driver = NULL;
char *version = NULL; char *version = NULL;
vendor = (char *)glsym_glGetString(GL_VENDOR); vendor = (char *)glGetString(GL_VENDOR);
driver = (char *)glsym_glGetString(GL_RENDERER); driver = (char *)glGetString(GL_RENDERER);
version = (char *)glsym_glGetString(GL_VERSION); version = (char *)glGetString(GL_VERSION);
new_path_len = snprintf(before_name, sizeof(before_name), "%s::%s::%s::%s::binary_shader.eet", vendor, version, driver, MODULE_ARCH); 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); data = eet_read(ef, pname, &length);
if ((!data) || (length <= 0)) goto finish; if ((!data) || (length <= 0)) goto finish;
glsym_glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num); glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num);
if (num <= 0) goto finish; if (num <= 0) goto finish;
formats = calloc(num, sizeof(int)); formats = calloc(num, sizeof(int));
if (!formats) goto finish; if (!formats) goto finish;
glsym_glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, formats); glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, formats);
if (!formats[0]) goto finish; if (!formats[0]) goto finish;
p->prog = glsym_glCreateProgram(); p->prog = glCreateProgram();
glsym_glProgramBinary(p->prog, formats[0], data, length); glsym_glProgramBinary(p->prog, formats[0], data, length);
glsym_glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex"); glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
glsym_glBindAttribLocation(p->prog, SHAD_COLOR, "color"); glBindAttribLocation(p->prog, SHAD_COLOR, "color");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord"); glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2"); glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3"); glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
glsym_glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm"); glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
glsym_glGetProgramiv(p->prog, GL_LINK_STATUS, &ok); glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok) if (!ok)
{ {
@ -958,7 +958,7 @@ finish:
if (data) free(data); if (data) free(data);
if ((!res) && (p->prog)) if ((!res) && (p->prog))
{ {
glsym_glDeleteProgram(p->prog); glDeleteProgram(p->prog);
p->prog = 0; p->prog = 0;
} }
return res; return res;
@ -975,7 +975,7 @@ _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p,
if (!glsym_glGetProgramBinary) return 0; if (!glsym_glGetProgramBinary) return 0;
glsym_glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length); glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (length <= 0) return 0; if (length <= 0) return 0;
@ -1008,21 +1008,21 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
{ {
GLint ok; GLint ok;
p->vert = glsym_glCreateShader(GL_VERTEX_SHADER); p->vert = glCreateShader(GL_VERTEX_SHADER);
p->frag = glsym_glCreateShader(GL_FRAGMENT_SHADER); p->frag = glCreateShader(GL_FRAGMENT_SHADER);
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
glsym_glShaderBinary(1, &(p->vert), 0, vert->bin, vert->bin_size); glShaderBinary(1, &(p->vert), 0, vert->bin, vert->bin_size);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size); glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#else #else
glsym_glShaderSource(p->vert, 1, glShaderSource(p->vert, 1,
(const char **)&(vert->src), NULL); (const char **)&(vert->src), NULL);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glCompileShader(p->vert); glCompileShader(p->vert);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
ok = 0; ok = 0;
glsym_glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok); glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok) 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); ERR("Abort compile of shader vert (%s): %s", name, vert->src);
return 0; return 0;
} }
glsym_glShaderSource(p->frag, 1, glShaderSource(p->frag, 1,
(const char **)&(frag->src), NULL); (const char **)&(frag->src), NULL);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glCompileShader(p->frag); glCompileShader(p->frag);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
ok = 0; ok = 0;
glsym_glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok); glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok) if (!ok)
{ {
@ -1045,35 +1045,35 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
return 0; return 0;
} }
#endif #endif
p->prog = glsym_glCreateProgram(); p->prog = glCreateProgram();
#if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX) #if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX)
#else #else
if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri)) if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri))
glsym_glProgramParameteri(p->prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, glsym_glProgramParameteri(p->prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT,
GL_TRUE); GL_TRUE);
#endif #endif
glsym_glAttachShader(p->prog, p->vert); glAttachShader(p->prog, p->vert);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glAttachShader(p->prog, p->frag); glAttachShader(p->prog, p->frag);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex"); glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindAttribLocation(p->prog, SHAD_COLOR, "color"); glBindAttribLocation(p->prog, SHAD_COLOR, "color");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord"); glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2"); glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3"); glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm"); glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glLinkProgram(p->prog); glLinkProgram(p->prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
ok = 0; ok = 0;
glsym_glGetProgramiv(p->prog, GL_LINK_STATUS, &ok); glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!ok) if (!ok)
{ {
@ -1249,14 +1249,14 @@ void
evas_gl_common_shader_program_init_done(void) evas_gl_common_shader_program_init_done(void)
{ {
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glsym_glReleaseShaderCompiler(); glReleaseShaderCompiler();
#endif #endif
} }
void void
evas_gl_common_shader_program_shutdown(Evas_GL_Program *p) evas_gl_common_shader_program_shutdown(Evas_GL_Program *p)
{ {
if (p->vert) glsym_glDeleteShader(p->vert); if (p->vert) glDeleteShader(p->vert);
if (p->frag) glsym_glDeleteShader(p->frag); if (p->frag) glDeleteShader(p->frag);
if (p->prog) glsym_glDeleteProgram(p->prog); if (p->prog) glDeleteProgram(p->prog);
} }

View File

@ -112,7 +112,7 @@ _tex_2d(int intfmt, int w, int h, int fmt, int type)
#ifdef GL_TEXTURE_INTERNAL_FORMAT #ifdef GL_TEXTURE_INTERNAL_FORMAT
int intfmtret = -1; int intfmtret = -1;
#endif #endif
glsym_glTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL); glTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_TEXTURE_INTERNAL_FORMAT #ifdef GL_TEXTURE_INTERNAL_FORMAT
// this is not in opengles!!! hrrrm // this is not in opengles!!! hrrrm
@ -129,7 +129,7 @@ _tex_2d(int intfmt, int w, int h, int fmt, int type)
static void static void
_tex_sub_2d(int x, int y, int w, int h, int fmt, int type, const void *pix) _tex_sub_2d(int x, int y, int w, int h, int fmt, int type, const void *pix)
{ {
glsym_glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
@ -168,20 +168,20 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum fo
_print_tex_count(); _print_tex_count();
glsym_glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, pt->texture); glBindTexture(GL_TEXTURE_2D, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt; return pt;
} }
@ -384,17 +384,17 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
_print_tex_count(); _print_tex_count();
glsym_glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, pt->texture); glBindTexture(GL_TEXTURE_2D, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
@ -407,7 +407,7 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt; return pt;
} }
@ -444,9 +444,9 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
_print_tex_count(); _print_tex_count();
glsym_glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(im->native.target, pt->texture); glBindTexture(im->native.target, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
@ -458,17 +458,17 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
} }
#endif #endif
glsym_glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(im->native.target, 0); glBindTexture(im->native.target, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(im->native.target, gc->pipe[0].shader.cur_tex); glBindTexture(im->native.target, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt; return pt;
} }
@ -524,17 +524,17 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
_print_tex_count(); _print_tex_count();
glsym_glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, pt->texture); glBindTexture(GL_TEXTURE_2D, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
egldisplay = pt->gc->egldisp; egldisplay = pt->gc->egldisp;
@ -544,45 +544,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: seems a bit slower than i'd like - maybe too many flushes?
// FIXME: YCbCr no support as yet // FIXME: YCbCr no support as yet
pt->dyn.img = glsym_eglCreateImage(egldisplay, pt->dyn.img = secsym_eglCreateImage(egldisplay,
EGL_NO_CONTEXT, EGL_NO_CONTEXT,
EGL_MAP_GL_TEXTURE_2D_SEC, EGL_MAP_GL_TEXTURE_2D_SEC,
0, attr); 0, attr);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (!pt->dyn.img) if (!pt->dyn.img)
{ {
glsym_glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDeleteTextures(1, &(pt->texture)); glDeleteTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
free(pt); free(pt);
return NULL; return NULL;
} }
if (glsym_eglGetImageAttribSEC(egldisplay, if (secsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img, pt->dyn.img,
EGL_MAP_GL_TEXTURE_WIDTH_SEC, EGL_MAP_GL_TEXTURE_WIDTH_SEC,
&(pt->dyn.w)) != EGL_TRUE) goto error; &(pt->dyn.w)) != EGL_TRUE) goto error;
if (glsym_eglGetImageAttribSEC(egldisplay, if (secsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img, pt->dyn.img,
EGL_MAP_GL_TEXTURE_HEIGHT_SEC, EGL_MAP_GL_TEXTURE_HEIGHT_SEC,
&(pt->dyn.h)) != EGL_TRUE) goto error; &(pt->dyn.h)) != EGL_TRUE) goto error;
if (glsym_eglGetImageAttribSEC(egldisplay, if (secsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img, pt->dyn.img,
EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC, EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC,
&(pt->dyn.stride)) != EGL_TRUE) goto error; &(pt->dyn.stride)) != EGL_TRUE) goto error;
if (glsym_eglGetImageAttribSEC(egldisplay, if (secsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img, pt->dyn.img,
EGL_MAP_GL_TEXTURE_FORMAT_SEC, EGL_MAP_GL_TEXTURE_FORMAT_SEC,
&(fmt)) != EGL_TRUE) goto error; &(fmt)) != EGL_TRUE) goto error;
if (glsym_eglGetImageAttribSEC(egldisplay, if (secsym_eglGetImageAttribSEC(egldisplay,
pt->dyn.img, pt->dyn.img,
EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC, EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC,
&(pixtype)) != EGL_TRUE) goto error; &(pixtype)) != EGL_TRUE) goto error;
if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) goto error; if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) goto error;
glsym_glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#else #else
gc = NULL; gc = NULL;
@ -596,12 +596,12 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
/* ERROR HANDLING */ /* ERROR HANDLING */
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
error: error:
glsym_eglDestroyImage(egldisplay, pt->dyn.img); secsym_eglDestroyImage(egldisplay, pt->dyn.img);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
pt->dyn.img = NULL; pt->dyn.img = NULL;
glsym_glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glDeleteTextures(1, &(pt->texture)); glDeleteTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
free(pt); free(pt);
return NULL; return NULL;
@ -650,8 +650,8 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
if (pt->dyn.img) if (pt->dyn.img)
{ {
if (pt->dyn.checked_out > 0) if (pt->dyn.checked_out > 0)
glsym_eglUnmapImageSEC(pt->gc->egldisp, pt->dyn.img); secsym_eglUnmapImageSEC(pt->gc->egldisp, pt->dyn.img);
glsym_eglDestroyImage(pt->gc->egldisp, pt->dyn.img); secsym_eglDestroyImage(pt->gc->egldisp, pt->dyn.img);
pt->dyn.img = NULL; pt->dyn.img = NULL;
pt->dyn.data = NULL; pt->dyn.data = NULL;
pt->dyn.w = 0; pt->dyn.w = 0;
@ -661,7 +661,7 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
} }
#endif #endif
glsym_glDeleteTextures(1, &(pt->texture)); glDeleteTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (pt->fb) if (pt->fb)
{ {
@ -853,13 +853,13 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
if (!im->image.data) return; if (!im->image.data) return;
fmt = tex->pt->format; fmt = tex->pt->format;
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH #ifdef GL_UNPACK_ROW_LENGTH
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#endif #endif
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h); // printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h);
@ -948,7 +948,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
#endif #endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -1032,19 +1032,19 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels,
unsigned int w, unsigned int h, int fh __UNUSED__) unsigned int w, unsigned int h, int fh __UNUSED__)
{ {
if (!tex->pt) return; if (!tex->pt) return;
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH #ifdef GL_UNPACK_ROW_LENGTH
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#endif #endif
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat, _tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat,
pixels); pixels);
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -1111,32 +1111,32 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
if (!tex->pt) return; if (!tex->pt) return;
// FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2
#ifdef GL_UNPACK_ROW_LENGTH #ifdef GL_UNPACK_ROW_LENGTH
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); _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]); _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat); _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]); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat); _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)]); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]);
#else #else
unsigned int y; unsigned int y;
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w) if ((rows[1] - rows[0]) == (int)w)
@ -1147,7 +1147,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]); _tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
} }
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat); _tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2)) if ((rows[h + 1] - rows[h]) == (int)(w / 2))
@ -1158,7 +1158,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]); _tex_sub_2d(0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]);
} }
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat); _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)) if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2))
@ -1171,7 +1171,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
#endif #endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -1318,9 +1318,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->pt = tex->double_buffer.pt[tex->double_buffer.source];
tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source]; tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source];
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w * 4) if ((rows[1] - rows[0]) == (int)w * 4)
@ -1331,7 +1331,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]); _tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
} }
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h, tex->ptuv->format, tex->ptuv->dataformat); _tex_2d(tex->ptuv->intformat, w / 2, h, tex->ptuv->format, tex->ptuv->dataformat);
#if 0 #if 0
@ -1350,7 +1350,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) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -1366,26 +1366,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 // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2
#ifdef GL_UNPACK_ROW_LENGTH #ifdef GL_UNPACK_ROW_LENGTH
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); _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]); _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat); _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]); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]);
#else #else
unsigned int y; unsigned int y;
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w) if ((rows[1] - rows[0]) == (int)w)
@ -1396,7 +1396,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]); _tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
} }
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat); _tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2)) if ((rows[h + 1] - rows[h]) == (int)(w / 2))
@ -1409,7 +1409,7 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
#endif #endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glsym_glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -1435,7 +1435,7 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi
char *texture_addr; char *texture_addr;
char *tmp; char *tmp;
texture_addr = glsym_eglMapImageSEC(tex->gc->egldisp, tex->pt->dyn.img); texture_addr = secsym_eglMapImageSEC(tex->gc->egldisp, tex->pt->dyn.img);
/* Iterate each Y macroblock like we do in evas_convert_yuv.c */ /* Iterate each Y macroblock like we do in evas_convert_yuv.c */
for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++) for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++)
@ -1490,9 +1490,9 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi
} }
} }
glsym_eglUnmapImageSEC(tex->gc->egldisp, tex->pt->dyn.img); secsym_eglUnmapImageSEC(tex->gc->egldisp, tex->pt->dyn.img);
texture_addr = glsym_eglMapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img); texture_addr = secsym_eglMapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img);
/* Iterate each UV macroblock like we do in evas_convert_yuv.c */ /* Iterate each UV macroblock like we do in evas_convert_yuv.c */
base_h = (mb_h >> 1) + (mb_h & 0x1); base_h = (mb_h >> 1) + (mb_h & 0x1);
@ -1557,15 +1557,15 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi
} }
} }
glsym_eglUnmapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img); secsym_eglUnmapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img);
return ; return ;
} }
#endif #endif
glsym_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// We are telling the driver to not swizzle back the buffer as we are going to replace all pixel // We are telling the driver to not swizzle back the buffer as we are going to replace all pixel
@ -1612,7 +1612,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); _tex_sub_2d(x, ry, 64, 32, tex->pt->format, tex->pt->dataformat, rows[mb_y] + rmb_x);
} }
glsym_glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w, h, tex->ptuv->format, tex->ptuv->dataformat); _tex_2d(tex->ptuv->intformat, w, h, tex->ptuv->format, tex->ptuv->dataformat);

File diff suppressed because it is too large Load Diff

View File

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

View File

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