[mutter] cogl: Remove the framebuffer and source stacks



commit 4ede6ea8c59a3fd02d679e008e543033671947b1
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Nov 22 17:04:55 2019 +0100

    cogl: Remove the framebuffer and source stacks
    
    They have been deprecated for a long time, and all their uses in clutter
    and mutter has been removed. This also removes some no longer needed
    legacy state tracking, as they were only ever excercised in certain
    circumstances when there was sources (pipelines or materials) on the now
    removed source stack.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/935

 clutter/clutter/clutter-backend-private.h          |   3 -
 clutter/clutter/clutter-backend.c                  |  21 --
 cogl/cogl/cogl-attribute-private.h                 |   5 +-
 cogl/cogl/cogl-attribute.c                         |   9 -
 cogl/cogl/cogl-context-private.h                   |   4 -
 cogl/cogl/cogl-context.c                           |   9 -
 cogl/cogl/cogl-framebuffer-private.h               |  15 --
 cogl/cogl/cogl-framebuffer.c                       |  18 +-
 cogl/cogl/cogl-framebuffer.h                       |  13 --
 cogl/cogl/cogl-journal.c                           |   3 +-
 cogl/cogl/cogl-pipeline.c                          |  31 ---
 cogl/cogl/cogl-primitives-private.h                |   3 +-
 cogl/cogl/cogl-primitives.c                        |  18 +-
 cogl/cogl/cogl-private.h                           |   6 -
 cogl/cogl/cogl.c                                   | 155 --------------
 cogl/cogl/cogl.h                                   |   1 -
 cogl/cogl/cogl1-context.h                          |  74 -------
 cogl/cogl/deprecated/cogl-framebuffer-deprecated.c | 228 ---------------------
 cogl/cogl/deprecated/cogl-program.c                |   5 -
 cogl/cogl/driver/gl/cogl-clip-stack-gl.c           |   3 +-
 cogl/cogl/meson.build                              |   7 -
 src/backends/x11/meta-stage-x11.c                  |  14 --
 src/backends/x11/nested/meta-stage-x11-nested.c    |  26 ---
 23 files changed, 13 insertions(+), 658 deletions(-)
---
diff --git a/clutter/clutter/clutter-backend-private.h b/clutter/clutter/clutter-backend-private.h
index f0855e1eb..369fe03ae 100644
--- a/clutter/clutter/clutter-backend-private.h
+++ b/clutter/clutter/clutter-backend-private.h
@@ -141,9 +141,6 @@ gint32                  _clutter_backend_get_units_serial               (Clutter
 
 PangoDirection          _clutter_backend_get_keymap_direction           (ClutterBackend         *backend);
 
-CLUTTER_EXPORT
-void                    _clutter_backend_reset_cogl_framebuffer         (ClutterBackend         *backend);
-
 void                    clutter_set_allowed_drivers                     (const char             *drivers);
 
 CLUTTER_EXPORT
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
index 4d3adc953..448093a65 100644
--- a/clutter/clutter/clutter-backend.c
+++ b/clutter/clutter/clutter-backend.c
@@ -1009,27 +1009,6 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
   return PANGO_DIRECTION_NEUTRAL;
 }
 
-void
-_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
-{
-  if (backend->dummy_onscreen == NULL)
-    {
-      GError *internal_error = NULL;
-
-      backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
-
-      if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (backend->dummy_onscreen),
-                                      &internal_error))
-        {
-          g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
-          g_error_free (internal_error);
-          return;
-        }
-    }
-
-  cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
-}
-
 void
 clutter_set_allowed_drivers (const char *drivers)
 {
diff --git a/cogl/cogl/cogl-attribute-private.h b/cogl/cogl/cogl-attribute-private.h
index 7ddc0e305..e97cb7d0f 100644
--- a/cogl/cogl/cogl-attribute-private.h
+++ b/cogl/cogl/cogl-attribute-private.h
@@ -90,17 +90,16 @@ 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,
   /* This forcibly disables the debug option to divert all drawing to
    * wireframes */
-  COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 5
+  COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 4
 } CoglDrawFlags;
 
 /* During CoglContext initialization we register the "cogl_color_in"
diff --git a/cogl/cogl/cogl-attribute.c b/cogl/cogl/cogl-attribute.c
index 78ac45968..72084f790 100644
--- a/cogl/cogl/cogl-attribute.c
+++ b/cogl/cogl/cogl-attribute.c
@@ -650,15 +650,6 @@ _cogl_flush_attributes_state (CoglFramebuffer *framebuffer,
    * when the framebuffer really does get drawn to. */
   _cogl_framebuffer_mark_clear_clip_dirty (framebuffer);
 
-  if (G_UNLIKELY (!(flags & COGL_DRAW_SKIP_LEGACY_STATE)) &&
-      G_UNLIKELY (ctx->legacy_state_set) &&
-      _cogl_get_enable_legacy_state ())
-    {
-      copy = cogl_pipeline_copy (pipeline);
-      pipeline = copy;
-      _cogl_pipeline_apply_legacy_state (pipeline);
-    }
-
   ctx->driver_vtable->flush_attributes_state (framebuffer,
                                               pipeline,
                                               &layers_state,
diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h
index 6a56e1ee4..b7d626bd3 100644
--- a/cogl/cogl/cogl-context-private.h
+++ b/cogl/cogl/cogl-context-private.h
@@ -151,9 +151,6 @@ struct _CoglContext
   GString          *codegen_header_buffer;
   GString          *codegen_source_buffer;
   GString          *codegen_boilerplate_buffer;
-  GList            *source_stack;
-
-  int               legacy_state_set;
 
   CoglPipelineCache *pipeline_cache;
 
@@ -190,7 +187,6 @@ struct _CoglContext
   CoglBuffer       *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT];
 
   /* Framebuffers */
-  GSList           *framebuffer_stack;
   unsigned long     current_draw_buffer_state_flushed;
   unsigned long     current_draw_buffer_changes;
   CoglFramebuffer  *current_draw_buffer;
diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c
index b10402fa4..d28f633b7 100644
--- a/cogl/cogl/cogl-context.c
+++ b/cogl/cogl/cogl-context.c
@@ -259,9 +259,6 @@ cogl_context_new (CoglDisplay *display,
   context->codegen_header_buffer = g_string_new ("");
   context->codegen_source_buffer = g_string_new ("");
   context->codegen_boilerplate_buffer = g_string_new ("");
-  context->source_stack = NULL;
-
-  context->legacy_state_set = 0;
 
   context->default_gl_texture_2d_tex = NULL;
 
@@ -317,8 +314,6 @@ cogl_context_new (CoglDisplay *display,
   for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
     context->current_buffer[i] = NULL;
 
-  context->framebuffer_stack = _cogl_create_framebuffer_stack ();
-
   context->current_path = NULL;
   context->stencil_pipeline = cogl_pipeline_new (context);
 
@@ -373,8 +368,6 @@ cogl_context_new (CoglDisplay *display,
                                    white_pixel,
                                    NULL); /* abort on error */
 
-  cogl_push_source (context->opaque_color_pipeline);
-
   context->atlases = NULL;
   g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook));
 
@@ -403,8 +396,6 @@ _cogl_context_free (CoglContext *context)
 
   winsys->context_deinit (context);
 
-  _cogl_free_framebuffer_stack (context->framebuffer_stack);
-
   if (context->current_path)
     cogl_object_unref (context->current_path);
 
diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h
index 30403e8a5..27d04af96 100644
--- a/cogl/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl/cogl-framebuffer-private.h
@@ -341,21 +341,6 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
                                        CoglOffscreenFlags create_flags,
                                        int level);
 
-/*
- * _cogl_push_framebuffers:
- * @draw_buffer: A pointer to the buffer used for drawing
- * @read_buffer: A pointer to the buffer used for reading back pixels
- *
- * Redirects drawing and reading to the specified framebuffers as in
- * cogl_push_framebuffer() except that it allows the draw and read
- * buffer to be different. The buffers are pushed as a pair so that
- * they can later both be restored with a single call to
- * cogl_pop_framebuffer().
- */
-void
-_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
-                         CoglFramebuffer *read_buffer);
-
 void
 _cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);
 
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 2bdac109b..917efe1a7 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -2172,8 +2172,7 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
                                  CoglPipeline *pipeline,
                                  CoglPrimitive *primitive)
 {
-  _cogl_primitive_draw (primitive, framebuffer, pipeline,
-                        COGL_DRAW_SKIP_LEGACY_STATE);
+  _cogl_primitive_draw (primitive, framebuffer, pipeline, 0);
 }
 
 void
@@ -2199,8 +2198,7 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
                                                    pipeline,
                                                    &rect,
-                                                   1,
-                                                   TRUE);
+                                                   1);
 }
 
 void
@@ -2231,8 +2229,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
                                                    pipeline,
                                                    &rect,
-                                                   1,
-                                                   TRUE);
+                                                   1);
 }
 
 void
@@ -2260,8 +2257,7 @@ cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer,
   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
                                                    pipeline,
                                                    &rect,
-                                                   1,
-                                                   TRUE);
+                                                   1);
 }
 
 void
@@ -2290,8 +2286,7 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
   _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
                                                    pipeline,
                                                    rects,
-                                                   n_rectangles,
-                                                   TRUE);
+                                                   n_rectangles);
 }
 
 void
@@ -2320,6 +2315,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/cogl-framebuffer.h b/cogl/cogl/cogl-framebuffer.h
index 9979e9082..79fa02753 100644
--- a/cogl/cogl/cogl-framebuffer.h
+++ b/cogl/cogl/cogl-framebuffer.h
@@ -1463,19 +1463,6 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
                               CoglPixelFormat format,
                               uint8_t *pixels);
 
-/**
- * cogl_get_draw_framebuffer:
- *
- * Gets the current #CoglFramebuffer as set using
- * cogl_push_framebuffer()
- *
- * Return value: (transfer none): The current #CoglFramebuffer
- * Stability: unstable
- * Since: 1.8
- */
-CoglFramebuffer *
-cogl_get_draw_framebuffer (void);
-
 uint32_t
 cogl_framebuffer_error_quark (void);
 
diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c
index ceb73b413..8d41dc0e1 100644
--- a/cogl/cogl/cogl-journal.c
+++ b/cogl/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/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c
index 37fcfa263..51f5b005e 100644
--- a/cogl/cogl/cogl-pipeline.c
+++ b/cogl/cogl/cogl-pipeline.c
@@ -2388,37 +2388,6 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
 }
 
 #ifdef COGL_DEBUG_ENABLED
-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.
-   */
-
-  /* A program explicitly set on the pipeline has higher precedence than
-   * one associated with the context using cogl_program_use() */
-  if (ctx->current_program &&
-      cogl_pipeline_get_user_program (pipeline) == NULL)
-    cogl_pipeline_set_user_program (pipeline, ctx->current_program);
-
-  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_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/cogl-primitives-private.h b/cogl/cogl/cogl-primitives-private.h
index 8f324ff33..20f304d50 100644
--- a/cogl/cogl/cogl-primitives-private.h
+++ b/cogl/cogl/cogl-primitives-private.h
@@ -59,8 +59,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
                                         CoglFramebuffer *framebuffer,
                                         CoglPipeline *pipeline,
                                         CoglMultiTexturedRect *rects,
-                                        int n_rects,
-                                        gboolean disable_legacy_state);
+                                        int n_rects);
 
 G_END_DECLS
 
diff --git a/cogl/cogl/cogl-primitives.c b/cogl/cogl/cogl-primitives.c
index 9636d60c5..2da0ae0bb 100644
--- a/cogl/cogl/cogl-primitives.c
+++ b/cogl/cogl/cogl-primitives.c
@@ -629,8 +629,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
                                         CoglFramebuffer *framebuffer,
                                         CoglPipeline *pipeline,
                                         CoglMultiTexturedRect *rects,
-                                        int n_rects,
-                                        gboolean disable_legacy_state)
+                                        int n_rects)
 {
   CoglContext *ctx = framebuffer->context;
   CoglPipeline *original_pipeline;
@@ -654,18 +653,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...
    */
@@ -761,8 +748,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]);
diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h
index 42364c720..a4b53ef7a 100644
--- a/cogl/cogl/cogl-private.h
+++ b/cogl/cogl/cogl-private.h
@@ -97,12 +97,6 @@ _cogl_check_extension (const char *name, char * const *ext);
 void
 _cogl_init (void);
 
-void
-_cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy);
-
-gboolean
-_cogl_get_enable_legacy_state (void);
-
 #define _cogl_has_private_feature(ctx, feature) \
   COGL_FLAGS_GET ((ctx)->private_features, (feature))
 
diff --git a/cogl/cogl/cogl.c b/cogl/cogl/cogl.c
index f3d420332..2cf0dbe21 100644
--- a/cogl/cogl/cogl.c
+++ b/cogl/cogl/cogl.c
@@ -53,8 +53,6 @@
 #include "cogl-offscreen.h"
 #include "winsys/cogl-winsys-private.h"
 
-#include "deprecated/cogl-framebuffer-deprecated.h"
-
 GCallback
 cogl_get_proc_address (const char* name)
 {
@@ -85,10 +83,6 @@ cogl_set_depth_test_enabled (gboolean 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 */
@@ -108,11 +102,6 @@ cogl_set_backface_culling_enabled (gboolean setting)
     return;
 
   ctx->legacy_backface_culling_enabled = setting;
-
-  if (ctx->legacy_backface_culling_enabled)
-    ctx->legacy_state_set++;
-  else
-    ctx->legacy_state_set--;
 }
 
 gboolean
@@ -172,150 +161,6 @@ _cogl_driver_error_quark (void)
   return g_quark_from_static_string ("cogl-driver-error-quark");
 }
 
-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 */
-  gboolean enable_legacy;
-} CoglSourceState;
-
-static void
-_push_source_real (CoglPipeline *pipeline, gboolean 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);
-
-  g_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, gboolean enable_legacy)
-{
-  CoglSourceState *top;
-
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  g_return_if_fail (cogl_is_pipeline (pipeline));
-
-  if (ctx->source_stack)
-    {
-      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);
-    }
-  else
-    _push_source_real (pipeline, enable_legacy);
-}
-
-/* FIXME: This needs to take a context pointer for Cogl 2.0 */
-void
-cogl_pop_source (void)
-{
-  CoglSourceState *top;
-
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  g_return_if_fail (ctx->source_stack);
-
-  top = ctx->source_stack->data;
-  top->push_count--;
-  if (top->push_count == 0)
-    {
-      cogl_object_unref (top->pipeline);
-      g_slice_free (CoglSourceState, top);
-      ctx->source_stack = g_list_delete_link (ctx->source_stack,
-                                              ctx->source_stack);
-    }
-}
-
-/* FIXME: This needs to take a context pointer for Cogl 2.0 */
-void *
-cogl_get_source (void)
-{
-  CoglSourceState *top;
-
-  _COGL_GET_CONTEXT (ctx, NULL);
-
-  g_return_val_if_fail (ctx->source_stack, NULL);
-
-  top = ctx->source_stack->data;
-  return top->pipeline;
-}
-
-gboolean
-_cogl_get_enable_legacy_state (void)
-{
-  CoglSourceState *top;
-
-  _COGL_GET_CONTEXT (ctx, FALSE);
-
-  g_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)
-{
-  CoglSourceState *top;
-  CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
-
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  g_return_if_fail (cogl_is_pipeline (pipeline));
-  g_return_if_fail (ctx->source_stack);
-
-  top = ctx->source_stack->data;
-  if (top->pipeline == pipeline && top->enable_legacy)
-    return;
-
-  if (top->push_count == 1)
-    {
-      /* NB: top->pipeline may be only thing keeping pipeline
-       * alive currently so ref pipeline first... */
-      cogl_object_ref (pipeline);
-      cogl_object_unref (top->pipeline);
-      top->pipeline = pipeline;
-      top->enable_legacy = TRUE;
-    }
-  else
-    {
-      top->push_count--;
-      cogl_push_source (pipeline);
-    }
-}
-
 /* Scale from OpenGL normalized device coordinates (ranging from -1 to 1)
  * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with
  * (0,0) being top left. */
diff --git a/cogl/cogl/cogl.h b/cogl/cogl/cogl.h
index 732726a2a..17c59d66e 100644
--- a/cogl/cogl/cogl.h
+++ b/cogl/cogl/cogl.h
@@ -83,7 +83,6 @@
  * they enable the experimental api... */
 #include <cogl/deprecated/cogl-type-casts.h>
 
-#include <cogl/deprecated/cogl-framebuffer-deprecated.h>
 #include <cogl/deprecated/cogl-auto-texture.h>
 #include <cogl/deprecated/cogl-shader.h>
 #include <cogl/deprecated/cogl-material-compat.h>
diff --git a/cogl/cogl/cogl1-context.h b/cogl/cogl/cogl1-context.h
index f16cbcd18..8f23aae9e 100644
--- a/cogl/cogl/cogl1-context.h
+++ b/cogl/cogl/cogl1-context.h
@@ -138,80 +138,6 @@ COGL_DEPRECATED_FOR (cogl_pipeline_get_cull_face_mode)
 gboolean
 cogl_get_backface_culling_enabled (void);
 
-/**
- * cogl_set_source:
- * @material: A #CoglMaterial
- *
- * This function changes the material at the top of the source stack.
- * The material at the top of this stack defines the GPU state used to
- * process subsequent primitives, such as rectangles drawn with
- * cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw().
- *
- * Since: 1.0
- * Deprecated: 1.16: Latest drawing apis all take an explicit
- *                   #CoglPipeline argument so this stack of
- *                   #CoglMaterial<!-- -->s shouldn't be used.
- */
-COGL_DEPRECATED
-void
-cogl_set_source (void *material);
-
-/**
- * cogl_get_source:
- *
- * Returns the current source material as previously set using
- * cogl_set_source().
- *
- * <note>You should typically consider the returned material immutable
- * and not try to change any of its properties unless you own a
- * reference to that material. At times you may be able to get a
- * reference to an internally managed materials and the result of
- * modifying such materials is undefined.</note>
- *
- * Return value: The current source material.
- *
- * Since: 1.6
- * Deprecated: 1.16: Latest drawing apis all take an explicit
- *                   #CoglPipeline argument so this stack of
- *                   #CoglMaterial<!-- -->s shouldn't be used.
- */
-COGL_DEPRECATED
-void *
-cogl_get_source (void);
-
-/**
- * cogl_push_source:
- * @material: A #CoglMaterial
- *
- * 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
- * process later primitives as defined by cogl_set_source().
- *
- * Since: 1.6
- * Deprecated: 1.16: Latest drawing apis all take an explicit
- *                   #CoglPipeline argument so this stack of
- *                   #CoglMaterial<!-- -->s shouldn't be used.
- */
-COGL_DEPRECATED
-void
-cogl_push_source (void *material);
-
-/**
- * cogl_pop_source:
- *
- * Removes the material at the top of the source stack. The material
- * at the top of this stack defines the GPU state used to process
- * later primitives as defined by cogl_set_source().
- *
- * Since: 1.6
- * Deprecated: 1.16: Latest drawing apis all take an explicit
- *                   #CoglPipeline argument so this stack of
- *                   #CoglMaterial<!-- -->s shouldn't be used.
- */
-COGL_DEPRECATED
-void
-cogl_pop_source (void);
-
 /**
  * cogl_flush:
  *
diff --git a/cogl/cogl/deprecated/cogl-program.c b/cogl/cogl/deprecated/cogl-program.c
index 49fd9a281..7033c9374 100644
--- a/cogl/cogl/deprecated/cogl-program.c
+++ b/cogl/cogl/deprecated/cogl-program.c
@@ -126,11 +126,6 @@ cogl_program_use (CoglHandle handle)
 
   g_return_if_fail (handle == NULL || cogl_is_program (handle));
 
-  if (ctx->current_program == 0 && handle != 0)
-    ctx->legacy_state_set++;
-  else if (handle == 0 && ctx->current_program != 0)
-    ctx->legacy_state_set--;
-
   if (handle != NULL)
     cogl_object_ref (handle);
   if (ctx->current_program != NULL)
diff --git a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
index 2bc754cc0..022cb9e2d 100644
--- a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -322,8 +322,7 @@ paint_primitive_silhouette (CoglFramebuffer *framebuffer,
                         pipeline,
                         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/meson.build b/cogl/cogl/meson.build
index 008b3bfb6..d72effe20 100644
--- a/cogl/cogl/meson.build
+++ b/cogl/cogl/meson.build
@@ -71,10 +71,6 @@ cogl_deprecated_headers = [
   'deprecated/cogl-auto-texture.h',
 ]
 
-cogl_deprecated_nonintrospected_headers = [
-  'deprecated/cogl-framebuffer-deprecated.h',
-]
-
 cogl_headers = [
   'cogl1-context.h',
   'cogl-bitmap.h',
@@ -356,7 +352,6 @@ cogl_sources = [
   'deprecated/cogl-shader-private.h',
   'deprecated/cogl-shader.c',
   'deprecated/cogl-clutter.c',
-  'deprecated/cogl-framebuffer-deprecated.c',
   'cogl-glib-source.c',
   'cogl-mutter.h',
 ]
@@ -427,7 +422,6 @@ cogl_headers_all = [
   cogl_introspected_headers,
   cogl_nonintrospected_headers,
   cogl_deprecated_headers,
-  cogl_deprecated_nonintrospected_headers,
 ]
 
 cogl_test_deps = []
@@ -497,7 +491,6 @@ install_headers([
 
 install_headers([
     cogl_deprecated_headers,
-    cogl_deprecated_nonintrospected_headers,
   ],
   subdir: join_paths(cogl_cogl_includesubdir, 'deprecated'))
 
diff --git a/src/backends/x11/meta-stage-x11.c b/src/backends/x11/meta-stage-x11.c
index 6a154709c..d201d786b 100644
--- a/src/backends/x11/meta-stage-x11.c
+++ b/src/backends/x11/meta-stage-x11.c
@@ -269,7 +269,6 @@ set_cursor_visible (MetaStageX11 *stage_x11)
 static void
 meta_stage_x11_unrealize (ClutterStageWindow *stage_window)
 {
-  ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
   MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
 
   if (clutter_stages_by_xid != NULL)
@@ -278,19 +277,6 @@ meta_stage_x11_unrealize (ClutterStageWindow *stage_window)
                            GINT_TO_POINTER (stage_x11->xwin));
     }
 
-  /* Clutter still uses part of the deprecated stateful API of Cogl
-   * (in particulart cogl_set_framebuffer). It means Cogl can keep an
-   * internal reference to the onscreen object we rendered to. In the
-   * case of foreign window, we want to avoid this, as we don't know
-   * what's going to happen to that window.
-   *
-   * The following call sets the current Cogl framebuffer to a dummy
-   * 1x1 one if we're unrealizing the current one, so Cogl doesn't
-   * keep any reference to the foreign window.
-   */
-  if (cogl_get_draw_framebuffer () == COGL_FRAMEBUFFER (stage_x11->onscreen))
-    _clutter_backend_reset_cogl_framebuffer (stage_cogl->backend);
-
   if (stage_x11->frame_closure)
     {
       cogl_onscreen_remove_frame_callback (stage_x11->onscreen,
diff --git a/src/backends/x11/nested/meta-stage-x11-nested.c b/src/backends/x11/nested/meta-stage-x11-nested.c
index 73b8f2854..decb4dd1d 100644
--- a/src/backends/x11/nested/meta-stage-x11-nested.c
+++ b/src/backends/x11/nested/meta-stage-x11-nested.c
@@ -307,32 +307,6 @@ static void
 meta_stage_x11_nested_unrealize (ClutterStageWindow *stage_window)
 {
   MetaStageX11Nested *stage_nested = META_STAGE_X11_NESTED (stage_window);
-  ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
-  MetaBackend *backend = meta_get_backend ();
-  MetaRenderer *renderer = meta_backend_get_renderer (backend);
-  GList *l;
-
-  /* Clutter still uses part of the deprecated stateful API of Cogl
-   * (in particulart cogl_set_framebuffer). It means Cogl can keep an
-   * internal reference to the onscreen object we rendered to. In the
-   * case of foreign window, we want to avoid this, as we don't know
-   * what's going to happen to that window.
-   *
-   * The following call sets the current Cogl framebuffer to a dummy
-   * 1x1 one if we're unrealizing the current one, so Cogl doesn't
-   * keep any reference to the foreign window.
-   */
-  for (l = meta_renderer_get_views (renderer); l ;l = l->next)
-    {
-      ClutterStageView *view = l->data;
-      CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
-
-      if (cogl_get_draw_framebuffer () == framebuffer)
-        {
-          _clutter_backend_reset_cogl_framebuffer (stage_cogl->backend);
-          break;
-        }
-    }
 
   g_clear_pointer (&stage_nested->pipeline, cogl_object_unref);
 


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