From 70c9afd7c1bdeb77d082476c28b54ace91054575 Mon Sep 17 00:00:00 2001 From: raster Date: Sat, 6 Feb 2010 08:38:26 +0000 Subject: [PATCH] reduce binds when things get clipped and split. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@45928 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/modules/engines/gl_common/evas_gl_context.c | 31 ++++++++++++++++--------- src/modules/engines/gl_common/evas_gl_image.c | 2 +- src/modules/engines/gl_x11/evas_engine.c | 6 ++--- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/modules/engines/gl_common/evas_gl_context.c b/src/modules/engines/gl_common/evas_gl_context.c index de1c197..b661f48 100644 --- a/src/modules/engines/gl_common/evas_gl_context.c +++ b/src/modules/engines/gl_common/evas_gl_context.c @@ -555,16 +555,19 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc, } 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 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc, { 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 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, 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 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, 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 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, 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 @@ shader_array_flush(Evas_GL_Context *gc) } else glDisableVertexAttribArray(SHAD_TEXUV); - + if (gc->array.line) { glDisableVertexAttribArray(SHAD_TEXUV); @@ -1060,6 +1068,7 @@ shader_array_flush(Evas_GL_Context *gc) 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); diff --git a/src/modules/engines/gl_common/evas_gl_image.c b/src/modules/engines/gl_common/evas_gl_image.c index 1dd6da8..0a839da 100644 --- a/src/modules/engines/gl_common/evas_gl_image.c +++ b/src/modules/engines/gl_common/evas_gl_image.c @@ -408,7 +408,7 @@ evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy 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) { diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index d9b5fe9..8f026b2 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -430,9 +430,9 @@ eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x 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 -- 2.7.4