summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-12-09 18:02:20 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-12-09 18:38:08 +0900
commit2a69980959408ccd7cc48c29d7e3939764cb1281 (patch)
treeca6b52d8aeabad0e75eb10c6af12bbeaef7c0ac4
parent959c4cec3e551ce03306ad8a0b9efdd90798a68d (diff)
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).
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c24
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core_private.h1
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)
1854 int ret; 1854 int ret;
1855 if (dbg) DBG("Surface sfc %p is a pbuffer: %p", sfc, sfc->pbuffer.native_surface); 1855 if (dbg) DBG("Surface sfc %p is a pbuffer: %p", sfc, sfc->pbuffer.native_surface);
1856 1856
1857 if (sfc->pbuffer.fbo)
1858 glDeleteFramebuffers(1, &sfc->pbuffer.fbo);
1859
1860 ret = evgl_engine->funcs->pbuffer_surface_destroy(eng_data, sfc->pbuffer.native_surface); 1857 ret = evgl_engine->funcs->pbuffer_surface_destroy(eng_data, sfc->pbuffer.native_surface);
1861 LKL(evgl_engine->resource_lock); 1858 LKL(evgl_engine->resource_lock);
1862 evgl_engine->surfaces = eina_list_remove(evgl_engine->surfaces, sfc); 1859 evgl_engine->surfaces = eina_list_remove(evgl_engine->surfaces, sfc);
@@ -1935,7 +1932,12 @@ evgl_context_create(void *eng_data, EVGL_Context *share_ctx,
1935 return NULL; 1932 return NULL;
1936 } 1933 }
1937 1934
1935 // Set default values
1938 ctx->version = version; 1936 ctx->version = version;
1937 ctx->scissor_coord[0] = 0;
1938 ctx->scissor_coord[1] = 0;
1939 ctx->scissor_coord[2] = evgl_engine->caps.max_w;
1940 ctx->scissor_coord[3] = evgl_engine->caps.max_h;
1939 1941
1940 // Call engine create context 1942 // Call engine create context
1941 if (share_ctx) 1943 if (share_ctx)
@@ -2058,6 +2060,15 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
2058 { 2060 {
2059 if (rsc->direct.partial.enabled) 2061 if (rsc->direct.partial.enabled)
2060 evgl_direct_partial_render_end(); 2062 evgl_direct_partial_render_end();
2063
2064 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo);
2065 if ((rsc->current_ctx->surface_fbo == (GLuint) curr_fbo) ||
2066 (rsc->current_ctx->current_sfc &&
2067 rsc->current_ctx->current_sfc->color_buf == (GLuint) curr_fbo))
2068 {
2069 glBindFramebuffer(GL_FRAMEBUFFER, 0);
2070 rsc->current_ctx->current_fbo = 0;
2071 }
2061 } 2072 }
2062 2073
2063 if (dbg) DBG("Calling make_current(NULL, NULL)"); 2074 if (dbg) DBG("Calling make_current(NULL, NULL)");
@@ -2207,12 +2218,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
2207 2218
2208 if (sfc->color_buf) 2219 if (sfc->color_buf)
2209 { 2220 {
2210 if (!sfc->pbuffer.fbo) 2221 if (!_surface_buffers_fbo_set(sfc, sfc->color_buf))
2211 {
2212 glGenFramebuffers(1, &sfc->pbuffer.fbo);
2213 GLERRLOG();
2214 }
2215 if (!_surface_buffers_fbo_set(sfc, sfc->pbuffer.fbo))
2216 ERR("Could not detach current FBO"); 2222 ERR("Could not detach current FBO");
2217 } 2223 }
2218 2224
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
133 struct { 133 struct {
134 EVGLNative_Surface native_surface; 134 EVGLNative_Surface native_surface;
135 Evas_GL_Color_Format color_fmt; 135 Evas_GL_Color_Format color_fmt;
136 GLuint fbo;
137 Eina_Bool is_pbuffer : 1; 136 Eina_Bool is_pbuffer : 1;
138 } pbuffer; 137 } pbuffer;
139 138