diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h b/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h index 04007f7c09..a131cce370 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h @@ -6,7 +6,6 @@ #include "config.h" #include -#include #include #include #include @@ -134,9 +133,9 @@ struct _Evas_GL_Program_Source struct _Evas_GL_Shared { Eina_List *images; - + int images_size; - + struct { GLint max_texture_units; GLint max_texture_size; @@ -151,31 +150,31 @@ struct _Evas_GL_Shared // tuning params - per gpu/cpu combo? #define MAX_CUTOUT 512 #define DEF_CUTOUT 512 - -// FIXME bug with pipes > 1 right now, should default to 32 + +// FIXME bug with pipes > 1 right now, should default to 32 #define MAX_PIPES 128 #define DEF_PIPES 32 #define DEF_PIPES_SGX_540 32 #define DEF_PIPES_TEGRA_2 1 - + #define MIN_ATLAS_ALLOC 16 #define MAX_ATLAS_ALLOC 1024 #define DEF_ATLAS_ALLOC 1024 - + #define MIN_ATLAS_ALLOC_ALPHA 16 #define MAX_ATLAS_ALLOC_ALPHA 4096 #define DEF_ATLAS_ALLOC_ALPHA 4096 - + #define MAX_ATLAS_W 512 #define DEF_ATLAS_W 512 - + #define MAX_ATLAS_H 512 #define DEF_ATLAS_H 512 - + #define MIN_ATLAS_SLOT 16 #define MAX_ATLAS_SLOT 512 #define DEF_ATLAS_SLOT 16 - + struct { struct { int max; @@ -192,19 +191,19 @@ struct _Evas_GL_Shared } atlas; } tune; } info; - + struct { Eina_List *whole; Eina_List *atlas[33][3]; } tex; - + Eina_Hash *native_pm_hash; Eina_Hash *native_tex_hash; - + struct { Evas_GL_Program rect; Evas_GL_Program font; - + Evas_GL_Program img, img_nomul; Evas_GL_Program img_bgra, img_bgra_nomul; Evas_GL_Program img_mask; @@ -236,7 +235,7 @@ struct _Evas_GL_Shared #define RTYPE_IMAGE 2 #define RTYPE_FONT 3 #define RTYPE_YUV 4 -#define RTYPE_MAP 5 /* need to merge with image */ +#define RTYPE_MAP 5 /* need to merge with image */ #define RTYPE_IMASK 6 @@ -248,7 +247,7 @@ struct _Evas_Engine_GL_Context int rot; int foc, z0, px, py; RGBA_Draw_Context *dc; - + Evas_GL_Shared *shared; int flushnum; @@ -265,7 +264,7 @@ struct _Evas_Engine_GL_Context int clip; } current; } state; - + struct { struct { int x, y, w, h; @@ -303,22 +302,22 @@ struct _Evas_Engine_GL_Context Evas_GL_Image *im; } array; } pipe[MAX_PIPES]; - + struct { Eina_Bool size : 1; } change; - + Eina_Bool havestuff : 1; - + Evas_GL_Image *def_surface; /* If this is set: Force drawing with a particular filter */ GLuint filter_prog; - + #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -// FIXME: hack. expose egl display to gl core for egl image sec extn. +// FIXME: hack. expose egl display to gl core for egl image sec extn. void *egldisp; -#endif +#endif }; struct _Evas_GL_Texture_Pool @@ -350,7 +349,7 @@ struct _Evas_GL_Texture int x, y, w, h; double sx1, sy1, sx2, sy2; int references; - + Eina_Bool alpha : 1; }; @@ -368,7 +367,7 @@ struct _Evas_GL_Image void *data; unsigned char no_free : 1; } cs; - + struct { void *data; struct { @@ -385,7 +384,7 @@ struct _Evas_GL_Image int scale_hint, content_hint; int csize; - + Eina_List *filtered; unsigned char dirty : 1; @@ -458,7 +457,7 @@ extern Evas_GL_Program_Source shader_filter_blur_bgra_nomul_frag_src; #endif void glerr(int err, const char *file, const char *func, int line, const char *op); - + Evas_Engine_GL_Context *evas_gl_common_context_new(void); void evas_gl_common_context_free(Evas_Engine_GL_Context *gc); void evas_gl_common_context_use(Evas_Engine_GL_Context *gc); @@ -506,7 +505,7 @@ void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *g RGBA_Map_Point *p, int clip, int cx, int cy, int cw, int ch, int r, int g, int b, int a, - Eina_Bool smooth, + Eina_Bool smooth, Eina_Bool tex_only, Eina_Bool yuv); void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc); @@ -514,7 +513,7 @@ void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc); int evas_gl_common_shader_program_init(Evas_GL_Shared *shared); void evas_gl_common_shader_program_init_done(void); void evas_gl_common_shader_program_shutdown(Evas_GL_Program *p); - + void evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h); void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt); diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c index c17d55584b..221d7f2937 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c @@ -53,17 +53,17 @@ gl_symbols(void) # define FINDSYM(dst, sym, typ) if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym) #endif #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); @@ -82,11 +82,11 @@ gl_symbols(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) \ @@ -102,17 +102,17 @@ gl_symbols(void) 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); @@ -124,21 +124,21 @@ gl_symbols(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 +#endif } static void shader_array_flush(Evas_Engine_GL_Context *gc); @@ -186,12 +186,12 @@ matrix_ortho(GLfloat *m, GLfloat rotf; GLfloat cosv, sinv; GLfloat tx, ty; - + rotf = (((rot / 90) & 0x3) * M_PI) / 2.0; - + tx = -0.5 * (1.0 - orth); ty = -0.5 * (1.0 - orth); - + if (rot == 90) { tx += -(vw * 1.0); @@ -207,25 +207,25 @@ matrix_ortho(GLfloat *m, tx += -(vw * 0.0); ty += -(vh * 1.0); } - + cosv = cos(rotf); sinv = sin(rotf); - + m[0] = (2.0 / (r - l)) * ( cosv); m[1] = (2.0 / (r - l)) * ( sinv); m[2] = 0.0; m[3] = 0.0; - + m[4] = (2.0 / (t - b)) * (-sinv); m[5] = (2.0 / (t - b)) * ( cosv); m[6] = 0.0; m[7] = 0.0; - + m[8] = 0.0; m[9] = 0.0; m[10] = -(2.0 / (far - near)); m[11] = 1.0 / (GLfloat)foc; - + m[12] = (m[0] * tx) + (m[4] * ty) - ((r + l) / (r - l)); m[13] = (m[1] * tx) + (m[5] * ty) - ((t + b) / (t - b)); m[14] = (m[2] * tx) + (m[6] * ty) - ((near + far) / (far - near)); @@ -343,13 +343,13 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) rot = 0; m = -1; } - - if ((!gc->change.size) || + + if ((!gc->change.size) || ((gc->shared->w == w) && (gc->shared->h == h) && (gc->shared->rot == rot) && (gc->shared->foc == gc->foc) && (gc->shared->mflip == m))) return; - + gc->shared->w = w; gc->shared->h = h; gc->shared->rot = rot; @@ -369,15 +369,15 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // std matrix if (m == 1) - matrix_ortho(proj, - 0, w, 0, h, + matrix_ortho(proj, + 0, w, 0, h, -1000000.0, 1000000.0, rot, w, h, 1, 1.0); // v flipped matrix for render-to-texture else - matrix_ortho(proj, - 0, w, h, 0, + matrix_ortho(proj, + 0, w, h, 0, -1000000.0, 1000000.0, rot, w, h, 1, 1.0); @@ -385,15 +385,15 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) else { int px, py, vx, vy, vw = 0, vh = 0, ax = 0, ay = 0, ppx = 0, ppy = 0; - + px = gc->shared->px; py = gc->shared->py; - + if ((rot == 0 ) || (rot == 90 )) ppx = px; else if ((rot == 180) || (rot == 270)) ppx = w - px; if ((rot == 0 ) || (rot == 270)) ppy = py; else if ((rot == 90 ) || (rot == 180)) ppy = h - py; - + vx = ((w / 2) - ppx); if (vx >= 0) { @@ -408,7 +408,7 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) else if ((rot == 180) || (rot == 270)) ax = ppx - px; vx = 0; } - + vy = ((h / 2) - ppy); if (vy < 0) { @@ -424,9 +424,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) else if ((rot == 90 ) || (rot == 180)) ay = 0; vy = 0; } - + if (m == -1) ay = vy * 2; - + if ((rot == 0) || (rot == 180)) glViewport(-2 * vx, -2 * vy, vw, vh); else @@ -444,7 +444,7 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) gc->shared->ax = ax; gc->shared->ay = ay; } - + glUseProgram(gc->shared->shader.rect.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.rect.prog, "mvp"), 1, @@ -455,7 +455,7 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.font.prog, "mvp"), 1, GL_FALSE, proj); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glUseProgram(gc->shared->shader.yuv.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.yuv.prog, "mvp"), 1, @@ -466,7 +466,7 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.yuv_nomul.prog, "mvp"), 1, GL_FALSE, proj); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glUseProgram(gc->shared->shader.tex.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.tex.prog, "mvp"), 1, @@ -477,7 +477,7 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.tex_nomul.prog, "mvp"), 1, GL_FALSE, proj); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glUseProgram(gc->shared->shader.img.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img.prog, "mvp"), 1, @@ -615,14 +615,14 @@ evas_gl_common_context_new(void) if (!gc) return NULL; gl_symbols(); - + gc->references = 1; - + _evas_gl_common_context = gc; - + for (i = 0; i < MAX_PIPES; i++) gc->pipe[i].shader.render_op = EVAS_RENDER_BLEND; - + if (!shared) { const GLubyte *ext; @@ -646,7 +646,7 @@ evas_gl_common_context_new(void) shared->info.bin_program = 1; #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic"))) - glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &(shared->info.anisotropic)); #endif #ifdef GL_BGRA @@ -672,7 +672,7 @@ evas_gl_common_context_new(void) (secsym_eglGetImageAttribSEC)) shared->info.sec_image_map = 1; } -#endif +#endif } glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &(shared->info.max_texture_units)); @@ -689,7 +689,7 @@ evas_gl_common_context_new(void) if (s) shared->info.max_vertex_elements = atoi(s); if (shared->info.max_vertex_elements < 6) shared->info.max_vertex_elements = 6; - + // magic numbers that are a result of imperical testing and getting // "best case" performance across a range of systems shared->info.tune.cutout.max = DEF_CUTOUT; @@ -699,7 +699,7 @@ evas_gl_common_context_new(void) shared->info.tune.atlas.max_w = DEF_ATLAS_W; shared->info.tune.atlas.max_h = DEF_ATLAS_H; shared->info.tune.atlas.slot_size = DEF_ATLAS_SLOT; - + // per gpu hacks. based on impirical measurement of some known gpu's s = (const char *)glGetString(GL_RENDERER); if (s) @@ -709,7 +709,7 @@ evas_gl_common_context_new(void) else if (strstr(s, "NVIDIA Tegra")) shared->info.tune.pipes.max = DEF_PIPES_TEGRA_2; } - + #define GETENVOPT(name, tune_param, min, max) \ do { \ const char *__v = getenv(name); \ @@ -755,7 +755,7 @@ evas_gl_common_context_new(void) "EVAS_GL_ATLAS_ALLOC_ALPHA_SIZE: %i\n" "EVAS_GL_ATLAS_MAX_W x EVAS_GL_ATLAS_MAX_H: %i x %i\n" "EVAS_GL_ATLAS_SLOT_SIZE: %i\n" - , + , (int)shared->info.max_texture_size, (int)shared->info.max_texture_size, (int)shared->info.max_texture_units, (int)shared->info.tex_npo2, @@ -764,7 +764,7 @@ evas_gl_common_context_new(void) (double)shared->info.anisotropic, (int)shared->info.sec_image_map, (int)shared->info.max_vertex_elements, - + (int)shared->info.bin_program, (int)shared->info.tune.cutout.max, (int)shared->info.tune.pipes.max, @@ -773,7 +773,7 @@ evas_gl_common_context_new(void) (int)shared->info.tune.atlas.max_w, (int)shared->info.tune.atlas.max_h, (int)shared->info.tune.atlas.slot_size ); - + glDisable(GL_DEPTH_TEST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnable(GL_DITHER); @@ -787,7 +787,7 @@ evas_gl_common_context_new(void) // glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? glDepthMask(GL_FALSE); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -803,14 +803,14 @@ evas_gl_common_context_new(void) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } #endif - + glEnableVertexAttribArray(SHAD_VERTEX); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_COLOR); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!evas_gl_common_shader_program_init(shared)) goto error; - + glUseProgram(shared->shader.yuv.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "tex"), 0); @@ -819,7 +819,7 @@ evas_gl_common_context_new(void) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texv"), 2); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glUseProgram(shared->shader.yuv_nomul.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv_nomul.prog, "tex"), 0); @@ -840,11 +840,11 @@ evas_gl_common_context_new(void) glUseProgram(gc->pipe[0].shader.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + evas_gl_common_shader_program_init_done(); // in shader: // uniform sampler2D tex[8]; - // + // // in code: // GLuint texes[8]; // GLint loc = glGetUniformLocation(prog, "tex"); @@ -856,9 +856,9 @@ evas_gl_common_context_new(void) gc->shared = shared; gc->shared->references++; _evas_gl_common_viewport_set(gc); - + gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1); - + return gc; error: evas_gl_common_context_free(gc); @@ -870,11 +870,11 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc) { int i, j; Eina_List *l; - + gc->references--; if (gc->references > 0) return; if (gc->shared) gc->shared->references--; - + if (gc->def_surface) evas_gl_common_image_free(gc->def_surface); if (gc->shared) @@ -889,11 +889,11 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc) if (gc->pipe[i].array.texuv3) free(gc->pipe[i].array.texuv3); } } - + if ((gc->shared) && (gc->shared->references == 0)) { Evas_GL_Texture_Pool *pt; - + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.rect)); evas_gl_common_shader_program_shutdown(&(gc->shared->shader.font)); evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img)); @@ -912,7 +912,7 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc) { evas_gl_common_image_free(gc->shared->images->data); } - + EINA_LIST_FOREACH(gc->shared->tex.whole, l, pt) evas_gl_texture_pool_empty(pt); for (i = 0; i < 33; i++) @@ -951,7 +951,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc) if (getenv("EVAS_GL_DBG")) dbgflushnum = 1; } if (dbgflushnum) printf("----prev-flushnum: %i -----------------------------------\n", gc->flushnum); - + gc->flushnum = 0; gc->state.current.cur_prog = 0; gc->state.current.cur_tex = 0; @@ -968,7 +968,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc) gc->state.current.cy = 0; gc->state.current.cw = 0; gc->state.current.ch = 0; - + for (i = 0; i < gc->shared->info.tune.pipes.max; i++) { gc->pipe[i].region.x = 0; @@ -997,12 +997,12 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc) gc->pipe[i].shader.ch = 0; } gc->change.size = 1; - + glDisable(GL_SCISSOR_TEST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glScissor(0, 0, 0, 0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glDisable(GL_DEPTH_TEST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnable(GL_DITHER); @@ -1016,7 +1016,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc) // glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? glDepthMask(GL_FALSE); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -1032,14 +1032,14 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } #endif - + glEnableVertexAttribArray(SHAD_VERTEX); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_COLOR); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->pipe[0].shader.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glActiveTexture(GL_TEXTURE0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); @@ -1065,9 +1065,9 @@ evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc, Evas_GL_Image *surface) { if (surface == gc->pipe[0].shader.surface) return; - + evas_gl_common_context_flush(gc); - + gc->state.current.cur_prog = -1; gc->state.current.cur_tex = -1; gc->state.current.cur_texu = -1; @@ -1086,12 +1086,12 @@ evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc, #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) # ifndef GL_FRAMEBUFFER # define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES -# endif +# endif #else # ifndef GL_FRAMEBUFFER # define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT -# endif -#endif +# endif +#endif if (gc->pipe[0].shader.surface == gc->def_surface) { glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -1159,25 +1159,25 @@ pipe_region_intersects(Evas_Engine_GL_Context *gc, int n, int x, int y, int w, int h) { int i, rx, ry, rw, rh, ii; - + rx = gc->pipe[n].region.x; ry = gc->pipe[n].region.y; rw = gc->pipe[n].region.w; rh = gc->pipe[n].region.h; if (!RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0; - + // a hack for now. map pipes use their whole bounding box for intersects // which at worst case reduces to old pipeline flushes, but cheaper than // full quad region or triangle intersects right now if (gc->pipe[n].region.type == RTYPE_MAP) return 1; - - for (i = 0, - ii = 0; - - i < gc->pipe[n].array.num; - - i += (3 * 2), + + for (i = 0, + ii = 0; + + i < gc->pipe[n].array.num; + + i += (3 * 2), ii += (3 * 3 * 2)) { // tri 1... // 0, 1, 2 < top left @@ -1198,7 +1198,7 @@ pipe_region_expand(Evas_Engine_GL_Context *gc, int n, int x, int y, int w, int h) { int x1, y1, x2, y2; - + if (gc->pipe[n].region.w <= 0) { gc->pipe[n].region.x = x; @@ -1235,7 +1235,7 @@ vertex_array_size_check(Evas_Engine_GL_Context *gc, int pn, int n) } void -evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, +evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int y2, int clip, int cx, int cy, int cw, int ch, int r, int g, int b, int a) @@ -1244,10 +1244,10 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, Eina_Bool blend = 0; GLuint prog = gc->shared->shader.rect.prog; int pn = 0; - + if (a < 255) blend = 1; if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0; - + shader_array_flush(gc); vertex_array_size_check(gc, gc->state.top_pipe, 2); pn = gc->state.top_pipe; @@ -1260,27 +1260,27 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, gc->pipe[pn].shader.cy = cy; gc->pipe[pn].shader.cw = cw; gc->pipe[pn].shader.ch = ch; - + gc->pipe[pn].array.line = 1; gc->pipe[pn].array.use_vertex = 1; gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 0; gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; - + pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4; gc->pipe[pn].array.num += 2; array_alloc(gc, pn); - + PUSH_VERTEX(pn, x1, y1, 0); PUSH_VERTEX(pn, x2, y2, 0); - + for (i = 0; i < 2; i++) { PUSH_COLOR(pn, r, g, b, a); } - + shader_array_flush(gc); gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 0; @@ -1291,7 +1291,7 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, } void -evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc, +evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc, int x, int y, int w, int h, int r, int g, int b, int a) { @@ -1315,7 +1315,7 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc, if (a < 255) blend = 1; if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0; - + again: vertex_array_size_check(gc, gc->state.top_pipe, 6); pn = gc->state.top_pipe; @@ -1342,7 +1342,7 @@ again: else { int found = 0; - + for (i = pn; i >= 0; i--) { if ((gc->pipe[i].region.type == RTYPE_RECT) @@ -1386,7 +1386,7 @@ again: gc->pipe[pn].array.use_texuv3 = 0; } } -#else +#else if ((gc->pipe[pn].shader.cur_tex != 0) || (gc->pipe[pn].shader.cur_prog != prog) || (gc->pipe[pn].shader.blend != blend) @@ -1406,7 +1406,7 @@ again: gc->pipe[pn].shader.cw = 0; gc->pipe[pn].shader.ch = 0; } - + gc->pipe[pn].region.type = RTYPE_RECT; gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 1; @@ -1415,22 +1415,22 @@ again: gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; #endif - + pipe_region_expand(gc, pn, x, y, w, h); - + pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4; gc->pipe[pn].array.num += 6; array_alloc(gc, pn); - + PUSH_VERTEX(pn, x , y , 0); PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x + w, y + h, 0); PUSH_VERTEX(pn, x , y + h, 0); - + for (i = 0; i < 6; i++) { PUSH_COLOR(pn, r, g, b, a); @@ -1521,7 +1521,7 @@ again: else { int found = 0; - + for (i = pn; i >= 0; i--) { if ((gc->pipe[i].region.type == RTYPE_IMAGE) @@ -1566,7 +1566,7 @@ again: gc->pipe[pn].array.use_texuv = 1; gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; - + } } if ((tex->im) && (tex->im->native.data)) @@ -1589,7 +1589,7 @@ again: goto again; } } -#else +#else if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) || (gc->pipe[pn].shader.cur_prog != prog) || (gc->pipe[pn].shader.smooth != smooth) @@ -1609,7 +1609,7 @@ again: gc->pipe[pn].shader.cy = 0; gc->pipe[pn].shader.cw = 0; gc->pipe[pn].shader.ch = 0; - } + } if ((tex->im) && (tex->im->native.data)) { if (gc->pipe[pn].array.im != tex->im) @@ -1638,7 +1638,7 @@ again: #endif pipe_region_expand(gc, pn, x, y, w, h); - + pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; nt = pnum * 4; @@ -1663,15 +1663,15 @@ again: PUSH_VERTEX(pn, x , y , 0); PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx1, ty1); PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx1, ty2); - + PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x + w, y + h, 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx2, ty2); PUSH_TEXUV(pn, tx1, ty2); @@ -1743,7 +1743,7 @@ again: else { int found = 0; - + for (i = pn; i >= 0; i--) { if ((gc->pipe[i].region.type == RTYPE_IMASK) @@ -1790,7 +1790,7 @@ again: gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; gc->pipe[pn].array.use_texm = 1; - + } } if ((tex->im) && (tex->im->native.data)) @@ -1813,7 +1813,7 @@ again: goto again; } } -#else +#else if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) || (gc->pipe[pn].shader.cur_prog != prog) || (gc->pipe[pn].shader.smooth != smooth) @@ -1834,7 +1834,7 @@ again: gc->pipe[pn].shader.cy = 0; gc->pipe[pn].shader.cw = 0; gc->pipe[pn].shader.ch = 0; - } + } if ((tex->im) && (tex->im->native.data)) { if (gc->pipe[pn].array.im != tex->im) @@ -1862,7 +1862,7 @@ again: #endif pipe_region_expand(gc, pn, x, y, w, h); - + pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nm = pnum * 2; nu = pnum * 2; nt = pnum * 4; @@ -1901,7 +1901,7 @@ again: PUSH_VERTEX(pn, x , y , 0); PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx1, ty1); PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx1, ty2); @@ -1913,7 +1913,7 @@ again: PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x + w, y + h, 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx2, ty2); PUSH_TEXUV(pn, tx1, ty2); @@ -1968,7 +1968,7 @@ again: else { int found = 0; - + for (i = pn; i >= 0; i--) { if ((gc->pipe[i].region.type == RTYPE_FONT) @@ -2014,7 +2014,7 @@ again: gc->pipe[pn].array.use_texuv3 = 0; } } -#else +#else if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) || (gc->pipe[pn].shader.cur_prog != gc->shared->shader.font.prog) || (gc->pipe[pn].shader.smooth != 0) @@ -2044,9 +2044,9 @@ again: gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; #endif - + pipe_region_expand(gc, pn, x, y, w, h); - + pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4; gc->pipe[pn].array.num += 6; @@ -2066,19 +2066,19 @@ again: tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; } - + PUSH_VERTEX(pn, x , y , 0); PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx1, ty1); PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx1, ty2); - + PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x + w, y + h, 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx2, ty2); PUSH_TEXUV(pn, tx1, ty2); @@ -2091,7 +2091,7 @@ again: void evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc, - Evas_GL_Texture *tex, + Evas_GL_Texture *tex, double sx, double sy, double sw, double sh, int x, int y, int w, int h, int r, int g, int b, int a, @@ -2104,12 +2104,12 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc, int pn = 0; if (a < 255) blend = 1; - + if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) prog = gc->shared->shader.yuv_nomul.prog; else prog = gc->shared->shader.yuv.prog; - + again: vertex_array_size_check(gc, gc->state.top_pipe, 6); pn = gc->state.top_pipe; @@ -2139,7 +2139,7 @@ again: else { int found = 0; - + for (i = pn; i >= 0; i--) { if ((gc->pipe[i].region.type == RTYPE_YUV) @@ -2187,7 +2187,7 @@ again: gc->pipe[pn].array.use_texuv3 = 1; } } -#else +#else if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) || (gc->pipe[pn].shader.cur_prog != prog) || (gc->pipe[pn].shader.smooth != smooth) @@ -2210,7 +2210,7 @@ again: gc->pipe[pn].shader.cw = 0; gc->pipe[pn].shader.ch = 0; } - + gc->pipe[pn].region.type = RTYPE_YUV; gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 1; @@ -2219,11 +2219,11 @@ again: gc->pipe[pn].array.use_texuv2 = 1; gc->pipe[pn].array.use_texuv3 = 1; #endif - + pipe_region_expand(gc, pn, x, y, w, h); - + pnum = gc->pipe[pn].array.num; - nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; + nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4; gc->pipe[pn].array.num += 6; array_alloc(gc, pn); @@ -2232,32 +2232,32 @@ again: ty1 = (sy) / (double)tex->pt->h; tx2 = (sx + sw) / (double)tex->pt->w; ty2 = (sy + sh) / (double)tex->pt->h; - + t2x1 = ((sx) / 2) / (double)tex->ptu->w; t2y1 = ((sy) / 2) / (double)tex->ptu->h; t2x2 = ((sx + sw) / 2) / (double)tex->ptu->w; t2y2 = ((sy + sh) / 2) / (double)tex->ptu->h; - + PUSH_VERTEX(pn, x , y , 0); PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx1, ty1); PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx1, ty2); - + PUSH_TEXUV2(pn, t2x1, t2y1); PUSH_TEXUV2(pn, t2x2, t2y1); PUSH_TEXUV2(pn, t2x1, t2y2); - + PUSH_TEXUV3(pn, t2x1, t2y1); PUSH_TEXUV3(pn, t2x2, t2y1); PUSH_TEXUV3(pn, t2x1, t2y2); - + PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x + w, y + h, 0); PUSH_VERTEX(pn, x , y + h, 0); - + PUSH_TEXUV(pn, tx2, ty1); PUSH_TEXUV(pn, tx2, ty2); PUSH_TEXUV(pn, tx1, ty2); @@ -2307,12 +2307,12 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, if ((A_VAL(&(p[0].col)) < 0xff) || (A_VAL(&(p[1].col)) < 0xff) || (A_VAL(&(p[2].col)) < 0xff) || (A_VAL(&(p[3].col)) < 0xff)) blend = 1; - + if ((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z)) flat = 1; if (!clip) cx = cy = cw = ch = 0; - + if (!flat) { if (p[0].foc <= 0) flat = 1; @@ -2392,14 +2392,14 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, } } } - + x = w = (p[points[0]].x >> FP); y = h = (p[points[0]].y >> FP); for (i = 0; i < 4; i++) { tx[i] = ((double)(tex->x) + (((double)p[i].u) / FP1)) / (double)tex->pt->w; - ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) / + ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) / (double)tex->pt->h; px = (p[points[i]].x >> FP); if (px < x) x = px; @@ -2415,11 +2415,11 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, } w = w - x; h = h - y; - + if (clip) { int nx = x, ny = y, nw = w, nh = h; - + RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch); if ((nx == x) && (ny == y) && (nw == w) && (nh == h)) { @@ -2427,7 +2427,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, } x = nx; y = nw; w = nw; h = nh; } - + if (!flat) { shader_array_flush(gc); @@ -2478,7 +2478,7 @@ again: else { int found = 0; - + for (i = pn; i >= 0; i--) { if ((gc->pipe[i].region.type == RTYPE_MAP) @@ -2561,7 +2561,7 @@ again: goto again; } } -#else +#else if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) || (gc->pipe[pn].shader.cur_prog != prog) || (gc->pipe[pn].shader.smooth != smooth) @@ -2618,10 +2618,10 @@ again: gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; } -#endif - +#endif + pipe_region_expand(gc, pn, x, y, w, h); - + pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4; @@ -2637,7 +2637,7 @@ again: t2y[i] = 1.0 - t2y[i]; } } - + cmul = ARGB_JOIN(a, r, g, b); for (i = 0; i < 6; i++) { @@ -2645,16 +2645,16 @@ again: if (flat) { PUSH_VERTEX(pn, - (p[points[i]].x >> FP), + (p[points[i]].x >> FP), (p[points[i]].y >> FP), 0); } else { PUSH_VERTEX(pn, - (p[points[i]].fx) + gc->shared->ax, + (p[points[i]].fx) + gc->shared->ax, (p[points[i]].fy) + gc->shared->ay, - (p[points[i]].fz) + (p[points[i]].fz) + (gc->shared->foc - gc->shared->z0)); } PUSH_TEXUV(pn, @@ -2669,7 +2669,7 @@ again: t2x[points[i]], t2y[points[i]]); } - + PUSH_COLOR(pn, R_VAL(&cl), G_VAL(&cl), @@ -2745,7 +2745,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc) glUseProgram(gc->pipe[i].shader.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } - + if (gc->pipe[i].shader.cur_tex != gc->state.current.cur_tex) { #if 0 @@ -2774,12 +2774,12 @@ shader_array_flush(Evas_Engine_GL_Context *gc) (GL_TEXTURE_2D, gc->pipe[i].array.im->tex->pt->dyn.img); } else -#endif +#endif { if (!gc->pipe[i].array.im->native.loose) { if (gc->pipe[i].array.im->native.func.bind) - gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im->native.func.data, + gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im->native.func.data, gc->pipe[i].array.im); } } @@ -2869,14 +2869,14 @@ shader_array_flush(Evas_Engine_GL_Context *gc) } if (gc->pipe[i].shader.clip != gc->state.current.clip) { - + if (gc->pipe[i].shader.clip) { cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch; if (fbo) cy = gc->pipe[i].shader.cy; glEnable(GL_SCISSOR_TEST); if (!fbo) - scissor_rot(gc, gc->rot, gw, gh, + scissor_rot(gc, gc->rot, gw, gh, gc->pipe[i].shader.cx, cy, gc->pipe[i].shader.cw, @@ -2902,7 +2902,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc) cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch; if (fbo) cy = gc->pipe[i].shader.cy; if (!fbo) - scissor_rot(gc, gc->rot, gw, gh, + scissor_rot(gc, gc->rot, gw, gh, gc->pipe[i].shader.cx, cy, gc->pipe[i].shader.cw, @@ -2929,7 +2929,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc) glDisableVertexAttribArray(SHAD_TEXUV); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } - + if (gc->pipe[i].array.line) { glDisableVertexAttribArray(SHAD_TEXUV); @@ -3002,11 +3002,11 @@ shader_array_flush(Evas_Engine_GL_Context *gc) } if (dbgflushnum) { - const char *types[6] = + const char *types[6] = {"----", "RECT", "IMAG", "FONT", "YUV-", "MAP"}; printf(" DRAW#%3i %4i -> %p[%4ix%4i] @ %4ix%4i -{ tex %4i type %s }-\n", i, - gc->pipe[i].array.num / 6, + gc->pipe[i].array.num / 6, gc->pipe[0].shader.surface, gc->pipe[0].shader.surface->w, gc->pipe[0].shader.surface->h, @@ -3023,12 +3023,12 @@ shader_array_flush(Evas_Engine_GL_Context *gc) if (!gc->pipe[i].array.im->native.loose) { if (gc->pipe[i].array.im->native.func.unbind) - gc->pipe[i].array.im->native.func.unbind(gc->pipe[i].array.im->native.func.data, + gc->pipe[i].array.im->native.func.unbind(gc->pipe[i].array.im->native.func.data, gc->pipe[i].array.im); } gc->pipe[i].array.im = NULL; } - + gc->state.current.cur_prog = gc->pipe[i].shader.cur_prog; gc->state.current.cur_tex = gc->pipe[i].shader.cur_tex; gc->state.current.blend = gc->pipe[i].shader.blend; @@ -3039,14 +3039,14 @@ shader_array_flush(Evas_Engine_GL_Context *gc) gc->state.current.cy = gc->pipe[i].shader.cy; gc->state.current.cw = gc->pipe[i].shader.cw; gc->state.current.ch = gc->pipe[i].shader.ch; - + if (gc->pipe[i].array.vertex) free(gc->pipe[i].array.vertex); if (gc->pipe[i].array.color) free(gc->pipe[i].array.color); if (gc->pipe[i].array.texuv) free(gc->pipe[i].array.texuv); if (gc->pipe[i].array.texm) free(gc->pipe[i].array.texm); if (gc->pipe[i].array.texuv2) free(gc->pipe[i].array.texuv2); if (gc->pipe[i].array.texuv3) free(gc->pipe[i].array.texuv3); - + gc->pipe[i].array.vertex = NULL; gc->pipe[i].array.color = NULL; gc->pipe[i].array.texuv = NULL; @@ -3056,7 +3056,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc) gc->pipe[i].array.num = 0; gc->pipe[i].array.alloc = 0; - + gc->pipe[i].region.x = 0; gc->pipe[i].region.y = 0; gc->pipe[i].region.w = 0; diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_font.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_font.c index d867a09479..7c3dd6c4cf 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_font.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_font.c @@ -11,7 +11,7 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg) int fh; if (fg->ext_dat) return fg->ext_dat; // FIXME: one engine at a time can do this :( - + w = fg->glyph_out->bitmap.width; h = fg->glyph_out->bitmap.rows; if ((w == 0) || (h == 0)) return NULL; @@ -45,13 +45,13 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg) DATA8 *tmpbuf = NULL, *dp, *tp, bits; int bi, bj, end; const DATA8 bitrepl[2] = {0x0, 0xff}; - + tmpbuf = alloca(w); if (tmpbuf) { int x, y; DATA8 *p1, *p2; - + for (y = 0; y < h; y++) { p1 = tmpbuf; @@ -109,7 +109,7 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co int c, cx, cy, cw, ch; int i; int sx, sy, sw, sh; - + if (dc != gc->dc) return; tex = fg->ext_dat; if (!tex) return; @@ -119,14 +119,14 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co g = (dc->col.col >> 8 ) & 0xff; b = (dc->col.col ) & 0xff; sx = 0; sy = 0; sw = tex->w, sh = tex->h; - if ((!gc->dc->cutout.rects) + if ((!gc->dc->cutout.rects) // || (gc->dc->cutout.active > 32) ) { if (gc->dc->clip.use) { int nx, ny, nw, nh; - + nx = x; ny = y; nw = tex->w; nh = tex->h; RECTS_CLIP_TO_RECT(nx, ny, nw, nh, gc->dc->clip.x, gc->dc->clip.y, @@ -145,14 +145,14 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h)); ssw = ((double)sw * (double)(nw)) / (double)(tex->w); ssh = ((double)sh * (double)(nh)) / (double)(tex->h); - evas_gl_common_context_font_push(gc, tex, + evas_gl_common_context_font_push(gc, tex, ssx, ssy, ssw, ssh, nx, ny, nw, nh, r, g, b, a); } else { - evas_gl_common_context_font_push(gc, tex, + evas_gl_common_context_font_push(gc, tex, 0.0, 0.0, 0.0, 0.0, // sx, sy, sw, sh, x, y, tex->w, tex->h, @@ -174,7 +174,7 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co for (i = 0; i < rects->active; ++i) { int nx, ny, nw, nh; - + rct = rects->rects + i; nx = x; ny = y; nw = tex->w; nh = tex->h; RECTS_CLIP_TO_RECT(nx, ny, nw, nh, rct->x, rct->y, rct->w, rct->h); @@ -192,7 +192,7 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h)); ssw = ((double)sw * (double)(nw)) / (double)(tex->w); ssh = ((double)sh * (double)(nh)) / (double)(tex->h); - evas_gl_common_context_font_push(gc, tex, + evas_gl_common_context_font_push(gc, tex, ssx, ssy, ssw, ssh, nx, ny, nw, nh, r, g, b, a); diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c index 237d8f125d..726ba0f454 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c @@ -5,7 +5,7 @@ evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc) { Eina_List *l; Evas_GL_Image *im; - + EINA_LIST_FOREACH(gc->shared->images, l, im) { if (im->im) evas_cache_image_unload_data(&im->im->cache_entry); @@ -35,7 +35,7 @@ _evas_gl_image_cache_trim(Evas_Engine_GL_Context *gc) if (im2->references == 0) { im2->cached = 0; - im2->gc->shared->images = + im2->gc->shared->images = eina_list_remove_list(im2->gc->shared->images, l); im2->gc->shared->images_size -= (im2->csize); evas_gl_common_image_free(im2); @@ -45,13 +45,13 @@ _evas_gl_image_cache_trim(Evas_Engine_GL_Context *gc) } if ((gc->shared->images_size > size) && (l)) { - printf("EEK %i > %i, no 0 ref imgs\n", + printf("EEK %i > %i, no 0 ref imgs\n", gc->shared->images_size, size); break; } if (!gc->shared->images) { - printf("EEK %i > %i, no imgs\n", + printf("EEK %i > %i, no imgs\n", gc->shared->images_size, size); break; } @@ -323,7 +323,7 @@ evas_gl_common_image_native_enable(Evas_GL_Image *im) evas_gl_common_texture_free(im->tex); im->tex = NULL; } - + im->cs.space = EVAS_COLORSPACE_ARGB8888; im->tex = evas_gl_common_texture_native_new(im->gc, im->w, im->h, im->alpha, im); im->tex_only = 1; @@ -343,7 +343,7 @@ evas_gl_common_image_native_disable(Evas_GL_Image *im) im->tex = NULL; } im->tex_only = 0; - + im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); im->im->cache_entry.flags.alpha = im->alpha; im->cs.space = EVAS_COLORSPACE_ARGB8888; @@ -413,7 +413,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint) im->tex = NULL; } im->tex_only = 0; - + im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); im->im->cache_entry.flags.alpha = im->alpha; im->cs.space = EVAS_COLORSPACE_ARGB8888; @@ -436,14 +436,14 @@ evas_gl_common_image_free(Evas_GL_Image *im) #if 0 // filtering disabled Filtered_Image *fi; #endif - + evas_gl_common_context_flush(im->gc); im->references--; if (im->references > 0) return; - + if (im->native.func.free) im->native.func.free(im->native.func.data, im); - + if (im->cs.data) { if (!im->cs.no_free) free(im->cs.data); @@ -504,7 +504,7 @@ void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) { if (!im->im) return; -/* +/* if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) { @@ -516,7 +516,7 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) free(im->im->image.data); im->im->image.data = malloc(im->im->cache_entry.w * im->im->cache_entry.h * sizeof(DATA32)); if (im->im->image.data) - evas_common_convert_yuv_420p_601_rgba(im->cs.data, + evas_common_convert_yuv_420p_601_rgba(im->cs.data, (void *)im->im->image.data, im->im->cache_entry.w, im->im->cache_entry.h); } @@ -548,14 +548,14 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) if ((im->tex) && (im->dirty)) { evas_gl_common_texture_yuv_update(im->tex, im->cs.data, - im->im->cache_entry.w, + im->im->cache_entry.w, im->im->cache_entry.h); im->dirty = 0; } if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data))) { im->tex = evas_gl_common_texture_yuv_new(gc, im->cs.data, - im->im->cache_entry.w, + im->im->cache_entry.w, im->im->cache_entry.h); im->dirty = 0; } @@ -568,14 +568,14 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) } void -evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, +evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level __UNUSED__) { RGBA_Draw_Context *dc; int r, g, b, a; int c, cx, cy, cw, ch; Eina_Bool yuv = 0; - + dc = gc->dc; if (dc->mul.use) { @@ -588,18 +588,18 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, { r = g = b = a = 255; } - + evas_gl_common_image_update(gc, im); - c = gc->dc->clip.use; - cx = gc->dc->clip.x; cy = gc->dc->clip.y; + c = gc->dc->clip.use; + cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; im->tex->im = im; if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) yuv = 1; evas_gl_common_context_image_map_push(gc, im->tex, npoints, p, - c, cx, cy, cw, ch, + c, cx, cy, cw, ch, r, g, b, a, smooth, im->tex_only, yuv); } @@ -617,7 +617,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int c, cx, cy, cw, ch; int i; int yuv = 0; - + if (sw < 1) sw = 1; if (sh < 1) sh = 1; dc = gc->dc; @@ -633,7 +633,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, { r = g = b = a = 255; } - + evas_gl_common_image_update(gc, im); if (!im->tex) { @@ -744,7 +744,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, } return; } - + /* save out clip info */ c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; evas_common_draw_context_clip_clip(gc->dc, 0, 0, gc->w, gc->h); diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_line.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_line.c index a76fa6a49b..48499ea0e4 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_line.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_line.c @@ -6,7 +6,7 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int RGBA_Draw_Context *dc; int r, g, b, a; int c, cx, cy, cw, ch; - + dc = gc->dc; if (dc->mul.use) { @@ -21,12 +21,12 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int } glFlush(); - + c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; - - evas_gl_common_context_line_push(gc, x1, y1, x2, y2, - c, cx, cy, cw, ch, + + evas_gl_common_context_line_push(gc, x1, y1, x2, y2, + c, cx, cy, cw, ch, r, g, b, a); } diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_polygon.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_polygon.c index fa6b31236e..06647cd679 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_polygon.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_polygon.c @@ -101,7 +101,7 @@ static int polygon_point_sorter(const void *a, const void *b) { RGBA_Vertex *p, *q; - + p = (RGBA_Vertex *)a; q = (RGBA_Vertex *)b; if (p->y <= q->y) return -1; @@ -112,7 +112,7 @@ static int polygon_edge_sorter(const void *a, const void *b) { RGBA_Edge *p, *q; - + p = (RGBA_Edge *)a; q = (RGBA_Edge *)b; if (p->x <= q->x) return -1; @@ -133,7 +133,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int RGBA_Vertex *point; Evas_GL_Polygon_Point *pt; Eina_Inlist *spans; - + /* save out clip info */ c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; @@ -142,7 +142,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int cr = (gc->dc->col.col >> 16) & 0xff; cg = (gc->dc->col.col >> 8 ) & 0xff; cb = (gc->dc->col.col ) & 0xff; - + n = eina_list_count(poly->points); if (n < 3) return; edges = malloc(sizeof(RGBA_Edge) * n); @@ -160,7 +160,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int free(point); return; } - + k = 0; EINA_LIST_FOREACH(poly->points, l, pt) { @@ -180,20 +180,20 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int point[k].i = k; k++; } - + y0 = MAX(cy, ceil(point[sorted_index[0]].y - 0.5)); y1 = MIN(cy + ch - 1, floor(point[sorted_index[n - 1]].y - 0.5)); - + k = 0; num_active_edges = 0; spans = NULL; - + for (y = y0; y <= y1; y++) { for (; (k < n) && (point[sorted_index[k]].y <= ((double)y + 0.5)); k++) { i = sorted_index[k]; - + if (i > 0) j = i - 1; else j = n - 1; if (point[j].y <= ((double)y - 0.5)) @@ -215,13 +215,13 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int POLY_EDGE_ADD(i, y) } } - + qsort(edges, num_active_edges, sizeof(RGBA_Edge), polygon_edge_sorter); - + for (j = 0; j < num_active_edges; j += 2) { int x0, x1; - + x0 = ceil(edges[j].x - 0.5); if (j < (num_active_edges - 1)) x1 = floor(edges[j + 1].x - 0.5); @@ -230,7 +230,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int if ((x1 >= cx) && (x0 < (cx + cw)) && (x0 <= x1)) { RGBA_Span *span; - + if (x0 < cx) x0 = cx; if (x1 >= (cx + cw)) x1 = cx + cw - 1; span = malloc(sizeof(RGBA_Span)); @@ -243,13 +243,13 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int edges[j + 1].x += edges[j + 1].dx; } } - + free(edges); free(point); free(sorted_index); - + evas_common_draw_context_clip_clip(gc->dc, 0, 0, gc->w, gc->h); - + if (spans) { RGBA_Span *span; @@ -298,9 +298,9 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int span = (RGBA_Span *)spans; spans = eina_inlist_remove(spans, spans); free(span); - } - } - + } + } + /* restore clip info */ gc->dc->clip.use = c; gc->dc->clip.x = cx; gc->dc->clip.y = cy; gc->dc->clip.w = cw; gc->dc->clip.h = ch; diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_rectangle.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_rectangle.c index 2714cfd4f5..190331490e 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_rectangle.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_rectangle.c @@ -6,12 +6,12 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h) Cutout_Rects *rects; Cutout_Rect *r; int c, cx, cy, cw, ch, cr, cg, cb, ca, i; - + if ((w <= 0) || (h <= 0)) return; if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, gc->w, gc->h))) return; /* save out clip info */ c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; - + ca = (gc->dc->col.col >> 24) & 0xff; if ((gc->dc->render_op != EVAS_RENDER_COPY) && (ca <= 0)) return; cr = (gc->dc->col.col >> 16) & 0xff; @@ -25,7 +25,7 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h) gc->dc->clip.x, gc->dc->clip.y, gc->dc->clip.w, gc->dc->clip.h); } - + if (!gc->dc->cutout.rects) { evas_gl_common_context_rectangle_push(gc, x, y, w, h, cr, cg, cb, ca); diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c index 2df8076227..4c206111d5 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c @@ -16,9 +16,9 @@ Evas_GL_Program_Source shader_rect_frag_src = rect_frag_glsl, #if defined (GLES_VARIETY_S3C6410) rect_frag_bin, sizeof(rect_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -35,9 +35,9 @@ Evas_GL_Program_Source shader_rect_vert_src = rect_vert_glsl, #if defined (GLES_VARIETY_S3C6410) rect_vert_bin, sizeof(rect_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -56,9 +56,9 @@ Evas_GL_Program_Source shader_font_frag_src = font_frag_glsl, #if defined (GLES_VARIETY_S3C6410) font_frag_bin, sizeof(font_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -75,9 +75,9 @@ Evas_GL_Program_Source shader_font_vert_src = font_vert_glsl, #if defined (GLES_VARIETY_S3C6410) font_vert_bin, sizeof(font_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -96,9 +96,9 @@ Evas_GL_Program_Source shader_yuv_frag_src = yuv_frag_glsl, #if defined (GLES_VARIETY_S3C6410) yuv_frag_bin, sizeof(yuv_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -115,9 +115,9 @@ Evas_GL_Program_Source shader_yuv_vert_src = yuv_vert_glsl, #if defined (GLES_VARIETY_S3C6410) yuv_vert_bin, sizeof(yuv_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -136,9 +136,9 @@ Evas_GL_Program_Source shader_yuv_nomul_frag_src = yuv_nomul_frag_glsl, #if defined (GLES_VARIETY_S3C6410) yuv_nomul_frag_bin, sizeof(yuv_nomul_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -155,9 +155,9 @@ Evas_GL_Program_Source shader_yuv_nomul_vert_src = yuv_nomul_vert_glsl, #if defined (GLES_VARIETY_S3C6410) yuv_nomul_vert_bin, sizeof(yuv_nomul_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -176,9 +176,9 @@ Evas_GL_Program_Source shader_tex_frag_src = tex_frag_glsl, #if defined (GLES_VARIETY_S3C6410) tex_frag_bin, sizeof(tex_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -195,9 +195,9 @@ Evas_GL_Program_Source shader_tex_vert_src = tex_vert_glsl, #if defined (GLES_VARIETY_S3C6410) tex_vert_bin, sizeof(tex_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -216,9 +216,9 @@ Evas_GL_Program_Source shader_tex_nomul_frag_src = tex_nomul_frag_glsl, #if defined (GLES_VARIETY_S3C6410) tex_nomul_frag_bin, sizeof(tex_nomul_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -235,9 +235,9 @@ Evas_GL_Program_Source shader_tex_nomul_vert_src = tex_nomul_vert_glsl, #if defined (GLES_VARIETY_S3C6410) tex_nomul_vert_bin, sizeof(tex_nomul_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -256,9 +256,9 @@ Evas_GL_Program_Source shader_img_frag_src = img_frag_glsl, #if defined (GLES_VARIETY_S3C6410) img_frag_bin, sizeof(img_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -275,9 +275,9 @@ Evas_GL_Program_Source shader_img_vert_src = img_vert_glsl, #if defined (GLES_VARIETY_S3C6410) img_vert_bin, sizeof(img_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -296,9 +296,9 @@ Evas_GL_Program_Source shader_img_nomul_frag_src = img_nomul_frag_glsl, #if defined (GLES_VARIETY_S3C6410) img_nomul_frag_bin, sizeof(img_nomul_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -315,9 +315,9 @@ Evas_GL_Program_Source shader_img_nomul_vert_src = img_nomul_vert_glsl, #if defined (GLES_VARIETY_S3C6410) img_nomul_vert_bin, sizeof(img_nomul_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -336,9 +336,9 @@ Evas_GL_Program_Source shader_img_bgra_frag_src = img_bgra_frag_glsl, #if defined (GLES_VARIETY_S3C6410) img_bgra_frag_bin, sizeof(img_bgra_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -355,9 +355,9 @@ Evas_GL_Program_Source shader_img_bgra_vert_src = img_bgra_vert_glsl, #if defined (GLES_VARIETY_S3C6410) img_bgra_vert_bin, sizeof(img_bgra_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; @@ -418,9 +418,9 @@ Evas_GL_Program_Source shader_img_bgra_nomul_frag_src = img_bgra_nomul_frag_glsl, #if defined (GLES_VARIETY_S3C6410) img_bgra_nomul_frag_bin, sizeof(img_bgra_nomul_frag_bin) -#else +#else NULL, 0 -#endif +#endif }; #if defined (GLES_VARIETY_S3C6410) @@ -437,9 +437,9 @@ Evas_GL_Program_Source shader_img_bgra_nomul_vert_src = img_bgra_nomul_vert_glsl, #if defined (GLES_VARIETY_S3C6410) img_bgra_nomul_vert_bin, sizeof(img_bgra_nomul_vert_bin) -#else +#else NULL, 0 -#endif +#endif }; ///////////////////////////////////////////// @@ -622,7 +622,7 @@ gl_compile_link_error(GLuint target, const char *action) free(logtxt); } } - + /* Program info log */ glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen); if (loglen > 0) @@ -709,7 +709,7 @@ _evas_gl_shader_dir_check(char *bin_shader_dir, int num) home = getenv("HOME"); if ((!home) || (!home[0])) return 0; - + snprintf(bin_shader_dir, num, "%s/%s", home, subdir); return _evas_gl_shader_file_exists(bin_shader_dir); } @@ -774,8 +774,8 @@ _evas_gl_common_shader_program_binary_init(Evas_GL_Program *p, p->prog = glCreateProgram(); #if 0 - // TODO: invalid rendering error occurs when attempting to use a - // glProgramBinary. in order to render correctly we should create a dummy + // TODO: invalid rendering error occurs when attempting to use a + // glProgramBinary. in order to render correctly we should create a dummy // vertex shader. p->vert = glCreateShader(GL_VERTEX_SHADER); glAttachShader(p->prog, p->vert); @@ -840,7 +840,7 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p, const char *name) { GLint ok; - + p->vert = glCreateShader(GL_VERTEX_SHADER); p->frag = glCreateShader(GL_FRAGMENT_SHADER); #if defined (GLES_VARIETY_S3C6410) @@ -848,7 +848,7 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p, GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -#else +#else glShaderSource(p->vert, 1, (const char **)&(vert->src), NULL); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -882,14 +882,14 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p, #if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX) #else 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); -#endif +#endif glAttachShader(p->prog, p->vert); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glAttachShader(p->prog, p->frag); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex"); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_COLOR, "color"); @@ -902,7 +902,7 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p, GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm"); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glLinkProgram(p->prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); ok = 0; @@ -965,7 +965,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared) &(shader_yuv_nomul_vert_src), &(shader_yuv_nomul_frag_src), "yuv_nomul")) return 0; - + /* Most of the filters use the image fragment shader */ if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert), &(shader_img_vert_src), @@ -983,7 +983,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared) &(shader_img_vert_src), &(shader_filter_invert_bgra_nomul_frag_src), "filter_invert_bgra_nomul")) return 0; - + if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia), &(shader_img_vert_src), &(shader_filter_sepia_frag_src), @@ -1000,7 +1000,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared) &(shader_img_vert_src), &(shader_filter_sepia_bgra_nomul_frag_src), "filter_sepia_bgra_nomul")) return 0; - + if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale), &(shader_img_vert_src), &(shader_filter_greyscale_frag_src), @@ -1035,7 +1035,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared) &(shader_filter_blur_bgra_nomul_frag_src), "filter_blur_bgra_nomul")) return 0; #endif - + return 1; } @@ -1049,11 +1049,11 @@ _evas_gl_common_shader_binary_init(Evas_GL_Shared *shared) if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) return 0; - + if (!_evas_gl_shader_file_check(bin_dir_path, bin_file_path, - sizeof(bin_dir_path))) + sizeof(bin_dir_path))) return 0; - + /* use eet */ if (!eet_init()) return 0; et = eet_open(bin_file_path, EET_FILE_MODE_READ); @@ -1117,10 +1117,10 @@ _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared) if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) res = _evas_gl_shader_file_mkpath(bin_dir_path); if (!res) return 0; /* we can't make directory */ - - _evas_gl_shader_file_check(bin_dir_path, bin_file_path, + + _evas_gl_shader_file_check(bin_dir_path, bin_file_path, sizeof(bin_dir_path)); - + /* use mkstemp for writing */ snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", bin_file_path); tmpfd = mkstemp(tmp_file); @@ -1182,7 +1182,7 @@ int evas_gl_common_shader_program_init(Evas_GL_Shared *shared) { // gl support binary shader and get env of binary shader path - if (shared->info.bin_program && + if (shared->info.bin_program && _evas_gl_common_shader_binary_init(shared)) return 1; /* compile all shader.*/ if (!_evas_gl_common_shader_source_init(shared)) return 0; @@ -1196,7 +1196,7 @@ evas_gl_common_shader_program_init_done(void) { #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) glReleaseShaderCompiler(); -#endif +#endif } void diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c index 9e3d8f8204..941c830dcb 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c @@ -88,7 +88,7 @@ _tex_format_index(GLuint format) case GL_RGBA: #ifdef GL_BGRA case GL_BGRA: -#endif +#endif return 0; case GL_RGB: return 1; @@ -120,7 +120,7 @@ static Evas_GL_Texture_Pool * _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum format) { Evas_GL_Texture_Pool *pt; - + pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; @@ -132,7 +132,7 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum fo pt->format = format; pt->dataformat = GL_UNSIGNED_BYTE; pt->references = 0; - + if (format == alpha_fmt) { texinfo.a.num++; @@ -150,7 +150,7 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum fo } _print_tex_count(); - + glGenTextures(1, &(pt->texture)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, pt->texture); @@ -215,8 +215,8 @@ _pool_tex_alloc(Evas_GL_Texture_Pool *pt, int w, int h __UNUSED__, int *u, int * } static Evas_GL_Texture_Pool * -_pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, - int intformat, int format, int *u, int *v, +_pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, + int intformat, int format, int *u, int *v, Eina_List **l_after, int atlas_w) { Evas_GL_Texture_Pool *pt = NULL; @@ -225,7 +225,7 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, if (atlas_w > gc->shared->info.max_texture_size) atlas_w = gc->shared->info.max_texture_size; - if ((w > gc->shared->info.tune.atlas.max_w) || + if ((w > gc->shared->info.tune.atlas.max_w) || (h > gc->shared->info.tune.atlas.max_h)) { pt = _pool_tex_new(gc, w, h, intformat, format); @@ -238,22 +238,22 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, *l_after = NULL; return pt; } - + th = _tex_round_slot(gc, h); th2 = _tex_format_index(intformat); EINA_LIST_FOREACH(gc->shared->tex.atlas[th][th2], l, pt) { if (_pool_tex_alloc(pt, w, h, u, v, l_after)) { - gc->shared->tex.atlas[th][th2] = + gc->shared->tex.atlas[th][th2] = eina_list_remove_list(gc->shared->tex.atlas[th][th2], l); - gc->shared->tex.atlas[th][th2] = + gc->shared->tex.atlas[th][th2] = eina_list_prepend(gc->shared->tex.atlas[th][th2], pt); return pt; } } pt = _pool_tex_new(gc, atlas_w, h, intformat, format); - gc->shared->tex.atlas[th][th2] = + gc->shared->tex.atlas[th][th2] = eina_list_prepend(gc->shared->tex.atlas[th][th2], pt); pt->slot = th; pt->fslot = th2; @@ -272,7 +272,7 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im) tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; - + tex->gc = gc; tex->references = 1; @@ -280,12 +280,12 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im) { if (gc->shared->info.bgra) tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2, - im->cache_entry.h + 1, bgra_ifmt, bgra_fmt, + im->cache_entry.h + 1, bgra_ifmt, bgra_fmt, &u, &v, &l_after, gc->shared->info.tune.atlas.max_alloc_size); else tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2, - im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, + im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, &u, &v, &l_after, gc->shared->info.tune.atlas.max_alloc_size); tex->alpha = 1; @@ -293,18 +293,18 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im) else { if (gc->shared->info.bgra) - tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, + tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, im->cache_entry.h + 1, bgr_ifmt, bgr_fmt, &u, &v, &l_after, gc->shared->info.tune.atlas.max_alloc_size); else #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) - tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, + tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, &u, &v, &l_after, gc->shared->info.tune.atlas.max_alloc_size); #else - tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, + tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, im->cache_entry.h + 1, rgb_ifmt, rgb_fmt, &u, &v, &l_after, gc->shared->info.tune.atlas.max_alloc_size); @@ -320,10 +320,10 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im) tex->w = im->cache_entry.w; tex->h = im->cache_entry.h; if (l_after) - tex->pt->allocations = + tex->pt->allocations = eina_list_append_relative_list(tex->pt->allocations, tex, l_after); else - tex->pt->allocations = + tex->pt->allocations = eina_list_prepend(tex->pt->allocations, tex); tex->pt->references++; evas_gl_common_texture_update(tex, im); @@ -334,7 +334,7 @@ static Evas_GL_Texture_Pool * _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format) { Evas_GL_Texture_Pool *pt; - + pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; @@ -361,12 +361,12 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in # ifndef GL_COLOR_ATTACHMENT0 # define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT # endif -#endif +#endif texinfo.r.num++; texinfo.r.pix += pt->w * pt->h; - + _print_tex_count(); - + glGenTextures(1, &(pt->texture)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, pt->texture); @@ -380,7 +380,7 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); - + glsym_glGenFramebuffers(1, &(pt->fb)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glsym_glBindFramebuffer(GL_FRAMEBUFFER, pt->fb); @@ -389,7 +389,7 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; @@ -399,11 +399,11 @@ static Evas_GL_Texture_Pool * _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im) { Evas_GL_Texture_Pool *pt; - + pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; pt->gc = gc; -#ifdef GL_TEXTURE_RECTANGLE_ARB +#ifdef GL_TEXTURE_RECTANGLE_ARB if (im->native.target == GL_TEXTURE_RECTANGLE_ARB) { printf("REEEEEEEEECT\n"); @@ -411,7 +411,7 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in pt->h = h; } else -#endif +#endif { // FIXME: handle po2 only textures pt->w = w; @@ -424,14 +424,14 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in pt->native = 1; texinfo.n.num++; texinfo.n.pix += pt->w * pt->h; - + _print_tex_count(); - + glGenTextures(1, &(pt->texture)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(im->native.target, pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #else if (im->native.loose) @@ -440,7 +440,7 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in im->native.func.bind(im->native.func.data, im); } #endif - + glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -460,7 +460,7 @@ static Evas_GL_Texture_Pool * _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format) { Evas_GL_Texture_Pool *pt = NULL; - + #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) int fmt; // EGL_MAP_GL_TEXTURE_RGBA_SEC or EGL_MAP_GL_TEXTURE_RGB_SEC or bust int pixtype; // EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC or bust @@ -473,7 +473,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i EGL_NONE }; void *egldisplay; - + pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; @@ -488,9 +488,9 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i pt->references = 0; texinfo.d.num++; texinfo.d.pix += pt->w * pt->h; - + _print_tex_count(); - + glGenTextures(1, &(pt->texture)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, pt->texture); @@ -505,14 +505,14 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i GLERR(__FUNCTION__, __FILE__, __LINE__, ""); egldisplay = pt->gc->egldisp; - + attr[1] = pt->w; attr[3] = pt->h; // FIXME: seems a bit slower than i'd like - maybe too many flushes? // FIXME: YCbCr no support as yet pt->dyn.img = secsym_eglCreateImage(egldisplay, - EGL_NO_CONTEXT, + EGL_NO_CONTEXT, EGL_MAP_GL_TEXTURE_2D_SEC, 0, attr); if (!pt->dyn.img) @@ -593,7 +593,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; } - + glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #else @@ -602,7 +602,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i h = 0; intformat = 0; format = 0; -#endif +#endif return pt; } @@ -610,7 +610,7 @@ void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) { if (!pt->gc) return; - + if (pt->format == alpha_fmt) { texinfo.a.num--; @@ -641,9 +641,9 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) texinfo.c.num--; texinfo.c.pix -= pt->w * pt->h; } - + _print_tex_count(); - + #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if (pt->dyn.img) { @@ -654,8 +654,8 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) pt->dyn.h = 0; pt->dyn.stride = 0; } -#endif - +#endif + glDeleteTextures(1, &(pt->texture)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (pt->fb) @@ -665,7 +665,7 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) pt->fb = 0; } while (pt->allocations) - pt->allocations = + pt->allocations = eina_list_remove_list(pt->allocations, pt->allocations); pt->texture = 0; pt->gc = NULL; @@ -683,7 +683,7 @@ pt_unref(Evas_GL_Texture_Pool *pt) if (!((pt->render) || (pt->native))) { if (pt->whole) - pt->gc->shared->tex.whole = + pt->gc->shared->tex.whole = eina_list_remove(pt->gc->shared->tex.whole, pt); else pt->gc->shared->tex.atlas [pt->slot][pt->fslot] = @@ -700,7 +700,7 @@ evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, un tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; - + tex->gc = gc; tex->references = 1; tex->alpha = alpha; @@ -738,7 +738,7 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; - + tex->gc = gc; tex->references = 1; tex->alpha = alpha; @@ -765,7 +765,7 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un tex->y = 0; tex->w = w; tex->h = h; - tex->pt->references++; + tex->pt->references++; return tex; } @@ -776,7 +776,7 @@ evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; - + tex->gc = gc; tex->references = 1; tex->alpha = im->alpha; @@ -834,36 +834,36 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) } if (!tex->pt) return; if (!im->image.data) return; - + fmt = tex->pt->format; glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -#ifdef GL_UNPACK_ROW_LENGTH +#ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -#endif +#endif glPixelStorei(GL_UNPACK_ALIGNMENT, 4); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h); // +-+ // +-+ - // - _tex_sub_2d(tex->x, tex->y, + // + _tex_sub_2d(tex->x, tex->y, im->cache_entry.w, im->cache_entry.h, fmt, tex->pt->dataformat, im->image.data); // |xxx // |xxx - // - _tex_sub_2d(tex->x - 1, tex->y, + // + _tex_sub_2d(tex->x - 1, tex->y, 1, im->cache_entry.h, fmt, tex->pt->dataformat, im->image.data); // xxx| // xxx| - // - _tex_sub_2d(tex->x + im->cache_entry.w, tex->y, + // + _tex_sub_2d(tex->x + im->cache_entry.w, tex->y, 1, im->cache_entry.h, fmt, tex->pt->dataformat, im->image.data + (im->cache_entry.w - 1)); @@ -923,11 +923,11 @@ evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels, tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; - + tex->gc = gc; tex->references = 1; tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v, - &l_after, + &l_after, gc->shared->info.tune.atlas.max_alloc_alpha_size); if (!tex->pt) { @@ -939,7 +939,7 @@ evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels, tex->w = w; tex->h = h; if (l_after) - tex->pt->allocations = + tex->pt->allocations = eina_list_append_relative_list(tex->pt->allocations, tex, l_after); else tex->pt->allocations = eina_list_prepend(tex->pt->allocations, tex); @@ -955,13 +955,13 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels, if (!tex->pt) return; glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -#ifdef GL_UNPACK_ROW_LENGTH +#ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -#endif +#endif glPixelStorei(GL_UNPACK_ALIGNMENT, 4); 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); if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) { @@ -977,7 +977,7 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigne tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; - + tex->gc = gc; tex->references = 1; tex->pt = _pool_tex_new(gc, w + 1, h + 1, lum_ifmt, lum_fmt); @@ -1073,7 +1073,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i for (y = 0; y < (h / 2); y++) _tex_sub_2d(0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]); } - + glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2)) @@ -1083,7 +1083,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i for (y = 0; y < (h / 2); y++) _tex_sub_2d(0, y, w / 2, 1, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2) + y]); } -#endif +#endif if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) { glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); diff --git a/legacy/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h b/legacy/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h index 7224f9c936..fb2c81cf4e 100644 --- a/legacy/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h +++ b/legacy/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h @@ -33,16 +33,14 @@ struct _Evas_Engine_Info_GL_X11 struct { void (*pre_swap) (void *data, Evas *e); void (*post_swap) (void *data, Evas *e); - + void *data; // data for callback calls } callback; /* non-blocking or blocking mode */ Evas_Engine_Render_Mode render_mode; - + unsigned char vsync : 1; // does nothing right now unsigned char indirect : 1; // use indirect rendering }; #endif - - diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c index 04426d4d2a..d5cc6d361d 100644 --- a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c +++ b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c @@ -24,12 +24,12 @@ struct _Render_Engine Evas_Engine_Info_GL_X11 *info; Evas *evas; int end; - + XrmDatabase xrdb; // xres - dpi struct { // xres - dpi int dpi; // xres - dpi } xr; // xres - dpi - + int w, h; int vsync; }; @@ -45,7 +45,7 @@ struct _Render_Engine_GL_Surface // Render target texture/buffers GLuint rt_tex; GLint rt_internal_fmt; - GLenum rt_fmt; + GLenum rt_fmt; GLuint rb_depth; GLenum rb_depth_fmt; GLuint rb_stencil; @@ -59,11 +59,11 @@ struct _Render_Engine_GL_Context int initialized; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) EGLContext context; -#else +#else GLXContext context; #endif - GLuint fbo; - + GLuint fbo; + Render_Engine_GL_Surface *current_sfc; }; @@ -114,29 +114,29 @@ static void _sym_init(void) { static int done = 0; - + if (done) return; - + #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #define FINDSYM(dst, sym, typ) \ if ((!dst) && (glsym_eglGetProcAddress)) dst = (typ)glsym_eglGetProcAddress(sym); \ if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym) - + FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn); FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressEXT", glsym_func_eng_fn); FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn); FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressKHR", glsym_func_eng_fn); - + FINDSYM(glsym_eglBindTexImage, "eglBindTexImage", glsym_func_void); FINDSYM(glsym_eglBindTexImage, "eglBindTexImageEXT", glsym_func_void); FINDSYM(glsym_eglBindTexImage, "eglBindTexImageARB", glsym_func_void); FINDSYM(glsym_eglBindTexImage, "eglBindTexImageKHR", glsym_func_void); - + FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImage", glsym_func_void); FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageEXT", glsym_func_void); FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageARB", glsym_func_void); FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageKHR", glsym_func_void); - + FINDSYM(glsym_eglCreateImage, "eglCreateImage", glsym_func_void_ptr); FINDSYM(glsym_eglCreateImage, "eglCreateImageEXT", glsym_func_void_ptr); FINDSYM(glsym_eglCreateImage, "eglCreateImageARB", glsym_func_void_ptr); @@ -156,7 +156,7 @@ _sym_init(void) FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress", glsym_func_eng_fn); FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT", glsym_func_eng_fn); FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB", glsym_func_eng_fn); - + FINDSYM(glsym_glXBindTexImage, "glXBindTexImage", glsym_func_void); FINDSYM(glsym_glXBindTexImage, "glXBindTexImageEXT", glsym_func_void); FINDSYM(glsym_glXBindTexImage, "glXBindTexImageARB", glsym_func_void); @@ -166,24 +166,24 @@ _sym_init(void) FINDSYM(glsym_glXReleaseTexImage, "glXReleaseTexImageARB", glsym_func_void); FINDSYM(glsym_glXGetVideoSync, "glXGetVideoSyncSGI", glsym_func_int); - + FINDSYM(glsym_glXWaitVideoSync, "glXWaitVideoSyncSGI", glsym_func_int); FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmap", glsym_func_xid); FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapEXT", glsym_func_xid); FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmapARB", glsym_func_xid); - + FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmap", glsym_func_void); FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapEXT", glsym_func_void); FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmapARB", glsym_func_void); - + FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawable", glsym_func_void); FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableEXT", glsym_func_void); FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableARB", glsym_func_void); FINDSYM(glsym_glxSwapIntervalSGI, "glXSwapIntervalMESA", glsym_func_int); FINDSYM(glsym_glxSwapIntervalSGI, "glXSwapIntervalSGI", glsym_func_int); - + FINDSYM(glsym_glxSwapIntervalEXT, "glXSwapIntervalEXT", glsym_func_void); #endif } @@ -259,7 +259,7 @@ static void eng_info_free(Evas *e __UNUSED__, void *info) { Evas_Engine_Info_GL_X11 *in; -// dont free! why bother? its not worth it +// dont free! why bother? its not worth it // eina_log_domain_unregister(_evas_engine_GL_X11_log_dom); in = (Evas_Engine_Info_GL_X11 *)info; free(in); @@ -294,9 +294,9 @@ eng_setup(Evas *e, void *in) if (!e->engine.data.output) { #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -#else +#else int eb, evb; - + if (!glXQueryExtension(info->info.display, &eb, &evb)) return 0; #endif re = calloc(1, sizeof(Render_Engine)); @@ -324,12 +324,12 @@ eng_setup(Evas *e, void *in) return 0; } gl_wins++; - + { int status; char *type = NULL; XrmValue val; - + re->xr.dpi = 75000; // dpy * 1000 status = xrdb_user_query("Xft.dpi", "Xft.Dpi", &type, &val); @@ -346,22 +346,22 @@ eng_setup(Evas *e, void *in) if (!strcmp(type, "String")) { const char *str, *dp; - + str = val.addr; dp = strchr(str, '.'); if (!dp) dp = strchr(str, ','); - + if (dp) { int subdpi, len, i; char *buf; - + buf = alloca(dp - str + 1); strncpy(buf, str, dp - str); buf[dp - str] = 0; len = strlen(dp + 1); subdpi = atoi(dp + 1); - + if (len < 3) { for (i = len; i < 3; i++) subdpi *= 10; @@ -382,7 +382,7 @@ eng_setup(Evas *e, void *in) if (!initted) { evas_common_cpu_init(); - + evas_common_blend_init(); evas_common_image_init(); evas_common_convert_init(); @@ -411,7 +411,7 @@ eng_setup(Evas *e, void *in) (re->info->info.rotation != re->win->rot)) { int inc = 0; - + if (re->win) { re->win->gl_context->references++; @@ -454,7 +454,7 @@ eng_setup(Evas *e, void *in) free(re); return 0; } - + if (!e->engine.data.output) { if (re->win) @@ -476,9 +476,9 @@ eng_setup(Evas *e, void *in) glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); } - + _sym_init(); - + return 1; } @@ -488,7 +488,7 @@ eng_output_free(void *data) Render_Engine *re; re = (Render_Engine *)data; - + if (re) { // NOTE: XrmGetDatabase() result is shared per connection, do not free it. @@ -590,7 +590,7 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i // dont need to for egl - eng_window_use() can check for other ctxt's #else eng_window_use(NULL); -#endif +#endif eng_window_use(re->win); if (!_re_wincheck(re)) return NULL; evas_gl_common_context_flush(re->win->gl_context); @@ -613,7 +613,7 @@ double get_time(void) { struct timeval timev; - + gettimeofday(&timev, NULL); return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); } @@ -629,7 +629,7 @@ eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x static double pt = 0.0; double ta, tb; #endif - + re = (Render_Engine *)data; /* put back update surface.. in this case just unflag redraw */ if (!_re_wincheck(re)) return; @@ -665,7 +665,7 @@ eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x double t1 = get_time(); tb = t1 - t0; printf("... %1.5f -> %1.5f | ", ta, tb); -#endif +#endif // if (eglGetError() != EGL_SUCCESS) // { // printf("Error: eglWaitNative(EGL_CORE_NATIVE_ENGINE) fail.\n"); @@ -712,13 +712,13 @@ eng_output_flush(void *data) #ifdef FRAMECOUNT double t1 = get_time(); printf("%1.5f\n", t1 - t0); -#endif +#endif // if (eglGetError() != EGL_SUCCESS) // { // printf("Error: eglSwapBuffers() fail.\n"); // } #else -#ifdef VSYNC_TO_SCREEN +#ifdef VSYNC_TO_SCREEN if ((re->info->vsync)/* || (1)*/) { if (glsym_glxSwapIntervalEXT) @@ -744,7 +744,7 @@ eng_output_flush(void *data) if ((glsym_glXGetVideoSync) && (glsym_glXWaitVideoSync)) { unsigned int rc; - + glsym_glXGetVideoSync(&rc); glsym_glXWaitVideoSync(1, 0, &rc); } @@ -755,9 +755,9 @@ eng_output_flush(void *data) { re->info->callback.pre_swap(re->info->callback.data, re->evas); } -/* +/* if ((1) -// (re->win->draw.x1 == 0) && +// (re->win->draw.x1 == 0) && // (re->win->draw.y1 == 0) && // (re->win->draw.x2 == (re->win->w - 1)) && // (re->win->draw.y2 == (re->win->h - 1)) @@ -767,16 +767,16 @@ eng_output_flush(void *data) glXSwapBuffers(re->win->disp, re->win->win); if (!safe_native) glXWaitGL(); } -/* +/* else { -// FIXME: this doesn't work.. why oh why? +// FIXME: this doesn't work.. why oh why? int sx, sy, sw, sh; - + // fimxe - reset when done // glEnable(GL_SCISSOR_TEST); glDrawBuffer(GL_FRONT); - + sx = re->win->draw.x1; sy = re->win->draw.y1; sw = (re->win->draw.x2 - re->win->draw.x1) + 1; @@ -787,7 +787,7 @@ eng_output_flush(void *data) glRasterPos2i(sx, re->win->h - sy); glCopyPixels(sx, sy, sw, sh, GL_COLOR); glRasterPos2i(0, 0); - + // glDisable(GL_SCISSOR_TEST); glDrawBuffer(GL_BACK); glFlush(); @@ -798,7 +798,7 @@ eng_output_flush(void *data) re->info->callback.post_swap(re->info->callback.data, re->evas); } #endif - + if (re->win->alpha) { glClearColor(0.0, 0.0, 0.0, 0.0); @@ -967,9 +967,9 @@ eng_image_alpha_set(void *data, void *image, int has_alpha) if (im->references > 1) { Evas_GL_Image *im_new; - + im_new = evas_gl_common_image_new_from_copied_data - (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, + (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data, eng_image_alpha_get(data, image), eng_image_colorspace_get(data, image)); @@ -1058,7 +1058,7 @@ eng_image_colorspace_set(void *data, void *image, int cspace) if (!im->cs.no_free) free(im->cs.data); } if (im->im->cache_entry.h > 0) - im->cs.data = + im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); else im->cs.data = NULL; @@ -1081,7 +1081,7 @@ struct _Native Evas_Native_Surface ns; Pixmap pixmap; Visual *visual; - + #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) void *egl_surface; #else @@ -1093,10 +1093,10 @@ struct _Native // FIXME: this is enabled so updates happen - but its SLOOOOOOOOOOOOOOOW // (i am sure this is the reason) not to mention seemingly superfluous. but // i need to enable it for it to work on fglrx at least. havent tried nvidia. -// +// // why is this the case? does anyone know? has anyone tried it on other gfx // drivers? -// +// //#define GLX_TEX_PIXMAP_RECREATE 1 static void @@ -1104,7 +1104,7 @@ _native_bind_cb(void *data, void *image) { Evas_GL_Image *im = image; Native *n = im->native.data; - + if (n->ns.type == EVAS_NATIVE_SURFACE_X11) { #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) @@ -1122,10 +1122,10 @@ _native_bind_cb(void *data, void *image) #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT Render_Engine *re = data; - + if (glsym_glXBindTexImage) { - glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, + glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, GLX_FRONT_LEFT_EXT, NULL); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } @@ -1136,7 +1136,7 @@ _native_bind_cb(void *data, void *image) } else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) { - glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id); + glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } return; @@ -1148,7 +1148,7 @@ _native_unbind_cb(void *data, void *image) { Evas_GL_Image *im = image; Native *n = im->native.data; - + if (n->ns.type == EVAS_NATIVE_SURFACE_X11) { #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) @@ -1156,10 +1156,10 @@ _native_unbind_cb(void *data, void *image) #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT Render_Engine *re = data; - + if (glsym_glXReleaseTexImage) { - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, GLX_FRONT_LEFT_EXT); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } @@ -1170,7 +1170,7 @@ _native_unbind_cb(void *data, void *image) } else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) { - glBindTexture(GL_TEXTURE_2D, 0); + glBindTexture(GL_TEXTURE_2D, 0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } return; @@ -1253,22 +1253,22 @@ eng_image_native_set(void *data, void *image, void *native) Native *n = NULL; uint32_t pmid, texid; unsigned int tex = 0; - unsigned int fbo = 0; - - if (!im) + unsigned int fbo = 0; + + if (!im) { - if ((!ns) && (ns->type == EVAS_NATIVE_SURFACE_OPENGL)) + if ((!ns) && (ns->type == EVAS_NATIVE_SURFACE_OPENGL)) { - im = evas_gl_common_image_new_from_data(re->win->gl_context, - ns->data.opengl.w, - ns->data.opengl.h, - NULL, 1, + im = evas_gl_common_image_new_from_data(re->win->gl_context, + ns->data.opengl.w, + ns->data.opengl.h, + NULL, 1, EVAS_COLORSPACE_ARGB8888); - } - else + } + else return NULL; } - + if (ns) { if (ns->type == EVAS_NATIVE_SURFACE_X11) @@ -1278,7 +1278,7 @@ eng_image_native_set(void *data, void *image, void *native) if (im->native.data) { Evas_Native_Surface *ens = im->native.data; - if ((ens->data.x11.visual == vis) && + if ((ens->data.x11.visual == vis) && (ens->data.x11.pixmap == pm)) return im; } @@ -1290,16 +1290,16 @@ eng_image_native_set(void *data, void *image, void *native) if (im->native.data) { Evas_Native_Surface *ens = im->native.data; - if ((ens->data.opengl.texture_id == tex) && + if ((ens->data.opengl.texture_id == tex) && (ens->data.opengl.framebuffer_id == fbo)) return im; } } } if ((!ns) && (!im->native.data)) return im; - + eng_window_use(re->win); - + if (im->native.data) { if (im->native.func.free) @@ -1308,7 +1308,7 @@ eng_image_native_set(void *data, void *image, void *native) } if (!ns) return im; - + if (ns->type == EVAS_NATIVE_SURFACE_X11) { pmid = pm; @@ -1342,7 +1342,7 @@ eng_image_native_set(void *data, void *image, void *native) } } - im2 = evas_gl_common_image_new_from_data(re->win->gl_context, + im2 = evas_gl_common_image_new_from_data(re->win->gl_context, im->w, im->h, NULL, im->alpha, EVAS_COLORSPACE_ARGB8888); evas_gl_common_image_free(im); @@ -1350,7 +1350,7 @@ eng_image_native_set(void *data, void *image, void *native) if (ns->type == EVAS_NATIVE_SURFACE_X11) { #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) - if (native) + if (native) { n = calloc(1, sizeof(Native)); if (n) @@ -1358,9 +1358,9 @@ eng_image_native_set(void *data, void *image, void *native) EGLConfig egl_config; int config_attrs[20]; int num_config, i = 0; - + eina_hash_add(re->win->gl_context->shared->native_pm_hash, &pmid, im); - + config_attrs[i++] = EGL_RED_SIZE; config_attrs[i++] = 8; config_attrs[i++] = EGL_GREEN_SIZE; @@ -1378,8 +1378,8 @@ eng_image_native_set(void *data, void *image, void *native) config_attrs[i++] = EGL_SURFACE_TYPE; config_attrs[i++] = EGL_PIXMAP_BIT; config_attrs[i++] = EGL_NONE; - - if (!eglChooseConfig(re->win->egl_disp, config_attrs, + + if (!eglChooseConfig(re->win->egl_disp, config_attrs, &egl_config, 1, &num_config)) ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i", (unsigned int)pm, num_config); memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); @@ -1414,9 +1414,9 @@ eng_image_native_set(void *data, void *image, void *native) int dummy; unsigned int w, h, depth = 32, border; Window wdummy; - + // fixme: round trip :( - XGetGeometry(re->win->disp, pm, &wdummy, &dummy, &dummy, + XGetGeometry(re->win->disp, pm, &wdummy, &dummy, &dummy, &w, &h, &border, &depth); n = calloc(1, sizeof(Native)); if (n) @@ -1424,10 +1424,10 @@ eng_image_native_set(void *data, void *image, void *native) int pixmap_att[20]; unsigned int target = 0; unsigned int i = 0; - + eina_hash_add(re->win->gl_context->shared->native_pm_hash, &pmid, im); if ((re->win->depth_cfg[depth].tex_target & - GLX_TEXTURE_2D_BIT_EXT) + GLX_TEXTURE_2D_BIT_EXT) // && (1) // we assume npo2 for now // size is pow2 || mnpo2 supported ) @@ -1448,29 +1448,29 @@ eng_image_native_set(void *data, void *image, void *native) GLX_TEXTURE_RECTANGLE_BIT_EXT)) target = GLX_TEXTURE_2D_EXT; } - - + + pixmap_att[i++] = GLX_TEXTURE_FORMAT_EXT; pixmap_att[i++] = re->win->depth_cfg[depth].tex_format; pixmap_att[i++] = GLX_MIPMAP_TEXTURE_EXT; pixmap_att[i++] = re->win->depth_cfg[depth].mipmap; - + if (target) { pixmap_att[i++] = GLX_TEXTURE_TARGET_EXT; pixmap_att[i++] = target; } - + pixmap_att[i++] = 0; - + memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); n->pixmap = pm; n->visual = vis; n->fbc = re->win->depth_cfg[depth].fbc; if (glsym_glXCreatePixmap) - n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp, - n->fbc, - n->pixmap, + n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp, + n->fbc, + n->pixmap, pixmap_att); else ERR("Try glXCreatePixmap on GLX with no support"); @@ -1483,8 +1483,8 @@ eng_image_native_set(void *data, void *image, void *native) ERR("no target :("); if (glsym_glXQueryDrawable) glsym_glXQueryDrawable(re->win->disp, - n->pixmap, - GLX_TEXTURE_TARGET_EXT, + n->pixmap, + GLX_TEXTURE_TARGET_EXT, &target); } if (target == GLX_TEXTURE_2D_EXT) @@ -1492,13 +1492,13 @@ eng_image_native_set(void *data, void *image, void *native) im->native.target = GL_TEXTURE_2D; im->native.mipmap = re->win->depth_cfg[depth].mipmap; } -# ifdef GL_TEXTURE_RECTANGLE_ARB +# ifdef GL_TEXTURE_RECTANGLE_ARB else if (target == GLX_TEXTURE_RECTANGLE_EXT) { im->native.target = GL_TEXTURE_RECTANGLE_ARB; im->native.mipmap = 0; } -# endif +# endif else { im->native.target = GL_TEXTURE_2D; @@ -1515,11 +1515,11 @@ eng_image_native_set(void *data, void *image, void *native) im->native.func.bind = _native_bind_cb; im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; - + evas_gl_common_image_native_enable(im); } } -# endif +# endif #endif } else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL) @@ -1549,9 +1549,9 @@ eng_image_native_set(void *data, void *image, void *native) im->native.func.bind = _native_bind_cb; im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; - im->native.target = GL_TEXTURE_2D; + im->native.target = GL_TEXTURE_2D; im->native.mipmap = 0; - + // FIXME: need to implement mapping sub texture regions // x, y, w, h for possible texture atlasing @@ -1674,7 +1674,7 @@ eng_image_size_set(void *data, void *image, int w, int h) Render_Engine *re; Evas_GL_Image *im = image; Evas_GL_Image *im_old; - + re = (Render_Engine *)data; if (!im) return NULL; if (im->native.data) @@ -1703,9 +1703,9 @@ eng_image_size_set(void *data, void *image, int w, int h) return image; if (im_old) { - im = evas_gl_common_image_new(re->win->gl_context, w, h, - eng_image_alpha_get(data, image), - eng_image_colorspace_get(data, image)); + im = evas_gl_common_image_new(re->win->gl_context, w, h, + eng_image_alpha_get(data, image), + eng_image_colorspace_get(data, image)); /* evas_common_load_image_data_from_file(im_old->im); if (im_old->im->image->data) @@ -1773,22 +1773,22 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i { Evas_GL_Image *im_new; - im_new = evas_gl_common_image_new_from_copied_data + im_new = evas_gl_common_image_new_from_copied_data (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data, eng_image_alpha_get(data, image), eng_image_colorspace_get(data, image)); - if (!im_new) - { - *image_data = NULL; + if (!im_new) + { + *image_data = NULL; if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - return im; - } - evas_gl_common_image_free(im); - im = im_new; + return im; + } + evas_gl_common_image_free(im); + im = im_new; } - else - evas_gl_common_image_dirty(im, 0, 0, 0, 0); + else + evas_gl_common_image_dirty(im, 0, 0, 0, 0); } *image_data = im->im->image.data; break; @@ -1830,9 +1830,9 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data) im2 = eng_image_new_from_data(data, w, h, image_data, eng_image_alpha_get(data, image), eng_image_colorspace_get(data, image)); - if (!im2) return im; - evas_gl_common_image_free(im); - im = im2; + if (!im2) return im; + evas_gl_common_image_free(im); + im = im2; evas_gl_common_image_dirty(im, 0, 0, 0, 0); return im; } @@ -1849,9 +1849,9 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data) im2 = eng_image_new_from_data(data, w, h, image_data, eng_image_alpha_get(data, image), eng_image_colorspace_get(data, image)); - if (!im2) return im; - evas_gl_common_image_free(im); - im = im2; + if (!im2) return im; + evas_gl_common_image_free(im); + im = im2; } break; case EVAS_COLORSPACE_YCBCR422P601_PL: @@ -1935,7 +1935,7 @@ eng_image_map_draw(void *data, void *context, void *surface, void *image, int np { Evas_GL_Image *gim = image; Render_Engine *re; - + re = (Render_Engine *)data; if (!image) return; eng_window_use(re->win); @@ -1966,7 +1966,7 @@ eng_image_map_draw(void *data, void *context, void *surface, void *image, int np (p[3].col == 0xffffffff)) { int dx, dy, dw, dh; - + dx = p[0].x >> FP; dy = p[0].y >> FP; dw = (p[2].x >> FP) - dx; @@ -1985,7 +1985,7 @@ static void * eng_image_map_surface_new(void *data, int w, int h, int alpha) { Render_Engine *re; - + re = (Render_Engine *)data; return evas_gl_common_image_surface_new(re->win->gl_context, w, h, alpha); } @@ -2015,9 +2015,9 @@ eng_image_cache_flush(void *data) { Render_Engine *re; int tmp_size; - + re = (Render_Engine *)data; - + tmp_size = evas_common_image_get_cache(); evas_common_image_set_cache(0); evas_common_rgba_image_scalecache_flush(); @@ -2029,7 +2029,7 @@ static void eng_image_cache_set(void *data, int bytes) { Render_Engine *re; - + re = (Render_Engine *)data; evas_common_image_set_cache(bytes); evas_common_rgba_image_scalecache_size_set(bytes); @@ -2067,16 +2067,16 @@ eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font, int { // FIXME: put im into context so we can free it static RGBA_Image *im = NULL; - + if (!im) im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); im->cache_entry.w = re->win->w; im->cache_entry.h = re->win->h; evas_common_draw_context_font_ext_set(context, - re->win->gl_context, - evas_gl_font_texture_new, - evas_gl_font_texture_free, - evas_gl_font_texture_draw); + re->win->gl_context, + evas_gl_font_texture_new, + evas_gl_font_texture_free, + evas_gl_font_texture_draw); evas_common_font_draw(im, context, (RGBA_Font *) font, x, y, intl_props); evas_common_draw_context_font_ext_set(context, @@ -2099,7 +2099,7 @@ _set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg) { // Also initialize pixel format here as well... switch(cfg->color_format) - { + { case EVAS_GL_RGB_8: sfc->rt_fmt = GL_RGB; sfc->rt_internal_fmt = GL_RGB; @@ -2109,7 +2109,7 @@ _set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg) sfc->rt_internal_fmt = GL_RGBA; break; case EVAS_GL_RGB_32: - // Only supported on some hw + // Only supported on some hw // Fill it in later... case EVAS_GL_RGBA_32: // Only supported on some hw @@ -2120,7 +2120,7 @@ _set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg) } switch(cfg->depth_bits) - { + { case EVAS_GL_DEPTH_NONE: break; case EVAS_GL_DEPTH_BIT_8: @@ -2140,7 +2140,7 @@ _set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg) } switch(cfg->stencil_bits) - { + { case EVAS_GL_STENCIL_NONE: break; case EVAS_GL_STENCIL_BIT_1: @@ -2159,13 +2159,13 @@ _set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg) return 0; } - // Do Packed Depth24_Stencil8 Later... + // Do Packed Depth24_Stencil8 Later... return 1; } static int -_create_rt_buffers(Render_Engine *data __UNUSED__, +_create_rt_buffers(Render_Engine *data __UNUSED__, Render_Engine_GL_Surface *sfc) { // Render Target texture @@ -2175,7 +2175,7 @@ _create_rt_buffers(Render_Engine *data __UNUSED__, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sfc->w, sfc->h, 0, + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sfc->w, sfc->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindTexture(GL_TEXTURE_2D, 0); @@ -2203,8 +2203,8 @@ _create_rt_buffers(Render_Engine *data __UNUSED__, } static int -_attach_fbo_surface(Render_Engine *data __UNUSED__, - Render_Engine_GL_Surface *sfc, +_attach_fbo_surface(Render_Engine *data __UNUSED__, + Render_Engine_GL_Surface *sfc, Render_Engine_GL_Context *ctx) { int fb_status; @@ -2213,7 +2213,7 @@ _attach_fbo_surface(Render_Engine *data __UNUSED__, glBindFramebuffer(GL_FRAMEBUFFER, ctx->fbo); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sfc->rt_tex, 0); - + // Depth RenderBuffer - Attach it to FBO if (sfc->depth_bits != EVAS_GL_DEPTH_NONE) { @@ -2234,7 +2234,7 @@ _attach_fbo_surface(Render_Engine *data __UNUSED__, // Check FBO for completeness fb_status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - if (fb_status != GL_FRAMEBUFFER_COMPLETE) + if (fb_status != GL_FRAMEBUFFER_COMPLETE) { ERR("FBO not complete!"); return 0; @@ -2248,7 +2248,7 @@ eng_gl_surface_create(void *data, void *config, int w, int h) { Render_Engine *re; Render_Engine_GL_Surface *sfc; - Evas_GL_Config *cfg; + Evas_GL_Config *cfg; int ret; sfc = calloc(1, sizeof(Render_Engine_GL_Surface)); @@ -2277,19 +2277,19 @@ eng_gl_surface_create(void *data, void *config, int w, int h) } // Create Render Target Texture/Buffers if not initialized - if (!sfc->initialized) + if (!sfc->initialized) { // I'm using evas's original context to create the render target texture // This is to prevent awkwardness in using native_surface_get() function // If the rt texture creation is deferred till the context is created and // make_current called, the user can't call native_surface_get() right - // after the surface is created. hence this is done here using evas' context. + // after the surface is created. hence this is done here using evas' context. #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0], re->win->egl_surface[0], re->win->egl_context[0]); #else ret = glXMakeCurrent(re->info->info.display, re->win->win, re->win->context); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); free(sfc); @@ -2297,7 +2297,7 @@ eng_gl_surface_create(void *data, void *config, int w, int h) } // Create Render texture - if (!_create_rt_buffers(re, sfc)) + if (!_create_rt_buffers(re, sfc)) { ERR("_create_rt_buffers() failed."); free(sfc); @@ -2305,12 +2305,12 @@ eng_gl_surface_create(void *data, void *config, int w, int h) } #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) - ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, + ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); #else ret = glXMakeCurrent(re->info->info.display, None, NULL); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); free(sfc); @@ -2335,13 +2335,13 @@ eng_gl_surface_destroy(void *data, void *surface) // I'm using evas's original context to delete the created fbo and texture // This is because the fbo/texture was created in the user created context // but the context can be destroyed already... - // I don't think this is the best way but at least for now this is A WAY. + // I don't think this is the best way but at least for now this is A WAY. #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0], re->win->egl_surface[0], re->win->egl_context[0]); #else ret = glXMakeCurrent(re->info->info.display, re->win->win, re->win->context); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); return 0; @@ -2363,7 +2363,7 @@ eng_gl_surface_destroy(void *data, void *surface) #else ret = glXMakeCurrent(re->info->info.display, None, NULL); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); return 0; @@ -2383,7 +2383,7 @@ eng_gl_context_create(void *data, void *share_context) Render_Engine_GL_Context *share_ctx; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) int context_attrs[3]; -#endif +#endif ctx = calloc(1, sizeof(Render_Engine_GL_Context)); @@ -2407,7 +2407,7 @@ eng_gl_context_create(void *data, void *share_context) share_ctx->context, // Share Context context_attrs); } - else + else { ctx->context = eglCreateContext(re->win->egl_disp, re->win->egl_config, @@ -2415,7 +2415,7 @@ eng_gl_context_create(void *data, void *share_context) context_attrs); } - if (!ctx->context) + if (!ctx->context) { ERR("eglCreateContext() fail. code=%#x", eglGetError()); return NULL; @@ -2429,7 +2429,7 @@ eng_gl_context_create(void *data, void *share_context) share_ctx->context, // Share Context 1); } - else + else { ctx->context = glXCreateContext(re->info->info.display, re->win->visualinfo, @@ -2437,7 +2437,7 @@ eng_gl_context_create(void *data, void *share_context) 1); } - if (!ctx->context) + if (!ctx->context) { ERR("glXCreateContext() fail."); return NULL; @@ -2463,13 +2463,13 @@ eng_gl_context_destroy(void *data, void *context) // 1. Do a make current with the given context #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) - ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0], + ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0], re->win->egl_surface[0], ctx->context); #else - ret = glXMakeCurrent(re->info->info.display, re->win->win, + ret = glXMakeCurrent(re->info->info.display, re->win->win, ctx->context); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); return 0; @@ -2485,7 +2485,7 @@ eng_gl_context_destroy(void *data, void *context) ctx->context = EGL_NO_CONTEXT; - ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, + ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); #else glXDestroyContext(re->info->info.display, ctx->context); @@ -2494,7 +2494,7 @@ eng_gl_context_destroy(void *data, void *context) ret = glXMakeCurrent(re->info->info.display, None, NULL); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); return 0; @@ -2535,7 +2535,7 @@ eng_gl_make_current(void *data, void *surface, void *context) evas_gl_common_context_use(re->win->gl_context); evas_gl_common_context_flush(re->win->gl_context); } -#endif +#endif eng_window_use(NULL); evas_gl_common_context_use(NULL); } @@ -2544,12 +2544,12 @@ eng_gl_make_current(void *data, void *surface, void *context) if ((!sfc) || (!ctx)) { #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) - ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, + ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); #else ret = glXMakeCurrent(re->info->info.display, None, NULL); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); return 0; @@ -2561,20 +2561,20 @@ eng_gl_make_current(void *data, void *surface, void *context) ret = 1; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if ((eglGetCurrentContext() != ctx->context)) - ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0], + ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0], re->win->egl_surface[0], ctx->context); #else if (glXGetCurrentContext() != ctx->context) ret = glXMakeCurrent(re->info->info.display, re->win->win, ctx->context); #endif - if (!ret) + if (!ret) { ERR("xxxMakeCurrent() failed!"); return 0; } // Create FBO if not already created - if (!ctx->initialized) + if (!ctx->initialized) { glGenFramebuffers(1, &ctx->fbo); ctx->initialized = 1; @@ -2583,7 +2583,7 @@ eng_gl_make_current(void *data, void *surface, void *context) // Attach FBO if it hasn't been attached or if surface changed if ((!sfc->fbo_attached) || (ctx != sfc->current_ctx)) { - if (!_attach_fbo_surface(re, sfc, ctx)) + if (!_attach_fbo_surface(re, sfc, ctx)) { ERR("_attach_fbo_surface() failed."); return 0; @@ -2591,7 +2591,7 @@ eng_gl_make_current(void *data, void *surface, void *context) sfc->fbo_attached = 1; } - // Set the current surface/context + // Set the current surface/context ctx->current_sfc = sfc; sfc->current_ctx = ctx; @@ -2617,7 +2617,7 @@ eng_gl_proc_address_get(void *data __UNUSED__, const char *name) #endif } -static int +static int eng_gl_native_surface_get(void *data, void *surface, void *native_surface) { Render_Engine *re; @@ -2627,7 +2627,7 @@ eng_gl_native_surface_get(void *data, void *surface, void *native_surface) re = (Render_Engine *)data; sfc = (Render_Engine_GL_Surface*)surface; ns = (Evas_Native_Surface*)native_surface; - + ns->type = EVAS_NATIVE_SURFACE_OPENGL; ns->version = EVAS_NATIVE_SURFACE_VERSION; ns->data.opengl.texture_id = sfc->rt_tex; @@ -2637,7 +2637,7 @@ eng_gl_native_surface_get(void *data, void *surface, void *native_surface) ns->data.opengl.y = 0; ns->data.opengl.w = sfc->w; ns->data.opengl.h = sfc->h; - + return 1; } @@ -2718,7 +2718,7 @@ evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const #endif } -#endif +#endif static void * eng_gl_api_get(void *data) @@ -2874,9 +2874,9 @@ eng_gl_api_get(void *data) // Override functions wrapped by Evas_GL #define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_) - ORD(glBindFramebuffer); - ORD(glBindRenderbuffer); - + ORD(glBindFramebuffer); + ORD(glBindRenderbuffer); + // GLES2.0 API compat on top of desktop gl ORD(glClearDepthf); ORD(glDepthRangef); @@ -2885,7 +2885,7 @@ eng_gl_api_get(void *data) ORD(glShaderBinary); #undef ORD -#endif +#endif return &gl_funcs; } @@ -2894,7 +2894,7 @@ static int eng_image_load_error_get(void *data __UNUSED__, void *image) { Evas_GL_Image *im; - + if (!image) return EVAS_LOAD_ERROR_NONE; im = image; return im->im->cache_entry.load_error; @@ -2978,17 +2978,17 @@ module_open(Evas_Module *em) ORD(image_filtered_save); ORD(image_filtered_free); #endif - + ORD(font_draw); - + ORD(image_scale_hint_set); ORD(image_scale_hint_get); ORD(image_stride_get); - + ORD(image_map_draw); ORD(image_map_surface_new); ORD(image_map_surface_free); - + ORD(image_content_hint_set); ORD(image_content_hint_get); @@ -3005,9 +3005,9 @@ module_open(Evas_Module *em) ORD(gl_native_surface_get); ORD(gl_api_get); - + ORD(image_load_error_get); - + /* now advertise out own api */ em->functions = (void *)(&func); return 1; diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_engine.h b/legacy/evas/src/modules/engines/gl_x11/evas_engine.h index b7163c2e20..4f62c580c9 100644 --- a/legacy/evas/src/modules/engines/gl_x11/evas_engine.h +++ b/legacy/evas/src/modules/engines/gl_x11/evas_engine.h @@ -92,7 +92,7 @@ struct _Evas_GL_X11_Window EGLSurface egl_surface[1]; EGLConfig egl_config; EGLDisplay egl_disp; -#else +#else GLXContext context; GLXWindow glxwin; struct { @@ -102,7 +102,7 @@ struct _Evas_GL_X11_Window int mipmap; unsigned char yinvert : 1; } depth_cfg[33]; // config for all 32 possible depths! - + struct { unsigned int loose_binding : 1; } detected; diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c b/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c index c9bc959020..72394f8820 100644 --- a/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c +++ b/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c @@ -41,15 +41,15 @@ eng_window_new(Display *disp, int config_attrs[40]; int major_version, minor_version; int num_config, n = 0; -#endif +#endif XVisualInfo *vi_use; const GLubyte *vendor, *renderer, *version; - + if (!_evas_gl_x11_vi) return NULL; - + gw = calloc(1, sizeof(Evas_GL_X11_Window)); if (!gw) return NULL; - + win_count++; gw->disp = disp; gw->win = win; @@ -76,11 +76,11 @@ eng_window_new(Display *disp, { vi_use = _evas_gl_x11_rgba_vi; } -#endif -#endif +#endif +#endif } gw->visualinfo = vi_use; - + // EGL / GLES #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION; @@ -137,7 +137,7 @@ eng_window_new(Display *disp, config_attrs[n++] = 1; config_attrs[n++] = EGL_BLUE_SIZE; config_attrs[n++] = 1; -// FIXME: end n900 breakage +// FIXME: end n900 breakage #endif if (gw->alpha) { @@ -155,7 +155,7 @@ eng_window_new(Display *disp, config_attrs[n++] = 0; config_attrs[n++] = EGL_NONE; # endif - + gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp)); if (!gw->egl_disp) { @@ -176,7 +176,7 @@ eng_window_new(Display *disp, eng_window_free(gw); return NULL; } - + num_config = 0; if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config, 1, &num_config) || (num_config != 1)) @@ -196,7 +196,7 @@ eng_window_new(Display *disp, return NULL; } if (context == EGL_NO_CONTEXT) - context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL, + context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL, context_attrs); gw->egl_context[0] = context; if (gw->egl_context[0] == EGL_NO_CONTEXT) @@ -205,8 +205,8 @@ eng_window_new(Display *disp, eng_window_free(gw); return NULL; } - if (eglMakeCurrent(gw->egl_disp, - gw->egl_surface[0], + if (eglMakeCurrent(gw->egl_disp, + gw->egl_surface[0], gw->egl_surface[0], gw->egl_context[0]) == EGL_FALSE) { @@ -227,18 +227,18 @@ eng_window_new(Display *disp, fprintf(stderr, "renderer: %s\n", renderer); fprintf(stderr, "version: %s\n", version); } -// GLX +// GLX #else if (!context) { -#ifdef NEWGL +#ifdef NEWGL if (indirect) - context = glXCreateNewContext(gw->disp, fbconf, - GLX_RGBA_TYPE, NULL, + context = glXCreateNewContext(gw->disp, fbconf, + GLX_RGBA_TYPE, NULL, GL_TRUE); else - context = glXCreateNewContext(gw->disp, fbconf, - GLX_RGBA_TYPE, NULL, + context = glXCreateNewContext(gw->disp, fbconf, + GLX_RGBA_TYPE, NULL, GL_FALSE); #else if (indirect) @@ -251,12 +251,12 @@ eng_window_new(Display *disp, if ((gw->alpha) && (!rgba_context)) { if (indirect) - rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf, - GLX_RGBA_TYPE, context, + rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf, + GLX_RGBA_TYPE, context, GL_TRUE); else - rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf, - GLX_RGBA_TYPE, context, + rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf, + GLX_RGBA_TYPE, context, GL_FALSE); } if (gw->alpha) @@ -268,10 +268,10 @@ eng_window_new(Display *disp, eng_window_free(gw); return NULL; } - + if (gw->alpha) gw->context = rgba_context; else gw->context = context; -#else +#else gw->context = context; #endif @@ -288,7 +288,7 @@ eng_window_new(Display *disp, if (gw->glxwin) { - if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, + if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, gw->context)) { printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); @@ -305,7 +305,7 @@ eng_window_new(Display *disp, return NULL; } } - + // FIXME: move this up to context creation vendor = glGetString(GL_VENDOR); @@ -363,7 +363,7 @@ eng_window_new(Display *disp, // version: 2.0 Mesa 7.8.2 // or // vendor: Tungsten Graphics, Inc - // renderer: Mesa DRI Mobile IntelĀ® GM45 Express Chipset GEM 20100330 DEVELOPMENT + // renderer: Mesa DRI Mobile IntelĀ® GM45 Express Chipset GEM 20100330 DEVELOPMENT // version: 2.1 Mesa 7.9-devel // or (bad - software renderer) // vendor: Mesa Project @@ -373,7 +373,7 @@ eng_window_new(Display *disp, // vendor: VMware, Inc. // renderer: Gallium 0.4 on softpipe // version: 2.1 Mesa 7.9-devel - + if (strstr((const char *)vendor, "Mesa Project")) { if (strstr((const char *)renderer, "Software Rasterizer")) @@ -396,12 +396,12 @@ eng_window_new(Display *disp, { int v1 = 0, v2 = 0, v3 = 0; - if (sscanf((const char *)version, + if (sscanf((const char *)version, "%*s %*s %i.%i.%i", &v1, &v2, &v3) != 3) { v1 = v2 = v3 = 0; - if (sscanf((const char *)version, + if (sscanf((const char *)version, "%*s %*s %i.%i", &v1, &v2) != 2) v1 = 0; @@ -415,7 +415,7 @@ eng_window_new(Display *disp, { // noothing yet. add more cases and options over time } - + fbc = glXGetFBConfigs(gw->disp, screen, &num); if (!fbc) { @@ -431,22 +431,22 @@ eng_window_new(Display *disp, int vd; int alph, val, dbuf, stencil, tdepth; int rgba; - + vi = glXGetVisualFromFBConfig(gw->disp, fbc[j]); if (!vi) continue; vd = vi->depth; XFree(vi); - + if (vd != i) continue; - + glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val); - + if ((val != i) && ((val - alph) != i)) continue; - + val = 0; rgba = 0; - + if (i == 32) { glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val); @@ -463,32 +463,32 @@ eng_window_new(Display *disp, if (!val) continue; gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGB_EXT; } - + dbuf = 0x7fff; glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val); if (val > dbuf) continue; dbuf = val; - + stencil = 0x7fff; glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val); if (val > stencil) continue; stencil = val; - + tdepth = 0x7fff; glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val); if (val > tdepth) continue; tdepth = val; - + glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val); if (val < 0) continue; gw->depth_cfg[i].mipmap = val; - + glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val); gw->depth_cfg[i].yinvert = val; - + glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val); gw->depth_cfg[i].tex_target = val; - + gw->depth_cfg[i].fbc = fbc[j]; } } @@ -499,7 +499,7 @@ eng_window_new(Display *disp, } } #endif - + gw->gl_context = evas_gl_common_context_new(); if (!gw->gl_context) { @@ -508,7 +508,7 @@ eng_window_new(Display *disp, } #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) gw->gl_context->egldisp = gw->egl_disp; -#endif +#endif eng_window_use(gw); evas_gl_common_context_resize(gw->gl_context, w, h, rot); gw->surf = 1; @@ -557,15 +557,15 @@ void eng_window_use(Evas_GL_X11_Window *gw) { Eina_Bool force_use = EINA_FALSE; - + #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if (_evas_gl_x11_window) { - if ((eglGetCurrentContext() != + if ((eglGetCurrentContext() != _evas_gl_x11_window->egl_context[0]) || - (eglGetCurrentSurface(EGL_READ) != + (eglGetCurrentSurface(EGL_READ) != _evas_gl_x11_window->egl_surface[0]) || - (eglGetCurrentSurface(EGL_DRAW) != + (eglGetCurrentSurface(EGL_DRAW) != _evas_gl_x11_window->egl_surface[0])) force_use = EINA_TRUE; } @@ -575,7 +575,7 @@ eng_window_use(Evas_GL_X11_Window *gw) if (glXGetCurrentContext() != _evas_gl_x11_window->context) force_use = EINA_TRUE; } -#endif +#endif if ((_evas_gl_x11_window != gw) || (force_use)) { if (_evas_gl_x11_window) @@ -590,19 +590,19 @@ eng_window_use(Evas_GL_X11_Window *gw) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if (gw->egl_surface[0] != EGL_NO_SURFACE) { - if (eglMakeCurrent(gw->egl_disp, - gw->egl_surface[0], + if (eglMakeCurrent(gw->egl_disp, + gw->egl_surface[0], gw->egl_surface[0], gw->egl_context[0]) == EGL_FALSE) { ERR("eglMakeCurrent() failed!"); } } -// GLX +// GLX #else if (gw->glxwin) { - if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, + if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, gw->context)) { ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); @@ -667,8 +667,8 @@ eng_window_resurf(Evas_GL_X11_Window *gw) (unsigned int)gw->win, eglGetError()); return; } - if (eglMakeCurrent(gw->egl_disp, - gw->egl_surface[0], + if (eglMakeCurrent(gw->egl_disp, + gw->egl_surface[0], gw->egl_surface[0], gw->egl_context[0]) == EGL_FALSE) { @@ -680,18 +680,18 @@ eng_window_resurf(Evas_GL_X11_Window *gw) gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL); else gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL); - if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, + if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, gw->context)) { ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); } -#else +#else if (!glXMakeCurrent(gw->disp, gw->win, gw->context)) { ERR("glXMakeCurrent(%p, 0x%x, %p) failed", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context); } -#endif -#endif +#endif +#endif gw->surf = 1; } @@ -703,7 +703,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) if (!_evas_gl_x11_vi) { int alpha; - + // EGL / GLES #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) for (alpha = 0; alpha < 2; alpha++) @@ -715,7 +715,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) XVisualInfo *xvi, vi_in; int nvi, i; XRenderPictFormat *fmt; - + vi_in.screen = einfo->info.screen; vi_in.depth = 32; vi_in.class = TrueColor; @@ -726,16 +726,16 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) if (xvi) { for (i = 0; i < nvi; i++) - { - fmt = XRenderFindVisualFormat(einfo->info.display, + { + fmt = XRenderFindVisualFormat(einfo->info.display, xvi[i].visual); - if ((fmt->type == PictTypeDirect) && + if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask)) { - _evas_gl_x11_rgba_vi = + _evas_gl_x11_rgba_vi = calloc(1, sizeof(XVisualInfo)); if (_evas_gl_x11_rgba_vi) - memcpy(_evas_gl_x11_rgba_vi, + memcpy(_evas_gl_x11_rgba_vi, &(xvi[i]), sizeof(XVisualInfo)); break; } @@ -758,7 +758,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) int config_attrs[40]; GLXFBConfig *configs = NULL, config = 0; int i, num; - + i = 0; config_attrs[i++] = GLX_DRAWABLE_TYPE; config_attrs[i++] = GLX_WINDOW_BIT; @@ -793,8 +793,8 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) config_attrs[i++] = GLX_TRANSPARENT_TYPE; config_attrs[i++] = GLX_NONE;//GLX_NONE;//GLX_TRANSPARENT_INDEX//GLX_TRANSPARENT_RGB; config_attrs[i++] = 0; - - configs = glXChooseFBConfig(einfo->info.display, + + configs = glXChooseFBConfig(einfo->info.display, einfo->info.screen, config_attrs, &num); if ((!configs) || (num < 1)) @@ -806,8 +806,8 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) { XVisualInfo *visinfo; XRenderPictFormat *format = NULL; - - visinfo = glXGetVisualFromFBConfig(einfo->info.display, + + visinfo = glXGetVisualFromFBConfig(einfo->info.display, configs[i]); if (!visinfo) continue; if (!alpha) @@ -849,11 +849,11 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) // EGL / GLES #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual; -#else +#else # ifdef NEWGL if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual; # endif -#endif +#endif } return _evas_gl_x11_vi->visual; } @@ -868,24 +868,24 @@ eng_best_colormap_get(Evas_Engine_Info_GL_X11 *einfo) if (einfo->info.destination_alpha) { if (!_evas_gl_x11_rgba_cmap) - _evas_gl_x11_rgba_cmap = + _evas_gl_x11_rgba_cmap = XCreateColormap(einfo->info.display, RootWindow(einfo->info.display, einfo->info.screen), - _evas_gl_x11_rgba_vi->visual, + _evas_gl_x11_rgba_vi->visual, 0); return _evas_gl_x11_rgba_cmap; } if (!_evas_gl_x11_cmap) - _evas_gl_x11_cmap = + _evas_gl_x11_cmap = XCreateColormap(einfo->info.display, RootWindow(einfo->info.display, einfo->info.screen), - _evas_gl_x11_vi->visual, + _evas_gl_x11_vi->visual, 0); return _evas_gl_x11_cmap; } - + int eng_best_depth_get(Evas_Engine_Info_GL_X11 *einfo) {