Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Enlightenment SVN <no-reply@en...> - 2009-10-13 09:40:53
|
Log: more work putting shared bits in shared. but context seems to be a big problem. :( Author: raster Date: 2009-10-13 02:40:39 -0700 (Tue, 13 Oct 2009) New Revision: 43048 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_font.c trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-10-13 03:12:32 UTC (rev 43047) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-10-13 09:40:39 UTC (rev 43048) @@ -48,6 +48,7 @@ typedef struct _Evas_GL_Program Evas_GL_Program; typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source; +typedef struct _Evas_GL_Shared Evas_GL_Shared; typedef struct _Evas_GL_Context Evas_GL_Context; typedef struct _Evas_GL_Texture_Pool Evas_GL_Texture_Pool; typedef struct _Evas_GL_Texture Evas_GL_Texture; @@ -73,31 +74,56 @@ int bin_size; }; +struct _Evas_GL_Shared +{ + Eina_List *images; + + struct { + GLint max_texture_units; + GLint max_texture_size; + Eina_Bool tex_npo2 : 1; + Eina_Bool tex_rect : 1; + } info; + + struct { + Eina_List *whole; + Eina_List *atlas[33][3]; + } tex; + + struct { + Evas_GL_Program rect, img, font, yuv; + } shader; + int references; + int w, h; +}; + struct _Evas_GL_Context { int references; int w, h; RGBA_Draw_Context *dc; + Evas_GL_Shared *shared; +/* Eina_List *images; struct { Eina_List *whole; Eina_List *atlas[33][3]; } tex; - struct { GLint max_texture_units; GLint max_texture_size; Eina_Bool tex_npo2 : 1; Eina_Bool tex_rect : 1; } info; + */ struct { int x, y, w, h; Eina_Bool active : 1; } clip; struct { - Evas_GL_Program rect, img, font, yuv; +/* Evas_GL_Program rect, img, font, yuv;*/ GLuint cur_prog; GLuint cur_tex, cur_texu, cur_texv; Eina_Bool smooth : 1; @@ -121,7 +147,6 @@ struct { Eina_Bool size : 1; } change; - Eina_Bool checked : 1; }; struct _Evas_GL_Texture_Pool @@ -141,6 +166,7 @@ Evas_GL_Context *gc; Evas_GL_Texture_Pool *pt, *ptu, *ptv; int x, y, w, h; + double sx1, sy1, sx2, sy2; int references; }; Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-10-13 03:12:32 UTC (rev 43047) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-10-13 09:40:39 UTC (rev 43048) @@ -1,9 +1,9 @@ #include "evas_gl_private.h" - -static void _evas_gl_common_viewport_set(Evas_GL_Context *gc); + static void shader_array_flush(Evas_GL_Context *gc); static Evas_GL_Context *_evas_gl_common_context = NULL; +static Evas_GL_Shared *shared = NULL; void glerr(const char *file, const char *func, int line, const char *op) @@ -32,16 +32,76 @@ } } +static void +matrix_ident(GLfloat *m) +{ + memset(m, 0, 16 * sizeof(GLfloat)); + m[0] = m[5] = m[10] = m[15] = 1.0; +} + +static void +matrix_ortho(GLfloat *m, GLfloat l, GLfloat r, GLfloat t, GLfloat b, GLfloat near, GLfloat far) +{ + m[0] = 2.0 / (r - l); + m[1] = m[2] = m[3] = 0.0; + + m[4] = 0.0; + m[5] = 2.0 / (t - b); + m[6] = m[7] = 0.0; + + m[8] = m[9] = 0.0; + m[10] = -(2.0 / (far - near)); + m[11] = 0.0; + + m[12] = -((r + l)/(r - l)); + m[13] = -((t + b)/(t - b)); + m[14] = -((near + far)/(far - near)); + m[15] = 1.0; +} + +static void +_evas_gl_common_viewport_set(Evas_GL_Context *gc) +{ + GLfloat proj[16]; + + if ((!gc->change.size) || + ((gc->shared->w == gc->w) && (gc->shared->h == gc->h))) + return; + gc->shared->w = gc->w; + gc->shared->h = gc->h; + gc->change.size = 0; + + glViewport(0, 0, gc->w, gc->h); + + matrix_ident(proj); + matrix_ortho(proj, 0, gc->w, 0, gc->h, -1.0, 1.0); + + glUseProgram(gc->shared->shader.rect.prog); + glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.rect.prog, "mvp"), 1, + GL_FALSE, proj); + glUseProgram(gc->shared->shader.img.prog); + glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img.prog, "mvp"), 1, + GL_FALSE, proj); + glUseProgram(gc->shared->shader.font.prog); + glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.font.prog, "mvp"), 1, + GL_FALSE, proj); + glUseProgram(gc->shared->shader.yuv.prog); + glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.yuv.prog, "mvp"), 1, + GL_FALSE, proj); +} + Evas_GL_Context * evas_gl_common_context_new(void) { Evas_GL_Context *gc; +#if 1 if (_evas_gl_common_context) { _evas_gl_common_context->references++; return _evas_gl_common_context; } +#endif gc = calloc(1, sizeof(Evas_GL_Context)); if (!gc) return NULL; @@ -49,37 +109,38 @@ _evas_gl_common_context = gc; - if (!gc->checked) + if (!shared) { GLint linked; unsigned int pixel = 0xffffffff; const GLubyte *ext; - + + shared = calloc(1, sizeof(Evas_GL_Shared)); ext = glGetString(GL_EXTENSIONS); if (ext) { fprintf(stderr, "EXT:\n%s\n", ext); if ((strstr(ext, "GL_ARB_texture_non_power_of_two")) || (strstr(ext, "OES_texture_npot"))) - gc->info.tex_npo2 = 1; + shared->info.tex_npo2 = 1; if ((strstr(ext, "GL_NV_texture_rectangle")) || (strstr(ext, "GL_EXT_texture_rectangle"))) - gc->info.tex_rect = 1; + shared->info.tex_rect = 1; } glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, - &(gc->info.max_texture_units)); + &(shared->info.max_texture_units)); glGetIntegerv(GL_MAX_TEXTURE_SIZE, - &(gc->info.max_texture_size)); + &(shared->info.max_texture_size)); fprintf(stderr, "max tex size %ix%i\n" "max units %i\n" "non-power-2 tex %i\n" "rect tex %i\n" , - gc->info.max_texture_size, gc->info.max_texture_size, - gc->info.max_texture_units, - (int)gc->info.tex_npo2, - (int)gc->info.tex_rect + shared->info.max_texture_size, shared->info.max_texture_size, + shared->info.max_texture_units, + (int)shared->info.tex_npo2, + (int)shared->info.tex_rect ); glDisable(GL_DEPTH_TEST); @@ -101,29 +162,32 @@ glEnableVertexAttribArray(SHAD_COLOR); glEnableVertexAttribArray(SHAD_TEXUV); - evas_gl_common_shader_program_init(&(gc->shader.rect), + evas_gl_common_shader_program_init(&(shared->shader.rect), &(shader_rect_vert_src), &(shader_rect_frag_src), "rect"); - evas_gl_common_shader_program_init(&(gc->shader.img), + evas_gl_common_shader_program_init(&(shared->shader.img), &(shader_img_vert_src), &(shader_img_frag_src), "img"); - evas_gl_common_shader_program_init(&(gc->shader.font), + evas_gl_common_shader_program_init(&(shared->shader.font), &(shader_font_vert_src), &(shader_font_frag_src), "font"); #if defined (GLES_VARIETY_S3C6410) - evas_gl_common_shader_program_init(&(gc->shader.yuv), + evas_gl_common_shader_program_init(&(shared->shader.yuv), &(shader_img_vert_src), &(shader_img_frag_src), "yuv"); #else - evas_gl_common_shader_program_init(&(gc->shader.yuv), + evas_gl_common_shader_program_init(&(shared->shader.yuv), &(shader_yuv_vert_src), &(shader_yuv_frag_src), "yuv"); - glUseProgram(gc->shader.yuv.prog); + glUseProgram(shared->shader.yuv.prog); + glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "tex"), 0); + glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texu"), 1); + glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texv"), 2); #endif // in shader: // uniform sampler2D tex[8]; @@ -132,13 +196,10 @@ // GLuint texes[8]; // GLint loc = glGetUniformLocation(prog, "tex"); // glUniform1iv(loc, 8, texes); - - glUniform1i(glGetUniformLocation(gc->shader.yuv.prog, "tex"), 0); - glUniform1i(glGetUniformLocation(gc->shader.yuv.prog, "texu"), 1); - glUniform1i(glGetUniformLocation(gc->shader.yuv.prog, "texv"), 2); - _evas_gl_common_viewport_set(gc); - gc->checked = 1; } + gc->shared = shared; + gc->shared->references++; + _evas_gl_common_viewport_set(gc); return gc; } @@ -150,23 +211,29 @@ gc->references--; if (gc->references > 0) return; - while (gc->images) + gc->shared->references--; + if (gc->shared->references == 0) { - evas_gl_common_image_free(gc->images->data); - } - while (gc->tex.whole) - { - evas_gl_common_texture_free(gc->tex.whole->data); - } - for (i = 0; i < 33; i++) - { - for (j = 0; j < 3; j++) + while (gc->shared->images) { - while (gc->tex.atlas[i][j]) - evas_gl_common_texture_free(gc->tex.atlas[i][j]); + evas_gl_common_image_free(gc->shared->images->data); } + while (gc->shared->tex.whole) + { + evas_gl_common_texture_free(gc->shared->tex.whole->data); + } + for (i = 0; i < 33; i++) + { + for (j = 0; j < 3; j++) + { + while (gc->shared->tex.atlas[i][j]) + evas_gl_common_texture_free(gc->shared->tex.atlas[i][j]); + } + } + free(gc->shared); + shared = NULL; + // FIXME: free shader.rect.prog etc. etc. } - // FIXME: free shader.rect.prog etc. etc. free(gc->array.vertex); free(gc->array.color); @@ -181,8 +248,9 @@ void evas_gl_common_context_use(Evas_GL_Context *gc) { - if (_evas_gl_common_context == gc) return; -// _evas_gl_common_context = gc; +// if (_evas_gl_common_context == gc) return; + _evas_gl_common_context = gc; + _evas_gl_common_viewport_set(gc); } void @@ -247,13 +315,13 @@ if (a < 255) blend = 1; if ((gc->shader.cur_tex != 0) - || (gc->shader.cur_prog != gc->shader.rect.prog) + || (gc->shader.cur_prog != gc->shared->shader.rect.prog) || (gc->shader.blend != blend) ) { shader_array_flush(gc); gc->shader.cur_tex = 0; - gc->shader.cur_prog = gc->shader.rect.prog; + gc->shader.cur_prog = gc->shared->shader.rect.prog; gc->shader.blend = blend; } @@ -297,14 +365,14 @@ if (a < 255) blend = 1; if ((gc->shader.cur_tex != tex->pt->texture) - || (gc->shader.cur_prog != gc->shader.img.prog) + || (gc->shader.cur_prog != gc->shared->shader.img.prog) || (gc->shader.smooth != smooth) || (gc->shader.blend != blend) ) { shader_array_flush(gc); gc->shader.cur_tex = tex->pt->texture; - gc->shader.cur_prog = gc->shader.img.prog; + gc->shader.cur_prog = gc->shared->shader.img.prog; gc->shader.smooth = smooth; gc->shader.blend = blend; } @@ -353,14 +421,14 @@ GLfloat rr, gg, bb, aa, tx1, tx2, ty1, ty2; if ((gc->shader.cur_tex != tex->pt->texture) - || (gc->shader.cur_prog != gc->shader.font.prog) + || (gc->shader.cur_prog != gc->shared->shader.font.prog) || (gc->shader.smooth != 0) || (gc->shader.blend != 1) ) { shader_array_flush(gc); gc->shader.cur_tex = tex->pt->texture; - gc->shader.cur_prog = gc->shader.font.prog; + gc->shader.cur_prog = gc->shared->shader.font.prog; gc->shader.smooth = 0; gc->shader.blend = 1; } @@ -370,10 +438,20 @@ gc->array.num += 6; _evas_gl_common_context_array_alloc(gc); - tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; - ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h; - tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; - ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; + if (sw == 0.0) + { + tx1 = tex->sx1; + ty1 = tex->sy1; + tx2 = tex->sx2; + ty2 = tex->sy2; + } + else + { + tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; + ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h; + tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; + ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; + } PUSH_VERTEX(x , y , 0); PUSH_VERTEX(x + w, y , 0); @@ -413,7 +491,7 @@ if (a < 255) blend = 1; if ((gc->shader.cur_tex != tex->pt->texture) - || (gc->shader.cur_prog != gc->shader.yuv.prog) + || (gc->shader.cur_prog != gc->shared->shader.yuv.prog) || (gc->shader.smooth != smooth) || (gc->shader.blend != blend) ) @@ -422,7 +500,7 @@ gc->shader.cur_tex = tex->pt->texture; gc->shader.cur_texu = tex->ptu->texture; gc->shader.cur_texv = tex->ptv->texture; - gc->shader.cur_prog = gc->shader.yuv.prog; + gc->shader.cur_prog = gc->shared->shader.yuv.prog; gc->shader.smooth = smooth; gc->shader.blend = blend; } @@ -578,57 +656,3 @@ gc->array.num = 0; gc->array.alloc = 0; } - -static void -matrix_ident(GLfloat *m) -{ - memset(m, 0, 16 * sizeof(GLfloat)); - m[0] = m[5] = m[10] = m[15] = 1.0; -} - -static void -matrix_ortho(GLfloat *m, GLfloat l, GLfloat r, GLfloat t, GLfloat b, GLfloat near, GLfloat far) -{ - m[0] = 2.0 / (r - l); - m[1] = m[2] = m[3] = 0.0; - - m[4] = 0.0; - m[5] = 2.0 / (t - b); - m[6] = m[7] = 0.0; - - m[8] = m[9] = 0.0; - m[10] = -(2.0 / (far - near)); - m[11] = 0.0; - - m[12] = -((r + l)/(r - l)); - m[13] = -((t + b)/(t - b)); - m[14] = -((near + far)/(far - near)); - m[15] = 1.0; -} - -static void -_evas_gl_common_viewport_set(Evas_GL_Context *gc) -{ - GLfloat proj[16]; - - if (!gc->change.size) return; - gc->change.size = 0; - - glViewport(0, 0, gc->w, gc->h); - - matrix_ident(proj); - matrix_ortho(proj, 0, gc->w, 0, gc->h, -1.0, 1.0); - - glUseProgram(gc->shader.rect.prog); - glUniformMatrix4fv(glGetUniformLocation(gc->shader.rect.prog, "mvp"), 1, - GL_FALSE, proj); - glUseProgram(gc->shader.img.prog); - glUniformMatrix4fv(glGetUniformLocation(gc->shader.img.prog, "mvp"), 1, - GL_FALSE, proj); - glUseProgram(gc->shader.font.prog); - glUniformMatrix4fv(glGetUniformLocation(gc->shader.font.prog, "mvp"), 1, - GL_FALSE, proj); - glUseProgram(gc->shader.yuv.prog); - glUniformMatrix4fv(glGetUniformLocation(gc->shader.yuv.prog, "mvp"), 1, - GL_FALSE, proj); -} Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_font.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_font.c 2009-10-13 03:12:32 UTC (rev 43047) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_font.c 2009-10-13 09:40:39 UTC (rev 43048) @@ -19,8 +19,7 @@ j = fg->glyph_out->bitmap.pitch; if (j < w) j = w; - /* bug bug! glTexSubImage2D need a multiple of 4 pixels horizontally! :( */ - nw = ((w + 3) / 4 ) * 4; + nw = w; ndata = alloca(nw *h); if (!ndata) return NULL; if (fg->glyph_out->bitmap.num_grays == 256) @@ -82,6 +81,10 @@ // fh = h; fh = fg->fi->max_h; tex = evas_gl_common_texture_alpha_new(gc, ndata, w, h, fh); + tex->sx1 = ((double)(tex->x)) / (double)tex->pt->w; + tex->sy1 = ((double)(tex->y)) / (double)tex->pt->h; + tex->sx2 = ((double)(tex->x + tex->w)) / (double)tex->pt->w; + tex->sy2 = ((double)(tex->y + tex->h)) / (double)tex->pt->h; return tex; } @@ -129,7 +132,8 @@ if ((nx == x) && (ny == y) && (nw == tex->w) && (nh == tex->h)) { evas_gl_common_context_font_push(gc, tex, - sx, sy, sw, sh, + 0.0, 0.0, 0.0, 0.0, +// sx, sy, sw, sh, x, y, tex->w, tex->h, r, g, b, a); return; @@ -146,7 +150,8 @@ else { evas_gl_common_context_font_push(gc, tex, - sx, sy, sw, sh, + 0.0, 0.0, 0.0, 0.0, +// sx, sy, sw, sh, x, y, tex->w, tex->h, r, g, b, a); } @@ -174,7 +179,8 @@ if ((nx == x) && (ny == y) && (nw == tex->w) && (nh == tex->h)) { evas_gl_common_context_font_push(gc, tex, - sx, sy, sw, sh, + 0.0, 0.0, 0.0, 0.0, +// sx, sy, sw, sh, x, y, tex->w, tex->h, r, g, b, a); continue; Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2009-10-13 03:12:32 UTC (rev 43047) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2009-10-13 09:40:39 UTC (rev 43048) @@ -10,13 +10,13 @@ im_im = evas_common_load_image_from_file(file, key, lo); if (!im_im) return NULL; - EINA_LIST_FOREACH(gc->images, l, im) + EINA_LIST_FOREACH(gc->shared->images, l, im) { if (im->im == im_im) { evas_cache_image_drop(&im_im->cache_entry); - gc->images = eina_list_remove_list(gc->images, l); - gc->images = eina_list_prepend(gc->images, im); + gc->shared->images = eina_list_remove_list(gc->shared->images, l); + gc->shared->images = eina_list_prepend(gc->shared->images, im); im->references++; return im; } @@ -31,7 +31,7 @@ im->cached = 1; im->cs.space = EVAS_COLORSPACE_ARGB8888; if (lo) im->load_opts = *lo; - gc->images = eina_list_prepend(gc->images, im); + gc->shared->images = eina_list_prepend(gc->shared->images, im); return im; } @@ -41,14 +41,14 @@ Evas_GL_Image *im; Eina_List *l; - EINA_LIST_FOREACH(gc->images, l, im) + EINA_LIST_FOREACH(gc->shared->images, l, im) { if (((void *)(im->im->image.data) == (void *)data) && (im->im->cache_entry.w == w) && (im->im->cache_entry.h == h)) { - gc->images = eina_list_remove_list(gc->images, l); - gc->images = eina_list_prepend(gc->images, im); + gc->shared->images = eina_list_remove_list(gc->shared->images, l); + gc->shared->images = eina_list_prepend(gc->shared->images, im); im->references++; return im; } @@ -82,7 +82,7 @@ } /* im->cached = 1; - gc->images = eina_list_prepend(gc->images, im); + gc->shared->images = eina_list_prepend(gc->shared->images, im); */ return im; } @@ -171,7 +171,7 @@ { if (!im->cs.no_free) free(im->cs.data); } - if (im->cached) im->gc->images = eina_list_remove(im->gc->images, im); + if (im->cached) im->gc->shared->images = eina_list_remove(im->gc->shared->images, im); if (im->im) evas_cache_image_drop(&im->im->cache_entry); if (im->tex) evas_gl_common_texture_free(im->tex); free(im); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2009-10-13 03:12:32 UTC (rev 43047) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2009-10-13 09:40:39 UTC (rev 43048) @@ -18,8 +18,8 @@ unsigned int n; // disable - has a bug somewhere -// if (gc->info.tex_npo2) return; - /*if (gc->info.tex_rect) return;*/ +// if (gc->shared->info.tex_npo2) return; + /*if (gc->shared->info.tex_rect) return;*/ *w = _nearest_pow2(*w); *h = _nearest_pow2(*h); } @@ -28,7 +28,7 @@ _tex_round_slot(Evas_GL_Context *gc, int h) { // disable. has a bug somewhere -// if (!gc->info.tex_npo2) +// if (!gc->shared->info.tex_npo2) h = _nearest_pow2(h); return (h + 15) >> 4; } @@ -132,7 +132,7 @@ if ((w > 512) || (h > 512)) { pt = _pool_tex_new(gc, w + 2, h + 1, format); - gc->tex.whole = eina_list_prepend(gc->tex.whole, pt); + gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, pt); pt->slot = -1; pt->fslot = -1; pt->whole = 1; @@ -144,19 +144,19 @@ th = _tex_round_slot(gc, h); th2 = _tex_format_index(format); - EINA_LIST_FOREACH(gc->tex.atlas[th][th2], l, pt) + EINA_LIST_FOREACH(gc->shared->tex.atlas[th][th2], l, pt) { if (_pool_tex_alloc(pt, format, w, h, u, v, l_after)) { - gc->tex.atlas[th][th2] = - eina_list_remove_list(gc->tex.atlas[th][th2], l); - gc->tex.atlas[th][th2] = - eina_list_prepend(gc->tex.atlas[th][th2], pt); + gc->shared->tex.atlas[th][th2] = + eina_list_remove_list(gc->shared->tex.atlas[th][th2], l); + 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, format); - gc->tex.atlas[th][th2] = eina_list_prepend(gc->tex.atlas[th][th2], pt); + gc->shared->tex.atlas[th][th2] = eina_list_prepend(gc->shared->tex.atlas[th][th2], pt); pt->slot = th; pt->fslot = th2; *u = 0; @@ -284,12 +284,12 @@ if (pt->references > 0) return; if (pt->whole) { - pt->gc->tex.whole = eina_list_remove(pt->gc->tex.whole, pt); + pt->gc->shared->tex.whole = eina_list_remove(pt->gc->shared->tex.whole, pt); } else { - pt->gc->tex.atlas [pt->slot][pt->fslot] = - eina_list_remove(pt->gc->tex.atlas[pt->slot][pt->fslot], pt); + pt->gc->shared->tex.atlas [pt->slot][pt->fslot] = + eina_list_remove(pt->gc->shared->tex.atlas[pt->slot][pt->fslot], pt); } glDeleteTextures(1, &(pt->texture)); free(pt); @@ -321,7 +321,8 @@ tex->gc = gc; tex->references = 1; - if (tw > gc->info.max_texture_size) tw = gc->info.max_texture_size; + if (tw > gc->shared->info.max_texture_size) + tw = gc->shared->info.max_texture_size; tex->pt = _pool_tex_find(gc, w + 3, fh, GL_ALPHA, &u, &v, &l_after, tw); if (!tex->pt) @@ -349,7 +350,7 @@ #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); #endif - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexSubImage2D(GL_TEXTURE_2D, 0, tex->x, tex->y, w, h, GL_ALPHA, GL_UNSIGNED_BYTE, @@ -373,17 +374,17 @@ tex->gc = gc; tex->references = 1; tex->pt = _pool_tex_new(gc, w + 1, h + 1, GL_LUMINANCE); - gc->tex.whole = eina_list_prepend(gc->tex.whole, tex->pt); + gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->pt); tex->pt->slot = -1; tex->pt->fslot = -1; tex->pt->whole = 1; tex->ptu = _pool_tex_new(gc, (w / 2) + 1, (h / 2) + 1, GL_LUMINANCE); - gc->tex.whole = eina_list_prepend(gc->tex.whole, tex->ptu); + gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->ptu); tex->ptu->slot = -1; tex->ptu->fslot = -1; tex->ptu->whole = 1; tex->ptv = _pool_tex_new(gc, (w / 2) + 1, (h / 2) + 1, GL_LUMINANCE); - gc->tex.whole = eina_list_prepend(gc->tex.whole, tex->ptv); + gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->ptv); tex->ptv->slot = -1; tex->ptv->fslot = -1; tex->ptv->whole = 1; Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-10-13 03:12:32 UTC (rev 43047) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-10-13 09:40:39 UTC (rev 43048) @@ -103,12 +103,14 @@ info->info.depth, e->output.w, e->output.h); + } if (!e->engine.data.output) return 0; if (!e->engine.data.context) e->engine.data.context = e->engine.func->context_new(e->engine.data.output); - + eng_window_use(re->win); + return 1; } @@ -133,6 +135,7 @@ re = (Render_Engine *)data; re->win->w = w; re->win->h = h; + eng_window_use(re->win); evas_gl_common_context_resize(re->win->gl_context, w, h); } @@ -275,6 +278,7 @@ re->win->draw.drew = 0; eng_window_use(re->win); +// glFlush(); # if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); #else Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2009-10-13 03:12:32 UTC (rev 43047) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2009-10-13 09:40:39 UTC (rev 43048) @@ -6,7 +6,7 @@ static EGLContext context = EGL_NO_CONTEXT; #else // FIXME: this will only work for 1 display connection (glx land can have > 1) -static GLXContext context = NULL; +static GLXContext context = 0; #endif XVisualInfo *_evas_gl_x11_vi = NULL; @@ -133,11 +133,19 @@ } // GLX #else + +#if 1 if (!context) context = glXCreateContext(disp, gw->visualinfo, NULL, GL_TRUE); gw->context = context; +#else + gw->context = glXCreateContext(disp, gw->visualinfo, context, GL_TRUE); + if (!context) context = gw->context; +#endif + glXMakeCurrent(gw->disp, gw->win, gw->context); #endif + _evas_gl_x11_window = gw; gw->gl_context = evas_gl_common_context_new(); if (!gw->gl_context) @@ -145,6 +153,7 @@ free(gw); return NULL; } + evas_gl_common_context_use(gw->gl_context); evas_gl_common_context_resize(gw->gl_context, w, h); return gw; } @@ -157,7 +166,7 @@ #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if (gw->egl_surface[0] != EGL_NO_SURFACE) eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); -#else +#else // FIXME: refcount context // glXDestroyContext(gw->disp, gw->context); #endif |
From: Enlightenment SVN <no-reply@en...> - 2009-11-11 11:39:35
|
Log: step 1. some map support! images only right now. next. render-to-texture. invasive change right now. Author: raster Date: 2009-11-11 03:39:25 -0800 (Wed, 11 Nov 2009) New Revision: 43611 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-11-11 11:17:11 UTC (rev 43610) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-11-11 11:39:25 UTC (rev 43611) @@ -241,6 +241,12 @@ int x, int y, int w, int h, int r, int g, int b, int a, Eina_Bool smooth); +void evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, + Evas_GL_Texture *tex, + 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); void evas_gl_common_context_flush(Evas_GL_Context *gc); void evas_gl_common_shader_program_init(Evas_GL_Program *p, @@ -264,6 +270,7 @@ Evas_GL_Image *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspace); void evas_gl_common_image_free(Evas_GL_Image *im); void evas_gl_common_image_dirty(Evas_GL_Image *im); +void evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im, RGBA_Map_Point *p, int smooth, int level); void evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth); Evas_GL_Texture *evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-11-11 11:17:11 UTC (rev 43610) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-11-11 11:39:25 UTC (rev 43611) @@ -546,6 +546,68 @@ } void +evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, + Evas_GL_Texture *tex, + 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) +{ + int pnum, nv, nc, nu, nt, i; + const int points[6] = { 0, 1, 2, 0, 2, 3 }; + GLfloat tx[4], ty[4]; + Eina_Bool blend = 1; + RGBA_Map_Point *pt; + DATA32 cmul; + + blend = 1; + +// if (tex->pt->format == GL_RGB) blend = 0; +// if (a < 255) blend = 1; + + if ((gc->shader.cur_tex != tex->pt->texture) + || (gc->shader.cur_prog != gc->shared->shader.img.prog) + || (gc->shader.smooth != smooth) + || (gc->shader.blend != blend) + ) + { + shader_array_flush(gc); + gc->shader.cur_tex = tex->pt->texture; + gc->shader.cur_prog = gc->shared->shader.img.prog; + gc->shader.smooth = smooth; + gc->shader.blend = blend; + } + + pnum = gc->array.num; + nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4; + gc->array.num += 6; + _evas_gl_common_context_array_alloc(gc); + + 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)) / + (double)tex->pt->h; + } + cmul = ARGB_JOIN(a, r, g, b); + for (i = 0; i < 6; i++) + { + DATA32 cl = MUL4_SYM(cmul, p[points[i]].col); + PUSH_VERTEX((p[points[i]].x >> FP), + (p[points[i]].y >> FP), + 0); +// (p[points[i]].z >> FP)); + PUSH_TEXUV(tx[points[i]], + ty[points[i]]); + PUSH_COLOR(R_VAL(&cl), + G_VAL(&cl), + B_VAL(&cl), + A_VAL(&cl)); + } +} + +void evas_gl_common_context_flush(Evas_GL_Context *gc) { shader_array_flush(gc); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2009-11-11 11:17:11 UTC (rev 43610) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2009-11-11 11:39:25 UTC (rev 43611) @@ -111,7 +111,7 @@ case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: if (im->tex) evas_gl_common_texture_free(im->tex); - im->tex = NULL; + im->tex = NULL; im->cs.no_free = 0; im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); if ((data) && (im->cs.data)) @@ -184,33 +184,9 @@ im->dirty = 1; } -void -evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth) +static void +image_update(Evas_GL_Context *gc, Evas_GL_Image *im) { - RGBA_Draw_Context *dc; - int r, g, b, a; - double ssx, ssy, ssw, ssh; - int space; - Cutout_Rects *rects; - Cutout_Rect *rct; - int c, cx, cy, cw, ch; - int i; - int yuv = 0; - - if (sw < 1) sw = 1; - if (sh < 1) sh = 1; - dc = gc->dc; - if (dc->mul.use) - { - a = (dc->mul.col >> 24) & 0xff; - r = (dc->mul.col >> 16) & 0xff; - g = (dc->mul.col >> 8 ) & 0xff; - b = (dc->mul.col ) & 0xff; - } - else - { - r = g = b = a = 255; - } /* if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) @@ -232,9 +208,7 @@ } else */ - space = im->cs.space; - - switch (space) + switch (im->cs.space) { case EVAS_COLORSPACE_ARGB8888: evas_cache_image_load_data(&im->im->cache_entry); @@ -263,14 +237,78 @@ im->im->cache_entry.h); im->dirty = 0; } - yuv = 1; if (!im->tex) return; break; default: printf("unhandled img format\n"); break; } +} +void +evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im, + RGBA_Map_Point *p, int smooth, int level) +{ + RGBA_Draw_Context *dc; + int r, g, b, a; + int c, cx, cy, cw, ch; + + dc = gc->dc; + if (dc->mul.use) + { + a = (dc->mul.col >> 24) & 0xff; + r = (dc->mul.col >> 16) & 0xff; + g = (dc->mul.col >> 8 ) & 0xff; + b = (dc->mul.col ) & 0xff; + } + else + { + r = g = b = a = 255; + } + + image_update(gc, im); + + 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_image_map4_push(gc, im->tex, p, + c, cx, cy, cw, ch, + r, g, b, a, smooth); +} + +void +evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth) +{ + RGBA_Draw_Context *dc; + int r, g, b, a; + double ssx, ssy, ssw, ssh; + Cutout_Rects *rects; + Cutout_Rect *rct; + int c, cx, cy, cw, ch; + int i; + int yuv = 0; + + if (sw < 1) sw = 1; + if (sh < 1) sh = 1; + dc = gc->dc; + if (dc->mul.use) + { + a = (dc->mul.col >> 24) & 0xff; + r = (dc->mul.col >> 16) & 0xff; + g = (dc->mul.col >> 8 ) & 0xff; + b = (dc->mul.col ) & 0xff; + } + else + { + r = g = b = a = 255; + } + + image_update(gc, im); + + if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || + (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) + yuv = 1; + if ((!gc->dc->cutout.rects) // || (gc->dc->cutout.active > 32) ) Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-11-11 11:17:11 UTC (rev 43610) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-11-11 11:39:25 UTC (rev 43611) @@ -787,7 +787,6 @@ *error = 0; eng_window_use(re->win); return evas_gl_common_image_load(re->win->gl_context, file, key, lo); - return NULL; } static void * @@ -798,7 +797,6 @@ re = (Render_Engine *)data; eng_window_use(re->win); return evas_gl_common_image_new_from_data(re->win->gl_context, w, h, image_data, alpha, cspace); - return NULL; } static void * @@ -809,7 +807,6 @@ re = (Render_Engine *)data; eng_window_use(re->win); return evas_gl_common_image_new_from_copied_data(re->win->gl_context, w, h, image_data, alpha, cspace); - return NULL; } static void @@ -1031,7 +1028,10 @@ static void eng_image_map4_draw(void *data __UNUSED__, void *context, void *surface, void *image, RGBA_Map_Point *p, int smooth, int level) { - // XXX + Render_Engine *re; + + re = (Render_Engine *)data; + evas_gl_common_image_map4_draw(re->win->gl_context, image, p, smooth, level); } static void * |
From: Enlightenment SVN <no-reply@en...> - 2009-11-13 08:28:59
|
Log: fix some valgrind issues Author: raster Date: 2009-11-13 00:28:47 -0800 (Fri, 13 Nov 2009) New Revision: 43657 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-11-13 08:19:13 UTC (rev 43656) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-11-13 08:28:47 UTC (rev 43657) @@ -238,6 +238,9 @@ gc->references--; if (gc->references > 0) return; gc->shared->references--; + + evas_gl_common_image_free(gc->def_surface); + if (gc->shared->references == 0) { while (gc->shared->images) @@ -261,8 +264,7 @@ shared = NULL; } - evas_gl_common_image_free(gc->def_surface); - + free(gc->array.vertex); free(gc->array.color); free(gc->array.texuv); Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-11-13 08:19:13 UTC (rev 43656) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-11-13 08:28:47 UTC (rev 43657) @@ -38,7 +38,8 @@ eng_info_free(Evas *e __UNUSED__, void *info) { Evas_Engine_Info_GL_X11 *in; - eina_log_domain_unregister(_evas_engine_GL_X11_log_dom); +// dont free! why bother? its not worth it +// eina_log_domain_unregister(_evas_engine_GL_X11_log_dom); in = (Evas_Engine_Info_GL_X11 *)info; free(in); } @@ -1106,11 +1107,12 @@ if (!em) return 0; /* get whatever engine module we inherit from */ if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0; - _evas_engine_GL_X11_log_dom = eina_log_domain_register("EvasEngineGLX11", EVAS_DEFAULT_LOG_COLOR); - if(_evas_engine_GL_X11_log_dom<0) + if (_evas_engine_GL_X11_log_dom < 0) + _evas_engine_GL_X11_log_dom = eina_log_domain_register("EvasEngineGLX11", EVAS_DEFAULT_LOG_COLOR); + if (_evas_engine_GL_X11_log_dom < 0) { - EINA_LOG_ERR("Impossible to create a log domain for GL X11 engine.\n"); - return 0; + EINA_LOG_ERR("Impossible to create a log domain for GL X11 engine.\n"); + return 0; } /* store it for later use */ func = pfunc; |
From: Enlightenment SVN <no-reply@en...> - 2009-11-21 10:52:04
|
Log: find gl symbols runtime - some gl's support the feature but havent standardised symbols! (bad gl! bad!) Author: raster Date: 2009-11-21 02:51:51 -0800 (Sat, 21 Nov 2009) New Revision: 43857 Modified: trunk/evas/src/modules/engines/gl_common/Makefile.am trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_private.h trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.h Modified: trunk/evas/src/modules/engines/gl_common/Makefile.am =================================================================== --- trunk/evas/src/modules/engines/gl_common/Makefile.am 2009-11-21 02:00:28 UTC (rev 43856) +++ trunk/evas/src/modules/engines/gl_common/Makefile.am 2009-11-21 10:51:51 UTC (rev 43857) @@ -48,7 +48,7 @@ #evas_gl_polygon.c \ # -libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @evas_engine_gl_common_libs@ +libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @evas_engine_gl_common_libs@ @dlopen_libs@ endif EXTRA_DIST = \ Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-11-21 02:00:28 UTC (rev 43856) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-11-21 10:51:51 UTC (rev 43857) @@ -21,17 +21,18 @@ #ifdef BUILD_ENGINE_GL_QUARTZ # include <OpenGL/gl.h> +# include <OpenGL/glext.h> #else # if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) # if defined(GLES_VARIETY_S3C6410) # include <GLES2/gl2.h> -//// this changed. this was the old style. above the new style -//# include <GLES/gl.h> # elif defined(GLES_VARIETY_SGX) # include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> # endif # else # include <GL/gl.h> +# include <GL/glext.h> # endif #endif @@ -293,6 +294,10 @@ void evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y); +void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b); +void (*glsym_glBindFramebuffer) (GLenum a, GLuint b); +void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e); +void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); @@ -311,6 +316,7 @@ + /* Evas_GL_Polygon *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y); Evas_GL_Polygon *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-11-21 02:00:28 UTC (rev 43856) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2009-11-21 10:51:51 UTC (rev 43857) @@ -1,5 +1,44 @@ #include "evas_gl_private.h" - + +static int sym_done = 0; + +void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b) = NULL; +void (*glsym_glBindFramebuffer) (GLenum a, GLuint b) = NULL; +void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e) = NULL; +void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b) = NULL; + +static void +sym_missing(void) +{ + printf("EVAS ERROR - GL symbols missing!\n"); +} + +static void +gl_symbols(void) +{ + if (sym_done) return; + sym_done = 1; + +#define FINDSYM(dst, sym) if (!dst) dst = dlsym(RTLD_DEFAULT, sym) +#define FALLBAK(dst) if (!dst) dst = (void *)sym_missing; + + FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffers"); + FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffersEXT"); + FALLBAK(glsym_glGenFramebuffers); + + FINDSYM(glsym_glBindFramebuffer, "glBindFramebuffer"); + FINDSYM(glsym_glBindFramebuffer, "glBindFramebufferEXT"); + FALLBAK(glsym_glBindFramebuffer); + + FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2D"); + FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2DEXT"); + FALLBAK(glsym_glFramebufferTexture2D); + + FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffers"); + FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersEXT"); + FALLBAK(glsym_glDeleteFramebuffers); +} + static void shader_array_flush(Evas_GL_Context *gc); static Evas_GL_Context *_evas_gl_common_context = NULL; @@ -118,6 +157,7 @@ { Evas_GL_Context *gc; + gl_symbols(); #if 1 if (_evas_gl_common_context) { @@ -315,9 +355,9 @@ # endif #endif if (gc->shader.surface == gc->def_surface) - glBindFramebuffer(GL_FRAMEBUFFER, 0); + glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); else - glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb); + glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb); _evas_gl_common_viewport_set(gc); } Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_private.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_private.h 2009-11-21 02:00:28 UTC (rev 43856) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_private.h 2009-11-21 10:51:51 UTC (rev 43857) @@ -2,4 +2,6 @@ #define _EVAS_GL_PRIVATE_H #include "evas_gl_common.h" +#include <dlfcn.h> /* dlopen,dlclose,etc */ + #endif Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2009-11-21 02:00:28 UTC (rev 43856) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2009-11-21 10:51:51 UTC (rev 43857) @@ -290,10 +290,12 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); - glGenFramebuffers(1, &(pt->fb)); - glBindFramebuffer(GL_FRAMEBUFFER, pt->fb); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pt->texture, 0); - glBindFramebuffer(GL_FRAMEBUFFER, 0); + + glsym_glGenFramebuffers(1, &(pt->fb)); + glsym_glBindFramebuffer(GL_FRAMEBUFFER, pt->fb); + glsym_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pt->texture, 0); + glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); + glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); return pt; } @@ -389,7 +391,7 @@ pt->gc->shared->tex.atlas [pt->slot][pt->fslot] = eina_list_remove(pt->gc->shared->tex.atlas[pt->slot][pt->fslot], pt); glDeleteTextures(1, &(pt->texture)); - if (pt->fb) glDeleteFramebuffers(1, &(pt->fb)); + if (pt->fb) glsym_glDeleteFramebuffers(1, &(pt->fb)); free(pt); } Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.h =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2009-11-21 02:00:28 UTC (rev 43856) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2009-11-21 10:51:51 UTC (rev 43857) @@ -24,6 +24,7 @@ # define SUPPORT_X11 1 # include <EGL/egl.h> # include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> # include <X11/Xlib.h> # include <X11/Xatom.h> # include <X11/Xutil.h> @@ -36,6 +37,7 @@ # include <X11/Xutil.h> # include <X11/extensions/Xrender.h> # include <GL/gl.h> +# include <GL/glext.h> # include <GL/glx.h> # endif #endif |
From: Enlightenment SVN <no-reply@en...> - 2009-12-27 00:40:49
|
Log: gl -> polygons now work. slow - but does it matter? Author: raster Date: 2009-12-26 16:40:25 -0800 (Sat, 26 Dec 2009) New Revision: 44724 Modified: trunk/evas/src/modules/engines/gl_common/Makefile.am trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_polygon.c trunk/evas/src/modules/engines/gl_common/evas_gl_rectangle.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/Makefile.am =================================================================== --- trunk/evas/src/modules/engines/gl_common/Makefile.am 2009-12-26 10:35:47 UTC (rev 44723) +++ trunk/evas/src/modules/engines/gl_common/Makefile.am 2009-12-27 00:40:25 UTC (rev 44724) @@ -39,9 +39,9 @@ evas_gl_rectangle.c \ evas_gl_texture.c \ evas_gl_image.c \ -evas_gl_font.c +evas_gl_font.c \ +evas_gl_polygon.c - #evas_gl_gradient.c \ #evas_gl_line.c \ #evas_gl_misc.c \ Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-12-26 10:35:47 UTC (rev 44723) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2009-12-27 00:40:25 UTC (rev 44724) @@ -55,12 +55,10 @@ typedef struct _Evas_GL_Texture Evas_GL_Texture; typedef struct _Evas_GL_Image Evas_GL_Image; typedef struct _Evas_GL_Font_Texture Evas_GL_Font_Texture; -/* typedef struct _Evas_GL_Polygon Evas_GL_Polygon; typedef struct _Evas_GL_Polygon_Point Evas_GL_Polygon_Point; +/* typedef struct _Evas_GL_Gradient Evas_GL_Gradient; -typedef struct _Evas_GL_Font_Texture_Pool Evas_GL_Font_Texture_Pool; -typedef struct _Evas_GL_Font_Texture_Pool_Allocation Evas_GL_Font_Texture_Pool_Allocation; */ struct _Evas_GL_Program @@ -189,11 +187,10 @@ { Evas_GL_Texture *tex; }; -/* + struct _Evas_GL_Polygon { Eina_List *points; - GLuint dl; Eina_Bool changed : 1; }; @@ -202,6 +199,7 @@ int x, y; }; +/* struct _Evas_GL_Gradient { RGBA_Gradient *grad; @@ -209,14 +207,6 @@ int tw, th; unsigned char changed : 1; }; - -struct _Evas_GL_Font_Texture_Pool -{ - Evas_GL_Context *gc; - int w, h; - GLuint texture; - unsigned char rectangle : 1; -}; */ extern Evas_GL_Program_Source shader_rect_frag_src; @@ -297,6 +287,9 @@ void evas_gl_font_texture_free(void *); void evas_gl_font_texture_draw(void *gc, void *surface, void *dc, RGBA_Font_Glyph *fg, int x, int y); +Evas_GL_Polygon *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y); +Evas_GL_Polygon *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly); +void evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly); void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b); void (*glsym_glBindFramebuffer) (GLenum a, GLuint b); @@ -322,8 +315,6 @@ /* -Evas_GL_Polygon *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y); -Evas_GL_Polygon *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly); Evas_GL_Gradient *evas_gl_common_gradient_new(void); void evas_gl_common_gradient_free(Evas_GL_Gradient *gr); @@ -349,7 +340,6 @@ void evas_gl_common_swap_rect(Evas_GL_Context *gc, int x, int y, int w, int h); void evas_gl_common_line_draw(Evas_GL_Context *gc, int x1, int y1, int x2, int y2); -void evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly); */ #endif Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_polygon.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_polygon.c 2009-12-26 10:35:47 UTC (rev 44723) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_polygon.c 2009-12-27 00:40:25 UTC (rev 44724) @@ -1,13 +1,70 @@ #include "evas_gl_private.h" -#ifdef _WIN32 -# define EFL_STDCALL __stdcall -#else -# define EFL_STDCALL -#endif +// FIXME: this is a verbatim copy of the software poly renderer. it just +// use gl to draw 1 pixel high spans like software does. this is to make +// sure rendering correctness matches the software engine but also to save +// time in coming up with a good triangulation algorithm. if you want to +// feel free to turn this into a real triangulation system and use gl to its +// fullest, but as such polygons are used so little, it's not worth it. -#define GLU_TESS +typedef struct _RGBA_Span RGBA_Span; +typedef struct _RGBA_Edge RGBA_Edge; +typedef struct _RGBA_Vertex RGBA_Vertex; +struct _RGBA_Span +{ + EINA_INLIST; + int x, y, w; +}; + +struct _RGBA_Edge +{ + double x, dx; + int i; +}; + +struct _RGBA_Vertex +{ + double x, y; + int i; +}; + +#define POLY_EDGE_DEL(_i) \ + { \ + int _j; \ + \ + for (_j = 0; (_j < num_active_edges) && (edges[_j].i != _i); _j++); \ + if (_j < num_active_edges) \ + { \ + num_active_edges--; \ + memmove(&(edges[_j]), &(edges[_j + 1]), \ + (num_active_edges - _j) * sizeof(RGBA_Edge)); \ + } \ + } + +#define POLY_EDGE_ADD(_i, _y) \ + { \ + int _j; \ + float _dx; \ + RGBA_Vertex *_p, *_q; \ + if (_i < (n - 1)) _j = _i + 1; \ + else _j = 0; \ + if (point[_i].y < point[_j].y) \ + { \ + _p = &(point[_i]); \ + _q = &(point[_j]); \ + } \ + else \ + { \ + _p = &(point[_j]); \ + _q = &(point[_i]); \ + } \ + edges[num_active_edges].dx = _dx = (_q->x - _p->x) / (_q->y - _p->y); \ + edges[num_active_edges].x = (_dx * ((float)_y + 0.5 - _p->y)) + _p->x; \ + edges[num_active_edges].i = _i; \ + num_active_edges++; \ + } + Evas_GL_Polygon * evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y) { @@ -36,133 +93,215 @@ poly->points = eina_list_remove(poly->points, pt); free(pt); } - if (poly->dl > 0) glDeleteLists(poly->dl, 1); free(poly); return NULL; } -#ifdef GLU_TESS -static void EFL_STDCALL _evas_gl_tess_begin_cb(GLenum which); -static void EFL_STDCALL _evas_gl_tess_end_cb(void); -static void EFL_STDCALL _evas_gl_tess_error_cb(GLenum errorcode); -static void EFL_STDCALL _evas_gl_tess_vertex_cb(GLvoid *vertex); -static void EFL_STDCALL _evas_gl_tess_combine_cb(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **data_out); - -static void EFL_STDCALL -_evas_gl_tess_begin_cb(GLenum which) +static int +polygon_point_sorter(const void *a, const void *b) { - glBegin(which); + RGBA_Vertex *p, *q; + + p = (RGBA_Vertex *)a; + q = (RGBA_Vertex *)b; + if (p->y <= q->y) return -1; + return 1; } -static void EFL_STDCALL -_evas_gl_tess_end_cb(void) +static int +polygon_edge_sorter(const void *a, const void *b) { - glEnd(); + RGBA_Edge *p, *q; + + p = (RGBA_Edge *)a; + q = (RGBA_Edge *)b; + if (p->x <= q->x) return -1; + return 1; } -static void EFL_STDCALL -_evas_gl_tess_error_cb(GLenum errorcode __UNUSED__) -{ -} - -static void EFL_STDCALL -_evas_gl_tess_vertex_cb(GLvoid *vertex) -{ - GLdouble *v; - - v = vertex; - glVertex2d(v[0], v[1]); -} - -static void EFL_STDCALL -_evas_gl_tess_combine_cb(GLdouble coords[3], GLdouble *vertex_data[4] __UNUSED__, GLfloat weight[4] __UNUSED__, GLdouble **data_out) -{ - GLdouble *vertex; - - vertex = (GLdouble *) malloc(6 * sizeof(GLdouble)); - vertex[0] = coords[0]; - vertex[1] = coords[1]; - *data_out = vertex; -} -#endif - void evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly) { - int r, g, b, a; + Cutout_Rects *rects; + Cutout_Rect *r; + int c, cx, cy, cw, ch, cr, cg, cb, ca, i; + int x, y, w, h; + Eina_List *l; - static void *tess = NULL; - GLdouble *glp = NULL; - int i, num; - RGBA_Draw_Context *dc = gc->dc; - Evas_GL_Polygon_Point *p; + int n, k, num_active_edges, y0, y1, *sorted_index, j; + RGBA_Edge *edges; + 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; - a = (dc->col.col >> 24) & 0xff; - r = (dc->col.col >> 16) & 0xff; - g = (dc->col.col >> 8 ) & 0xff; - b = (dc->col.col ) & 0xff; - evas_gl_common_context_color_set(gc, r, g, b, a); - if (a < 255) evas_gl_common_context_blend_set(gc, 1); - else evas_gl_common_context_blend_set(gc, 0); - if (dc->clip.use) - evas_gl_common_context_clip_set(gc, 1, - dc->clip.x, dc->clip.y, - dc->clip.w, dc->clip.h); - else - evas_gl_common_context_clip_set(gc, 0, - 0, 0, 0, 0); - evas_gl_common_context_texture_set(gc, NULL, 0, 0, 0); - evas_gl_common_context_read_buf_set(gc, GL_BACK); - evas_gl_common_context_write_buf_set(gc, GL_BACK); + ca = (gc->dc->col.col >> 24) & 0xff; + if (ca <= 0) return; + 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); + if (!edges) return; + point = malloc(sizeof(RGBA_Vertex) * n); + if (!point) + { + free(edges); + return; + } + sorted_index = malloc(sizeof(int) * n); + if (!sorted_index) + { + free(edges); + free(point); + return; + } + + k = 0; + EINA_LIST_FOREACH(poly->points, l, pt) + { + point[k].x = pt->x; + point[k].y = pt->y; + point[k].i = k; + k++; + } + qsort(point, n, sizeof(RGBA_Vertex), polygon_point_sorter); + for (k = 0; k < n; k++) sorted_index[k] = point[k].i; + k = 0; - if (poly->changed || poly->dl <= 0) + EINA_LIST_FOREACH(poly->points, l, pt) { - if (poly->dl > 0) glDeleteLists(poly->dl, 1); - poly->dl = glGenLists(1); + point[k].x = pt->x; + point[k].y = pt->y; + 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)) + { + POLY_EDGE_DEL(j) + } + else if (point[j].y > ((double)y + 0.5)) + { + POLY_EDGE_ADD(j, y) + } + if (i < (n - 1)) j = i + 1; + else j = 0; + if (point[j].y <= ((double)y - 0.5)) + { + POLY_EDGE_DEL(i) + } + else if (point[j].y > ((double)y + 0.5)) + { + 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); + else + x1 = x0; + 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)); + spans = eina_inlist_append(spans, EINA_INLIST_GET(span)); + span->y = y; + span->x = x0; + span->w = (x1 - x0) + 1; + } + edges[j].x += edges[j].dx; + 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; - glNewList(poly->dl, GL_COMPILE_AND_EXECUTE); -#ifdef GLU_TESS - if (!tess) - { - tess = gluNewTess(); + /* no cutouts - cut right to the chase */ + if (!gc->dc->cutout.rects) + { + EINA_INLIST_FOREACH(spans, span) + { + x = span->x; + y = span->y; + w = span->w; + h = 1; + evas_gl_common_context_rectangle_push(gc, x, y, w, h, cr, cg, cb, ca); + } + } + else + { + evas_common_draw_context_clip_clip(gc->dc, x, y, w, h); + /* our clip is 0 size.. abort */ + if ((gc->dc->clip.w > 0) && (gc->dc->clip.h > 0)) + { + rects = evas_common_draw_context_apply_cutouts(gc->dc); + for (i = 0; i < rects->active; ++i) + { + r = rects->rects + i; + if ((r->w > 0) && (r->h > 0)) + { + EINA_INLIST_FOREACH(spans, span) + { + x = span->x; + y = span->y; + w = span->w; + h = 1; + RECTS_CLIP_TO_RECT(x, y, w, h, r->x, r->y, r->w, r->h); + if ((w > 0) && (h > 0)) + evas_gl_common_context_rectangle_push(gc, x, y, w, h, cr, cg, cb, ca); + } + } + } + evas_common_draw_context_apply_clear_cutouts(rects); + } + } + while (spans) + { + 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; - gluTessCallback(tess, GLU_TESS_BEGIN, _evas_gl_tess_begin_cb); - gluTessCallback(tess, GLU_TESS_END, _evas_gl_tess_end_cb); - gluTessCallback(tess, GLU_TESS_ERROR, _evas_gl_tess_error_cb); - gluTessCallback(tess, GLU_TESS_VERTEX, _evas_gl_tess_vertex_cb); - gluTessCallback(tess, GLU_TESS_COMBINE, _evas_gl_tess_combine_cb); - } - num = 0; - num = eina_list_count(poly->points); - i = 0; - glp = malloc(num * 6 * sizeof(GLdouble)); - gluTessNormal(tess, 0, 0, 1); - gluTessProperty(tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); - gluTessBeginPolygon(tess, NULL); - gluTessBeginContour(tess); - EINA_LIST_FOREACH(poly->points, l, p) - { - glp[i++] = p->x; - glp[i++] = p->y; - glp[i++] = 0; - gluTessVertex(tess, &(glp[i - 3]), &(glp[i - 3])); - i += 3; - } - gluTessEndContour(tess); - gluTessEndPolygon(tess); - free(glp); -#else - glBegin(GL_POLYGON); - EINA_LIST_FOREACH(poly->points, l, p) - glVertex2i(p->x, p->y); - glEnd(); -#endif - glEndList(); - - poly->changed = 0; - - return ; - } - - glCallList(poly->dl); } Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_rectangle.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_rectangle.c 2009-12-26 10:35:47 UTC (rev 44723) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_rectangle.c 2009-12-27 00:40:25 UTC (rev 44724) @@ -13,7 +13,7 @@ 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 (ca <= 0) return; + if (ca <= 0) return; cr = (gc->dc->col.col >> 16) & 0xff; cg = (gc->dc->col.col >> 8 ) & 0xff; cb = (gc->dc->col.col ) & 0xff; Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-12-26 10:35:47 UTC (rev 44723) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2009-12-27 00:40:25 UTC (rev 44724) @@ -363,8 +363,7 @@ Render_Engine *re; re = (Render_Engine *)data; -//--// return evas_gl_common_poly_point_add(polygon, x, y); - return NULL; + return evas_gl_common_poly_point_add(polygon, x, y); } static void * @@ -373,8 +372,7 @@ Render_Engine *re; re = (Render_Engine *)data; -//--// return evas_gl_common_poly_points_clear(polygon); - return NULL; + return evas_gl_common_poly_points_clear(polygon); } static void @@ -386,7 +384,7 @@ eng_window_use(re->win); evas_gl_common_context_target_surface_set(re->win->gl_context, surface); re->win->gl_context->dc = context; -//--// evas_gl_common_poly_draw(re->win->gl_context, polygon); + evas_gl_common_poly_draw(re->win->gl_context, polygon); } static void |
From: Enlightenment SVN <no-reply@en...> - 2010-01-21 09:42:33
|
Log: some protection against playing with native surfaces (setting image size doent re-alloc for example) Author: raster Date: 2010-01-21 01:42:26 -0800 (Thu, 21 Jan 2010) New Revision: 45385 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-01-21 08:44:41 UTC (rev 45384) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-01-21 09:42:26 UTC (rev 45385) @@ -568,11 +568,21 @@ gc->array.num += 6; _evas_gl_common_context_array_alloc(gc); - tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; - ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h; - tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; - ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; - + // yinvert! + if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert)) + { + tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; + ty1 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; + tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; + ty2 = ((double)(tex->y) + sy) / (double)tex->pt->h; + } + else + { + tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; + ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h; + tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; + ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; + } if (blend) bl = 0.0; PUSH_VERTEX(x , y , 0); @@ -845,6 +855,7 @@ gc->array.num += 6; _evas_gl_common_context_array_alloc(gc); + // FIXME: handle yinvert for (i = 0; i < 4; i++) { tx[i] = ((double)(tex->x) + (((double)p[i].u) / FP1)) / Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-01-21 08:44:41 UTC (rev 45384) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-01-21 09:42:26 UTC (rev 45385) @@ -322,6 +322,13 @@ pt->references = 0; glGenTextures(1, &(pt->texture)); glBindTexture(GL_TEXTURE_2D, pt->texture); + +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + // is this really needed for gl-es? + glTexImage2D(GL_TEXTURE_2D, 0, intformat, w, h, 0, format, + GL_UNSIGNED_BYTE, 0); +#endif + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-01-21 08:44:41 UTC (rev 45384) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-01-21 09:42:26 UTC (rev 45385) @@ -12,9 +12,8 @@ #endif #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -# if defined(GLES_VARIETY_S3C6410) -# elif defined(GLES_VARIETY_SGX) -# endif +void (*glsym_eglBindTexImage) (EGLDisplay a, EGLSurface b, int c) = NULL; +void (*glsym_eglReleaseTexImage) (EGLDisplay a, EGLSurface b, int c) = NULL; #else typedef void (*_eng_fn) (void); @@ -28,17 +27,23 @@ { static int done = 0; -#define FINDSYM(dst, sym) \ - if ((!dst) && (glsym_glXGetProcAddress)) dst = glsym_glXGetProcAddress(sym); \ - if (!dst) dst = dlsym(RTLD_DEFAULT, sym) if (done) return; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -# if defined(GLES_VARIETY_S3C6410) -# elif defined(GLES_VARIETY_SGX) -# endif +#define FINDSYM(dst, sym) if (!dst) dst = dlsym(RTLD_DEFAULT, sym) + FINDSYM(glsym_eglBindTexImage, "eglBindTexImage"); + FINDSYM(glsym_eglBindTexImage, "eglBindTexImageEXT"); + FINDSYM(glsym_eglBindTexImage, "eglBindTexImageARB"); + + FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImage"); + FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageEXT"); + FINDSYM(glsym_eglReleaseTexImage, "eglReleaseTexImageARB"); #else +#define FINDSYM(dst, sym) \ + if ((!dst) && (glsym_glXGetProcAddress)) dst = glsym_glXGetProcAddress(sym); \ + if (!dst) dst = dlsym(RTLD_DEFAULT, sym) + FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddress"); FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressEXT"); FINDSYM(glsym_glXGetProcAddress, "glXGetProcAddressARB"); @@ -896,6 +901,11 @@ if (!image) return NULL; eng_window_use(re->win); im = image; + if (im->native.data) + { + im->alpha = has_alpha; + return image; + } /* FIXME: can move to gl_common */ if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im; if ((has_alpha) && (im->im->cache_entry.flags.alpha)) return image; @@ -966,6 +976,7 @@ re = (Render_Engine *)data; if (!image) return; im = image; + if (im->native.data) return; /* FIXME: can move to gl_common */ if (im->cs.space == cspace) return; eng_window_use(re->win); @@ -1010,6 +1021,8 @@ Visual *visual; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + EGLSurface egl_surface; + EGLContext egl_context; #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT GLXFBConfig fbc; @@ -1026,7 +1039,10 @@ Native *n = im->native.data; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -// eglBindTexImage(egl->dpy, egl->pixmap_surface, EGL_SINGLE_BUFFER); + if (glsym_eglBindTexImage) + { + glsym_eglBindTexImage(re->win->egl_disp, n->egl_surface, EGL_SINGLE_BUFFER); + } #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXBindTexImage) @@ -1042,7 +1058,6 @@ n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, n->pixmap, pixmap_att); - printf("bind: %p %i %i %p\n", re->win->disp, n->glx_pixmap, GLX_FRONT_LEFT_EXT, NULL); glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, GLX_FRONT_LEFT_EXT, NULL); } @@ -1058,12 +1073,14 @@ Native *n = im->native.data; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -// eglReleaseTexImage(egl->dpy, egl->pixmap_surface, EGL_SINGLE_BUFFER); + if (glsym_eglReleaseTexImage) + { + glsym_eglReleaseTexImage(re->win->egl_disp, n->egl_surface, EGL_SINGLE_BUFFER); + } #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXReleaseTexImage) { - printf("unbind: %p %i %i\n", re->win->disp, n->glx_pixmap, GLX_FRONT_LEFT_EXT); glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, GLX_FRONT_LEFT_EXT); glXDestroyPixmap(re->win->disp, n->glx_pixmap); @@ -1081,17 +1098,16 @@ Native *n = im->native.data; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -/* if (egl->pixmap_ctx != EGL_NO_CONTEXT) + if (n->egl_context) { - eglDestroyContext(egl->dpy, egl->pixmap_ctx); - egl->pixmap_ctx = EGL_NO_CONTEXT; + eglDestroyContext(re->win->egl_disp, n->egl_context); + n->egl_context = 0; } - if (egl->pixmap_surface != EGL_NO_SURFACE) + if (n->egl_surface) { - eglDestroySurface(egl->dpy, egl->pixmap_surface); - egl->pixmap_surface = EGL_NO_SURFACE; + eglDestroySurface(re->win->egl_disp, n->egl_surface); + n->egl_surface = 0; } - res = true; */ #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (n->glx_pixmap) @@ -1120,7 +1136,6 @@ Visual *vis = NULL; Pixmap pm = 0; - printf("eng_image_native_set\n"); if (ns) { vis = ns->data.x11.visual; @@ -1130,55 +1145,73 @@ Evas_Native_Surface *n = im->native.data; if ((n->data.x11.visual == vis) && (n->data.x11.pixmap == pm)) { - printf(" same\n"); return; } } } - printf(" .1\n"); if ((!ns) && (!im->native.data)) return; - printf(" ..2\n"); if (!im) return; - printf(" ...3\n"); #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -/* EGLConfig cfg; - EGLint num; - EGLint attbs[30] = { NULL, }; - - EGLint ctx_attbs[] = + if (im->native.data) { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - - int i = 0; - - attbs[i++] = EGL_RED_SIZE; - attbs[i++] = egl->cfg_r; - attbs[i++] = EGL_GREEN_SIZE; - attbs[i++] = egl->cfg_g; - attbs[i++] = EGL_BLUE_SIZE; - attbs[i++] = egl->cfg_b; - attbs[i++] = EGL_ALPHA_SIZE; - attbs[i++] = egl->cfg_a; - attbs[i++] = EGL_DEPTH_SIZE; - attbs[i++] = egl->cfg_d; - attbs[i++] = EGL_STENCIL_SIZE; - attbs[i++] = egl->cfg_s; - attbs[i++] = EGL_RENDERABLE_TYPE; - attbs[i++] = EGL_OPENGL_ES2_BIT; - attbs[i++] = EGL_SURFACE_TYPE; - attbs[i++] = EGL_PIXMAP_BIT; // for pixmap surface - attbs[i++] = EGL_NONE; - - eglChooseConfig(egl->dpy, attbs, &cfg, 1, &num); - egl->pixmap_surface = eglCreatePixmapSurface(egl->dpy, cfg, pixmap, NULL); - eglBindAPI(EGL_OPENGL_ES_API); - egl->pixmap_ctx = eglCreateContext(egl->dpy, cfg, EGL_NO_CONTEXT, ctx_attbs); */ + if (im->native.func.free) + im->native.func.free(im->native.func.data, im); + evas_gl_common_image_native_disable(im); + } + if (native) + { + Native *n; + + n = calloc(1, sizeof(Native)); + if (n) + { + EGLConfig egl_config; + int context_attrs[3]; + int config_attrs[20]; + int num_config, i; + + context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION; + context_attrs[1] = 2; + context_attrs[2] = EGL_NONE; + + i = 0; + config_attrs[i++] = EGL_RED_SIZE; + config_attrs[i++] = 8; + config_attrs[i++] = EGL_GREEN_SIZE; + config_attrs[i++] = 8; + config_attrs[i++] = EGL_BLUE_SIZE; + config_attrs[i++] = 8; + config_attrs[i++] = EGL_ALPHA_SIZE; + config_attrs[i++] = 8; + config_attrs[i++] = EGL_DEPTH_SIZE; + config_attrs[i++] = 32; + config_attrs[i++] = EGL_RENDERABLE_TYPE; + config_attrs[i++] = EGL_OPENGL_ES2_BIT; + config_attrs[i++] = EGL_SURFACE_TYPE; + config_attrs[i++] = EGL_PIXMAP_BIT; + config_attrs[i++] = EGL_NONE; + + eglChooseConfig(re->win->egl_disp, config_attrs, + &egl_config, 1, &num_config); + n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp, + egl_config, pixmap, + NULL); + eglBindAPI(EGL_OPENGL_ES_API); + n->egl_context = eglCreateContext(re->win->egl_disp, egl_config, + NULL, context_attrs); + evas_gl_common_image_native_enable(im); + n->pixmap = pm; + n->visual = vis; + im->native.yinvert = 1; + im->native.data = n; + im->native.func.data = re; + im->native.func.bind = _native_bind_cb; + im->native.func.unbind = _native_unbind_cb; + im->native.func.free = _native_free_cb; + } + } #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT - printf(" ....4\n"); - // FIXME: if there is already a natiive surface - free it if (im->native.data) { if (im->native.func.free) @@ -1196,10 +1229,8 @@ fbc = glXGetFBConfigs(re->win->disp, 0 /* FIXME: screen 0 assumption */, &num); - printf(" .....5\n"); if (fbc) { - printf(" ......6\n"); for (i = 0; i < num; i++) { XVisualInfo *vi; @@ -1240,12 +1271,9 @@ { Native *n; - printf(" .......7\n"); n = calloc(1, sizeof(Native)); if (n) { - - printf(" .......8\n"); evas_gl_common_image_native_enable(im); memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); n->pixmap = pm; @@ -1258,7 +1286,6 @@ im->native.func.bind = _native_bind_cb; im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; - printf(" yinvert = %i\n", yinvert); } } } @@ -1337,18 +1364,25 @@ *h = 0; return; } - if (w) *w = ((Evas_GL_Image *)image)->im->cache_entry.w; - if (h) *h = ((Evas_GL_Image *)image)->im->cache_entry.h; + if (w) *w = ((Evas_GL_Image *)image)->w; + if (h) *h = ((Evas_GL_Image *)image)->h; } static void * eng_image_size_set(void *data, void *image, int w, int h) { Render_Engine *re; - Evas_GL_Image *im, *im_old; - + Evas_GL_Image *im = image; + Evas_GL_Image *im_old; + re = (Render_Engine *)data; - if (!image) return NULL; + if (!im) return NULL; + if (im->native.data) + { + im->w = w; + im->h = h; + return image; + } eng_window_use(re->win); im_old = image; if ((eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P601_PL) || @@ -1380,10 +1414,12 @@ eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h) { Render_Engine *re; + Evas_GL_Image *im = image; re = (Render_Engine *)data; if (!image) return NULL; eng_window_use(re->win); + if (im->native.data) return image; evas_gl_common_image_dirty(image, x, y, w, h); return image; } @@ -1401,6 +1437,11 @@ return NULL; } im = image; + if (im->native.data) + { + *image_data = NULL; + return im; + } eng_window_use(re->win); evas_cache_image_load_data(&im->im->cache_entry); switch (im->cs.space) @@ -1448,6 +1489,7 @@ re = (Render_Engine *)data; if (!image) return NULL; im = image; + if (im->native.data) return image; eng_window_use(re->win); switch (im->cs.space) { @@ -1492,9 +1534,10 @@ Evas_GL_Image *gim = image; RGBA_Image *im; - if (!gim) return ; - im = (RGBA_Image*) gim->im; - if (!im) return ; + if (!gim) return; + if (gim->native.data) return; + im = (RGBA_Image *)gim->im; + if (!im) return; evas_cache_image_preload_data(&im->cache_entry, target); } @@ -1504,9 +1547,10 @@ Evas_GL_Image *gim = image; RGBA_Image *im; - if (!gim) return ; - im = (RGBA_Image*) gim->im; - if (!im) return ; + if (!gim) return; + if (gim->native.data) return; + im = (RGBA_Image *)gim->im; + if (!im) return; evas_cache_image_preload_cancel(&im->cache_entry, target); } |
From: Enlightenment SVN <no-reply@en...> - 2010-01-24 05:12:02
|
Log: ok. work on native pixmap suppport. have problmes - not sure why. see comments (create/destory glx pixmap needed for updates to work, but this makes rendering dead-slow. without it rendering is fast, but updates dont happen (useless). anyone know why glxcreatepixmap is needed as well as bindteximage+release (and destroy pixmap) vs just bind/unbind? Author: raster Date: 2010-01-23 21:11:54 -0800 (Sat, 23 Jan 2010) New Revision: 45508 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-01-24 04:48:28 UTC (rev 45507) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-01-24 05:11:54 UTC (rev 45508) @@ -199,6 +199,7 @@ void *data; } func; unsigned char yinvert : 1; + unsigned char loose : 1; } native; unsigned char dirty : 1; @@ -293,7 +294,7 @@ void evas_gl_common_rect_draw(Evas_GL_Context *gc, int x, int y, int w, int h); Evas_GL_Texture *evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im); -Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha); +Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha, Evas_GL_Image *im); Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_GL_Context *gc, int w, int h, int alpha); void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im); void evas_gl_common_texture_free(Evas_GL_Texture *tex); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-01-24 04:48:28 UTC (rev 45507) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-01-24 05:11:54 UTC (rev 45508) @@ -905,6 +905,8 @@ if (gc->shader.cur_tex != gc->shader.current.cur_tex) { + if (gc->shader.cur_tex) glEnable(GL_TEXTURE_2D); + else glDisable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); } @@ -943,10 +945,8 @@ } if (gc->shader.blend != gc->shader.current.blend) { - if (gc->shader.blend) - glEnable(GL_BLEND); - else - glDisable(GL_BLEND); + if (gc->shader.blend) glEnable(GL_BLEND); + else glDisable(GL_BLEND); } if (gc->shader.smooth != gc->shader.current.smooth) { @@ -1049,6 +1049,12 @@ if (gc->array.im->native.func.unbind) gc->array.im->native.func.unbind(gc->array.im->native.func.data, gc->array.im); +/* + gc->shader.cur_tex = 0; + glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + if (gc->shader.cur_tex) glEnable(GL_TEXTURE_2D); + else glDisable(GL_TEXTURE_2D); + */ } gc->shader.current.cur_prog = gc->shader.cur_prog; Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-01-24 04:48:28 UTC (rev 45507) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-01-24 05:11:54 UTC (rev 45508) @@ -200,7 +200,7 @@ } im->cs.space = EVAS_COLORSPACE_ARGB8888; - im->tex = evas_gl_common_texture_native_new(im->gc, im->w, im->h, im->alpha); + im->tex = evas_gl_common_texture_native_new(im->gc, im->w, im->h, im->alpha, im); im->tex_only = 1; } Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-01-24 04:48:28 UTC (rev 45507) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-01-24 05:11:54 UTC (rev 45508) @@ -306,7 +306,7 @@ } static Evas_GL_Texture_Pool * -_pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int format) +_pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im) { Evas_GL_Texture_Pool *pt; @@ -327,12 +327,19 @@ // is this really needed for gl-es? // glTexImage2D(GL_TEXTURE_2D, 0, intformat, w, h, 0, format, // GL_UNSIGNED_BYTE, 0); +#else + if (im->native.loose) + { + if (im->native.func.bind) + im->native.func.bind(im->native.func.data, im); + } #endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); return pt; } @@ -356,7 +363,7 @@ } Evas_GL_Texture * -evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha) +evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha, Evas_GL_Image *im) { Evas_GL_Texture *tex; Eina_List *l_after = NULL; @@ -369,9 +376,9 @@ tex->references = 1; tex->alpha = alpha; if (alpha) - tex->pt = _pool_tex_native_new(gc, w, h, rgba_ifmt, rgba_fmt); + tex->pt = _pool_tex_native_new(gc, w, h, rgba_ifmt, rgba_fmt, im); else - tex->pt = _pool_tex_native_new(gc, w, h, rgb_ifmt, rgb_fmt); + tex->pt = _pool_tex_native_new(gc, w, h, rgb_ifmt, rgb_fmt, im); if (!tex->pt) { free(tex); Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-01-24 04:48:28 UTC (rev 45507) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-01-24 05:11:54 UTC (rev 45508) @@ -1024,6 +1024,15 @@ #endif }; +// 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 _native_bind_cb(void *data, void *image) { @@ -1040,6 +1049,7 @@ # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXBindTexImage) { +#ifdef GLX_TEX_PIXMAP_RECREATE const int pixmap_att[] = { GLX_TEXTURE_TARGET_EXT, @@ -1051,8 +1061,10 @@ n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, n->pixmap, pixmap_att); - glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT, NULL); +#endif + if (!im->native.loose) + glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT, NULL); } # endif #endif @@ -1074,10 +1086,13 @@ # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXReleaseTexImage) { - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT); + if (!im->native.loose) + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT); +#ifdef GLX_TEX_PIXMAP_RECREATE glXDestroyPixmap(re->win->disp, n->glx_pixmap); n->glx_pixmap = 0; +#endif } # endif #endif @@ -1100,8 +1115,12 @@ # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (n->glx_pixmap) { - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT); + if (im->native.loose) + { + if (glsym_glXReleaseTexImage) + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT); + } glXDestroyPixmap(re->win->disp, n->glx_pixmap); n->glx_pixmap = 0; } @@ -1176,18 +1195,19 @@ eglChooseConfig(re->win->egl_disp, config_attrs, &egl_config, 1, &num_config); - n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp, - egl_config, pm, - NULL); - evas_gl_common_image_native_enable(im); n->pixmap = pm; n->visual = vis; im->native.yinvert = 1; + im->native.loose = 0; im->native.data = n; im->native.func.data = re; im->native.func.bind = _native_bind_cb; im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; + n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp, + egl_config, pm, + NULL); + evas_gl_common_image_native_enable(im); } } #else @@ -1254,18 +1274,33 @@ n = calloc(1, sizeof(Native)); if (n) { - evas_gl_common_image_native_enable(im); +#ifndef GLX_TEX_PIXMAP_RECREATE + const int pixmap_att[] = + { + GLX_TEXTURE_TARGET_EXT, + GLX_TEXTURE_2D_EXT, + GLX_TEXTURE_FORMAT_EXT, + GLX_TEXTURE_FORMAT_RGBA_EXT, + 0 + }; +#endif memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); n->pixmap = pm; n->visual = vis; memcpy(&(n->fbc), fbc, sizeof(GLXFBConfig)); n->fbc = *fbc; im->native.yinvert = yinvert; + im->native.loose = 0; im->native.data = n; im->native.func.data = re; im->native.func.bind = _native_bind_cb; im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; +#ifndef GLX_TEX_PIXMAP_RECREATE + n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, + n->pixmap, pixmap_att); +#endif + evas_gl_common_image_native_enable(im); } } } Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-01-24 04:48:28 UTC (rev 45507) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-01-24 05:11:54 UTC (rev 45508) @@ -133,15 +133,9 @@ } // GLX #else - -#if 1 if (!context) context = glXCreateContext(disp, gw->visualinfo, NULL, GL_TRUE); gw->context = context; -#else - gw->context = glXCreateContext(disp, gw->visualinfo, context, GL_TRUE); - if (!context) context = gw->context; -#endif glXMakeCurrent(gw->disp, gw->win, gw->context); #endif |
From: Enlightenment SVN <no-reply@en...> - 2010-01-24 11:01:27
|
Log: add pre/post swap callbacks. need them! :( Author: raster Date: 2010-01-24 03:01:20 -0800 (Sun, 24 Jan 2010) New Revision: 45514 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-01-24 10:56:57 UTC (rev 45513) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-01-24 11:01:20 UTC (rev 45514) @@ -1030,6 +1030,7 @@ glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texu); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texv); + glActiveTexture(GL_TEXTURE0); } else if (gc->array.use_texuv2) { Modified: trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h =================================================================== --- trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h 2010-01-24 10:56:57 UTC (rev 45513) +++ trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h 2010-01-24 11:01:20 UTC (rev 45514) @@ -26,6 +26,13 @@ Colormap (*best_colormap_get) (Display *disp, int screen); int (*best_depth_get) (Display *disp, int screen); } func; + + struct { + void (*pre_swap) (void *data, Evas *e); + void (*post_swap) (void *data, Evas *e); + + void *data; // data for callback calls + } callback; }; #endif Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-01-24 10:56:57 UTC (rev 45513) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-01-24 11:01:20 UTC (rev 45514) @@ -72,8 +72,10 @@ struct _Render_Engine { - Evas_GL_X11_Window *win; - int end; + Evas_GL_X11_Window *win; + Evas_Engine_Info_GL_X11 *info; + Evas *evas; + int end; XrmDatabase xrdb; // xres - dpi struct { // xres - dpi @@ -122,6 +124,8 @@ #endif re = calloc(1, sizeof(Render_Engine)); if (!re) return 0; + re->info = info; + re->evas = e; e->engine.data.output = re; re->win = eng_window_new(info->info.display, info->info.drawable, @@ -391,8 +395,8 @@ re->win->draw.drew = 0; eng_window_use(re->win); +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) // glFlush(); -# if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); #else # ifdef VSYNC_TO_SCREEN @@ -403,18 +407,17 @@ // glXWaitVideoSyncSGI(2, (rc + 1) % 2, &rc); // } # endif -# ifdef SLOW_GL_COPY_RECT + if (re->info->callback.pre_swap) + { + glXWaitGL(); + re->info->callback.pre_swap(re->info->callback.data, re->evas); + } glXSwapBuffers(re->win->disp, re->win->win); -# else -// /* SLOW AS ALL HELL! */ -// evas_gl_common_swap_rect(re->win->gl_context, -// re->win->draw.x1, re->win->draw.y1, -// re->win->draw.x2 - re->win->draw.x1 + 1, -// re->win->draw.y2 - re->win->draw.y1 + 1); -# endif -// glFlush(); -// glXWaitGL(); -// XSync(re->win->disp, False); + if (re->info->callback.post_swap) + { + glXWaitGL(); + re->info->callback.post_swap(re->info->callback.data, re->evas); + } #endif } |
From: Enlightenment SVN <no-reply@en...> - 2010-02-02 05:30:26
|
Log: fix! broek egl compositing. fixed now. Author: raster Date: 2010-02-01 21:30:19 -0800 (Mon, 01 Feb 2010) New Revision: 45792 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-02 04:50:04 UTC (rev 45791) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-02 05:30:19 UTC (rev 45792) @@ -916,7 +916,7 @@ } if (gc->array.im) { - if (!gc->array.im->native.func.bind) + if (!gc->array.im->native.loose) { if (gc->array.im->native.func.bind) gc->array.im->native.func.bind(gc->array.im->native.func.data, @@ -1054,7 +1054,7 @@ } if (gc->array.im) { - if (!gc->array.im->native.func.bind) + if (!gc->array.im->native.loose) { if (gc->array.im->native.func.unbind) gc->array.im->native.func.unbind(gc->array.im->native.func.data, Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-02 04:50:04 UTC (rev 45791) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-02 05:30:19 UTC (rev 45792) @@ -429,6 +429,11 @@ re->win->draw.redraw = 0; re->win->draw.drew = 1; evas_gl_common_context_flush(re->win->gl_context); +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + eglWaitGL(); // previous rendering should be done and swapped +#else + glXWaitGL(); +#endif //x// printf("frame -> push\n"); } @@ -444,8 +449,8 @@ eng_window_use(re->win); #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -// glFlush(); eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); + eglWaitGL(); // excessive - swapbuffers should wait in windowed mode #else #ifdef VSYNC_TO_SCREEN if (re->info->vsync) @@ -461,13 +466,11 @@ # endif if (re->info->callback.pre_swap) { - glFinish(); re->info->callback.pre_swap(re->info->callback.data, re->evas); } glXSwapBuffers(re->win->disp, re->win->win); if (re->info->callback.post_swap) { - glXWaitGL(); re->info->callback.post_swap(re->info->callback.data, re->evas); } #endif @@ -1285,6 +1288,8 @@ 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.mipmap = 0; #if 0 // old texfrompixmap n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp, egl_config, pm, |
From: Enlightenment SVN <no-reply@en...> - 2010-02-02 07:00:17
|
Log: clean up gl text-from-pixmap a bit Author: raster Date: 2010-02-01 23:00:10 -0800 (Mon, 01 Feb 2010) New Revision: 45796 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-02-02 06:50:38 UTC (rev 45795) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-02-02 07:00:10 UTC (rev 45796) @@ -327,8 +327,7 @@ else #endif { - printf("%i %i\n", w, h); - // FIXME: handle npo2 + // FIXME: handle po2 only textures pt->w = w; pt->h = h; } Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-02 06:50:38 UTC (rev 45795) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-02 07:00:10 UTC (rev 45796) @@ -1099,40 +1099,16 @@ Native *n = im->native.data; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -# if 0 // old texfrompixmap if (n->egl_surface) { - if (glsym_eglBindTexImage) - glsym_eglBindTexImage(re->win->egl_disp, n->egl_surface, EGL_SINGLE_BUFFER); - } -# else - if (n->egl_surface) - { if (glsym_glEGLImageTargetTexture2DOES) glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); } -# endif #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXBindTexImage) - { -#ifdef GLX_TEX_PIXMAP_RECREATE - const int pixmap_att[] = - { - GLX_TEXTURE_TARGET_EXT, - GLX_TEXTURE_2D_EXT, - GLX_TEXTURE_FORMAT_EXT, -// GLX_TEXTURE_FORMAT_RGBA_EXT, - GLX_TEXTURE_FORMAT_RGB_EXT, - 0 - }; - - n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, - n->pixmap, pixmap_att); -#endif - glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT, NULL); - } + glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT, NULL); # endif #endif } @@ -1145,24 +1121,12 @@ Native *n = im->native.data; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -# if 0 // old texfrompixmap - if (n->egl_surface) - { - if (glsym_eglReleaseTexImage) - glsym_eglReleaseTexImage(re->win->egl_disp, n->egl_surface, EGL_SINGLE_BUFFER); - } -# endif + // nothing #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXReleaseTexImage) - { - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT); -#ifdef GLX_TEX_PIXMAP_RECREATE - glXDestroyPixmap(re->win->disp, n->glx_pixmap); - n->glx_pixmap = 0; -#endif - } + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT); # endif #endif } @@ -1175,20 +1139,12 @@ Native *n = im->native.data; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -# if 0 // old texfrompixmap if (n->egl_surface) { - eglDestroySurface(re->win->egl_disp, n->egl_surface); - n->egl_surface = 0; - } -# else - if (n->egl_surface) - { if (glsym_eglDestroyImage) glsym_eglDestroyImage(re->win->egl_disp, n->egl_surface); } -# endif #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (n->glx_pixmap) @@ -1290,18 +1246,12 @@ im->native.func.free = _native_free_cb; im->native.target = GL_TEXTURE_2D; im->native.mipmap = 0; -#if 0 // old texfrompixmap - n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp, - egl_config, pm, - NULL); -#else if (glsym_eglCreateImage) n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (void *)pm, NULL); -#endif if (!n->egl_surface) { printf("ERROR: eglCreatePixmapSurface() for 0x%x failed\n", (unsigned int)pm); @@ -1329,7 +1279,6 @@ n = calloc(1, sizeof(Native)); if (n) { -#ifndef GLX_TEX_PIXMAP_RECREATE int pixmap_att[20]; int target = 0; int i = 0; @@ -1377,20 +1326,19 @@ } pixmap_att[i++] = 0; -#endif + memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); n->pixmap = pm; n->visual = vis; n->fbc = re->win->depth_cfg[depth].fbc; im->native.yinvert = re->win->depth_cfg[depth].yinvert; - im->native.target = GL_TEXTURE_2D; im->native.loose = 0; im->native.data = n; im->native.func.data = re; im->native.func.bind = _native_bind_cb; im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; -#ifndef GLX_TEX_PIXMAP_RECREATE + n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, n->pixmap, pixmap_att); if (!target) @@ -1410,9 +1358,11 @@ } else { + im->native.target = GL_TEXTURE_2D; + im->native.mipmap = 0; printf("still unknown target\n"); } -#endif + evas_gl_common_image_native_enable(im); } } |
From: Enlightenment SVN <no-reply@en...> - 2010-02-06 08:38:34
|
Log: reduce binds when things get clipped and split. Author: raster Date: 2010-02-06 00:38:26 -0800 (Sat, 06 Feb 2010) New Revision: 45928 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-06 07:29:10 UTC (rev 45927) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-06 08:38:26 UTC (rev 45928) @@ -555,16 +555,19 @@ } if ((tex->im) && (tex->im->native.data)) { - shader_array_flush(gc); - gc->array.im = tex->im; + if (gc->array.im != tex->im) + { + shader_array_flush(gc); + gc->array.im = tex->im; + } } + gc->array.line = 0; gc->array.use_vertex = 1; gc->array.use_color = 1; gc->array.use_texuv = 1; gc->array.use_texuv2 = 1; gc->array.use_texuv3 = 0; - pnum = gc->array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; @@ -617,12 +620,6 @@ { PUSH_COLOR(r, g, b, a); } - - if ((tex->im) && (tex->im->native.data)) - { - shader_array_flush(gc); - gc->array.im = NULL; - } } void @@ -846,6 +843,14 @@ gc->shader.cw = cw; gc->shader.ch = ch; } + if ((tex->im) && (tex->im->native.data)) + { + if (gc->array.im != tex->im) + { + shader_array_flush(gc); + gc->array.im = tex->im; + } + } gc->array.line = 0; gc->array.use_vertex = 1; gc->array.use_color = 1; @@ -859,7 +864,6 @@ gc->array.num += 6; _evas_gl_common_context_array_alloc(gc); - // FIXME: handle yinvert for (i = 0; i < 4; i++) { tx[i] = ((double)(tex->x) + (((double)p[i].u) / FP1)) / @@ -867,6 +871,10 @@ ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) / (double)tex->pt->h; } + if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert)) + { + // FIXME: handle yinvert + } if (blend) bl = 0.0; @@ -1017,7 +1025,7 @@ } else glDisableVertexAttribArray(SHAD_TEXUV); - + if (gc->array.line) { glDisableVertexAttribArray(SHAD_TEXUV); @@ -1060,6 +1068,7 @@ gc->array.im->native.func.unbind(gc->array.im->native.func.data, gc->array.im); } + gc->array.im = NULL; /* gc->shader.cur_tex = 0; glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-02-06 07:29:10 UTC (rev 45927) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-02-06 08:38:26 UTC (rev 45928) @@ -408,7 +408,7 @@ yuv = 1; im->tex->im = im; - if ((!gc->dc->cutout.rects) || (gc->dc->cutout.active > 8)) + if ((!gc->dc->cutout.rects) || (gc->dc->cutout.active > 16)) { if (gc->dc->clip.use) { Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-06 07:29:10 UTC (rev 45927) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-06 08:38:26 UTC (rev 45928) @@ -430,9 +430,9 @@ re->win->draw.drew = 1; evas_gl_common_context_flush(re->win->gl_context); #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -// no neeed - eglSwapBuffers() should waitnative at end of swap... -// this also may flush cpu+gpu caches etc. thus performancce hit -// eglWaitNative(EGL_CORE_NATIVE_ENGINE); // previous rendering should be done and swapped + // this is needed to make sure all previous rendering is flushed to + // buffers/surfaces + eglWaitNative(EGL_CORE_NATIVE_ENGINE); // previous rendering should be done and swapped #else glXWaitGL(); #endif |
From: Enlightenment SVN <no-reply@en...> - 2010-02-15 04:12:57
|
Log: add checks for vendor etc. too Author: raster Date: 2010-02-14 20:12:50 -0800 (Sun, 14 Feb 2010) New Revision: 46176 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_engine.h trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-14 23:21:06 UTC (rev 46175) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-15 04:12:50 UTC (rev 46176) @@ -165,7 +165,6 @@ { Evas_GL_Context *gc; - gl_symbols(); #if 1 if (_evas_gl_common_context) { @@ -176,6 +175,8 @@ gc = calloc(1, sizeof(Evas_GL_Context)); if (!gc) return NULL; + gl_symbols(); + gc->references = 1; _evas_gl_common_context = gc; Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-14 23:21:06 UTC (rev 46175) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-15 04:12:50 UTC (rev 46176) @@ -1348,8 +1348,7 @@ n->visual = vis; n->fbc = re->win->depth_cfg[depth].fbc; im->native.yinvert = re->win->depth_cfg[depth].yinvert; -// im->native.loose = 1; // works well on nvidia - intel may not be happy i hear. for now.. lets make nv work 1. - because i have an nv card, 2. because it doesnt seem broken for texture-from-pixmap like fglrx has seemed, 3. its some of the best done drivers on linux - im->native.loose = 0; + im->native.loose = re->win->detected.loose_binding; im->native.data = n; im->native.func.data = re; im->native.func.bind = _native_bind_cb; Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.h =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2010-02-14 23:21:06 UTC (rev 46175) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2010-02-15 04:12:50 UTC (rev 46176) @@ -101,6 +101,10 @@ int mipmap; unsigned char yinvert : 1; } depth_cfg[33]; // config for all 32 possible depths! + + struct { + unsigned int loose_binding : 1; + } detected; #endif }; Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-02-14 23:21:06 UTC (rev 46175) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-02-15 04:12:50 UTC (rev 46176) @@ -155,9 +155,29 @@ { int i, j, num; GLXFBConfig *fbc; + const GLubyte *vendor, *renderer, *version; glXMakeCurrent(gw->disp, gw->win, gw->context); + // FIXME: move this up to context creation + + vendor = glGetString(GL_VENDOR); + renderer = glGetString(GL_RENDERER); + version = glGetString(GL_VERSION); + + printf("vendor: %s\n", vendor); + printf("renderer: %s\n", renderer); + printf("version: %s\n", version); + + if (strstr(vendor, "NVIDIA")) + { + gw->detected.loose_binding = 1; + } + else + { + // noothing yet. add more cases and options over time + } + fbc = glXGetFBConfigs(disp, 0/* FIXME: assume screen 0 */, &num); for (i = 0; i <= 32; i++) { |
From: Enlightenment SVN <no-reply@en...> - 2010-02-17 04:22:06
|
Log: lots of gl error catching.. if gl errors happen. it's a #defined macro so it can be removed. Author: raster Date: 2010-02-16 20:21:59 -0800 (Tue, 16 Feb 2010) New Revision: 46233 Removed: trunk/evas/src/modules/engines/gl_common/evas_gl_gradient.c trunk/evas/src/modules/engines/gl_common/evas_gl_misc.c Modified: trunk/evas/src/modules/engines/gl_common/Makefile.am trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/Makefile.am =================================================================== --- trunk/evas/src/modules/engines/gl_common/Makefile.am 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_common/Makefile.am 2010-02-17 04:21:59 UTC (rev 46233) @@ -43,11 +43,6 @@ evas_gl_polygon.c \ evas_gl_line.c -#evas_gl_misc.c \ -#evas_gl_gradient.c \ -#evas_gl_polygon.c \ -# - libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @evas_engine_gl_common_libs@ @dlopen_libs@ endif Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-02-17 04:21:59 UTC (rev 46233) @@ -340,4 +340,12 @@ void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e); void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); +#define GL_ERRORS 1 + +#ifdef GL_ERRORS +# define GLERR(fn, fl, ln, op) if (glGetError()) glerr(fn, fl, ln, op) +#else +# define GLERR(fn, fl, ln, op) #endif + +#endif Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-02-17 04:21:59 UTC (rev 46233) @@ -137,27 +137,39 @@ gc->change.size = 0; glViewport(0, 0, w, h); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); matrix_ident(proj); if (m == 1) matrix_ortho(proj, 0, w, 0, h, -1.0, 1.0); else matrix_ortho(proj, 0, w, h, 0, -1.0, 1.0); glUseProgram(gc->shared->shader.rect.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.rect.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, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shared->shader.font.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 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, 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, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shader.cur_prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } Evas_GL_Context * @@ -219,24 +231,36 @@ ); glDisable(GL_DEPTH_TEST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnable(GL_DITHER); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisable(GL_BLEND); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // no dest alpha // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha // glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? glDepthMask(GL_FALSE); + 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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glEnableVertexAttribArray(SHAD_VERTEX); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_COLOR); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); evas_gl_common_shader_program_init(&(shared->shader.rect), &(shader_rect_vert_src), @@ -259,10 +283,15 @@ &(shader_tex_frag_src), "tex"); glUseProgram(shared->shader.yuv.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "tex"), 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texu"), 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texv"), 2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shader.cur_prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // in shader: // uniform sampler2D tex[8]; // @@ -363,9 +392,15 @@ # endif #endif if (gc->shader.surface == gc->def_surface) - glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); + { + glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } else - glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb); + { + glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } _evas_gl_common_viewport_set(gc); } @@ -914,14 +949,27 @@ // fprintf(stderr, " flush array %i\n", gc->array.num); if (gc->shader.cur_prog != gc->shader.current.cur_prog) - glUseProgram(gc->shader.cur_prog); + { + glUseProgram(gc->shader.cur_prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } if (gc->shader.cur_tex != gc->shader.current.cur_tex) { - if (gc->shader.cur_tex) glEnable(GL_TEXTURE_2D); - else glDisable(GL_TEXTURE_2D); + if (gc->shader.cur_tex) + { + glEnable(GL_TEXTURE_2D); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + glDisable(GL_TEXTURE_2D); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } glActiveTexture(GL_TEXTURE0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } if (gc->array.im) { @@ -938,10 +986,12 @@ { case EVAS_RENDER_BLEND: /**< default op: d = d*(1-sa) + s */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); break; case EVAS_RENDER_COPY: /**< d = s */ gc->shader.blend = 0; glBlendFunc(GL_ONE, GL_ONE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); break; // FIXME: fix blend funcs below! case EVAS_RENDER_BLEND_REL: /**< d = d*(1 - sa) + s*da */ @@ -956,13 +1006,22 @@ case EVAS_RENDER_MUL: /**< d = d*s */ default: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); break; } } if (gc->shader.blend != gc->shader.current.blend) { - if (gc->shader.blend) glEnable(GL_BLEND); - else glDisable(GL_BLEND); + if (gc->shader.blend) + { + glEnable(GL_BLEND); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + glDisable(GL_BLEND); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } if (gc->shader.smooth != gc->shader.current.smooth) { @@ -970,21 +1029,31 @@ { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } } /* hmmm this breaks things. must find out why! @@ -1018,48 +1087,73 @@ } */ glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->array.vertex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->array.color); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (gc->array.use_texuv) { glEnableVertexAttribArray(SHAD_TEXUV); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else - glDisableVertexAttribArray(SHAD_TEXUV); + { + glDisableVertexAttribArray(SHAD_TEXUV); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } if (gc->array.line) { glDisableVertexAttribArray(SHAD_TEXUV); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisableVertexAttribArray(SHAD_TEXUV3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDrawArrays(GL_LINES, 0, gc->array.num); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else { if ((gc->array.use_texuv2) && (gc->array.use_texuv3)) { glEnableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_TEXUV3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glActiveTexture(GL_TEXTURE1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texu); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glActiveTexture(GL_TEXTURE2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texv); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glActiveTexture(GL_TEXTURE0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else if (gc->array.use_texuv2) { glEnableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else { glDisableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisableVertexAttribArray(SHAD_TEXUV3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } glDrawArrays(GL_TRIANGLES, 0, gc->array.num); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } if (gc->array.im) { Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-02-17 04:21:59 UTC (rev 46233) @@ -363,8 +363,6 @@ _evas_gl_common_image_update(gc, im); - 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; Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-02-17 04:21:59 UTC (rev 46233) @@ -235,12 +235,17 @@ p->frag = glCreateShader(GL_FRAGMENT_SHADER); #if defined (GLES_VARIETY_S3C6410) glShaderBinary(1, &(p->vert), 0, vert->bin, vert->bin_size); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #else glShaderSource(p->vert, 1, (const char **)&(vert->src), NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glCompileShader(p->vert); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!ok) { gl_compile_link_error(p->vert, "compile vertex shader"); @@ -249,8 +254,11 @@ } glShaderSource(p->frag, 1, (const char **)&(frag->src), NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glCompileShader(p->frag); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!ok) { gl_compile_link_error(p->frag, "compile fragment shader"); @@ -260,16 +268,25 @@ #endif p->prog = glCreateProgram(); 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"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glLinkProgram(p->prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glGetProgramiv(p->prog, GL_LINK_STATUS, &ok); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!ok) { gl_compile_link_error(p->prog, "link fragment and vertex shaders"); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-02-17 04:21:59 UTC (rev 46233) @@ -91,12 +91,14 @@ _tex_2d(int intfmt, int w, int h, int fmt, int type) { glTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } static void _tex_sub_2d(int x, int y, int w, int h, int fmt, int type, const void *pix) { glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } static Evas_GL_Texture_Pool * @@ -116,13 +118,20 @@ pt->dataformat = GL_UNSIGNED_BYTE; pt->references = 0; glGenTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, pt->texture); + 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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; } @@ -295,19 +304,30 @@ # endif #endif glGenTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, pt->texture); + 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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + 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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glsym_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pt->texture, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; } @@ -337,7 +357,9 @@ pt->references = 0; pt->native = 1; 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 @@ -349,11 +371,17 @@ #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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(im->native.target, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(im->native.target, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; } @@ -372,7 +400,12 @@ } glDeleteTextures(1, &(pt->texture)); - if (pt->fb) glsym_glDeleteFramebuffers(1, &(pt->fb)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + if (pt->fb) + { + glsym_glDeleteFramebuffers(1, &(pt->fb)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } memset(pt, 0x22, sizeof(Evas_GL_Texture_Pool)); // mark as freed free(pt); } @@ -454,10 +487,13 @@ } if (!tex->pt) return; glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // +-+ // +-+ @@ -508,7 +544,10 @@ rgba_fmt, tex->pt->dataformat, im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1)); if (tex->pt->texture != tex->gc->shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + { + glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } void @@ -574,14 +613,20 @@ { if (!tex->pt) return; glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #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, pixels); if (tex->pt->texture != tex->gc->shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + { + glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } Evas_GL_Texture * @@ -655,18 +700,27 @@ // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); #else glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if ((rows[1] - rows[0]) == w) _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); else @@ -676,6 +730,7 @@ } glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if ((rows[h + 1] - rows[h]) == (w / 2)) _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); else @@ -685,6 +740,7 @@ } glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (w / 2)) _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); else @@ -694,5 +750,8 @@ } #endif if (tex->pt->texture != tex->gc->shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + { + glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-17 04:21:59 UTC (rev 46233) @@ -417,6 +417,10 @@ // this is needed to make sure all previous rendering is flushed to // buffers/surfaces eglWaitNative(EGL_CORE_NATIVE_ENGINE); // previous rendering should be done and swapped + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: eglWaitNative(EGL_CORE_NATIVE_ENGINE) fail.\n"); + } #else glXWaitGL(); #endif @@ -436,6 +440,10 @@ #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: eglSwapBuffers() fail.\n"); + } #else #ifdef VSYNC_TO_SCREEN if ((re->info->vsync)/* || (1)*/) @@ -1117,13 +1125,30 @@ if (n->egl_surface) { if (glsym_glEGLImageTargetTexture2DOES) - glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); + { + glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: glEGLImageTargetTexture2DOES() fail.\n"); + } + } + else + { + printf("Try glEGLImageTargetTexture2DOES on EGL with no support\n"); + } } #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXBindTexImage) - glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT, NULL); + { + glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT, NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXBindTexImage on GLX with no support\n"); + } # endif #endif } @@ -1140,8 +1165,15 @@ #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXReleaseTexImage) - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT); + { + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXReleaseTexImage on GLX with no support\n"); + } # endif #endif } @@ -1157,8 +1189,18 @@ if (n->egl_surface) { if (glsym_eglDestroyImage) - glsym_eglDestroyImage(re->win->egl_disp, - n->egl_surface); + { + glsym_eglDestroyImage(re->win->egl_disp, + n->egl_surface); + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: eglDestroyImage() fail.\n"); + } + } + else + { + printf("Try eglDestroyImage on EGL with no support\n"); + } } #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT @@ -1167,12 +1209,25 @@ if (im->native.loose) { if (glsym_glXReleaseTexImage) - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT); + { + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXReleaseTexImage on GLX with no support\n"); + } } -// printf("free glx pixmap %p\n", n->glx_pixmap); if (glsym_glXDestroyPixmap) - glsym_glXDestroyPixmap(re->win->disp, n->glx_pixmap); + { + glsym_glXDestroyPixmap(re->win->disp, n->glx_pixmap); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXDestroyPixmap on GLX with no support\n"); + } n->glx_pixmap = 0; } # endif @@ -1264,11 +1319,17 @@ im->native.target = GL_TEXTURE_2D; im->native.mipmap = 0; if (glsym_eglCreateImage) - n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, - EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - (void *)pm, - NULL); + { + n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, + EGL_NO_CONTEXT, + EGL_NATIVE_PIXMAP_KHR, + (void *)pm, + NULL); + } + else + { + printf("Try eglCreateImage on EGL with no support\n"); + } if (!n->egl_surface) { printf("ERROR: eglCreatePixmapSurface() for 0x%x failed\n", (unsigned int)pm); @@ -1290,7 +1351,8 @@ unsigned int w, h, depth = 32, border; Window wdummy; Native *n; - + + // fixme: round trip :( XGetGeometry(re->win->disp, pm, &wdummy, &dummy, &dummy, &w, &h, &border, &depth); n = calloc(1, sizeof(Native)); @@ -1355,8 +1417,14 @@ im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; if (glsym_glXCreatePixmap) - n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp, n->fbc, - n->pixmap, pixmap_att); + { + n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp, n->fbc, + n->pixmap, pixmap_att); + } + else + { + printf("Try glXCreatePixmap on GLX with no support\n"); + } if (n->glx_pixmap) { // printf("new native texture for %x | %4i x %4i @ %2i = %p\n", @@ -1386,6 +1454,10 @@ printf("still unknown target\n"); } } + else + { + printf("ERROR: GLX Pixmap create fail\n"); + } evas_gl_common_image_native_enable(im); } Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-02-17 04:17:34 UTC (rev 46232) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-02-17 04:21:59 UTC (rev 46233) @@ -179,6 +179,10 @@ } fbc = glXGetFBConfigs(disp, 0/* FIXME: assume screen 0 */, &num); + if (!fbc) + { + printf("ERROR: glXGetFBConfigs() returned no fb configs\n"); + } for (i = 0; i <= 32; i++) { for (j = 0; j < num; j++) @@ -364,6 +368,10 @@ configs = glXChooseFBConfig(einfo->info.display, einfo->info.screen, config_attrs, &num); + if ((!configs) || (num < 1)) + { + printf("ERROR: glXChooseFBConfig returned no configs\n"); + } for (i = 0; i < num; i++) { XVisualInfo *visinfo; @@ -395,7 +403,6 @@ } XFree(visinfo); } - printf("ecore_evas_gl_x11_new = %p\n", _evas_gl_x11_vi); #else int _evas_gl_x11_configuration[] = { |
From: Enlightenment SVN <no-reply@en...> - 2010-02-21 15:49:52
|
Log: fix alpha set/unset on image obj in gl engine. Author: raster Date: 2010-02-21 07:49:44 -0800 (Sun, 21 Feb 2010) New Revision: 46344 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-02-21 10:55:45 UTC (rev 46343) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-02-21 15:49:44 UTC (rev 46344) @@ -341,6 +341,7 @@ Evas_GL_Image *evas_gl_common_image_new_from_data(Evas_GL_Context *gc, int w, int h, DATA32 *data, int alpha, int cspace); Evas_GL_Image *evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, DATA32 *data, int alpha, int cspace); Evas_GL_Image *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspace); +Evas_GL_Image *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha); void evas_gl_common_image_native_enable(Evas_GL_Image *im); void evas_gl_common_image_native_disable(Evas_GL_Image *im); void evas_gl_common_image_free(Evas_GL_Image *im); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-02-21 10:55:45 UTC (rev 46343) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-02-21 15:49:44 UTC (rev 46344) @@ -174,6 +174,24 @@ return im; } +Evas_GL_Image * +evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha) +{ + if (!im) return NULL; + if (im->alpha == alpha) return im; + im->alpha = alpha; + if (!im->im) return im; + im->im->cache_entry.flags.alpha = alpha ? 1 : 0; + if (im->tex) + { + evas_gl_common_texture_free(im->tex); + im->tex = NULL; + } + if (!im->tex) + im->tex = evas_gl_common_texture_new(im->gc, im->im); + return im; +} + void evas_gl_common_image_native_enable(Evas_GL_Image *im) { @@ -224,6 +242,8 @@ im->cs.space = EVAS_COLORSPACE_ARGB8888; evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space); im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h); + if (!im->tex) + im->tex = evas_gl_common_texture_new(im->gc, im->im); } void @@ -308,9 +328,7 @@ case EVAS_COLORSPACE_ARGB8888: evas_cache_image_load_data(&im->im->cache_entry); if ((im->tex) && (im->dirty)) - { - evas_gl_common_texture_update(im->tex, im->im); - } + evas_gl_common_texture_update(im->tex, im->im); if (!im->tex) im->tex = evas_gl_common_texture_new(gc, im->im); im->dirty = 0; Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-21 10:55:45 UTC (rev 46343) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-02-21 15:49:44 UTC (rev 46344) @@ -999,8 +999,9 @@ } else evas_gl_common_image_dirty(im, 0, 0, 0, 0); - im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0; - return image; + return evas_gl_common_image_alpha_set(im, has_alpha ? 1 : 0); +// im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0; +// return image; } static void * |
From: Enlightenment SVN <no-reply@en...> - 2010-03-01 04:44:30
|
Log: begin work on argb window support for gl - glx/gl doesnt work. i think egl/gles will tho. Author: raster Date: 2010-02-28 20:44:23 -0800 (Sun, 28 Feb 2010) New Revision: 46677 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_engine.h trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-03-01 02:20:41 UTC (rev 46676) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-03-01 04:44:23 UTC (rev 46677) @@ -365,7 +365,7 @@ void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e); void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); -//#define GL_ERRORS 1 +#define GL_ERRORS 1 #ifdef GL_ERRORS # define GLERR(fn, fl, ln, op) \ Modified: trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h =================================================================== --- trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h 2010-03-01 02:20:41 UTC (rev 46676) +++ trunk/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h 2010-03-01 04:44:23 UTC (rev 46677) @@ -13,12 +13,14 @@ /* engine specific data & parameters it needs to set up */ struct { - Display *display; - Drawable drawable; - Visual *visual; - Colormap colormap; - int depth; - int screen; + Display *display; + Drawable drawable; + Visual *visual; + Colormap colormap; + int depth; + int screen; + int rotation; + unsigned int destination_alpha : 1; } info; /* engine specific function calls to query stuff about the destination */ /* engine (what visual & colormap & depth to use, performance info etc. */ Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-03-01 02:20:41 UTC (rev 46676) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-03-01 04:44:23 UTC (rev 46677) @@ -182,7 +182,8 @@ info->info.depth, e->output.w, e->output.h, - info->indirect); + info->indirect, + info->info.destination_alpha); if (!re->win) { free(re); @@ -258,7 +259,8 @@ (0 != re->win->screen) || /* FIXME: screen 0 assumption */ (info->info.visual != re->win->visual) || (info->info.colormap != re->win->colormap) || - (info->info.depth != re->win->depth)) + (info->info.depth != re->win->depth) || + (info->info.destination_alpha != re->win->alpha)) { eng_window_free(re->win); re->win = eng_window_new(info->info.display, @@ -269,7 +271,8 @@ info->info.depth, e->output.w, e->output.h, - info->indirect); + info->indirect, + info->info.destination_alpha); } else if ((re->win->w != e->output.w) || (re->win->h != e->output.h)) @@ -287,6 +290,12 @@ e->engine.func->context_new(e->engine.data.output); eng_window_use(re->win); + if (re->win->alpha) + { + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + } + _sym_init(); return 1; @@ -498,7 +507,13 @@ { re->info->callback.post_swap(re->info->callback.data, re->evas); } -#endif +#endif + + if (re->win->alpha) + { + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + } } static void Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.h =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2010-03-01 02:20:41 UTC (rev 46676) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2010-03-01 04:44:23 UTC (rev 46677) @@ -81,6 +81,7 @@ Visual *visual; Colormap colormap; int depth; + int alpha; Evas_GL_Context *gl_context; struct { int redraw : 1; @@ -94,6 +95,7 @@ EGLDisplay egl_disp; #else GLXContext context; + GLXWindow glxwin; struct { GLXFBConfig fbc; int tex_format; @@ -111,7 +113,8 @@ Evas_GL_X11_Window *eng_window_new(Display *disp, Window win, int screen, Visual *vis, Colormap cmap, - int depth, int w, int h, int indirect); + int depth, int w, int h, int indirect, + int alpha); void eng_window_free(Evas_GL_X11_Window *gw); void eng_window_use(Evas_GL_X11_Window *gw); Visual *eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo); Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-03-01 02:20:41 UTC (rev 46676) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-03-01 04:44:23 UTC (rev 46677) @@ -7,9 +7,16 @@ #else // FIXME: this will only work for 1 display connection (glx land can have > 1) static GLXContext context = 0; +static GLXContext rgba_context = 0; +static GLXFBConfig fbconf = 0; +static GLXFBConfig rgba_fbconf = 0; #endif +// fixme: something is up/wrong here - dont know what tho... +//#define NEWGL 1 + XVisualInfo *_evas_gl_x11_vi = NULL; +XVisualInfo *_evas_gl_x11_rgba_vi = NULL; Colormap _evas_gl_x11_cmap = 0; Evas_GL_X11_Window * @@ -21,13 +28,15 @@ int depth, int w, int h, - int indirect) + int indirect, + int alpha) { Evas_GL_X11_Window *gw; int context_attrs[3]; int config_attrs[20]; int major_version, minor_version; int num_config; + XVisualInfo *vi_use; if (!_evas_gl_x11_vi) return NULL; @@ -39,16 +48,36 @@ gw->visual = vis; gw->colormap = cmap; gw->depth = depth; - - gw->visualinfo = _evas_gl_x11_vi; - + gw->alpha = alpha; + + vi_use = _evas_gl_x11_vi; + if (alpha) + { +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + if (_evas_gl_x11_rgba_vi) + { + vi_use = _evas_gl_x11_rgba_vi; + printf("argb vis!!!!!!!!!1\n"); + } +#else +#ifdef NEWGL + if (_evas_gl_x11_rgba_vi) + { + vi_use = _evas_gl_x11_rgba_vi; + printf("argb vis!!!!!!!!!1\n"); + } +#endif +#endif + } + gw->visualinfo = vi_use; + // EGL / GLES #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION; context_attrs[1] = 2; context_attrs[2] = EGL_NONE; # if defined(GLES_VARIETY_S3C6410) - if (_evas_gl_x11_vi->depth == 16) // 16bpp + if (gw->visualinfo->depth == 16) // 16bpp { config_attrs[0] = EGL_SURFACE_TYPE; config_attrs[1] = EGL_WINDOW_BIT; @@ -85,15 +114,31 @@ config_attrs[14] = EGL_NONE; } # elif defined(GLES_VARIETY_SGX) - context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION; - context_attrs[1] = 2; - context_attrs[2] = EGL_NONE; - config_attrs[0] = EGL_SURFACE_TYPE; config_attrs[1] = EGL_WINDOW_BIT; config_attrs[2] = EGL_RENDERABLE_TYPE; config_attrs[3] = EGL_OPENGL_ES2_BIT; - config_attrs[4] = EGL_NONE; + config_attrs[4] = EGL_RED_SIZE; + config_attrs[5] = 1; + config_attrs[6] = EGL_GREEN_SIZE; + config_attrs[7] = 1; + config_attrs[8] = EGL_BLUE_SIZE; + config_attrs[9] = 1; + if (alpha) + { + config_attrs[10] = EGL_ALPHA_SIZE; + config_attrs[11] = 1; + } + else + { + config_attrs[10] = EGL_ALPHA_SIZE; + config_attrs[11] = 0; + } + config_attrs[12] = EGL_DEPTH_SIZE; + config_attrs[13] = 0; + config_attrs[14] = EGL_STENCIL_SIZE; + config_attrs[15] = 0; + config_attrs[16] = EGL_NONE; # endif gw->egl_disp= eglGetDisplay((EGLNativeDisplayType)(gw->disp)); if (!gw->egl_disp) @@ -140,25 +185,70 @@ #else if (!context) { +#ifdef NEWGL + printf("fbconf %p\n", fbconf); if (indirect) + context = glXCreateNewContext(disp, fbconf, + GLX_RGBA_TYPE, NULL, + GL_TRUE); + else + context = glXCreateNewContext(disp, fbconf, + GLX_RGBA_TYPE, NULL, + GL_FALSE); + printf("context = %p\n", context); +#else + if (indirect) context = glXCreateContext(disp, gw->visualinfo, NULL, GL_FALSE); else context = glXCreateContext(disp, gw->visualinfo, NULL, GL_TRUE); - if (!context) - context = glXCreateContext(disp, gw->visualinfo, NULL, GL_TRUE); - if (!context) - context = glXCreateContext(disp, gw->visualinfo, NULL, GL_FALSE); +#endif } +#ifdef NEWGL + if ((alpha) && (!rgba_context)) + { + if (indirect) + rgba_context = glXCreateNewContext(disp, rgba_fbconf, + GLX_RGBA_TYPE, context, + GL_TRUE); + else + rgba_context = glXCreateNewContext(disp, rgba_fbconf, + GLX_RGBA_TYPE, context, + GL_FALSE); + printf("rgba_context = %p, from fbconf %p, context %p\n", rgba_context, rgba_fbconf, context); + } + if (alpha) + gw->glxwin = glXCreateWindow(disp, rgba_fbconf, gw->win, NULL); + else + gw->glxwin = glXCreateWindow(disp, fbconf, gw->win, NULL); + + if (alpha) gw->context = rgba_context; + else gw->context = context; +#else gw->context = context; +#endif if (gw->context) { int i, j, num; GLXFBConfig *fbc; const GLubyte *vendor, *renderer, *version; + + if (gw->glxwin) + { + if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, + gw->context)) + { + printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", gw->disp, gw->win, gw->win, gw->context); + } + } + else + { + if (!glXMakeCurrent(gw->disp, gw->win, gw->context)) + { + printf("Error: glXMakeCurrent(%p, 0x%x, %p) failed\n", gw->disp, gw->win, gw->context); + } + } - glXMakeCurrent(gw->disp, gw->win, gw->context); - // FIXME: move this up to context creation vendor = glGetString(GL_VENDOR); @@ -178,10 +268,10 @@ // noothing yet. add more cases and options over time } - fbc = glXGetFBConfigs(disp, 0/* FIXME: assume screen 0 */, &num); + fbc = glXGetFBConfigs(disp, screen, &num); if (!fbc) { - printf("ERROR: glXGetFBConfigs() returned no fb configs\n"); + printf("Error: glXGetFBConfigs() returned no fb configs\n"); } for (i = 0; i <= 32; i++) { @@ -253,7 +343,7 @@ } } XFree(fbc); - if (!gw->depth_cfg[DefaultDepth(disp, 0/* FIXMEL assume screen 0*/)].fbc) + if (!gw->depth_cfg[DefaultDepth(disp, screen)].fbc) { printf("text from pixmap not going to work\n"); } @@ -281,6 +371,7 @@ if (gw->egl_surface[0] != EGL_NO_SURFACE) eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); #else + if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin); // FIXME: refcount context // glXDestroyContext(gw->disp, gw->context); #endif @@ -306,7 +397,21 @@ } // GLX #else - glXMakeCurrent(gw->disp, gw->win, gw->context); + if (gw->glxwin) + { + if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, + gw->context)) + { + printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", gw->disp, gw->win, gw->win, gw->context); + } + } + else + { + if (!glXMakeCurrent(gw->disp, gw->win, gw->context)) + { + printf("Error: glXMakeCurrent(%p, 0x%x, %p) failed\n", gw->disp, gw->win, gw->context); + } + } #endif } evas_gl_common_context_use(gw->gl_context); @@ -319,110 +424,162 @@ if (!einfo->info.display) return NULL; if (!_evas_gl_x11_vi) { + int alpha; + // EGL / GLES #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) - int depth = DefaultDepth(einfo->info.display, - einfo->info.screen); - _evas_gl_x11_vi = calloc(1, sizeof(XVisualInfo)); - XMatchVisualInfo(einfo->info.display, - einfo->info.screen, depth, TrueColor, - _evas_gl_x11_vi); + for (alpha = 0; alpha < 2; alpha++) + { + int depth = DefaultDepth(einfo->info.display, + einfo->info.screen); + if (alpha) + { + XVisualInfo *xvi, vi_in; + int nvi, i; + XRenderPictFormat *fmt; + + vi_in.screen = einfo->info.screen; + vi_in.depth = 32; + vi_in.class = TrueColor; + xvi = XGetVisualInfo(einfo->info.display + VisualScreenMask | VisualDepthMask | + VisualClassMask, + &vi_in, &nvi); + if (xvi) + { + for (i = 0; i < nvi; i++) + { + fmt = XRenderFindVisualFormat(einfo->info.display, + xvi[i].visual); + if ((fmt->type == PictTypeDirect) && + (fmt->direct.alphaMask)) + { + _evas_gl_x11_rgba_vi = + calloc(1, sizeof(XVisualInfo)); + if (_evas_gl_x11_rgba_vi) + memcpy(_evas_gl_x11_rgba_vi, + &(xvi[i]), sizeof(XVisualInfo)); + break; + } + } + XFree (xvi); + } + } + else + { + _evas_gl_x11_vi = calloc(1, sizeof(XVisualInfo)); + XMatchVisualInfo(einfo->info.display, + einfo->info.screen, depth, TrueColor, + _evas_gl_x11_vi); + } + } // GLX #else - -#if 1 - 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; - config_attrs[i++] = GLX_DOUBLEBUFFER; - config_attrs[i++] = 1; - config_attrs[i++] = GLX_RED_SIZE; - config_attrs[i++] = 1; - config_attrs[i++] = GLX_GREEN_SIZE; - config_attrs[i++] =1; - config_attrs[i++] = GLX_BLUE_SIZE; - config_attrs[i++] = 1; - config_attrs[i++] = GLX_ALPHA_SIZE; - config_attrs[i++] = 0; -//// only needed if we want argb -// config_attrs[i++] = GLX_RENDER_TYPE; -// config_attrs[i++] = 0;//GLX_RGBA_BIT; - config_attrs[i++] = GLX_DEPTH_SIZE; - config_attrs[i++] = 0; - config_attrs[i++] = GLX_STENCIL_SIZE; - config_attrs[i++] = 0; - config_attrs[i++] = GLX_AUX_BUFFERS; - config_attrs[i++] = 0; - config_attrs[i++] = GLX_STEREO; - config_attrs[i++] = 0; - config_attrs[i++] = GLX_TRANSPARENT_TYPE; - config_attrs[i++] = GLX_NONE;//GLX_TRANSPARENT_RGB; -// config_attrs[i++] = GLX_TRANSPARENT_TYPE; -// config_attrs[i++] = GLX_NONE;//GLX_TRANSPARENT_INDEX; - config_attrs[i++] = 0; - - configs = glXChooseFBConfig(einfo->info.display, - einfo->info.screen, - config_attrs, &num); - if ((!configs) || (num < 1)) + for (alpha = 0; alpha < 2; alpha++) { - printf("ERROR: glXChooseFBConfig returned no configs\n"); - } - for (i = 0; i < num; i++) - { - XVisualInfo *visinfo; - XRenderPictFormat *format; + int config_attrs[40]; + GLXFBConfig *configs = NULL, config = 0; + int i, num; - visinfo = glXGetVisualFromFBConfig(einfo->info.display, - configs[i]); - if (!visinfo) continue; - if (1) // non argb + i = 0; + config_attrs[i++] = GLX_DRAWABLE_TYPE; + config_attrs[i++] = GLX_WINDOW_BIT; + config_attrs[i++] = GLX_DOUBLEBUFFER; + config_attrs[i++] = 1; + config_attrs[i++] = GLX_RED_SIZE; + config_attrs[i++] = 1; + config_attrs[i++] = GLX_GREEN_SIZE; + config_attrs[i++] =1; + config_attrs[i++] = GLX_BLUE_SIZE; + config_attrs[i++] = 1; + if (alpha) { - config = configs[i]; - _evas_gl_x11_vi = visinfo; - break; + config_attrs[i++] = GLX_RENDER_TYPE; + config_attrs[i++] = GLX_RGBA_BIT; + config_attrs[i++] = GLX_ALPHA_SIZE; + config_attrs[i++] = 1; } else { - format = XRenderFindVisualFormat(einfo->info.display, visinfo->visual); - if (!format) + config_attrs[i++] = GLX_ALPHA_SIZE; + config_attrs[i++] = 0; + } + config_attrs[i++] = GLX_DEPTH_SIZE; + config_attrs[i++] = 0; + config_attrs[i++] = GLX_STENCIL_SIZE; + config_attrs[i++] = 0; + config_attrs[i++] = GLX_AUX_BUFFERS; + config_attrs[i++] = 0; + config_attrs[i++] = GLX_STEREO; + config_attrs[i++] = 0; + 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, + einfo->info.screen, + config_attrs, &num); + if ((!configs) || (num < 1)) + { + printf("Error: glXChooseFBConfig returned no configs\n"); + } + for (i = 0; i < num; i++) + { + XVisualInfo *visinfo; + XRenderPictFormat *format; + + visinfo = glXGetVisualFromFBConfig(einfo->info.display, + configs[i]); + if (!visinfo) continue; + if (!alpha) { - XFree(visinfo); - continue; - } - if (format->direct.alphaMask > 0) - { config = configs[i]; _evas_gl_x11_vi = visinfo; + fbconf = config; break; } + else + { + format = XRenderFindVisualFormat(einfo->info.display, visinfo->visual); + if (!format) + { + XFree(visinfo); + continue; + } + if (format->direct.alphaMask > 0) + { + config = configs[i]; + _evas_gl_x11_rgba_vi = visinfo; + rgba_fbconf = config; + break; + } + } + XFree(visinfo); } - XFree(visinfo); +#endif } -#else - int _evas_gl_x11_configuration[] = + } + if (!_evas_gl_x11_vi) return NULL; + if (einfo->info.destination_alpha) + { +// EGL / GLES +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + if (_evas_gl_x11_rgba_vi) { - GLX_RGBA, GLX_DOUBLEBUFFER, - GLX_LEVEL, 0, - GLX_DEPTH_SIZE, 0, - GLX_STENCIL_SIZE, 0, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE,1, - GLX_BLUE_SIZE, 1, - None - }; - _evas_gl_x11_vi = glXChooseVisual(einfo->info.display, - einfo->info.screen, - _evas_gl_x11_configuration); -#endif - -#endif + printf("argb vis %x\n", _evas_gl_x11_rgba_vi->visual); + return _evas_gl_x11_rgba_vi->visual; + } +#else +# ifdef NEWGL + if (_evas_gl_x11_rgba_vi) + { + printf("argb vis %x\n", _evas_gl_x11_rgba_vi->visual); + return _evas_gl_x11_rgba_vi->visual; + } +# endif +#endif } - if (!_evas_gl_x11_vi) return NULL; + printf("vis %x\n", _evas_gl_x11_vi->visual); return _evas_gl_x11_vi->visual; } |
From: Enlightenment SVN <no-reply@en...> - 2010-03-01 15:51:35
|
Log: fix calloc with negative values - missing size set initially! Author: raster Date: 2010-03-01 07:51:22 -0800 (Mon, 01 Mar 2010) New Revision: 46701 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-03-01 15:08:40 UTC (rev 46700) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-03-01 15:51:22 UTC (rev 46701) @@ -143,7 +143,7 @@ im = calloc(1, sizeof(Evas_GL_Image)); if (!im) return NULL; im->references = 1; - im->im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get()); + im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); if (!im->im) { free(im); @@ -153,10 +153,12 @@ im->im->cache_entry.flags.alpha = alpha ? 1 : 0; im->cs.space = cspace; im->alpha = im->im->cache_entry.flags.alpha; + im->im->cache_entry.w = w; + im->im->cache_entry.h = h; im->w = im->im->cache_entry.w; im->h = im->im->cache_entry.h; evas_cache_image_colorspace(&im->im->cache_entry, cspace); - im->im = (RGBA_Image *) evas_cache_image_size_set(&im->im->cache_entry, w, h); + im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, w, h); switch (cspace) { case EVAS_COLORSPACE_ARGB8888: Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-03-01 15:08:40 UTC (rev 46700) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-03-01 15:51:22 UTC (rev 46701) @@ -408,12 +408,15 @@ char *logtxt; glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen); - logtxt = calloc(loglen, sizeof(char)); - if (logtxt) + if (loglen > 0) { - glGetProgramInfoLog(target, loglen, &chars, logtxt); - printf("Failed to %s: %s\n", action, logtxt); - free(logtxt); + logtxt = calloc(loglen, sizeof(char)); + if (logtxt) + { + glGetProgramInfoLog(target, loglen, &chars, logtxt); + printf("Failed to %s: %s\n", action, logtxt); + free(logtxt); + } } } Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-03-01 15:08:40 UTC (rev 46700) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-03-01 15:51:22 UTC (rev 46701) @@ -36,13 +36,12 @@ void (*glsym_glXDestroyPixmap) (Display *a, XID b) = NULL; void (*glsym_glXQueryDrawable) (Display *a, XID b, int c, unsigned int *d) = NULL; #endif - + static void _sym_init(void) { static int done = 0; - if (done) return; #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) |
From: Enlightenment SVN <no-reply@en...> - 2010-03-23 09:55:09
|
Log: 1. clean up egl better on context shutdown 2. clean up pprograms/shaders on shared shutdown Author: raster Date: 2010-03-23 02:55:02 -0700 (Tue, 23 Mar 2010) New Revision: 47386 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-03-23 08:19:18 UTC (rev 47385) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-03-23 09:55:02 UTC (rev 47386) @@ -324,6 +324,7 @@ Evas_GL_Program_Source *vert, Evas_GL_Program_Source *frag, const char *name); +void evas_gl_common_shader_program_shutdown(Evas_GL_Program *p); void evas_gl_common_rect_draw(Evas_GL_Context *gc, int x, int y, int w, int h); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-03-23 08:19:18 UTC (rev 47385) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-03-23 09:55:02 UTC (rev 47386) @@ -393,7 +393,7 @@ GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_COLOR); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - + evas_gl_common_shader_program_init(&(shared->shader.rect), &(shader_rect_vert_src), &(shader_rect_frag_src), @@ -485,6 +485,17 @@ if (gc->shared->references == 0) { + 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)); + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img_nomul)); + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img_bgra)); + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img_bgra_nomul)); + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.yuv)); + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.yuv_nomul)); + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.tex)); + evas_gl_common_shader_program_shutdown(&(gc->shared->shader.tex_nomul)); + while (gc->shared->images) { evas_gl_common_image_free(gc->shared->images->data); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-03-23 08:19:18 UTC (rev 47385) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-03-23 09:55:02 UTC (rev 47386) @@ -492,3 +492,11 @@ return; } } + +void +evas_gl_common_shader_program_shutdown(Evas_GL_Program *p) +{ + glDeleteShader(p->vert); + glDeleteShader(p->frag); + glDeleteProgram(p->prog); +} Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-03-23 08:19:18 UTC (rev 47385) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-03-23 09:55:02 UTC (rev 47386) @@ -398,8 +398,9 @@ eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); if (win_count == 0) { - if (context) eglDestroyContext(gw->disp, context); - eglTerminate(gw->disp); + if (context) eglDestroyContext(gw->egl_disp, context); + eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglTerminate(gw->egl_disp); context = EGL_NO_CONTEXT; } #else |
From: Enlightenment SVN <no-reply@en...> - 2010-05-09 05:15:27
|
Log: gl engine now does rotates (0, 90, 180, 270), like software engines Author: raster Date: 2010-05-08 22:15:20 -0700 (Sat, 08 May 2010) New Revision: 48704 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_engine.h trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-05-09 04:10:53 UTC (rev 48703) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-05-09 05:15:20 UTC (rev 48704) @@ -113,12 +113,14 @@ } shader; int references; int w, h; + int rot; }; struct _Evas_GL_Context { int references; int w, h; + int rot; RGBA_Draw_Context *dc; Evas_GL_Shared *shared; @@ -284,7 +286,7 @@ Evas_GL_Context *evas_gl_common_context_new(void); void evas_gl_common_context_free(Evas_GL_Context *gc); void evas_gl_common_context_use(Evas_GL_Context *gc); -void evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h); +void evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot); void evas_gl_common_context_target_surface_set(Evas_GL_Context *gc, Evas_GL_Image *surface); void evas_gl_common_context_line_push(Evas_GL_Context *gc, Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-05-09 04:10:53 UTC (rev 48703) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-05-09 05:15:20 UTC (rev 48704) @@ -80,29 +80,83 @@ { memset(m, 0, 16 * sizeof(GLfloat)); m[0] = m[5] = m[10] = m[15] = 1.0; + //------------------------ + // 1 0 0 0 + // 0 1 0 0 + // 0 0 1 0 + // 0 0 0 1 } static void matrix_ortho(GLfloat *m, GLfloat l, GLfloat r, GLfloat t, GLfloat b, - GLfloat near, GLfloat far) + GLfloat near, GLfloat far, + int rot, int w, int h) { + GLfloat rotf; + GLfloat cosv, sinv; + GLfloat tx, ty; + +// rot = 180; + //------------------------ m[0] = 2.0 / (r - l); - m[1] = m[2] = m[3] = 0.0; - + m[1] = 0.0; + m[2] = 0.0; + m[3] = 0.0; + + //------------------------ m[4] = 0.0; m[5] = 2.0 / (t - b); - m[6] = m[7] = 0.0; + m[6] = 0.0; + m[7] = 0.0; - m[8] = m[9] = 0.0; + //------------------------ + m[8] = 0.0; + m[9] = 0.0; m[10] = -(2.0 / (far - near)); m[11] = 0.0; - m[12] = -((r + l)/(r - l)); - m[13] = -((t + b)/(t - b)); - m[14] = -((near + far)/(far - near)); + //------------------------ + m[12] = -((r + l) / (r - l)); + m[13] = -((t + b) / (t - b)); + m[14] = -((near + far) / (far - near)); m[15] = 1.0; + + // rot + rotf = (((rot / 90) & 0x3) * M_PI) / 2.0; + + tx = 0.0; + ty = 0.0; + if (rot == 90) + { + tx = -(w * 1.0); + ty = -(h * 0.0); + } + if (rot == 180) + { + tx = -(w * 1.0); + ty = -(h * 1.0); + } + if (rot == 270) + { + tx = -(w * 0.0); + ty = -(h * 1.0); + } + + cosv = cos(rotf); + sinv = sin(rotf); + + m[0] = (2.0 / (r - l)) * ( cosv); + m[1] = (2.0 / (r - l)) * ( sinv); + + m[4] = (2.0 / (t - b)) * (-sinv); + m[5] = (2.0 / (t - b)) * ( cosv); + + m[12] += (m[0] * tx) + (m[4] * ty); + m[13] += (m[1] * tx) + (m[5] * ty); + m[14] += (m[2] * tx) + (m[6] * ty); + m[15] += (m[3] * tx) + (m[7] * ty); } static int @@ -119,7 +173,7 @@ * GL_VERSION is used to get the version of the connection */ - version = glGetString(GL_VERSION); + version = (char *)glGetString(GL_VERSION); /* * OpengL ES @@ -197,35 +251,41 @@ _evas_gl_common_viewport_set(Evas_GL_Context *gc) { GLfloat proj[16]; - int w = 1, h = 1, m = 1; + int w = 1, h = 1, m = 1, rot = 1; if ((gc->shader.surface == gc->def_surface) || (!gc->shader.surface)) { w = gc->w; h = gc->h; + rot = gc->rot; } else { w = gc->shader.surface->w; h = gc->shader.surface->h; + rot = 0; m = -1; } if ((!gc->change.size) || - ((gc->shared->w == w) && (gc->shared->h == h))) + ((gc->shared->w == w) && (gc->shared->h == h) && (gc->shared->rot == rot))) return; gc->shared->w = w; gc->shared->h = h; + gc->shared->rot = rot; gc->change.size = 0; - - glViewport(0, 0, w, h); + + if ((rot == 0) || (rot == 180)) + glViewport(0, 0, w, h); + else + glViewport(0, 0, h, w); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); matrix_ident(proj); - if (m == 1) matrix_ortho(proj, 0, w, 0, h, -1.0, 1.0); - else matrix_ortho(proj, 0, w, h, 0, -1.0, 1.0); + if (m == 1) matrix_ortho(proj, 0, w, 0, h, -1.0, 1.0, rot, w, h); + else matrix_ortho(proj, 0, w, h, 0, -1.0, 1.0, rot, w, h); glUseProgram(gc->shared->shader.rect.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -540,10 +600,11 @@ } void -evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h) +evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot) { - if ((gc->w == w) && (gc->h == h)) return; + if ((gc->w == w) && (gc->h == h) && (gc->rot == rot)) return; gc->change.size = 1; + gc->rot = rot; gc->w = w; gc->h = h; if (_evas_gl_common_context == gc) _evas_gl_common_viewport_set(gc); Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-05-09 04:10:53 UTC (rev 48703) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-05-09 05:15:20 UTC (rev 48704) @@ -220,14 +220,15 @@ e->engine.data.output = re; re->win = eng_window_new(info->info.display, info->info.drawable, - 0 /* FIXME: screen 0 assumption */, + info->info.screen, info->info.visual, info->info.colormap, info->info.depth, e->output.w, e->output.h, info->indirect, - info->info.destination_alpha); + info->info.destination_alpha, + info->info.rotation); if (!re->win) { free(re); @@ -308,23 +309,25 @@ re = e->engine.data.output; if ((info->info.display != re->win->disp) || (info->info.drawable != re->win->win) || - (0 != re->win->screen) || /* FIXME: screen 0 assumption */ + (info->info.screen != re->win->screen) || (info->info.visual != re->win->visual) || (info->info.colormap != re->win->colormap) || (info->info.depth != re->win->depth) || - (info->info.destination_alpha != re->win->alpha)) + (info->info.destination_alpha != re->win->alpha) || + (info->info.rotation != re->win->rot)) { eng_window_free(re->win); re->win = eng_window_new(info->info.display, info->info.drawable, - 0,/* FIXME: screen 0 assumption */ + info->info.screen, info->info.visual, info->info.colormap, info->info.depth, e->output.w, e->output.h, info->indirect, - info->info.destination_alpha); + info->info.destination_alpha, + info->info.rotation); } else if ((re->win->w != e->output.w) || (re->win->h != e->output.h)) @@ -332,7 +335,7 @@ re->win->w = e->output.w; re->win->h = e->output.h; eng_window_use(re->win); - evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h); + evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h, re->win->rot); } } @@ -379,7 +382,7 @@ re->win->w = w; re->win->h = h; eng_window_use(re->win); - evas_gl_common_context_resize(re->win->gl_context, w, h); + evas_gl_common_context_resize(re->win->gl_context, w, h, re->win->rot); } static void @@ -396,7 +399,7 @@ Render_Engine *re; re = (Render_Engine *)data; - evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h); + evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h, re->win->rot); /* smple bounding box */ RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, re->win->w, re->win->h); if ((w <= 0) || (h <= 0)) return; Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.h =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2010-05-09 04:10:53 UTC (rev 48703) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.h 2010-05-09 05:15:20 UTC (rev 48704) @@ -82,6 +82,7 @@ Colormap colormap; int depth; int alpha; + int rot; Evas_GL_Context *gl_context; struct { int redraw : 1; @@ -114,7 +115,7 @@ Evas_GL_X11_Window *eng_window_new(Display *disp, Window win, int screen, Visual *vis, Colormap cmap, int depth, int w, int h, int indirect, - int alpha); + int alpha, int rot); void eng_window_free(Evas_GL_X11_Window *gw); void eng_window_use(Evas_GL_X11_Window *gw); Visual *eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo); Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-05-09 04:10:53 UTC (rev 48703) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-05-09 05:15:20 UTC (rev 48704) @@ -32,7 +32,8 @@ int w, int h, int indirect, - int alpha) + int alpha, + int rot) { Evas_GL_X11_Window *gw; int context_attrs[3]; @@ -53,6 +54,9 @@ gw->colormap = cmap; gw->depth = depth; gw->alpha = alpha; + gw->w = w; + gw->h = h; + gw->rot = rot; vi_use = _evas_gl_x11_vi; if (alpha) @@ -382,7 +386,7 @@ return NULL; } evas_gl_common_context_use(gw->gl_context); - evas_gl_common_context_resize(gw->gl_context, w, h); + evas_gl_common_context_resize(gw->gl_context, w, h, rot); win_count++; return gw; } |
From: Enlightenment SVN <no-reply@en...> - 2010-05-18 03:50:07
|
Log: if shader compile fails - peroclate error back up to engine info_set so we know gl engine is useless. Author: raster Date: 2010-05-17 20:49:59 -0700 (Mon, 17 May 2010) New Revision: 48956 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-05-18 03:20:55 UTC (rev 48955) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-05-18 03:49:59 UTC (rev 48956) @@ -322,7 +322,7 @@ Eina_Bool tex_only); void evas_gl_common_context_flush(Evas_GL_Context *gc); -void evas_gl_common_shader_program_init(Evas_GL_Program *p, +int evas_gl_common_shader_program_init(Evas_GL_Program *p, Evas_GL_Program_Source *vert, Evas_GL_Program_Source *frag, const char *name); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-05-18 03:20:55 UTC (rev 48955) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-05-18 03:49:59 UTC (rev 48956) @@ -454,46 +454,46 @@ glEnableVertexAttribArray(SHAD_COLOR); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - evas_gl_common_shader_program_init(&(shared->shader.rect), - &(shader_rect_vert_src), - &(shader_rect_frag_src), - "rect"); - evas_gl_common_shader_program_init(&(shared->shader.font), - &(shader_font_vert_src), - &(shader_font_frag_src), - "font"); - evas_gl_common_shader_program_init(&(shared->shader.img), - &(shader_img_vert_src), - &(shader_img_frag_src), - "img"); - evas_gl_common_shader_program_init(&(shared->shader.img_nomul), - &(shader_img_nomul_vert_src), - &(shader_img_nomul_frag_src), - "img_nomul"); - evas_gl_common_shader_program_init(&(shared->shader.img_bgra), - &(shader_img_bgra_vert_src), - &(shader_img_bgra_frag_src), - "img_bgra"); - evas_gl_common_shader_program_init(&(shared->shader.img_bgra_nomul), - &(shader_img_bgra_nomul_vert_src), - &(shader_img_bgra_nomul_frag_src), - "img_bgra_nomul"); - evas_gl_common_shader_program_init(&(shared->shader.tex), - &(shader_tex_vert_src), - &(shader_tex_frag_src), - "tex"); - evas_gl_common_shader_program_init(&(shared->shader.tex_nomul), - &(shader_tex_nomul_vert_src), - &(shader_tex_nomul_frag_src), - "tex_nomul"); - evas_gl_common_shader_program_init(&(shared->shader.yuv), - &(shader_yuv_vert_src), - &(shader_yuv_frag_src), - "yuv"); - evas_gl_common_shader_program_init(&(shared->shader.yuv_nomul), - &(shader_yuv_nomul_vert_src), - &(shader_yuv_nomul_frag_src), - "yuv_nomul"); + if (!evas_gl_common_shader_program_init(&(shared->shader.rect), + &(shader_rect_vert_src), + &(shader_rect_frag_src), + "rect")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.font), + &(shader_font_vert_src), + &(shader_font_frag_src), + "font")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.img), + &(shader_img_vert_src), + &(shader_img_frag_src), + "img")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.img_nomul), + &(shader_img_nomul_vert_src), + &(shader_img_nomul_frag_src), + "img_nomul")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.img_bgra), + &(shader_img_bgra_vert_src), + &(shader_img_bgra_frag_src), + "img_bgra")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.img_bgra_nomul), + &(shader_img_bgra_nomul_vert_src), + &(shader_img_bgra_nomul_frag_src), + "img_bgra_nomul")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.tex), + &(shader_tex_vert_src), + &(shader_tex_frag_src), + "tex")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.tex_nomul), + &(shader_tex_nomul_vert_src), + &(shader_tex_nomul_frag_src), + "tex_nomul")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.yuv), + &(shader_yuv_vert_src), + &(shader_yuv_frag_src), + "yuv")) goto error; + if (!evas_gl_common_shader_program_init(&(shared->shader.yuv_nomul), + &(shader_yuv_nomul_vert_src), + &(shader_yuv_nomul_frag_src), + "yuv_nomul")) goto error; glUseProgram(shared->shader.yuv.prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -530,6 +530,9 @@ gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1); return gc; + error: + evas_gl_common_context_free(gc); + return NULL; } void @@ -539,11 +542,11 @@ gc->references--; if (gc->references > 0) return; - gc->shared->references--; + if (gc->shared) gc->shared->references--; - evas_gl_common_image_free(gc->def_surface); + if (gc->def_surface) evas_gl_common_image_free(gc->def_surface); - if (gc->shared->references == 0) + if ((gc->shared) && (gc->shared->references == 0)) { evas_gl_common_shader_program_shutdown(&(gc->shared->shader.rect)); evas_gl_common_shader_program_shutdown(&(gc->shared->shader.font)); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-05-18 03:20:55 UTC (rev 48955) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_shader.c 2010-05-18 03:49:59 UTC (rev 48956) @@ -420,7 +420,7 @@ } } -void +int evas_gl_common_shader_program_init(Evas_GL_Program *p, Evas_GL_Program_Source *vert, Evas_GL_Program_Source *frag, @@ -447,7 +447,7 @@ { gl_compile_link_error(p->vert, "compile vertex shader"); printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src); - return; + return 0; } glShaderSource(p->frag, 1, (const char **)&(frag->src), NULL); @@ -460,7 +460,7 @@ { gl_compile_link_error(p->frag, "compile fragment shader"); printf("Abort compile of shader frag (%s):\n%s\n", name, frag->src); - return; + return 0; } #endif p->prog = glCreateProgram(); @@ -489,8 +489,9 @@ gl_compile_link_error(p->prog, "link fragment and vertex shaders"); printf("Abort compile of shader frag (%s):\n%s\n", name, frag->src); printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src); - return; + return 0; } + return 1; } void Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-05-18 03:20:55 UTC (rev 48955) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-05-18 03:49:59 UTC (rev 48956) @@ -339,7 +339,17 @@ } } - if (!e->engine.data.output) return 0; + if (!re->win) + { + free(re); + return 0; + } + if (!e->engine.data.output) + { + if (re->win) eng_window_free(re->win); + free(re); + return 0; + } if (!e->engine.data.context) e->engine.data.context = e->engine.func->context_new(e->engine.data.output); @@ -362,13 +372,15 @@ Render_Engine *re; re = (Render_Engine *)data; - + + if (re) + { // NOTE: XrmGetDatabase() result is shared per connection, do not free it. // if (re->xrdb) XrmDestroyDatabase(re->xrdb); - eng_window_free(re->win); - free(re); - + if (re->win) eng_window_free(re->win); + free(re); + } evas_common_font_shutdown(); evas_common_image_shutdown(); } Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-05-18 03:20:55 UTC (rev 48955) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-05-18 03:49:59 UTC (rev 48956) @@ -382,7 +382,7 @@ gw->gl_context = evas_gl_common_context_new(); if (!gw->gl_context) { - free(gw); + eng_window_free(gw); return NULL; } evas_gl_common_context_use(gw->gl_context); @@ -396,7 +396,7 @@ { win_count--; if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL; - evas_gl_common_context_free(gw->gl_context); + if (gw->gl_context) evas_gl_common_context_free(gw->gl_context); #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if (gw->egl_surface[0] != EGL_NO_SURFACE) eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); |
From: Enlightenment SVN <no-reply@en...> - 2010-05-20 15:24:36
|
Log: be paranoid about gl context - reset it to "0" every frame. Author: raster Date: 2010-05-20 08:24:28 -0700 (Thu, 20 May 2010) New Revision: 49065 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-05-20 11:47:07 UTC (rev 49064) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-05-20 15:24:28 UTC (rev 49065) @@ -139,7 +139,7 @@ Eina_Bool clip : 1; struct { GLuint cur_prog; - GLuint cur_tex, cur_texum, cur_texv; + GLuint cur_tex, cur_texu, cur_texv; int render_op; int cx, cy, cw, ch; Eina_Bool smooth : 1; @@ -286,6 +286,7 @@ Evas_GL_Context *evas_gl_common_context_new(void); void evas_gl_common_context_free(Evas_GL_Context *gc); void evas_gl_common_context_use(Evas_GL_Context *gc); +void evas_gl_common_context_newframe(Evas_GL_Context *gc); void evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot); void evas_gl_common_context_target_surface_set(Evas_GL_Context *gc, Evas_GL_Image *surface); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-05-20 11:47:07 UTC (rev 49064) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-05-20 15:24:28 UTC (rev 49065) @@ -369,6 +369,8 @@ _evas_gl_common_context = gc; + gc->shader.render_op = EVAS_RENDER_BLEND; + if (!shared) { GLint linked; @@ -597,12 +599,97 @@ void evas_gl_common_context_use(Evas_GL_Context *gc) { -// if (_evas_gl_common_context == gc) return; + if (_evas_gl_common_context == gc) return; _evas_gl_common_context = gc; _evas_gl_common_viewport_set(gc); } void +evas_gl_common_context_newframe(Evas_GL_Context *gc) +{ + gc->clip.x = 0; + gc->clip.y = 0; + gc->clip.w = 0; + gc->clip.h = 0; + gc->clip.active = 0; + gc->shader.surface = NULL; + gc->shader.cur_prog = 0; + gc->shader.cur_tex = 0; + gc->shader.cur_texu = 0; + gc->shader.cur_texv = 0; + gc->shader.render_op = EVAS_RENDER_BLEND; + gc->shader.cx = 0; + gc->shader.cy = 0; + gc->shader.cw = 0; + gc->shader.ch = 0; + gc->shader.smooth = 0; + gc->shader.blend = 0; + gc->shader.clip = 0; + gc->shader.current.cur_prog = 0; + gc->shader.current.cur_tex = 0; + gc->shader.current.cur_texu = 0; + gc->shader.current.cur_texv = 0; + gc->shader.current.render_op = 0; + gc->shader.current.cx = 0; + gc->shader.current.cy = 0; + gc->shader.current.cw = 0; + gc->shader.current.ch = 0; + gc->shader.current.smooth = 0; + gc->shader.current.blend = 0; + gc->shader.current.clip = 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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glDisable(GL_BLEND); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + // no dest alpha +// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha +// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? + glDepthMask(GL_FALSE); + 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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); +#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT + if (shared->info.anisotropic > 0.0) + { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } +#endif + + glEnableVertexAttribArray(SHAD_VERTEX); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glEnableVertexAttribArray(SHAD_COLOR); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glUseProgram(gc->shader.cur_prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + + glActiveTexture(GL_TEXTURE0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + + _evas_gl_common_viewport_set(gc); +} + +void evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot) { if ((gc->w == w) && (gc->h == h) && (gc->rot == rot)) return; Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-05-20 11:47:07 UTC (rev 49064) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-05-20 15:24:28 UTC (rev 49065) @@ -492,9 +492,11 @@ Render_Engine *re; re = (Render_Engine *)data; - evas_gl_common_context_flush(re->win->gl_context); /* get the upate rect surface - return engine data as dummy */ if (!re->win->draw.redraw) return NULL; + evas_gl_common_context_flush(re->win->gl_context); + eng_window_use(re->win); + evas_gl_common_context_newframe(re->win->gl_context); if (x) *x = re->win->draw.x1; if (y) *y = re->win->draw.y1; if (w) *w = re->win->draw.x2 - re->win->draw.x1 + 1; |
From: Enlightenment SVN <no-reply@en...> - 2010-08-13 10:35:01
|
Log: more work on egl image direct access. Author: raster Date: 2010-08-13 03:34:51 -0700 (Fri, 13 Aug 2010) New Revision: 51070 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-08-13 10:34:14 UTC (rev 51069) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-08-13 10:34:51 UTC (rev 51070) @@ -51,6 +51,19 @@ # define GL_BGRA 0x80E1 #endif +#ifndef EGL_NO_CONTEXT +# define EGL_NO_CONTEXT 0 +#endif +#ifndef EGL_NONE +# define EGL_NONE 0x3038 +#endif +#ifndef EGL_TRUE +# define EGL_TRUE 1 +#endif +#ifndef EGL_FALSE +# define EGL_FALSE 0 +#endif + #ifndef EGL_MAP_GL_TEXTURE_2D_SEC # define EGL_MAP_GL_TEXTURE_2D_SEC 0x3201 #endif @@ -75,7 +88,7 @@ #ifndef EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC # define EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC 0x3207 #endif -#ifdef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC +#ifndef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC # define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x3208 #endif @@ -225,6 +238,11 @@ } change; Evas_GL_Image *def_surface; + +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) +// FIXME: hack. expose egl display to gl core for egl image sec extn. + void *egldisp; +#endif }; struct _Evas_GL_Texture_Pool @@ -235,10 +253,17 @@ int w, h; int references; int slot, fslot; + struct { + void *img; + unsigned int *data; + int w, h; + int stride; + } dyn; Eina_List *allocations; Eina_Bool whole : 1; Eina_Bool render : 1; Eina_Bool native : 1; + Eina_Bool dynamic : 1; }; struct _Evas_GL_Texture @@ -393,6 +418,7 @@ Evas_GL_Texture *evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im); Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha, Evas_GL_Image *im); Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_GL_Context *gc, int w, int h, int alpha); +Evas_GL_Texture *evas_gl_common_texture_dynamic_new(Evas_GL_Context *gc, Evas_GL_Image *im); void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im); void evas_gl_common_texture_free(Evas_GL_Texture *tex); Evas_GL_Texture *evas_gl_common_texture_alpha_new(Evas_GL_Context *gc, DATA8 *pixels, int w, int h, int fh); @@ -433,12 +459,12 @@ void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) -void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e); -void (*secsym_eglDestroyImage) (void *a, void *b); -void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b); -void (*secsym_eglMapImageSEC) (void *a, void *b); -void (*secsym_eglUnmapImageSEC) (void *a, void *b); -void (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d); +void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e); +unsigned int (*secsym_eglDestroyImage) (void *a, void *b); +void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b); +void *(*secsym_eglMapImageSEC) (void *a, void *b); +unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b); +unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d); #endif #define GL_ERRORS 1 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-08-13 10:34:14 UTC (rev 51069) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-08-13 10:34:51 UTC (rev 51070) @@ -14,12 +14,12 @@ typedef void (*_eng_fn) (void); static _eng_fn (*secsym_eglGetProcAddress) (const char *a) = NULL; -void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e) = NULL; -void (*secsym_eglDestroyImage) (void *a, void *b) = NULL; -void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL; -void (*secsym_eglMapImageSEC) (void *a, void *b) = NULL; -void (*secsym_eglUnmapImageSEC) (void *a, void *b) = NULL; -void (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL; +void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e) = NULL; +unsigned int (*secsym_eglDestroyImage) (void *a, void *b) = NULL; +void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL; +void *(*secsym_eglMapImageSEC) (void *a, void *b) = NULL; +unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b) = NULL; +unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL; #endif static void @@ -431,8 +431,6 @@ if (!shared) { - GLint linked; - unsigned int pixel = 0xffffffff; const GLubyte *ext; shared = calloc(1, sizeof(Evas_GL_Shared)); @@ -489,7 +487,7 @@ shared->info.pipes_max = 32; // per gpu hacks. based on impirical measurement of some known gpu's - s = glGetString(GL_RENDERER); + s = (const char *)glGetString(GL_RENDERER); if (s) { if (strstr(s, "PowerVR SGX 540")) @@ -997,7 +995,6 @@ if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0; shader_array_flush(gc); -again: pn = gc->state.top_pipe; gc->pipe[pn].shader.cur_tex = 0; gc->pipe[pn].shader.cur_prog = prog; @@ -1298,6 +1295,16 @@ goto again; } } + if (tex->pt->dyn.img) + { + if (gc->pipe[pn].array.im != tex->im) + { + shader_array_flush(gc); + pn = gc->state.top_pipe; + gc->pipe[pn].array.im = tex->im; + goto again; + } + } #else if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) || (gc->pipe[pn].shader.cur_prog != prog) @@ -1327,6 +1334,14 @@ gc->pipe[pn].array.im = tex->im; } } + if (tex->pt->dyn.img) + { + if (gc->pipe[pn].array.im != tex->im) + { + shader_array_flush(gc); + gc->pipe[pn].array.im = tex->im; + } + } gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 1; @@ -1742,7 +1757,6 @@ int x, y, w, h, px, py; GLfloat tx[4], ty[4]; Eina_Bool blend = 1; - RGBA_Map_Point *pt; DATA32 cmul; GLuint prog = gc->shared->shader.img.prog; int pn = 0; @@ -1883,6 +1897,16 @@ goto again; } } + if (tex->pt->dyn.img) + { + if (gc->pipe[pn].array.im != tex->im) + { + shader_array_flush(gc); + pn = gc->state.top_pipe; + gc->pipe[pn].array.im = tex->im; + goto again; + } + } #else if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) || (gc->pipe[pn].shader.cur_prog != prog) @@ -1916,6 +1940,14 @@ gc->pipe[pn].array.im = tex->im; } } + if (tex->pt->dyn.img) + { + if (gc->pipe[pn].array.im != tex->im) + { + shader_array_flush(gc); + gc->pipe[pn].array.im = tex->im; + } + } gc->pipe[pn].region.type = RTYPE_MAP; gc->pipe[pn].array.line = 0; @@ -2022,12 +2054,22 @@ } if (gc->pipe[i].array.im) { - if (!gc->pipe[i].array.im->native.loose) +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + if (gc->pipe[i].array.im->tex->pt->dyn.img) { - if (gc->pipe[i].array.im->native.func.bind) - gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im->native.func.data, - gc->pipe[i].array.im); + secsym_glEGLImageTargetTexture2DOES + (GL_TEXTURE_2D, gc->pipe[i].array.im->tex->pt->dyn.img); } + else +#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); + } + } } if (gc->pipe[i].shader.render_op != gc->state.current.render_op) { Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-08-13 10:34:14 UTC (rev 51069) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-08-13 10:34:51 UTC (rev 51070) @@ -277,7 +277,60 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint) { im->content_hint = hint; - // FIXME: make use of content hint + if (im->content_hint == hint) return; + if (!im->gc) return; + if (!im->gc->shared->info.sec_image_map) return; + // does not handle yuv yet. + if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return; + return; + if (im->content_hint == EVAS_IMAGE_CONTENT_HINT_DYNAMIC) + { + if (im->cs.data) + { + if (!im->cs.no_free) free(im->cs.data); + im->cs.data = NULL; + } + im->cs.no_free = 0; + if (im->cached) + { + im->gc->shared->images = eina_list_remove(im->gc->shared->images, im); + im->cached = 0; + } + if (im->im) + { + evas_cache_image_drop(&im->im->cache_entry); + im->im = NULL; + } + if (im->tex) + { + evas_gl_common_texture_free(im->tex); + im->tex = NULL; + } + im->tex = evas_gl_common_texture_dynamic_new(im->gc, im); + im->tex_only = 1; + } + else + { + if (im->im) + { + evas_cache_image_drop(&im->im->cache_entry); + im->im = NULL; + } + if (im->tex) + { + evas_gl_common_texture_free(im->tex); + 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; + evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space); + im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h); + if (!im->tex) + im->tex = evas_gl_common_texture_new(im->gc, im->im); + } } void Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-13 10:34:14 UTC (rev 51069) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-13 10:34:51 UTC (rev 51070) @@ -42,8 +42,6 @@ static void _tex_adjust(Evas_GL_Context *gc, int *w, int *h) { - unsigned int n; - if (gc->shared->info.tex_npo2) return; /*if (gc->shared->info.tex_rect) return;*/ *w = _nearest_pow2(*w); @@ -396,6 +394,142 @@ return pt; } +static Evas_GL_Texture_Pool * +_pool_tex_dynamic_new(Evas_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 + int attr[] = + { + EGL_MAP_GL_TEXTURE_WIDTH_SEC, 32, + EGL_MAP_GL_TEXTURE_HEIGHT_SEC, 32, + EGL_MAP_GL_TEXTURE_FORMAT_SEC, EGL_MAP_GL_TEXTURE_RGBA_SEC, + EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC, EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC, + EGL_NONE + }; + void *egldisplay = pt->gc->egldisp; + + + pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); + if (!pt) return NULL; + h = _tex_round_slot(gc, h) << 4; + _tex_adjust(gc, &w, &h); + pt->gc = gc; + pt->w = w; + pt->h = h; + pt->intformat = intformat; + pt->format = format; + pt->dataformat = GL_UNSIGNED_BYTE; + pt->render = 1; + pt->references = 0; + glGenTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glBindTexture(GL_TEXTURE_2D, pt->texture); + 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); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + + attr[1] = pt->w; + attr[2] = pt->h; + + pt->dyn.img = secsym_eglCreateImage(egldisplay, + EGL_NO_CONTEXT, + EGL_MAP_GL_TEXTURE_2D_SEC, + 0, attr); + if (!pt->dyn.img) + { + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + pt->dyn.data = secsym_eglMapImageSEC(egldisplay, + pt->dyn.img); + if (!pt->dyn.data) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + if (secsym_eglGetImageAttribSEC(egldisplay, + pt->dyn.img, + EGL_MAP_GL_TEXTURE_WIDTH_SEC, + &(pt->dyn.w)) != EGL_TRUE) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + if (secsym_eglGetImageAttribSEC(egldisplay, + pt->dyn.img, + EGL_MAP_GL_TEXTURE_HEIGHT_SEC, + &(pt->dyn.h)) != EGL_TRUE) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + if (secsym_eglGetImageAttribSEC(egldisplay, + pt->dyn.img, + EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC, + &(pt->dyn.stride)) != EGL_TRUE) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + if (secsym_eglGetImageAttribSEC(egldisplay, + pt->dyn.img, + EGL_MAP_GL_TEXTURE_FORMAT_SEC, + &(fmt)) != EGL_TRUE) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + if (fmt != EGL_MAP_GL_TEXTURE_RGBA_SEC) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + if (secsym_eglGetImageAttribSEC(egldisplay, + pt->dyn.img, + EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC, + &(pixtype)) != EGL_TRUE) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) + { + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + pt->dyn.img = NULL; + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + return pt; + } + + glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); +#endif + return pt; +} + static void pt_unref(Evas_GL_Texture_Pool *pt) { @@ -409,6 +543,19 @@ pt->gc->shared->tex.atlas [pt->slot][pt->fslot] = eina_list_remove(pt->gc->shared->tex.atlas[pt->slot][pt->fslot], pt); } +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + if (pt->dyn.img) + { + void *egldisplay = pt->gc->egldisp; + + secsym_eglDestroyImage(pt->gc->egldisp, pt->dyn.img); + pt->dyn.img = NULL; + pt->dyn.data = NULL; + pt->dyn.w = 0; + pt->dyn.h = 0; + pt->dyn.stride = 0; + } +#endif glDeleteTextures(1, &(pt->texture)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -425,8 +572,6 @@ evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha, Evas_GL_Image *im) { Evas_GL_Texture *tex; - Eina_List *l_after = NULL; - int u = 0, v = 0; tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; @@ -466,8 +611,6 @@ evas_gl_common_texture_render_new(Evas_GL_Context *gc, int w, int h, int alpha) { Evas_GL_Texture *tex; - Eina_List *l_after = NULL; - int u = 0, v = 0; tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; @@ -503,6 +646,45 @@ return tex; } +Evas_GL_Texture * +evas_gl_common_texture_dynamic_new(Evas_GL_Context *gc, Evas_GL_Image *im) +{ + Evas_GL_Texture *tex; + + tex = calloc(1, sizeof(Evas_GL_Texture)); + if (!tex) return NULL; + + tex->gc = gc; + tex->references = 1; + tex->alpha = im->alpha; + tex->x = 0; + tex->y = 0; + tex->w = im->w; + tex->h = im->h; + if (tex->alpha) + { + if (gc->shared->info.bgra) + tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgba_ifmt, rgba_fmt); + else + tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgba_ifmt, rgba_fmt); + } + else + { + if (gc->shared->info.bgra) + tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgb_ifmt, rgb_fmt); + else + tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, rgb_ifmt, rgb_fmt); + } + if (!tex->pt) + { + memset(tex, 0x44, sizeof(Evas_GL_Texture)); // mark as freed + free(tex); + return NULL; + } + + return tex; +} + void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) { Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-08-13 10:34:14 UTC (rev 51069) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-08-13 10:34:51 UTC (rev 51070) @@ -1776,6 +1776,11 @@ *image_data = NULL; return im; } + if (im->tex->pt->dyn.data) + { + *image_data = im->tex->pt->dyn.data; + return im; + } eng_window_use(re->win); evas_cache_image_load_data(&im->im->cache_entry); switch (im->cs.space) @@ -1825,6 +1830,28 @@ im = image; if (im->native.data) return image; eng_window_use(re->win); + if (im->tex->pt->dyn.data) + { + if (im->tex->pt->dyn.data == image_data) + { + return image; + } + else + { + int w, h; + + w = im->im->cache_entry.w; + h = im->im->cache_entry.h; + 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; + evas_gl_common_image_dirty(im, 0, 0, 0, 0); + return im; + } + } switch (im->cs.space) { case EVAS_COLORSPACE_ARGB8888: Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-08-13 10:34:14 UTC (rev 51069) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-08-13 10:34:51 UTC (rev 51070) @@ -397,6 +397,9 @@ eng_window_free(gw); return NULL; } +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + gw->gl_context->egldisp = gw->egl_disp; +#endif evas_gl_common_context_use(gw->gl_context); evas_gl_common_context_resize(gw->gl_context, w, h, rot); win_count++; |
From: Enlightenment SVN <no-reply@en...> - 2010-08-19 03:30:54
|
Log: fix 2 unimplemented bits in dynamic texture stuff. Author: raster Date: 2010-08-18 20:30:47 -0700 (Wed, 18 Aug 2010) New Revision: 51378 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-19 00:05:09 UTC (rev 51377) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-19 03:30:47 UTC (rev 51378) @@ -442,9 +442,6 @@ attr[1] = pt->w; attr[3] = pt->h; - // FIXME: stride not fetched or used from engine api - // FIXME: have to set dynamic AFTER setting alpha and size. shoudl allow - // any order // 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, Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-08-19 00:05:09 UTC (rev 51377) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-08-19 03:30:47 UTC (rev 51378) @@ -1357,6 +1357,13 @@ return image; } eng_window_use(re->win); + if ((im->tex) && (im->tex->pt->dyn.img)) + { + evas_gl_common_texture_free(im->tex); + im->tex = NULL; + im->tex = evas_gl_common_texture_dynamic_new(im->gc, im); + return image; + } im_old = image; if ((eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P601_PL) || (eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P709_PL)) @@ -1625,6 +1632,15 @@ return gim->content_hint; } +static int +eng_image_stride_get(void *data, void *image) +{ + Render_Engine *re = (Render_Engine *)data; + Evas_GL_Image *im = image; + if ((im->tex) && (im->tex->pt->dyn.img)) return im->tex->pt->dyn.w; + return im->w; +} + static void eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const Eina_Unicode *text, const Evas_BiDi_Props *intl_props) { @@ -1732,10 +1748,12 @@ ORD(image_colorspace_get); ORD(image_native_set); ORD(image_native_get); + ORD(font_draw); ORD(image_scale_hint_set); ORD(image_scale_hint_get); + ORD(image_stride_get); ORD(image_map4_draw); ORD(image_map_surface_new); |
From: Enlightenment SVN <no-reply@en...> - 2010-08-25 09:30:03
|
Log: remove segv in ghl engine with native surfaces if data is null! Author: raster Date: 2010-08-25 02:29:56 -0700 (Wed, 25 Aug 2010) New Revision: 51635 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_engine.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-08-25 09:25:36 UTC (rev 51634) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-08-25 09:29:56 UTC (rev 51635) @@ -63,17 +63,20 @@ Evas_GL_Image *im; Eina_List *l; - EINA_LIST_FOREACH(gc->shared->images, l, im) + if (data) { - if (((void *)(im->im->image.data) == (void *)data) && - (im->im->cache_entry.w == w) && - (im->im->cache_entry.h == h)) - { - gc->shared->images = eina_list_remove_list(gc->shared->images, l); - gc->shared->images = eina_list_prepend(gc->shared->images, im); - im->references++; - return im; - } + EINA_LIST_FOREACH(gc->shared->images, l, im) + { + if (((void *)(im->im->image.data) == (void *)data) && + (im->im->cache_entry.w == w) && + (im->im->cache_entry.h == h)) + { + gc->shared->images = eina_list_remove_list(gc->shared->images, l); + gc->shared->images = eina_list_prepend(gc->shared->images, im); + im->references++; + return im; + } + } } im = calloc(1, sizeof(Evas_GL_Image)); if (!im) return NULL; Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-25 09:25:36 UTC (rev 51634) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-25 09:29:56 UTC (rev 51635) @@ -692,7 +692,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) { GLuint fmt; - + if (tex->alpha != im->cache_entry.flags.alpha) { tex->pt->allocations = eina_list_remove(tex->pt->allocations, tex); @@ -714,6 +714,8 @@ } } if (!tex->pt) return; + if (!im->image.data) return; + fmt = tex->pt->format; glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); Modified: trunk/evas/src/modules/engines/gl_x11/evas_engine.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-08-25 09:25:36 UTC (rev 51634) +++ trunk/evas/src/modules/engines/gl_x11/evas_engine.c 2010-08-25 09:29:56 UTC (rev 51635) @@ -804,9 +804,11 @@ { 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->im->image.data, - eng_image_alpha_get(data, image), - eng_image_colorspace_get(data, image)); + 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) return im; evas_gl_common_image_free(im); im = im_new; @@ -1445,9 +1447,11 @@ { 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->im->image.data, - eng_image_alpha_get(data, image), - eng_image_colorspace_get(data, image)); + 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; |
From: Enlightenment SVN <no-reply@en...> - 2010-08-26 01:41:55
|
Log: silence gl enging output unless you set EVAS_GL_INFO in env. move some fixed numbers into env vars for tuning purposes and debugging ... and importantly - fix a smooth vs non-smooth texture mode thing. Author: raster Date: 2010-08-25 18:41:48 -0700 (Wed, 25 Aug 2010) New Revision: 51651 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_image.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_common.h =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-08-26 01:34:13 UTC (rev 51650) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_common.h 2010-08-26 01:41:48 UTC (rev 51651) @@ -98,9 +98,6 @@ #define SHAD_TEXUV2 3 #define SHAD_TEXUV3 4 -#define MAX_CUTOUT 512 -#define MAX_PIPES 128 - typedef struct _Evas_GL_Program Evas_GL_Program; typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source; typedef struct _Evas_GL_Shared Evas_GL_Shared; @@ -138,8 +135,47 @@ Eina_Bool tex_rect : 1; Eina_Bool sec_image_map : 1; // tuning params - per gpu/cpu combo? - int cutout_max; - int pipes_max; +#define MAX_CUTOUT 512 +#define DEF_CUTOUT 512 + +#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; + } cutout; + struct { + int max; + } pipes; + struct { + int max_alloc_size; + int max_alloc_alpha_size; + int max_w; + int max_h; + int slot_size; + } atlas; + } tune; } info; struct { Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-08-26 01:34:13 UTC (rev 51650) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-08-26 01:41:48 UTC (rev 51651) @@ -437,7 +437,8 @@ ext = glGetString(GL_EXTENSIONS); if (ext) { - fprintf(stderr, "EXT:\n%s\n", ext); + if (getenv("EVAS_GL_INFO")) + fprintf(stderr, "EXT:\n%s\n", ext); if ((strstr((char *)ext, "GL_ARB_texture_non_power_of_two")) || (strstr((char *)ext, "OES_texture_npot")) || (strstr((char *)ext, "GL_IMG_texture_npot"))) @@ -483,54 +484,77 @@ // magic numbers that are a result of imperical testing and getting // "best case" performance across a range of systems - shared->info.cutout_max = 512; - shared->info.pipes_max = 32; + shared->info.tune.cutout.max = DEF_CUTOUT; + shared->info.tune.pipes.max = DEF_PIPES; + shared->info.tune.atlas.max_alloc_size = DEF_ATLAS_ALLOC; + shared->info.tune.atlas.max_alloc_alpha_size = DEF_ATLAS_ALLOC_ALPHA; + 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) { if (strstr(s, "PowerVR SGX 540")) - shared->info.pipes_max = 32; + shared->info.tune.pipes.max = DEF_PIPES_SGX_540; else if (strstr(s, "NVIDIA Tegra")) - shared->info.pipes_max = 1; + shared->info.tune.pipes.max = DEF_PIPES_TEGRA_2; } - if (getenv("EVAS_GL_CUTOUT_MAX")) - shared->info.cutout_max = atoi(getenv("EVAS_GL_CUTOUT_MAX")); - if (getenv("EVAS_GL_PIPES_MAX")) - { - shared->info.pipes_max = atoi(getenv("EVAS_GL_PIPES_MAX")); - if (shared->info.pipes_max > MAX_PIPES) - shared->info.pipes_max = MAX_PIPES; - else if (shared->info.pipes_max < 1) - shared->info.pipes_max = 1; - } +#define GETENVOPT(name, tune_param, min, max) \ + do { \ + const char *__v = getenv(name); \ + if (__v) { \ + shared->info.tune.tune_param = atoi(__v); \ + if (shared->info.tune.tune_param > max) \ + shared->info.tune.tune_param = max; \ + else if (shared->info.tune.tune_param < min) \ + shared->info.tune.tune_param = min; \ + } \ + } while (0) + + GETENVOPT("EVAS_GL_CUTOUT_MAX", cutout.max, -1, 0x7fffffff); + GETENVOPT("EVAS_GL_PIPES_MAX", pipes.max, 1, MAX_PIPES); + GETENVOPT("EVAS_GL_ATLAS_ALLOC_SIZE", atlas.max_alloc_size, MIN_ATLAS_ALLOC, MAX_ATLAS_ALLOC); + GETENVOPT("EVAS_GL_ATLAS_ALLOC_ALPHA_SIZE", atlas.max_alloc_alpha_size, MIN_ATLAS_ALLOC_ALPHA, MAX_ATLAS_ALLOC_ALPHA); + GETENVOPT("EVAS_GL_ATLAS_MAX_W", atlas.max_w, 0, MAX_ATLAS_W); + GETENVOPT("EVAS_GL_ATLAS_MAX_H", atlas.max_h, 0, MAX_ATLAS_H); + GETENVOPT("EVAS_GL_ATLAS_SLOT_SIZE", atlas.slot_size, MIN_ATLAS_SLOT, MAX_ATLAS_SLOT); + + if (getenv("EVAS_GL_INFO")) + fprintf(stderr, + "max tex size %ix%i\n" + "max units %i\n" + "non-power-2 tex %i\n" + "rect tex %i\n" + "bgra : %i\n" + "max ansiotropic filtering: %3.3f\n" + "egl sec map image: %i\n" + "\n" + "EVAS_GL_CUTOUT_MAX: %i\n" + "EVAS_GL_PIPES_MAX: %i\n" + "EVAS_GL_ATLAS_ALLOC_SIZE: %i\n" + "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, + (int)shared->info.tex_rect, + (int)shared->info.bgra, + (double)shared->info.anisotropic, + (int)shared->info.sec_image_map, + + (int)shared->info.tune.cutout.max, + (int)shared->info.tune.pipes.max, + (int)shared->info.tune.atlas.max_alloc_size, + (int)shared->info.tune.atlas.max_alloc_alpha_size, + (int)shared->info.tune.atlas.max_w, (int)shared->info.tune.atlas.max_h, + (int)shared->info.tune.atlas.slot_size + ); - fprintf(stderr, - "max tex size %ix%i\n" - "max units %i\n" - "non-power-2 tex %i\n" - "rect tex %i\n" - "bgra : %i\n" - "max ansiotropic filtering: %3.3f\n" - "egl sec map image: %i\n" - "\n" - "cutout max: %i\n" - "pipes max: %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, - (int)shared->info.tex_rect, - (int)shared->info.bgra, - (double)shared->info.anisotropic, - (int)shared->info.sec_image_map, - - (int)shared->info.cutout_max, - (int)shared->info.pipes_max - ); - glDisable(GL_DEPTH_TEST); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnable(GL_DITHER); @@ -662,7 +686,7 @@ if (gc->shared) { - for (i = 0; i < gc->shared->info.pipes_max; i++) + for (i = 0; i < gc->shared->info.tune.pipes.max; i++) { if (gc->pipe[i].array.vertex) free(gc->pipe[i].array.vertex); if (gc->pipe[i].array.color) free(gc->pipe[i].array.color); @@ -752,7 +776,7 @@ gc->state.current.cw = 0; gc->state.current.ch = 0; - for (i = 0; i < gc->shared->info.pipes_max; i++) + for (i = 0; i < gc->shared->info.tune.pipes.max; i++) { gc->pipe[i].region.x = 0; gc->pipe[i].region.y = 0; @@ -1094,7 +1118,7 @@ if (!found) { pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.pipes_max) + if (pn >= gc->shared->info.tune.pipes.max) { shader_array_flush(gc); goto again; @@ -1269,7 +1293,7 @@ if (!found) { pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.pipes_max) + if (pn >= gc->shared->info.tune.pipes.max) { shader_array_flush(gc); goto again; @@ -1467,7 +1491,7 @@ if (!found) { pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.pipes_max) + if (pn >= gc->shared->info.tune.pipes.max) { shader_array_flush(gc); goto again; @@ -1637,7 +1661,7 @@ if (!found) { pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.pipes_max) + if (pn >= gc->shared->info.tune.pipes.max) { shader_array_flush(gc); goto again; @@ -1889,7 +1913,7 @@ if (!found) { pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.pipes_max) + if (pn >= gc->shared->info.tune.pipes.max) { shader_array_flush(gc); goto again; @@ -2048,7 +2072,7 @@ { int i; - for (i = 0; i < gc->shared->info.pipes_max; i++) + for (i = 0; i < gc->shared->info.tune.pipes.max; i++) { if (gc->pipe[i].array.num <= 0) break; @@ -2141,7 +2165,8 @@ GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } } - if (gc->pipe[i].shader.smooth != gc->state.current.smooth) + if ((gc->pipe[i].shader.smooth != gc->state.current.smooth) || + (gc->pipe[i].shader.cur_tex != gc->state.current.cur_tex)) { if (gc->pipe[i].shader.smooth) { Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_image.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-08-26 01:34:13 UTC (rev 51650) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_image.c 2010-08-26 01:41:48 UTC (rev 51651) @@ -527,8 +527,8 @@ im->tex->im = im; if ((!gc->dc->cutout.rects) || - ((gc->shared->info.cutout_max > 0) && - (gc->dc->cutout.active > gc->shared->info.cutout_max))) + ((gc->shared->info.tune.cutout.max > 0) && + (gc->dc->cutout.active > gc->shared->info.tune.cutout.max))) { if (gc->dc->clip.use) { Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-26 01:34:13 UTC (rev 51650) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-26 01:41:48 UTC (rev 51651) @@ -53,7 +53,8 @@ { if (!gc->shared->info.tex_npo2) h = _nearest_pow2(h); - return (h + 15) >> 4; + return (h + gc->shared->info.tune.atlas.slot_size - 1) / + gc->shared->info.tune.atlas.slot_size; } static int @@ -99,7 +100,7 @@ pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; - h = _tex_round_slot(gc, h) << 4; + h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; _tex_adjust(gc, &w, &h); pt->gc = gc; pt->w = w; @@ -180,7 +181,10 @@ Eina_List *l; int th, th2; - if ((w > 512) || (h > 512)) + 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) || + (h > gc->shared->info.tune.atlas.max_h)) { pt = _pool_tex_new(gc, w, h, intformat, format); gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, pt); @@ -233,30 +237,35 @@ if (im->cache_entry.flags.alpha) { 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, - &u, &v, &l_after, 1024); + tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2, + im->cache_entry.h + 1, bgra_ifmt, bgra_fmt, + &u, &v, &l_after, + gc->shared->info.tune.atlas.max_alloc_alpha_size); else - tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2, - im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, - &u, &v, &l_after, 1024); + tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2, + im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, + &u, &v, &l_after, + gc->shared->info.tune.atlas.max_alloc_alpha_size); tex->alpha = 1; } else { if (gc->shared->info.bgra) - tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, - im->cache_entry.h + 1, bgr_ifmt, bgr_fmt, - &u, &v, &l_after, 1024); + 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, - im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, - &u, &v, &l_after, 1024); + 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, - im->cache_entry.h + 1, rgb_ifmt, rgb_fmt, - &u, &v, &l_after, 1024); + 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); #endif } if (!tex->pt) @@ -287,7 +296,7 @@ pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; - h = _tex_round_slot(gc, h) << 4; + h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; _tex_adjust(gc, &w, &h); pt->gc = gc; pt->w = w; @@ -414,7 +423,8 @@ pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; - h = _tex_round_slot(gc, h) << 4; +// no atlas pools/sharing here +// h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; _tex_adjust(gc, &w, &h); pt->gc = gc; pt->w = w; @@ -801,20 +811,21 @@ Evas_GL_Texture *tex; Eina_List *l_after = NULL; int u = 0, v = 0; - int tw = 4096; tex = calloc(1, sizeof(Evas_GL_Texture)); if (!tex) return NULL; tex->gc = gc; tex->references = 1; - if (tw > gc->shared->info.max_texture_size) - tw = gc->shared->info.max_texture_size; tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v, - &l_after, tw); + &l_after, + gc->shared->info.tune.atlas.max_alloc_alpha_size); if (!tex->pt) { - memset(tex, 0x66, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x66, sizeof(Evas_GL_Texture)); free(tex); return NULL; } Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-08-26 01:34:13 UTC (rev 51650) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-08-26 01:41:48 UTC (rev 51651) @@ -210,9 +210,12 @@ if (!vendor) vendor = "-UNKNOWN-"; if (!renderer) renderer = "-UNKNOWN-"; if (!version) version = "-UNKNOWN-"; - fprintf(stderr, "vendor: %s\n", vendor); - fprintf(stderr, "renderer: %s\n", renderer); - fprintf(stderr, "version: %s\n", version); + if (getenv("EVAS_GL_INFO")) + { + fprintf(stderr, "vendor: %s\n", vendor); + fprintf(stderr, "renderer: %s\n", renderer); + fprintf(stderr, "version: %s\n", version); + } // GLX #else @@ -284,10 +287,12 @@ renderer = glGetString(GL_RENDERER); version = glGetString(GL_VERSION); - fprintf(stderr, "vendor: %s\n", vendor); - fprintf(stderr, "renderer: %s\n", renderer); - fprintf(stderr, "version: %s\n", version); - + if (getenv("EVAS_GL_INFO")) + { + fprintf(stderr, "vendor: %s\n", vendor); + fprintf(stderr, "renderer: %s\n", renderer); + fprintf(stderr, "version: %s\n", version); + } if (strstr(vendor, "NVIDIA")) // FIXME: also same as tegra2 - maybe check renderer too // |
From: Enlightenment SVN <no-reply@en...> - 2010-08-26 04:37:51
|
Log: aagh fix fix! works again. Author: raster Date: 2010-08-25 21:37:43 -0700 (Wed, 25 Aug 2010) New Revision: 51652 Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c trunk/evas/src/modules/engines/gl_x11/evas_x_main.c Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_context.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-08-26 01:41:48 UTC (rev 51651) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_context.c 2010-08-26 04:37:43 UTC (rev 51652) @@ -506,12 +506,12 @@ do { \ const char *__v = getenv(name); \ if (__v) { \ - shared->info.tune.tune_param = atoi(__v); \ - if (shared->info.tune.tune_param > max) \ - shared->info.tune.tune_param = max; \ - else if (shared->info.tune.tune_param < min) \ - shared->info.tune.tune_param = min; \ - } \ + shared->info.tune.tune_param = atoi(__v); \ + if (shared->info.tune.tune_param > max) \ + shared->info.tune.tune_param = max; \ + else if (shared->info.tune.tune_param < min) \ + shared->info.tune.tune_param = min; \ + } \ } while (0) GETENVOPT("EVAS_GL_CUTOUT_MAX", cutout.max, -1, 0x7fffffff); Modified: trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c =================================================================== --- trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-26 01:41:48 UTC (rev 51651) +++ trunk/evas/src/modules/engines/gl_common/evas_gl_texture.c 2010-08-26 04:37:43 UTC (rev 51652) @@ -180,7 +180,7 @@ Evas_GL_Texture_Pool *pt = NULL; Eina_List *l; int th, th2; - + 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) || @@ -239,13 +239,13 @@ 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, - &u, &v, &l_after, - gc->shared->info.tune.atlas.max_alloc_alpha_size); + &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, &u, &v, &l_after, - gc->shared->info.tune.atlas.max_alloc_alpha_size); + gc->shared->info.tune.atlas.max_alloc_size); tex->alpha = 1; } else @@ -270,7 +270,10 @@ } if (!tex->pt) { - memset(tex, 0x11, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x11, sizeof(Evas_GL_Texture)); free(tex); return NULL; } @@ -423,8 +426,7 @@ pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; -// no atlas pools/sharing here -// h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; + h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; _tex_adjust(gc, &w, &h); pt->gc = gc; pt->w = w; @@ -577,7 +579,10 @@ glsym_glDeleteFramebuffers(1, &(pt->fb)); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } - memset(pt, 0x22, sizeof(Evas_GL_Texture_Pool)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(pt, 0x22, sizeof(Evas_GL_Texture_Pool)); free(pt); } @@ -608,7 +613,10 @@ } if (!tex->pt) { - memset(tex, 0x33, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x33, sizeof(Evas_GL_Texture)); free(tex); return NULL; } @@ -647,7 +655,10 @@ } if (!tex->pt) { - memset(tex, 0x44, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x44, sizeof(Evas_GL_Texture)); free(tex); return NULL; } @@ -690,7 +701,10 @@ } if (!tex->pt) { - memset(tex, 0x44, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x55, sizeof(Evas_GL_Texture)); free(tex); return NULL; } @@ -800,7 +814,10 @@ } if (tex->ptu) pt_unref(tex->ptu); if (tex->ptv) pt_unref(tex->ptv); - memset(tex, 0x55, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x66, sizeof(Evas_GL_Texture)); free(tex); } @@ -817,15 +834,15 @@ tex->gc = gc; tex->references = 1; - tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v, - &l_after, + tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v, + &l_after, gc->shared->info.tune.atlas.max_alloc_alpha_size); if (!tex->pt) { // FIXME: mark as freed for now with 0x66, but this is me TRYING to // find some mysterious bug i simply have been unable to catch or // reproduce - so leave a trail and see how it goes. - memset(tex, 0x66, sizeof(Evas_GL_Texture)); + memset(tex, 0x77, sizeof(Evas_GL_Texture)); free(tex); return NULL; } @@ -880,7 +897,10 @@ tex->pt = _pool_tex_new(gc, w + 1, h + 1, lum_ifmt, lum_fmt); if (!tex->pt) { - memset(tex, 0x77, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x88, sizeof(Evas_GL_Texture)); free(tex); return NULL; } @@ -892,7 +912,10 @@ if (!tex->ptu) { pt_unref(tex->pt); - memset(tex, 0x88, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0x99, sizeof(Evas_GL_Texture)); free(tex); return NULL; } @@ -905,7 +928,10 @@ { pt_unref(tex->pt); pt_unref(tex->ptu); - memset(tex, 0x99, sizeof(Evas_GL_Texture)); // mark as freed + // FIXME: mark as freed for now with 0x66, but this is me TRYING to + // find some mysterious bug i simply have been unable to catch or + // reproduce - so leave a trail and see how it goes. + memset(tex, 0xaa, sizeof(Evas_GL_Texture)); free(tex); return NULL; } Modified: trunk/evas/src/modules/engines/gl_x11/evas_x_main.c =================================================================== --- trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-08-26 01:41:48 UTC (rev 51651) +++ trunk/evas/src/modules/engines/gl_x11/evas_x_main.c 2010-08-26 04:37:43 UTC (rev 51652) @@ -216,7 +216,6 @@ fprintf(stderr, "renderer: %s\n", renderer); fprintf(stderr, "version: %s\n", version); } - // GLX #else if (!context) @@ -286,7 +285,6 @@ vendor = glGetString(GL_VENDOR); renderer = glGetString(GL_RENDERER); version = glGetString(GL_VERSION); - if (getenv("EVAS_GL_INFO")) { fprintf(stderr, "vendor: %s\n", vendor); |