[mutter] cogl/offscreen: Remove depth buffer texture field



commit 408d4c9f091cae6c125846cad853c3afeebf751d
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sun Oct 18 22:01:33 2020 +0200

    cogl/offscreen: Remove depth buffer texture field
    
    It was never set, so it was just some dead code.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>

 cogl/cogl/cogl-offscreen-private.h        |  2 -
 cogl/cogl/cogl-offscreen.c                |  1 -
 cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 70 -------------------------------
 3 files changed, 73 deletions(-)
---
diff --git a/cogl/cogl/cogl-offscreen-private.h b/cogl/cogl/cogl-offscreen-private.h
index a84815fe6e..dabc8697ba 100644
--- a/cogl/cogl/cogl-offscreen-private.h
+++ b/cogl/cogl/cogl-offscreen-private.h
@@ -51,8 +51,6 @@ struct _CoglOffscreen
   CoglTexture *texture;
   int texture_level;
 
-  CoglTexture *depth_texture;
-
   CoglOffscreenAllocateFlags allocation_flags;
 
   /* FIXME: _cogl_offscreen_new_with_texture_full should be made to use
diff --git a/cogl/cogl/cogl-offscreen.c b/cogl/cogl/cogl-offscreen.c
index 7ba5ad483c..20154d78c1 100644
--- a/cogl/cogl/cogl-offscreen.c
+++ b/cogl/cogl/cogl-offscreen.c
@@ -131,7 +131,6 @@ cogl_offscreen_dispose (GObject *object)
   G_OBJECT_CLASS (cogl_offscreen_parent_class)->dispose (object);
 
   cogl_clear_object (&offscreen->texture);
-  cogl_clear_object (&offscreen->depth_texture);
 }
 
 static void
diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
index f2a2e1217a..3a540e4b6e 100644
--- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -480,52 +480,6 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
   ctx->current_draw_buffer_changes &= ~state;
 }
 
-static CoglTexture *
-attach_depth_texture (CoglContext *ctx,
-                      CoglTexture *depth_texture,
-                      CoglOffscreenAllocateFlags flags)
-{
-  GLuint tex_gl_handle;
-  GLenum tex_gl_target;
-
-  if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL)
-    {
-      /* attach a GL_DEPTH_STENCIL texture to the GL_DEPTH_ATTACHMENT and
-       * GL_STENCIL_ATTACHMENT attachment points */
-      g_assert (_cogl_texture_get_format (depth_texture) ==
-                COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8);
-
-      cogl_texture_get_gl_texture (depth_texture,
-                                   &tex_gl_handle, &tex_gl_target);
-
-      GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER,
-                                       GL_DEPTH_ATTACHMENT,
-                                       tex_gl_target, tex_gl_handle,
-                                       0));
-      GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER,
-                                       GL_STENCIL_ATTACHMENT,
-                                       tex_gl_target, tex_gl_handle,
-                                       0));
-    }
-  else if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH)
-    {
-      /* attach a newly created GL_DEPTH_COMPONENT16 texture to the
-       * GL_DEPTH_ATTACHMENT attachment point */
-      g_assert (_cogl_texture_get_format (depth_texture) ==
-                COGL_PIXEL_FORMAT_DEPTH_16);
-
-      cogl_texture_get_gl_texture (COGL_TEXTURE (depth_texture),
-                                   &tex_gl_handle, &tex_gl_target);
-
-      GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER,
-                                       GL_DEPTH_ATTACHMENT,
-                                       tex_gl_target, tex_gl_handle,
-                                       0));
-    }
-
-  return COGL_TEXTURE (depth_texture);
-}
-
 static GList *
 try_creating_renderbuffers (CoglContext *ctx,
                             int width,
@@ -661,7 +615,6 @@ try_creating_fbo (CoglContext                 *ctx,
                   int                          texture_level,
                   int                          texture_level_width,
                   int                          texture_level_height,
-                  CoglTexture                 *depth_texture,
                   const CoglFramebufferConfig *config,
                   CoglOffscreenAllocateFlags   flags,
                   CoglGlFbo                   *gl_fbo)
@@ -712,22 +665,6 @@ try_creating_fbo (CoglContext                 *ctx,
                                      tex_gl_target, tex_gl_handle,
                                      texture_level));
 
-  /* attach either a depth/stencil texture, a depth texture or render buffers
-   * depending on what we've been asked to provide */
-
-  if (depth_texture &&
-      flags & (COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL |
-               COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH))
-    {
-      attach_depth_texture (ctx, depth_texture, flags);
-
-      /* Let's clear the flags that are now fulfilled as we might need to
-       * create renderbuffers (for the ALLOCATE_FLAG_DEPTH |
-       * ALLOCATE_FLAG_STENCIL case) */
-      flags &= ~(COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL |
-                 COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH);
-    }
-
   if (flags)
     {
       gl_fbo->renderbuffers =
@@ -816,7 +753,6 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
                          offscreen->texture_level,
                          level_width,
                          level_height,
-                         offscreen->depth_texture,
                          config,
                          flags = 0,
                          gl_fbo)) ||
@@ -827,7 +763,6 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
                          offscreen->texture_level,
                          level_width,
                          level_height,
-                         offscreen->depth_texture,
                          config,
                          flags = ctx->last_offscreen_allocate_flags,
                          gl_fbo)) ||
@@ -844,7 +779,6 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
                          offscreen->texture_level,
                          level_width,
                          level_height,
-                         offscreen->depth_texture,
                          config,
                          flags = COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL,
                          gl_fbo)) ||
@@ -854,7 +788,6 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
                         offscreen->texture_level,
                         level_width,
                         level_height,
-                        offscreen->depth_texture,
                         config,
                         flags = COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH |
                         COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL,
@@ -865,7 +798,6 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
                         offscreen->texture_level,
                         level_width,
                         level_height,
-                        offscreen->depth_texture,
                         config,
                         flags = COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL,
                         gl_fbo) ||
@@ -875,7 +807,6 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
                         offscreen->texture_level,
                         level_width,
                         level_height,
-                        offscreen->depth_texture,
                         config,
                         flags = COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH,
                         gl_fbo) ||
@@ -885,7 +816,6 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
                         offscreen->texture_level,
                         level_width,
                         level_height,
-                        offscreen->depth_texture,
                         config,
                         flags = 0,
                         gl_fbo))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]