[*][Migration upstream r62695]
authorJaehwan Kim <jae.hwan.kim@samsung.com>
Fri, 2 Sep 2011 07:08:51 +0000 (16:08 +0900)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Fri, 2 Sep 2011 07:58:02 +0000 (16:58 +0900)
1  2 
src/lib/Evas_GL.h
src/modules/engines/gl_x11/evas_engine.c

@@@ -925,29 -926,8 +926,29 @@@ typedef signed long int  GLsizeiptr;   
  
  #define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
  
 +//---------------------------//
 +// GLES extension defines
 +
 +/* GL_EXT_read_format_bgra */
 +#ifndef GL_EXT_read_format_bgra
 +#define GL_BGRA_EXT                                             0x80E1
 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT                       0x8365
 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT                       0x8366
 +#endif
 +
 +/* GL_EXT_texture_filter_anisotropic */
 +#ifndef GL_EXT_texture_filter_anisotropic
 +#define GL_TEXTURE_MAX_ANISOTROPY_EXT                           0x84FE
 +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       0x84FF
 +#endif
 +
 +/* GL_EXT_texture_format_BGRA8888 */
 +#ifndef GL_EXT_texture_format_BGRA8888
 +#define GL_BGRA_EXT                                             0x80E1
 +#endif
 +
  #else
- # ifndef EVAS_GL_NO_GL_H_CHECK   
+ # ifndef EVAS_GL_NO_GL_H_CHECK
  #  error "You may only include either Evas_GL.h OR use your native OpenGL's headers. If you use Evas to do GL, then you cannot use the native gl headers."
  # endif
  #endif
@@@ -59,12 -59,11 +59,14 @@@ struct _Render_Engine_GL_Contex
     int         initialized;
  #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
     EGLContext  context;
- #else   
+ #else
     GLXContext  context;
  #endif
-    
 +   GLuint      context_fbo;
 +   GLuint      current_fbo;
++
+    GLuint      fbo;
     Render_Engine_GL_Surface   *current_sfc;
  };
  
@@@ -2243,10 -2243,10 +2248,10 @@@ _attach_fbo_surface(Render_Engine *dat
     int fb_status;
  
     // FBO
 -   glBindFramebuffer(GL_FRAMEBUFFER, ctx->fbo);
 +   glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo);
     glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                            GL_TEXTURE_2D, sfc->rt_tex, 0);
-    
     // Depth RenderBuffer - Attach it to FBO
     if (sfc->depth_bits != EVAS_GL_DEPTH_NONE)
       {
@@@ -2551,6 -2551,28 +2556,31 @@@ eng_gl_make_current(void *data, void *s
     sfc = (Render_Engine_GL_Surface*)surface;
     ctx = (Render_Engine_GL_Context*)context;
  
++<<<<<<< HEAD
++=======
+    // Flush remainder of what's in Evas' pipeline
+    if (re->win)
+      {
+ #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
+         if ((eglGetCurrentContext() == re->win->egl_context[0]) ||
+             (eglGetCurrentSurface(EGL_READ) == re->win->egl_surface[0]) ||
+             (eglGetCurrentSurface(EGL_DRAW) == re->win->egl_surface[0]))
+           {
+              evas_gl_common_context_use(re->win->gl_context);
+              evas_gl_common_context_flush(re->win->gl_context);
+           }
+ #else
+         if (glXGetCurrentContext() == re->win->context)
+           {
+              evas_gl_common_context_use(re->win->gl_context);
+              evas_gl_common_context_flush(re->win->gl_context);
+           }
+ #endif
+         eng_window_use(NULL);
+         evas_gl_common_context_use(NULL);
+      }
++>>>>>>> svn_merge
     // Unset surface/context
     if ((!sfc) || (!ctx))
       {
       }
  
     // Don't do a make current if it's already current
 -   ret = 1;
  #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
++<<<<<<< HEAD
 +   if ((eglGetCurrentContext() == ctx->context) &&
 +       (eglGetCurrentSurface(EGL_READ) == re->win->egl_surface[0]) &&
 +       (eglGetCurrentSurface(EGL_DRAW) == re->win->egl_surface[0]) )
 +     {
 +
 +        DBG("Context same\n");
 +        return 1;
 +     }
++=======
+    if ((eglGetCurrentContext() != ctx->context))
+       ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0],
+                            re->win->egl_surface[0], ctx->context);
++>>>>>>> svn_merge
  #else
 -   if (glXGetCurrentContext() != ctx->context)
 -      ret = glXMakeCurrent(re->info->info.display, re->win->win, ctx->context);
 +   if ((glXGetCurrentContext() == ctx->context) &&
 +       (glXGetCurrentDrawable() == re->win->win) )
 +     {
 +        DBG("Context same\n");
 +        return 1;
 +     }
  #endif
++<<<<<<< HEAD
 +
 +
 +   // Flush remainder of what's in Evas' pipeline
 +   if (re->win)
 +     {
 +        eng_window_use(NULL);
 +        //evas_gl_common_context_use(NULL);
 +     }
 +
 +
 +   // Don't do a make current if it's already current
 +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
 +   ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0],
 +                              re->win->egl_surface[0], ctx->context);
     if (!ret)
       {
          ERR("xxxMakeCurrent() failed!");
          return 0;
       }
 +#else
 +   ret = glXMakeCurrent(re->info->info.display, re->win->win, ctx->context);
 +   if (!ret) 
++=======
++   if (!ret)
++>>>>>>> svn_merge
 +     {
 +        ERR("xxxMakeCurrent() failed!");
 +        return 0;
 +     }
 +#endif
  
     // Create FBO if not already created
-    if (!ctx->initialized) 
+    if (!ctx->initialized)
       {
 -        glGenFramebuffers(1, &ctx->fbo);
 +        glGenFramebuffers(1, &ctx->context_fbo);
          ctx->initialized = 1;
       }
  
     // Attach FBO if it hasn't been attached or if surface changed
 -   if ((!sfc->fbo_attached) || (ctx != sfc->current_ctx))
 +   if ((!sfc->fbo_attached) || (ctx->current_sfc != sfc))
       {
-         if (!_attach_fbo_surface(re, sfc, ctx)) 
+         if (!_attach_fbo_surface(re, sfc, ctx))
            {
               ERR("_attach_fbo_surface() failed.");
               return 0;
          sfc->fbo_attached = 1;
       }
  
++<<<<<<< HEAD
 +   if (ctx->current_sfc != sfc)
 +     {
 +        if (ctx->current_fbo)
 +           // Bind to the previously bound buffer
 +           glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
 +        else
 +           // Bind FBO
 +           glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo);
 +     }
 +
 +   // Set the current surface/context 
++=======
+    // Set the current surface/context
++>>>>>>> svn_merge
     ctx->current_sfc = sfc;
     sfc->current_ctx = ctx;