[Cogl] [PATCH] Remove legacy state

Robert Bragg robert at sixbynine.org
Wed Apr 18 06:36:58 PDT 2012


Yeah, this looks good to me.

Reviewed-by: Robert Bragg <robert at linux.intel.com>

regards,
- Robert

On Tue, Apr 17, 2012 at 5:22 PM, Neil Roberts <neil at linux.intel.com> wrote:
> This removes the global legacy state for setting the depth state,
> backface culling and global program.
>
> The internal _cogl_push_source wrapper which takes a boolean to set
> whether legacy state should be applied has been removed. The normal
> cogl_push_source can always be used instead.
>
> The CoglDrawFlag for disable legacy state has been removed. Similarly
> the boolean argument to disable legacy state when drawing rectangles
> has also been removed.
>
> The legacy state testing in test-backface-culling had already been
> partially removed in f951d0995f8a8 but the masks were not correctly
> updated so it was not testing all of the combinations correctly.
>
> The legacy state testing from test-depth-state has been removed.
> ---
>  cogl/cogl-attribute-private.h         |    3 +-
>  cogl/cogl-attribute.c                 |   13 ---
>  cogl/cogl-blit.c                      |    2 +-
>  cogl/cogl-clip-stack.c                |    3 +-
>  cogl/cogl-context-private.h           |    8 --
>  cogl/cogl-context.c                   |    8 --
>  cogl/cogl-framebuffer.c               |   28 +++----
>  cogl/cogl-framebuffer.h               |   16 ----
>  cogl/cogl-journal.c                   |    3 +-
>  cogl/cogl-pipeline-private.h          |    3 -
>  cogl/cogl-pipeline.c                  |   28 ------
>  cogl/cogl-primitives-private.h        |    3 +-
>  cogl/cogl-primitives.c                |   31 +------
>  cogl/cogl-private.h                   |    6 --
>  cogl/cogl-texture.c                   |    2 +-
>  cogl/cogl.c                           |  149 +++------------------------------
>  cogl/cogl.symbols                     |    7 --
>  cogl/cogl1-context.h                  |  104 +----------------------
>  tests/conform/test-backface-culling.c |   10 +-
>  tests/conform/test-depth-test.c       |   35 --------
>  20 files changed, 41 insertions(+), 421 deletions(-)
>
> diff --git a/cogl/cogl-attribute-private.h b/cogl/cogl-attribute-private.h
> index 82a15f2..bde6fe2 100644
> --- a/cogl/cogl-attribute-private.h
> +++ b/cogl/cogl-attribute-private.h
> @@ -70,14 +70,13 @@ typedef enum
>   COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0,
>   COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1,
>   COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2,
> -  COGL_DRAW_SKIP_LEGACY_STATE = 1 << 3,
>   /* By default the vertex attribute drawing code will assume that if
>      there is a color attribute array enabled then we can't determine
>      if the colors will be opaque so we need to enabling
>      blending. However when drawing from the journal we know what the
>      contents of the color array is so we can override this by passing
>      this flag. */
> -  COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 4
> +  COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 3
>  } CoglDrawFlags;
>
>  /* During CoglContext initialization we register the "cogl_color_in"
> diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c
> index 2b1a986..3a6244f 100644
> --- a/cogl/cogl-attribute.c
> +++ b/cogl/cogl-attribute.c
> @@ -661,19 +661,6 @@ _cogl_flush_attributes_state (CoglFramebuffer *framebuffer,
>        */
>     }
>
> -  if (G_UNLIKELY (!(flags & COGL_DRAW_SKIP_LEGACY_STATE)) &&
> -      G_UNLIKELY (ctx->legacy_state_set) &&
> -      _cogl_get_enable_legacy_state ())
> -    {
> -      /* If we haven't already created a derived pipeline... */
> -      if (!copy)
> -        {
> -          copy = cogl_pipeline_copy (pipeline);
> -          pipeline = copy;
> -        }
> -      _cogl_pipeline_apply_legacy_state (pipeline);
> -    }
> -
>   _cogl_pipeline_flush_gl_state (pipeline, skip_gl_color, n_tex_coord_attribs);
>
>   _cogl_bitmask_clear_all (&ctx->enable_builtin_attributes_tmp);
> diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c
> index 247317f..8eaf8a5 100644
> --- a/cogl/cogl-blit.c
> +++ b/cogl/cogl-blit.c
> @@ -97,7 +97,7 @@ _cogl_blit_texture_render_begin (CoglBlitData *data)
>
>   cogl_pipeline_set_layer_texture (pipeline, 0, data->src_tex);
>
> -  _cogl_push_source (pipeline, FALSE);
> +  cogl_push_source (pipeline);
>
>   return TRUE;
>  }
> diff --git a/cogl/cogl-clip-stack.c b/cogl/cogl-clip-stack.c
> index 1bab67d..6bdd023 100644
> --- a/cogl/cogl-clip-stack.c
> +++ b/cogl/cogl-clip-stack.c
> @@ -418,8 +418,7 @@ paint_primitive_silhouette (void *user_data)
>                                     user_data,
>                                     COGL_DRAW_SKIP_JOURNAL_FLUSH |
>                                     COGL_DRAW_SKIP_PIPELINE_VALIDATION |
> -                                    COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
> -                                    COGL_DRAW_SKIP_LEGACY_STATE);
> +                                    COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
>  }
>
>  static void
> diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
> index 57d8b74..b94eabf 100644
> --- a/cogl/cogl-context-private.h
> +++ b/cogl/cogl-context-private.h
> @@ -100,8 +100,6 @@ struct _CoglContext
>   CoglBitmask       enable_custom_attributes_tmp;
>   CoglBitmask       changed_bits_tmp;
>
> -  CoglBool          legacy_backface_culling_enabled;
> -
>   /* A few handy matrix constants */
>   CoglMatrix        identity_matrix;
>   CoglMatrix        y_flip_matrix;
> @@ -122,8 +120,6 @@ struct _CoglContext
>   GArray           *texture_units;
>   int               active_texture_unit;
>
> -  CoglPipelineFogState legacy_fog_state;
> -
>   /* Pipelines */
>   CoglPipeline     *opaque_color_pipeline; /* used for set_source_color */
>   CoglPipeline     *blended_color_pipeline; /* used for set_source_color */
> @@ -132,8 +128,6 @@ struct _CoglContext
>   GString          *codegen_source_buffer;
>   GList            *source_stack;
>
> -  int               legacy_state_set;
> -
>   CoglPipelineCache *pipeline_cache;
>
>   /* Textures */
> @@ -165,8 +159,6 @@ struct _CoglContext
>   float                 depth_range_near_cache;
>   float                 depth_range_far_cache;
>
> -  CoglBool              legacy_depth_test_enabled;
> -
>   CoglBuffer       *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT];
>
>   /* Framebuffers */
> diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
> index 65f35d4..45ed8e0 100644
> --- a/cogl/cogl-context.c
> +++ b/cogl/cogl-context.c
> @@ -274,8 +274,6 @@ cogl_context_new (CoglDisplay *display,
>   context->current_clip_stack_valid = FALSE;
>   context->current_clip_stack = NULL;
>
> -  context->legacy_backface_culling_enabled = FALSE;
> -
>   cogl_matrix_init_identity (&context->identity_matrix);
>   cogl_matrix_init_identity (&context->y_flip_matrix);
>   cogl_matrix_scale (&context->y_flip_matrix, 1, -1, 1);
> @@ -290,8 +288,6 @@ cogl_context_new (CoglDisplay *display,
>   context->active_texture_unit = 1;
>   GE (context, glActiveTexture (GL_TEXTURE1));
>
> -  context->legacy_fog_state.enabled = FALSE;
> -
>   context->opaque_color_pipeline = cogl_pipeline_new (context);
>   context->blended_color_pipeline = cogl_pipeline_new (context);
>   context->texture_pipeline = cogl_pipeline_new (context);
> @@ -299,8 +295,6 @@ cogl_context_new (CoglDisplay *display,
>   context->codegen_source_buffer = g_string_new ("");
>   context->source_stack = NULL;
>
> -  context->legacy_state_set = 0;
> -
>   context->default_gl_texture_2d_tex = NULL;
>   context->default_gl_texture_3d_tex = NULL;
>   context->default_gl_texture_rect_tex = NULL;
> @@ -347,8 +341,6 @@ cogl_context_new (CoglDisplay *display,
>   context->depth_range_near_cache = 0;
>   context->depth_range_far_cache = 1;
>
> -  context->legacy_depth_test_enabled = FALSE;
> -
>   context->pipeline_cache = cogl_pipeline_cache_new ();
>
>   for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
> diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
> index 723e5b6..3918636 100644
> --- a/cogl/cogl-framebuffer.c
> +++ b/cogl/cogl-framebuffer.c
> @@ -3106,8 +3106,7 @@ draw_wireframe (CoglContext *ctx,
>                                            n_attributes,
>                                            COGL_DRAW_SKIP_JOURNAL_FLUSH |
>                                            COGL_DRAW_SKIP_PIPELINE_VALIDATION |
> -                                           COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
> -                                           COGL_DRAW_SKIP_LEGACY_STATE);
> +                                           COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
>   COGL_DEBUG_SET_FLAG (COGL_DEBUG_WIREFRAME);
>
>   cogl_object_unref (wire_indices);
> @@ -3159,7 +3158,7 @@ cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
>                                      first_vertex,
>                                      n_vertices,
>                                      attributes, n_attributes,
> -                                     COGL_DRAW_SKIP_LEGACY_STATE);
> +                                     0 /* flags */);
>  }
>
>  void
> @@ -3192,7 +3191,7 @@ cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer,
>                                      pipeline,
>                                      mode, first_vertex, n_vertices,
>                                      attributes, n_attributes,
> -                                     COGL_DRAW_SKIP_LEGACY_STATE);
> +                                     0 /* flags */);
>  }
>
>  static size_t
> @@ -3282,7 +3281,7 @@ cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
>                                              mode, first_vertex,
>                                              n_vertices, indices,
>                                              attributes, n_attributes,
> -                                             COGL_DRAW_SKIP_LEGACY_STATE);
> +                                             0 /* flags */);
>  }
>
>  void
> @@ -3320,7 +3319,7 @@ cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
>                                              indices,
>                                              attributes,
>                                              n_attributes,
> -                                             COGL_DRAW_SKIP_LEGACY_STATE);
> +                                             0 /* flags */);
>  }
>
>  void
> @@ -3356,7 +3355,7 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
>                                  CoglPrimitive *primitive)
>  {
>   _cogl_framebuffer_draw_primitive (framebuffer, pipeline, primitive,
> -                                    COGL_DRAW_SKIP_LEGACY_STATE);
> +                                    0 /* flags */);
>  }
>
>  void
> @@ -3382,8 +3381,7 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
>   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
>                                                    pipeline,
>                                                    &rect,
> -                                                   1,
> -                                                   TRUE);
> +                                                   1);
>  }
>
>  void
> @@ -3414,8 +3412,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
>   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
>                                                    pipeline,
>                                                    &rect,
> -                                                   1,
> -                                                   TRUE);
> +                                                   1);
>  }
>
>  void
> @@ -3443,8 +3440,7 @@ cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer,
>   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
>                                                    pipeline,
>                                                    &rect,
> -                                                   1,
> -                                                   TRUE);
> +                                                   1);
>  }
>
>  void
> @@ -3473,8 +3469,7 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
>   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
>                                                    pipeline,
>                                                    rects,
> -                                                   n_rectangles,
> -                                                   TRUE);
> +                                                   n_rectangles);
>  }
>
>  void
> @@ -3503,6 +3498,5 @@ cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer,
>   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
>                                                    pipeline,
>                                                    rects,
> -                                                   n_rectangles,
> -                                                   TRUE);
> +                                                   n_rectangles);
>  }
> diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
> index f081b84..bccde36 100644
> --- a/cogl/cogl-framebuffer.h
> +++ b/cogl/cogl-framebuffer.h
> @@ -989,10 +989,6 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
>  * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
>  * are associated with layers of the given @pipeline.
>  *
> - * <note>This api doesn't support any of the legacy global state options such
> - * as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
> - * cogl_program_use()</note>
> - *
>  * Stability: unstable
>  * Since: 1.10
>  */
> @@ -1068,10 +1064,6 @@ cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer,
>  * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
>  * are associated with layers of the given @pipeline.
>  *
> - * <note>This api doesn't support any of the legacy global state options such
> - * as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
> - * cogl_program_use()</note>
> - *
>  * Stability: unstable
>  * Since: 1.10
>  */
> @@ -1131,10 +1123,6 @@ cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
>  * a GPU such as #CoglTexture2D, #CoglTextureRectangle or
>  * #CoglTexture3D are associated with layers of the given @pipeline.
>  *
> - * <note>This api doesn't support any of the legacy global state
> - * options such as cogl_set_depth_test_enabled(),
> - * cogl_set_backface_culling_enabled() or cogl_program_use()</note>
> - *
>  * Stability: unstable
>  * Since: 1.10
>  */
> @@ -1196,10 +1184,6 @@ cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
>  * a GPU such as #CoglTexture2D, #CoglTextureRectangle or
>  * #CoglTexture3D are associated with layers of the given @pipeline.
>  *
> - * <note>This api doesn't support any of the legacy global state
> - * options such as cogl_set_depth_test_enabled(),
> - * cogl_set_backface_culling_enabled() or cogl_program_use()</note>
> - *
>  * Stability: unstable
>  * Since: 1.10
>  */
> diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c
> index a17c6bc..8f42f6c 100644
> --- a/cogl/cogl-journal.c
> +++ b/cogl/cogl-journal.c
> @@ -280,8 +280,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
>   CoglAttribute **attributes;
>   CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH |
>                               COGL_DRAW_SKIP_PIPELINE_VALIDATION |
> -                              COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
> -                              COGL_DRAW_SKIP_LEGACY_STATE);
> +                              COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
>
>   COGL_STATIC_TIMER (time_flush_modelview_and_entries,
>                      "flush: pipeline+entries", /* parent */
> diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
> index 4488541..0d2c9be 100644
> --- a/cogl/cogl-pipeline-private.h
> +++ b/cogl/cogl-pipeline-private.h
> @@ -922,9 +922,6 @@ void
>  _cogl_pipeline_texture_storage_change_notify (CoglTexture *texture);
>
>  void
> -_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline);
> -
> -void
>  _cogl_pipeline_apply_overrides (CoglPipeline *pipeline,
>                                 CoglPipelineFlushOptions *options);
>
> diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
> index 4c2f9b2..ef38df5 100644
> --- a/cogl/cogl-pipeline.c
> +++ b/cogl/cogl-pipeline.c
> @@ -2479,34 +2479,6 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
>  }
>
>  void
> -_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline)
> -{
> -  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
> -
> -  /* It was a mistake that we ever copied the OpenGL style API for
> -   * associating these things directly with the context when we
> -   * originally wrote Cogl. Until the corresponding deprecated APIs
> -   * can be removed though we now shoehorn the state changes through
> -   * the cogl_pipeline API instead.
> -   */
> -
> -  if (ctx->legacy_depth_test_enabled)
> -    {
> -      CoglDepthState depth_state;
> -      cogl_depth_state_init (&depth_state);
> -      cogl_depth_state_set_test_enabled (&depth_state, TRUE);
> -      cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
> -    }
> -
> -  if (ctx->legacy_fog_state.enabled)
> -    _cogl_pipeline_set_fog_state (pipeline, &ctx->legacy_fog_state);
> -
> -  if (ctx->legacy_backface_culling_enabled)
> -    cogl_pipeline_set_cull_face_mode (pipeline,
> -                                      COGL_PIPELINE_CULL_FACE_MODE_BACK);
> -}
> -
> -void
>  _cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
>                                       const char *breadcrumb)
>  {
> diff --git a/cogl/cogl-primitives-private.h b/cogl/cogl-primitives-private.h
> index 91b457f..f36213c 100644
> --- a/cogl/cogl-primitives-private.h
> +++ b/cogl/cogl-primitives-private.h
> @@ -52,8 +52,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
>                                         CoglFramebuffer *framebuffer,
>                                         CoglPipeline *pipeline,
>                                         CoglMultiTexturedRect *rects,
> -                                        int n_rects,
> -                                        CoglBool disable_legacy_state);
> +                                        int n_rects);
>
>  G_END_DECLS
>
> diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c
> index 528f2c5..85c0ea3 100644
> --- a/cogl/cogl-primitives.c
> +++ b/cogl/cogl-primitives.c
> @@ -630,8 +630,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
>                                         CoglFramebuffer *framebuffer,
>                                         CoglPipeline *pipeline,
>                                         CoglMultiTexturedRect *rects,
> -                                        int n_rects,
> -                                        CoglBool disable_legacy_state)
> +                                        int n_rects)
>  {
>   CoglContext *ctx = framebuffer->context;
>   CoglPipeline *original_pipeline;
> @@ -655,18 +654,6 @@ _cogl_framebuffer_draw_multitextured_rectangles (
>   if (state.override_source)
>     pipeline = state.override_source;
>
> -  if (!disable_legacy_state)
> -    {
> -      if (G_UNLIKELY (ctx->legacy_state_set) &&
> -          _cogl_get_enable_legacy_state ())
> -        {
> -          /* If we haven't already made a pipeline copy */
> -          if (pipeline == original_pipeline)
> -            pipeline = cogl_pipeline_copy (pipeline);
> -          _cogl_pipeline_apply_legacy_state (pipeline);
> -        }
> -    }
> -
>   /*
>    * Emit geometry for each of the rectangles...
>    */
> @@ -729,8 +716,7 @@ _cogl_rectangles_with_multitexture_coords (
>   _cogl_framebuffer_draw_multitextured_rectangles (cogl_get_draw_framebuffer (),
>                                                    cogl_get_source (),
>                                                    rects,
> -                                                   n_rects,
> -                                                   FALSE);
> +                                                   n_rects);
>  }
>
>  void
> @@ -892,8 +878,7 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
>                                      1,
>                                      COGL_DRAW_SKIP_JOURNAL_FLUSH |
>                                      COGL_DRAW_SKIP_PIPELINE_VALIDATION |
> -                                     COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
> -                                     COGL_DRAW_SKIP_LEGACY_STATE);
> +                                     COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
>
>
>   cogl_object_unref (attributes[0]);
> @@ -1113,14 +1098,6 @@ cogl_polygon (const CoglTextureVertex *vertices,
>                         v,
>                         ctx->polygon_vertices->len * sizeof (float));
>
> -  /* XXX: although this may seem redundant, we need to do this since
> -   * cogl_polygon() can be used with legacy state and its the source stack
> -   * which track whether legacy state is enabled.
> -   *
> -   * (We only have a CoglDrawFlag to disable legacy state not one
> -   *  to enable it) */
> -  cogl_push_source (pipeline);
> -
>   _cogl_framebuffer_draw_attributes (cogl_get_draw_framebuffer (),
>                                      pipeline,
>                                      COGL_VERTICES_MODE_TRIANGLE_FAN,
> @@ -1129,8 +1106,6 @@ cogl_polygon (const CoglTextureVertex *vertices,
>                                      n_attributes,
>                                      0 /* no draw flags */);
>
> -  cogl_pop_source ();
> -
>   if (pipeline != validate_state.original_pipeline)
>     cogl_object_unref (pipeline);
>
> diff --git a/cogl/cogl-private.h b/cogl/cogl-private.h
> index d167cb3..9006892 100644
> --- a/cogl/cogl-private.h
> +++ b/cogl/cogl-private.h
> @@ -39,12 +39,6 @@ _cogl_clear (const CoglColor *color, unsigned long buffers);
>  void
>  _cogl_init (void);
>
> -void
> -_cogl_push_source (CoglPipeline *pipeline, CoglBool enable_legacy);
> -
> -CoglBool
> -_cogl_get_enable_legacy_state (void);
> -
>  /*
>  * _cogl_pixel_format_get_bytes_per_pixel:
>  * @format: a #CoglPixelFormat
> diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
> index d805604..5d591d5 100644
> --- a/cogl/cogl-texture.c
> +++ b/cogl/cogl-texture.c
> @@ -885,7 +885,7 @@ _cogl_texture_draw_and_read (CoglTexture *texture,
>                                NULL);
>     }
>
> -  _cogl_push_source (ctx->texture_download_pipeline, FALSE);
> +  cogl_push_source (ctx->texture_download_pipeline);
>
>   cogl_pipeline_set_layer_texture (ctx->texture_download_pipeline, 0, texture);
>
> diff --git a/cogl/cogl.c b/cogl/cogl.c
> index 7608f53..9ee4d55 100644
> --- a/cogl/cogl.c
> +++ b/cogl/cogl.c
> @@ -137,54 +137,6 @@ cogl_clear (const CoglColor *color, unsigned long buffers)
>   cogl_framebuffer_clear (cogl_get_draw_framebuffer (), buffers, color);
>  }
>
> -/* XXX: This API has been deprecated */
> -void
> -cogl_set_depth_test_enabled (CoglBool setting)
> -{
> -  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
> -
> -  if (ctx->legacy_depth_test_enabled == setting)
> -    return;
> -
> -  ctx->legacy_depth_test_enabled = setting;
> -  if (ctx->legacy_depth_test_enabled)
> -    ctx->legacy_state_set++;
> -  else
> -    ctx->legacy_state_set--;
> -}
> -
> -/* XXX: This API has been deprecated */
> -CoglBool
> -cogl_get_depth_test_enabled (void)
> -{
> -  _COGL_GET_CONTEXT (ctx, FALSE);
> -  return ctx->legacy_depth_test_enabled;
> -}
> -
> -void
> -cogl_set_backface_culling_enabled (CoglBool setting)
> -{
> -  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
> -
> -  if (ctx->legacy_backface_culling_enabled == setting)
> -    return;
> -
> -  ctx->legacy_backface_culling_enabled = setting;
> -
> -  if (ctx->legacy_backface_culling_enabled)
> -    ctx->legacy_state_set++;
> -  else
> -    ctx->legacy_state_set--;
> -}
> -
> -CoglBool
> -cogl_get_backface_culling_enabled (void)
> -{
> -  _COGL_GET_CONTEXT (ctx, FALSE);
> -
> -  return ctx->legacy_backface_culling_enabled;
> -}
> -
>  void
>  cogl_set_source_color (const CoglColor *color)
>  {
> @@ -323,37 +275,6 @@ cogl_get_bitmasks (int *red,
>  }
>
>  void
> -cogl_set_fog (const CoglColor *fog_color,
> -              CoglFogMode      mode,
> -              float            density,
> -              float            z_near,
> -              float            z_far)
> -{
> -  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
> -
> -  if (ctx->legacy_fog_state.enabled == FALSE)
> -    ctx->legacy_state_set++;
> -
> -  ctx->legacy_fog_state.enabled = TRUE;
> -  ctx->legacy_fog_state.color = *fog_color;
> -  ctx->legacy_fog_state.mode = mode;
> -  ctx->legacy_fog_state.density = density;
> -  ctx->legacy_fog_state.z_near = z_near;
> -  ctx->legacy_fog_state.z_far = z_far;
> -}
> -
> -void
> -cogl_disable_fog (void)
> -{
> -  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
> -
> -  if (ctx->legacy_fog_state.enabled == TRUE)
> -    ctx->legacy_state_set--;
> -
> -  ctx->legacy_fog_state.enabled = FALSE;
> -}
> -
> -void
>  cogl_flush (void)
>  {
>   GList *l;
> @@ -568,45 +489,13 @@ typedef struct _CoglSourceState
>  {
>   CoglPipeline *pipeline;
>   int push_count;
> -  /* If this is TRUE then the pipeline will be copied and the legacy
> -     state will be applied whenever the pipeline is used. This is
> -     necessary because some internal Cogl code expects to be able to
> -     push a temporary pipeline to put GL into a known state. For that
> -     to work it also needs to prevent applying the legacy state */
> -  CoglBool enable_legacy;
>  } CoglSourceState;
>
> -static void
> -_push_source_real (CoglPipeline *pipeline, CoglBool enable_legacy)
> -{
> -  CoglSourceState *top = g_slice_new (CoglSourceState);
> -  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
> -
> -  top->pipeline = cogl_object_ref (pipeline);
> -  top->enable_legacy = enable_legacy;
> -  top->push_count = 1;
> -
> -  ctx->source_stack = g_list_prepend (ctx->source_stack, top);
> -}
> -
>  /* FIXME: This should take a context pointer for Cogl 2.0 Technically
>  * we could make it so we can retrieve a context reference from the
>  * pipeline, but this would not by symmetric with cogl_pop_source. */
>  void
> -cogl_push_source (void *material_or_pipeline)
> -{
> -  CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
> -
> -  _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
> -
> -  _cogl_push_source (pipeline, TRUE);
> -}
> -
> -/* This internal version of cogl_push_source is the same except it
> -   never applies the legacy state. Some parts of Cogl use this
> -   internally to set a temporary pipeline with a known state */
> -void
> -_cogl_push_source (CoglPipeline *pipeline, CoglBool enable_legacy)
> +cogl_push_source (CoglPipeline *pipeline)
>  {
>   CoglSourceState *top;
>
> @@ -614,19 +503,17 @@ _cogl_push_source (CoglPipeline *pipeline, CoglBool enable_legacy)
>
>   _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
>
> -  if (ctx->source_stack)
> +  if (ctx->source_stack &&
> +      (top = ctx->source_stack->data)->pipeline == pipeline)
> +    top->push_count++;
> +  else
>     {
> -      top = ctx->source_stack->data;
> -      if (top->pipeline == pipeline && top->enable_legacy == enable_legacy)
> -        {
> -          top->push_count++;
> -          return;
> -        }
> -      else
> -        _push_source_real (pipeline, enable_legacy);
> +      top = g_slice_new (CoglSourceState);
> +      top->pipeline = cogl_object_ref (pipeline);
> +      top->push_count = 1;
> +
> +      ctx->source_stack = g_list_prepend (ctx->source_stack, top);
>     }
> -  else
> -    _push_source_real (pipeline, enable_legacy);
>  }
>
>  /* FIXME: This needs to take a context pointer for Cogl 2.0 */
> @@ -664,19 +551,6 @@ cogl_get_source (void)
>   return top->pipeline;
>  }
>
> -CoglBool
> -_cogl_get_enable_legacy_state (void)
> -{
> -  CoglSourceState *top;
> -
> -  _COGL_GET_CONTEXT (ctx, FALSE);
> -
> -  _COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, FALSE);
> -
> -  top = ctx->source_stack->data;
> -  return top->enable_legacy;
> -}
> -
>  void
>  cogl_set_source (void *material_or_pipeline)
>  {
> @@ -689,7 +563,7 @@ cogl_set_source (void *material_or_pipeline)
>   _COGL_RETURN_IF_FAIL (ctx->source_stack);
>
>   top = ctx->source_stack->data;
> -  if (top->pipeline == pipeline && top->enable_legacy)
> +  if (top->pipeline == pipeline)
>     return;
>
>   if (top->push_count == 1)
> @@ -699,7 +573,6 @@ cogl_set_source (void *material_or_pipeline)
>       cogl_object_ref (pipeline);
>       cogl_object_unref (top->pipeline);
>       top->pipeline = pipeline;
> -      top->enable_legacy = TRUE;
>     }
>   else
>     {
> diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols
> index 9a9d2f9..3d09258 100644
> --- a/cogl/cogl.symbols
> +++ b/cogl/cogl.symbols
> @@ -168,8 +168,6 @@ cogl_depth_state_set_range
>  cogl_depth_state_set_write_enabled
>  cogl_depth_test_function_get_type
>
> -cogl_disable_fog
> -
>  cogl_display_get_renderer
>  cogl_display_new
>  cogl_display_setup
> @@ -266,9 +264,7 @@ cogl_gdl_display_set_plane
>
>  cogl_frustum
>
> -cogl_get_backface_culling_enabled
>  cogl_get_bitmasks
> -cogl_get_depth_test_enabled
>  cogl_get_draw_framebuffer
>  cogl_get_features
>  cogl_get_modelview_matrix
> @@ -576,12 +572,9 @@ cogl_rotate
>
>  cogl_scale
>
> -cogl_set_backface_culling_enabled
> -cogl_set_depth_test_enabled
>  #ifndef COGL_DISABLE_DEPRECATED
>  cogl_set_draw_buffer
>  #endif
> -cogl_set_fog
>  cogl_set_framebuffer
>  cogl_set_modelview_matrix
>  cogl_set_path  /* this is COGL 1.0 API */
> diff --git a/cogl/cogl1-context.h b/cogl/cogl1-context.h
> index 42ecbea..fc381bb 100644
> --- a/cogl/cogl1-context.h
> +++ b/cogl/cogl1-context.h
> @@ -380,100 +380,6 @@ void
>  cogl_get_viewport (float v[4]);
>
>  /**
> - * cogl_set_depth_test_enabled:
> - * @setting: %TRUE to enable depth testing or %FALSE to disable.
> - *
> - * Sets whether depth testing is enabled. If it is disabled then the
> - * order that actors are layered on the screen depends solely on the
> - * order specified using clutter_actor_raise() and
> - * clutter_actor_lower(), otherwise it will also take into account the
> - * actor's depth. Depth testing is disabled by default.
> - *
> - * Deprecated: 1.4: Use cogl_material_set_depth_test_enabled()
> - * instead.
> - */
> -void
> -cogl_set_depth_test_enabled (CoglBool setting);
> -
> -/**
> - * cogl_get_depth_test_enabled:
> - *
> - * Queries if depth testing has been enabled via cogl_set_depth_test_enable()
> - *
> - * Return value: %TRUE if depth testing is enabled, and %FALSE otherwise
> - *
> - * Deprecated: 1.4: Use cogl_material_get_depth_test_enabled()
> - * instead.
> - */
> -CoglBool
> -cogl_get_depth_test_enabled (void);
> -
> -/**
> - * cogl_set_backface_culling_enabled:
> - * @setting: %TRUE to enable backface culling or %FALSE to disable.
> - *
> - * Sets whether textures positioned so that their backface is showing
> - * should be hidden. This can be used to efficiently draw two-sided
> - * textures or fully closed cubes without enabling depth testing. This
> - * only affects calls to the cogl_rectangle* family of functions and
> - * cogl_vertex_buffer_draw*. Backface culling is disabled by default.
> - */
> -void
> -cogl_set_backface_culling_enabled (CoglBool setting);
> -
> -/**
> - * cogl_get_backface_culling_enabled:
> - *
> - * Queries if backface culling has been enabled via
> - * cogl_set_backface_culling_enabled()
> - *
> - * Return value: %TRUE if backface culling is enabled, and %FALSE otherwise
> - */
> -CoglBool
> -cogl_get_backface_culling_enabled (void);
> -
> -/**
> - * cogl_set_fog:
> - * @fog_color: The color of the fog
> - * @mode: A #CoglFogMode that determines the equation used to calculate the
> - *   fogging blend factor.
> - * @density: Used by %COGL_FOG_MODE_EXPONENTIAL and by
> - *   %COGL_FOG_MODE_EXPONENTIAL_SQUARED equations.
> - * @z_near: Position along Z axis where no fogging should be applied
> - * @z_far: Position along Z axis where full fogging should be applied
> - *
> - * Enables fogging. Fogging causes vertices that are further away from the eye
> - * to be rendered with a different color. The color is determined according to
> - * the chosen fog mode; at it's simplest the color is linearly interpolated so
> - * that vertices at @z_near are drawn fully with their original color and
> - * vertices at @z_far are drawn fully with @fog_color. Fogging will remain
> - * enabled until you call cogl_disable_fog().
> - *
> - * <note>The fogging functions only work correctly when primitives use
> - * unmultiplied alpha colors. By default Cogl will premultiply textures
> - * and cogl_set_source_color() will premultiply colors, so unless you
> - * explicitly load your textures requesting an unmultiplied internal format
> - * and use cogl_material_set_color() you can only use fogging with fully
> - * opaque primitives. This might improve in the future when we can depend
> - * on fragment shaders.</note>
> - */
> -void
> -cogl_set_fog (const CoglColor *fog_color,
> -              CoglFogMode mode,
> -              float density,
> -              float z_near,
> -              float z_far);
> -
> -/**
> - * cogl_disable_fog:
> - *
> - * This function disables fogging, so primitives drawn afterwards will not be
> - * blended with any previously set fog color.
> - */
> -void
> -cogl_disable_fog (void);
> -
> -/**
>  * cogl_clear:
>  * @color: Background color to clear to
>  * @buffers: A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary
> @@ -521,21 +427,21 @@ cogl_get_source (void);
>
>  /**
>  * cogl_push_source:
> - * @material: A #CoglMaterial
> + * @material: A #CoglPipeline
>  *
> - * Pushes the given @material to the top of the source stack. The
> - * material at the top of this stack defines the GPU state used to
> + * Pushes the given @pipeline to the top of the source stack. The
> + * pipeline at the top of this stack defines the GPU state used to
>  * process later primitives as defined by cogl_set_source().
>  *
>  * Since: 1.6
>  */
>  void
> -cogl_push_source (void *material);
> +cogl_push_source (CoglPipeline *pipeline);
>
>  /**
>  * cogl_pop_source:
>  *
> - * Removes the material at the top of the source stack. The material
> + * Removes the pipeline at the top of the source stack. The pipeline
>  * at the top of this stack defines the GPU state used to process
>  * later primitives as defined by cogl_set_source().
>  *
> diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c
> index 55b7192..1ee13b3 100644
> --- a/tests/conform/test-backface-culling.c
> +++ b/tests/conform/test-backface-culling.c
> @@ -39,8 +39,8 @@ validate_part (CoglFramebuffer *framebuffer,
>    to test all of the combinations of both winding orders and all four
>    culling modes */
>
> -#define FRONT_WINDING(draw_num)    (((draw_num) & 0x01) >> 1)
> -#define CULL_FACE_MODE(draw_num)   (((draw_num) & 0x06) >> 2)
> +#define FRONT_WINDING(draw_num)    ((draw_num) & 0x01)
> +#define CULL_FACE_MODE(draw_num)   (((draw_num) & 0x06) >> 1)
>
>  static void
>  paint_test_backface_culling (TestState *state,
> @@ -66,9 +66,9 @@ paint_test_backface_culling (TestState *state,
>                                    COGL_PIPELINE_FILTER_NEAREST,
>                                    COGL_PIPELINE_FILTER_NEAREST);
>
> -  /* Render the scene sixteen times to test all of the combinations of
> -     cull face mode, legacy state and winding orders */
> -  for (draw_num = 0; draw_num < 16; draw_num++)
> +  /* Render the scene eight times to test all of the combinations of
> +     cull face mode and winding orders */
> +  for (draw_num = 0; draw_num < 8; draw_num++)
>     {
>       float x1 = 0, x2, y1 = 0, y2 = (float)(TEXTURE_RENDER_SIZE);
>       CoglTextureVertex verts[4];
> diff --git a/tests/conform/test-depth-test.c b/tests/conform/test-depth-test.c
> index 8efff4d..8e9eb1f 100644
> --- a/tests/conform/test-depth-test.c
> +++ b/tests/conform/test-depth-test.c
> @@ -218,41 +218,6 @@ paint (TestState *state)
>                 FALSE, /* legacy mode */
>                 0xff0000ff); /* expected */
>   }
> -
> -  /* Test that the legacy cogl_set_depth_test_enabled() API still
> -   * works... */
> -
> -  {
> -    /* Nearest */
> -    TestDepthState rect0_state = {
> -      0xff0000ff, /* rgba color */
> -      -10, /* depth */
> -      FALSE, /* depth test enable */
> -      COGL_DEPTH_TEST_FUNCTION_LESS,
> -      TRUE, /* depth write enable */
> -      0, 1 /* depth range */
> -    };
> -    /* Furthest */
> -    TestDepthState rect1_state = {
> -      0x00ff00ff, /* rgba color */
> -      -70, /* depth */
> -      FALSE, /* depth test enable */
> -      COGL_DEPTH_TEST_FUNCTION_LESS,
> -      TRUE, /* depth write enable */
> -      0, 1 /* depth range */
> -    };
> -
> -    cogl_set_depth_test_enabled (TRUE);
> -    test_depth (state, 0, 2, /* position */
> -                &rect0_state, &rect1_state, NULL,
> -                TRUE, /* legacy mode */
> -                0xff0000ff); /* expected */
> -    cogl_set_depth_test_enabled (FALSE);
> -    test_depth (state, 1, 2, /* position */
> -                &rect0_state, &rect1_state, NULL,
> -                TRUE, /* legacy mode */
> -                0x00ff00ff); /* expected */
> -  }
>  }
>
>  void
> --
> 1.7.3.16.g9464b
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list