[Cogl] [PATCH] Remove some unused structure members from CoglContext

Neil Roberts neil at linux.intel.com
Thu Nov 8 07:30:44 PST 2012


• blended_color_pipeline and texture_pipeline. These were only used
  for cogl_set_source_color and cogl_set_source_texture which no
  longer exist.

• polygon_vertices. This was used to implement cogl_polygon which no
  longer exists.

• quad_buffer_indices*. These were used for
  cogl_vertex_buffer_indices_get_for_quads() which has been replaced
  with cogl_get_rectangle_indices()

• in_begin_gl_block. This was used for cogl_begin_gl().

• max_texture_image_units. This was used by the internal
  get_max_texture_image_units() which was removed in
  4e1d08d59e65fd06a3fa10e2be147fc290

• buffer_types: This was moved to a real global variable in
  3ea6acc072d9f1.

• current_clip_stack_uses_stencil. This was used to determine if
  drawing a path will collide the stencil clip. Paths are now drawn
  using the stencil clip so this no longer matters.
---
 cogl/cogl-context-private.h         | 22 +---------------------
 cogl/cogl-context.c                 | 24 ------------------------
 cogl/driver/gl/cogl-clip-stack-gl.c |  3 ---
 3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index 37743c4..1b4f70f 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -129,9 +129,7 @@ struct _CoglContext
   int               active_texture_unit;
 
   /* Pipelines */
-  CoglPipeline     *opaque_color_pipeline; /* used for set_source_color */
-  CoglPipeline     *blended_color_pipeline; /* used for set_source_color */
-  CoglPipeline     *texture_pipeline; /* used for set_source_texture */
+  CoglPipeline     *opaque_color_pipeline; /* to check for simple pipelines */
   GString          *codegen_header_buffer;
   GString          *codegen_source_buffer;
 
@@ -150,8 +148,6 @@ struct _CoglContext
   GArray           *journal_flush_attributes_array;
   GArray           *journal_clip_bounds;
 
-  GArray           *polygon_vertices;
-
   /* Some simple caching, to minimize state changes... */
   CoglPipeline     *current_pipeline;
   unsigned long     current_pipeline_changes_since_flush;
@@ -187,16 +183,10 @@ struct _CoglContext
 
   /* Pre-generated VBOs containing indices to generate GL_TRIANGLES
      out of a vertex array of quads */
-  CoglIndices      *quad_buffer_indices_byte;
-  unsigned int      quad_buffer_indices_len;
-  CoglIndices      *quad_buffer_indices;
-
   CoglIndices      *rectangle_byte_indices;
   CoglIndices      *rectangle_short_indices;
   int               rectangle_short_indices_len;
 
-  CoglBool          in_begin_gl_block;
-
   CoglPipeline     *texture_download_pipeline;
   CoglPipeline     *blit_texture_pipeline;
 
@@ -212,7 +202,6 @@ struct _CoglContext
   /* Cached values for GL_MAX_TEXTURE_[IMAGE_]UNITS to avoid calling
      glGetInteger too often */
   GLint             max_texture_units;
-  GLint             max_texture_image_units;
   GLint             max_activateable_texture_units;
 
   CoglPipelineProgramType current_fragment_program_type;
@@ -226,10 +215,6 @@ struct _CoglContext
      cogl_is_texture */
   GSList           *texture_types;
 
-  /* List of types that will be considered a subclass of CoglBuffer in
-     cogl_is_buffer */
-  GSList           *buffer_types;
-
   /* Clipping */
   /* TRUE if we have a valid clipping stack flushed. In that case
      current_clip_stack will describe what the current state is. If
@@ -246,11 +231,6 @@ struct _CoglContext
      same state multiple times. When the clip state is flushed this
      will hold a reference */
   CoglClipStack    *current_clip_stack;
-  /* Whether the stencil buffer was used as part of the current clip
-     state. If TRUE then any further use of the stencil buffer (such
-     as for drawing paths) would need to be merged with the existing
-     stencil buffer */
-  CoglBool          current_clip_stack_uses_stencil;
 
   /* This is used as a temporary buffer to fill a CoglBuffer when
      cogl_buffer_map fails and we only want to map to fill it with new
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index c70e020..d4f971d 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -165,7 +165,6 @@ cogl_context_new (CoglDisplay *display,
   context->private_feature_flags = 0;
 
   context->texture_types = NULL;
-  context->buffer_types = NULL;
 
   context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_UNKNOWN;
 
@@ -274,8 +273,6 @@ cogl_context_new (CoglDisplay *display,
     }
 
   context->opaque_color_pipeline = cogl_pipeline_new (context);
-  context->blended_color_pipeline = cogl_pipeline_new (context);
-  context->texture_pipeline = cogl_pipeline_new (context);
   context->codegen_header_buffer = g_string_new ("");
   context->codegen_source_buffer = g_string_new ("");
 
@@ -295,8 +292,6 @@ cogl_context_new (CoglDisplay *display,
     g_array_new (TRUE, FALSE, sizeof (CoglAttribute *));
   context->journal_clip_bounds = NULL;
 
-  context->polygon_vertices = g_array_new (FALSE, FALSE, sizeof (float));
-
   context->current_pipeline = NULL;
   context->current_pipeline_changes_since_flush = 0;
   context->current_pipeline_skip_gl_color = FALSE;
@@ -348,12 +343,6 @@ cogl_context_new (CoglDisplay *display,
 
   context->stencil_pipeline = cogl_pipeline_new (context);
 
-  context->in_begin_gl_block = FALSE;
-
-  context->quad_buffer_indices_byte = NULL;
-  context->quad_buffer_indices = NULL;
-  context->quad_buffer_indices_len = 0;
-
   context->rectangle_byte_indices = NULL;
   context->rectangle_short_indices = NULL;
   context->rectangle_short_indices_len = 0;
@@ -468,10 +457,6 @@ _cogl_context_free (CoglContext *context)
 
   if (context->opaque_color_pipeline)
     cogl_object_unref (context->opaque_color_pipeline);
-  if (context->blended_color_pipeline)
-    cogl_object_unref (context->blended_color_pipeline);
-  if (context->texture_pipeline)
-    cogl_object_unref (context->texture_pipeline);
 
   if (context->blit_texture_pipeline)
     cogl_object_unref (context->blit_texture_pipeline);
@@ -483,14 +468,6 @@ _cogl_context_free (CoglContext *context)
   if (context->journal_clip_bounds)
     g_array_free (context->journal_clip_bounds, TRUE);
 
-  if (context->polygon_vertices)
-    g_array_free (context->polygon_vertices, TRUE);
-
-  if (context->quad_buffer_indices_byte)
-    cogl_object_unref (context->quad_buffer_indices_byte);
-  if (context->quad_buffer_indices)
-    cogl_object_unref (context->quad_buffer_indices);
-
   if (context->rectangle_byte_indices)
     cogl_object_unref (context->rectangle_byte_indices);
   if (context->rectangle_short_indices)
@@ -521,7 +498,6 @@ _cogl_context_free (CoglContext *context)
   _cogl_bitmask_destroy (&context->changed_bits_tmp);
 
   g_slist_free (context->texture_types);
-  g_slist_free (context->buffer_types);
 
   if (context->current_modelview_entry)
     _cogl_matrix_entry_unref (context->current_modelview_entry);
diff --git a/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/driver/gl/cogl-clip-stack-gl.c
index 8d2cd4c..50bf4d8 100644
--- a/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -495,7 +495,6 @@ _cogl_clip_stack_gl_flush (CoglClipStack *stack,
     {
       COGL_NOTE (CLIPPING, "Flushed empty clip stack");
 
-      ctx->current_clip_stack_uses_stencil = FALSE;
       GE (ctx, glDisable (GL_SCISSOR_TEST));
       return;
     }
@@ -662,6 +661,4 @@ _cogl_clip_stack_gl_flush (CoglClipStack *stack,
      setting up the stencil buffer */
   if (using_clip_planes)
     enable_clip_planes (ctx);
-
-  ctx->current_clip_stack_uses_stencil = using_stencil_buffer;
 }
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list