YaGL: Fix surface invalidation in onscreen backend 38/13138/1
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Tue, 5 Nov 2013 10:25:27 +0000 (14:25 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Tue, 5 Nov 2013 10:25:27 +0000 (14:25 +0400)
We should always bind framebuffer zero before attaching
new texture/renderbuffer since current framebuffer might be
different from framebuffer zero

Change-Id: I797b9686473def2c85060a88ad7e9ae794070165

hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c

index 6c3c34d..0197b52 100644 (file)
@@ -50,8 +50,20 @@ static void yagl_egl_onscreen_surface_invalidate(struct yagl_eglb_surface *sfc,
     osfc->ws_sfc = ws_sfc;
 
     if (egl_onscreen_ts->sfc_draw == osfc) {
+        GLuint cur_fb = 0;
+
         yagl_egl_onscreen_surface_setup(osfc);
+
+        egl_onscreen->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING,
+                                               (GLint*)&cur_fb);
+
+        egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER,
+                                                   egl_onscreen_ts->ctx->fb);
+
         yagl_egl_onscreen_surface_attach_to_framebuffer(osfc);
+
+        egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER,
+                                                   cur_fb);
     }
 
     YAGL_LOG_FUNC_EXIT(NULL);