jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2a69980959408ccd7cc48c29d7e3939764cb1281
commit 2a69980959408ccd7cc48c29d7e3939764cb1281 Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Tue Dec 9 18:02:20 2014 +0900 Evas GL: Fix current FBO after make_current(0, 0) Example scenario: - Create a direct rendered Evas GL 'sfc' 'ctx' - Create a PBuffer dummy surface, make it current - Do some stuff - Make current (NULL, NULL) to go back to no target - Make current (sfc, ctx) --> glClear() will not render anything on screen Reason: The current FBO binding is still set to the implicit FBO bound to the PBuffer surface (it could be any surface, really). --- src/modules/evas/engines/gl_common/evas_gl_core.c | 24 ++++++++++++++-------- .../evas/engines/gl_common/evas_gl_core_private.h | 1 - 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c index 9ec771a..c0d7a2b 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.c +++ b/src/modules/evas/engines/gl_common/evas_gl_core.c @@ -1854,9 +1854,6 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc) int ret; if (dbg) DBG("Surface sfc %p is a pbuffer: %p", sfc, sfc->pbuffer.native_surface); - if (sfc->pbuffer.fbo) - glDeleteFramebuffers(1, &sfc->pbuffer.fbo); - ret = evgl_engine->funcs->pbuffer_surface_destroy(eng_data, sfc->pbuffer.native_surface); LKL(evgl_engine->resource_lock); evgl_engine->surfaces = eina_list_remove(evgl_engine->surfaces, sfc); @@ -1935,7 +1932,12 @@ evgl_context_create(void *eng_data, EVGL_Context *share_ctx, return NULL; } + // Set default values ctx->version = version; + ctx->scissor_coord[0] = 0; + ctx->scissor_coord[1] = 0; + ctx->scissor_coord[2] = evgl_engine->caps.max_w; + ctx->scissor_coord[3] = evgl_engine->caps.max_h; // Call engine create context if (share_ctx) @@ -2058,6 +2060,15 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) { if (rsc->direct.partial.enabled) evgl_direct_partial_render_end(); + + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo); + if ((rsc->current_ctx->surface_fbo == (GLuint) curr_fbo) || + (rsc->current_ctx->current_sfc && + rsc->current_ctx->current_sfc->color_buf == (GLuint) curr_fbo)) + { + glBindFramebuffer(GL_FRAMEBUFFER, 0); + rsc->current_ctx->current_fbo = 0; + } } if (dbg) DBG("Calling make_current(NULL, NULL)"); @@ -2207,12 +2218,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) if (sfc->color_buf) { - if (!sfc->pbuffer.fbo) - { - glGenFramebuffers(1, &sfc->pbuffer.fbo); - GLERRLOG(); - } - if (!_surface_buffers_fbo_set(sfc, sfc->pbuffer.fbo)) + if (!_surface_buffers_fbo_set(sfc, sfc->color_buf)) ERR("Could not detach current FBO"); } diff --git a/src/modules/evas/engines/gl_common/evas_gl_core_private.h b/src/modules/evas/engines/gl_common/evas_gl_core_private.h index 91242d8..4da0aa4 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h +++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h @@ -133,7 +133,6 @@ struct _EVGL_Surface struct { EVGLNative_Surface native_surface; Evas_GL_Color_Format color_fmt; - GLuint fbo; Eina_Bool is_pbuffer : 1; } pbuffer; --