evas/wayland_egl: Use packed_depth_stencil when possible
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Fri, 6 Dec 2013 10:42:28 +0000 (14:42 +0400)
committerRusty Lynch <rusty.lynch@intel.com>
Wed, 18 Dec 2013 01:45:32 +0000 (17:45 -0800)
According to OpenGL standard, 9.4.3 Required Framebuffer Formats:
"However, when both depth and stencil attachments are
present, implementations are only required to support
framebuffer objects where both attachments refer to
the same image."

So use packed_depth_stencil when it's possible

Change-Id: I92c4e0bb70e87bbfa69e65b5ece719c90d07f316
Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
src/modules/engines/wayland_egl/evas_engine.c

index c32223e7ca78d532b8f07426f69c825c2971d1e4..3bed4ed2ca546b2ef3d0115a10add78f69203d60 100644 (file)
@@ -2109,7 +2109,7 @@ eng_canvas_alpha_get(void *data, void *info __UNUSED__)
 }
 
 static int
-_set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg)
+_set_internal_config(Render_Engine *re, Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg)
 {
    // Also initialize pixel format here as well...
    switch(cfg->color_format)
@@ -2151,7 +2151,17 @@ _set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg)
       case EVAS_GL_STENCIL_BIT_2:
       case EVAS_GL_STENCIL_BIT_4:
       case EVAS_GL_STENCIL_BIT_8:
-         sfc->rb_stencil_fmt = GL_STENCIL_INDEX8;
+         if ((cfg->depth_bits != EVAS_GL_DEPTH_NONE) &&
+             re->gl_cap.depth_24_stencil_8[0])
+           {
+               sfc->rb_depth_stencil_fmt = re->gl_cap.depth_24_stencil_8[0];
+               sfc->rb_depth_fmt = re->gl_cap.depth_24_stencil_8[0];
+               sfc->rb_stencil_fmt = re->gl_cap.depth_24_stencil_8[0];
+           }
+         else
+           {
+               sfc->rb_stencil_fmt = GL_STENCIL_INDEX8;
+           }
          break;
       case EVAS_GL_STENCIL_BIT_16:
       default:
@@ -2159,8 +2169,6 @@ _set_internal_config(Render_Engine_GL_Surface *sfc, Evas_GL_Config *cfg)
          return 0;
      }
 
-   // Do Packed Depth24_Stencil8 Later...
-
    return 1;
 }
 
@@ -2595,7 +2603,7 @@ eng_gl_surface_create(void *data, void *config, int w, int h)
      }
 
    // Set the internal format based on the config
-   if (!_set_internal_config(sfc, cfg))
+   if (!_set_internal_config(re, sfc, cfg))
      {
         ERR("Unsupported Format!");
         goto finish;