From 51b39a4e953f1ff9774fd8ed4e9da3218cb03a99 Mon Sep 17 00:00:00 2001 From: raster Date: Thu, 2 Dec 2010 08:01:19 +0000 Subject: [PATCH] make sure we ensure out gl context is current at each frame start git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@55131 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/modules/engines/gl_x11/evas_engine.c | 3 +- src/modules/engines/gl_x11/evas_x_main.c | 55 +++++++++++++++++--------------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index 990c7a9..89faf5d 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -535,9 +535,10 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i re = (Render_Engine *)data; /* get the upate rect surface - return engine data as dummy */ if (!re->win->draw.redraw) return NULL; + eng_window_use(NULL); + eng_window_use(re->win); if (!_re_wincheck(re)) 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; diff --git a/src/modules/engines/gl_x11/evas_x_main.c b/src/modules/engines/gl_x11/evas_x_main.c index 423e6fd..f1810f0 100644 --- a/src/modules/engines/gl_x11/evas_x_main.c +++ b/src/modules/engines/gl_x11/evas_x_main.c @@ -482,38 +482,41 @@ eng_window_use(Evas_GL_X11_Window *gw) if (_evas_gl_x11_window) evas_gl_common_context_flush(_evas_gl_x11_window->gl_context); _evas_gl_x11_window = gw; + if (gw) + { // EGL / GLES #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) - if (gw->egl_surface[0] != EGL_NO_SURFACE) - { - if (eglMakeCurrent(gw->egl_disp, - gw->egl_surface[0], - gw->egl_surface[0], - gw->egl_context[0]) == EGL_FALSE) - { - ERR("eglMakeCurrent() failed!"); - } - } + if (gw->egl_surface[0] != EGL_NO_SURFACE) + { + if (eglMakeCurrent(gw->egl_disp, + gw->egl_surface[0], + gw->egl_surface[0], + gw->egl_context[0]) == EGL_FALSE) + { + ERR("eglMakeCurrent() failed!"); + } + } // GLX #else - if (gw->glxwin) - { - if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, - gw->context)) - { - ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); - } - } - else - { - if (!glXMakeCurrent(gw->disp, gw->win, gw->context)) - { - ERR("glXMakeCurrent(%p, 0x%x, %p) failed", gw->disp, (unsigned int)gw->win, (void *)gw->context); - } - } + if (gw->glxwin) + { + if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, + gw->context)) + { + ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); + } + } + else + { + if (!glXMakeCurrent(gw->disp, gw->win, gw->context)) + { + ERR("glXMakeCurrent(%p, 0x%x, %p) failed", gw->disp, (unsigned int)gw->win, (void *)gw->context); + } + } #endif + } } - evas_gl_common_context_use(gw->gl_context); + if (gw) evas_gl_common_context_use(gw->gl_context); } void -- 2.7.4