1
0
Fork 0

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
This commit is contained in:
Jonas Ådahl 2019-11-22 17:04:55 +01:00 committed by Georges Basile Stavracas Neto
parent 77b3c0d670
commit 4ede6ea8c5
23 changed files with 13 additions and 658 deletions

View file

@ -141,9 +141,6 @@ gint32 _clutter_backend_get_units_serial (Clutter
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend); 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); void clutter_set_allowed_drivers (const char *drivers);
CLUTTER_EXPORT CLUTTER_EXPORT

View file

@ -1009,27 +1009,6 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
return PANGO_DIRECTION_NEUTRAL; 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 void
clutter_set_allowed_drivers (const char *drivers) clutter_set_allowed_drivers (const char *drivers)
{ {

View file

@ -90,17 +90,16 @@ typedef enum
COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0, COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0,
COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1, COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1,
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2, 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 /* By default the vertex attribute drawing code will assume that if
there is a color attribute array enabled then we can't determine there is a color attribute array enabled then we can't determine
if the colors will be opaque so we need to enabling if the colors will be opaque so we need to enabling
blending. However when drawing from the journal we know what the blending. However when drawing from the journal we know what the
contents of the color array is so we can override this by passing contents of the color array is so we can override this by passing
this flag. */ 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 /* This forcibly disables the debug option to divert all drawing to
* wireframes */ * wireframes */
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 5 COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 4
} CoglDrawFlags; } CoglDrawFlags;
/* During CoglContext initialization we register the "cogl_color_in" /* During CoglContext initialization we register the "cogl_color_in"

View file

@ -650,15 +650,6 @@ _cogl_flush_attributes_state (CoglFramebuffer *framebuffer,
* when the framebuffer really does get drawn to. */ * when the framebuffer really does get drawn to. */
_cogl_framebuffer_mark_clear_clip_dirty (framebuffer); _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, ctx->driver_vtable->flush_attributes_state (framebuffer,
pipeline, pipeline,
&layers_state, &layers_state,

View file

@ -151,9 +151,6 @@ struct _CoglContext
GString *codegen_header_buffer; GString *codegen_header_buffer;
GString *codegen_source_buffer; GString *codegen_source_buffer;
GString *codegen_boilerplate_buffer; GString *codegen_boilerplate_buffer;
GList *source_stack;
int legacy_state_set;
CoglPipelineCache *pipeline_cache; CoglPipelineCache *pipeline_cache;
@ -190,7 +187,6 @@ struct _CoglContext
CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT]; CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT];
/* Framebuffers */ /* Framebuffers */
GSList *framebuffer_stack;
unsigned long current_draw_buffer_state_flushed; unsigned long current_draw_buffer_state_flushed;
unsigned long current_draw_buffer_changes; unsigned long current_draw_buffer_changes;
CoglFramebuffer *current_draw_buffer; CoglFramebuffer *current_draw_buffer;

View file

@ -259,9 +259,6 @@ cogl_context_new (CoglDisplay *display,
context->codegen_header_buffer = g_string_new (""); context->codegen_header_buffer = g_string_new ("");
context->codegen_source_buffer = g_string_new (""); context->codegen_source_buffer = g_string_new ("");
context->codegen_boilerplate_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; 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++) for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
context->current_buffer[i] = NULL; context->current_buffer[i] = NULL;
context->framebuffer_stack = _cogl_create_framebuffer_stack ();
context->current_path = NULL; context->current_path = NULL;
context->stencil_pipeline = cogl_pipeline_new (context); context->stencil_pipeline = cogl_pipeline_new (context);
@ -373,8 +368,6 @@ cogl_context_new (CoglDisplay *display,
white_pixel, white_pixel,
NULL); /* abort on error */ NULL); /* abort on error */
cogl_push_source (context->opaque_color_pipeline);
context->atlases = NULL; context->atlases = NULL;
g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook)); g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook));
@ -403,8 +396,6 @@ _cogl_context_free (CoglContext *context)
winsys->context_deinit (context); winsys->context_deinit (context);
_cogl_free_framebuffer_stack (context->framebuffer_stack);
if (context->current_path) if (context->current_path)
cogl_object_unref (context->current_path); cogl_object_unref (context->current_path);

View file

@ -341,21 +341,6 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
CoglOffscreenFlags create_flags, CoglOffscreenFlags create_flags,
int level); 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 void
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer); _cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);

View file

@ -2172,8 +2172,7 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline, CoglPipeline *pipeline,
CoglPrimitive *primitive) CoglPrimitive *primitive)
{ {
_cogl_primitive_draw (primitive, framebuffer, pipeline, _cogl_primitive_draw (primitive, framebuffer, pipeline, 0);
COGL_DRAW_SKIP_LEGACY_STATE);
} }
void void
@ -2199,8 +2198,7 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer, _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline, pipeline,
&rect, &rect,
1, 1);
TRUE);
} }
void void
@ -2231,8 +2229,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer, _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline, pipeline,
&rect, &rect,
1, 1);
TRUE);
} }
void void
@ -2260,8 +2257,7 @@ cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer, _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline, pipeline,
&rect, &rect,
1, 1);
TRUE);
} }
void void
@ -2290,8 +2286,7 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer, _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline, pipeline,
rects, rects,
n_rectangles, n_rectangles);
TRUE);
} }
void void
@ -2320,6 +2315,5 @@ cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer, _cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline, pipeline,
rects, rects,
n_rectangles, n_rectangles);
TRUE);
} }

View file

@ -1463,19 +1463,6 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
CoglPixelFormat format, CoglPixelFormat format,
uint8_t *pixels); 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 uint32_t
cogl_framebuffer_error_quark (void); cogl_framebuffer_error_quark (void);

View file

@ -280,8 +280,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
CoglAttribute **attributes; CoglAttribute **attributes;
CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH | CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH |
COGL_DRAW_SKIP_PIPELINE_VALIDATION | COGL_DRAW_SKIP_PIPELINE_VALIDATION |
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
COGL_DRAW_SKIP_LEGACY_STATE);
COGL_STATIC_TIMER (time_flush_modelview_and_entries, COGL_STATIC_TIMER (time_flush_modelview_and_entries,
"flush: pipeline+entries", /* parent */ "flush: pipeline+entries", /* parent */

View file

@ -2388,37 +2388,6 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
} }
#ifdef COGL_DEBUG_ENABLED #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 void
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline, _cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
const char *breadcrumb) const char *breadcrumb)

View file

@ -59,8 +59,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
CoglFramebuffer *framebuffer, CoglFramebuffer *framebuffer,
CoglPipeline *pipeline, CoglPipeline *pipeline,
CoglMultiTexturedRect *rects, CoglMultiTexturedRect *rects,
int n_rects, int n_rects);
gboolean disable_legacy_state);
G_END_DECLS G_END_DECLS

View file

@ -629,8 +629,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
CoglFramebuffer *framebuffer, CoglFramebuffer *framebuffer,
CoglPipeline *pipeline, CoglPipeline *pipeline,
CoglMultiTexturedRect *rects, CoglMultiTexturedRect *rects,
int n_rects, int n_rects)
gboolean disable_legacy_state)
{ {
CoglContext *ctx = framebuffer->context; CoglContext *ctx = framebuffer->context;
CoglPipeline *original_pipeline; CoglPipeline *original_pipeline;
@ -654,18 +653,6 @@ _cogl_framebuffer_draw_multitextured_rectangles (
if (state.override_source) if (state.override_source)
pipeline = 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... * Emit geometry for each of the rectangles...
*/ */
@ -761,8 +748,7 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
1, 1,
COGL_DRAW_SKIP_JOURNAL_FLUSH | COGL_DRAW_SKIP_JOURNAL_FLUSH |
COGL_DRAW_SKIP_PIPELINE_VALIDATION | COGL_DRAW_SKIP_PIPELINE_VALIDATION |
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
COGL_DRAW_SKIP_LEGACY_STATE);
cogl_object_unref (attributes[0]); cogl_object_unref (attributes[0]);

View file

@ -97,12 +97,6 @@ _cogl_check_extension (const char *name, char * const *ext);
void void
_cogl_init (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) \ #define _cogl_has_private_feature(ctx, feature) \
COGL_FLAGS_GET ((ctx)->private_features, (feature)) COGL_FLAGS_GET ((ctx)->private_features, (feature))

View file

@ -53,8 +53,6 @@
#include "cogl-offscreen.h" #include "cogl-offscreen.h"
#include "winsys/cogl-winsys-private.h" #include "winsys/cogl-winsys-private.h"
#include "deprecated/cogl-framebuffer-deprecated.h"
GCallback GCallback
cogl_get_proc_address (const char* name) cogl_get_proc_address (const char* name)
{ {
@ -85,10 +83,6 @@ cogl_set_depth_test_enabled (gboolean setting)
return; return;
ctx->legacy_depth_test_enabled = setting; 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 */ /* XXX: This API has been deprecated */
@ -108,11 +102,6 @@ cogl_set_backface_culling_enabled (gboolean setting)
return; return;
ctx->legacy_backface_culling_enabled = setting; ctx->legacy_backface_culling_enabled = setting;
if (ctx->legacy_backface_culling_enabled)
ctx->legacy_state_set++;
else
ctx->legacy_state_set--;
} }
gboolean gboolean
@ -172,150 +161,6 @@ _cogl_driver_error_quark (void)
return g_quark_from_static_string ("cogl-driver-error-quark"); 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) /* Scale from OpenGL normalized device coordinates (ranging from -1 to 1)
* to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with
* (0,0) being top left. */ * (0,0) being top left. */

View file

@ -83,7 +83,6 @@
* they enable the experimental api... */ * they enable the experimental api... */
#include <cogl/deprecated/cogl-type-casts.h> #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-auto-texture.h>
#include <cogl/deprecated/cogl-shader.h> #include <cogl/deprecated/cogl-shader.h>
#include <cogl/deprecated/cogl-material-compat.h> #include <cogl/deprecated/cogl-material-compat.h>

View file

@ -138,80 +138,6 @@ COGL_DEPRECATED_FOR (cogl_pipeline_get_cull_face_mode)
gboolean gboolean
cogl_get_backface_culling_enabled (void); 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: * cogl_flush:
* *

View file

@ -1,228 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2014 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#include "cogl-config.h"
#include "cogl-types.h"
#include "cogl-context-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-framebuffer-deprecated.h"
typedef struct _CoglFramebufferStackEntry
{
CoglFramebuffer *draw_buffer;
CoglFramebuffer *read_buffer;
} CoglFramebufferStackEntry;
static CoglFramebufferStackEntry *
create_stack_entry (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglFramebufferStackEntry *entry = g_slice_new (CoglFramebufferStackEntry);
entry->draw_buffer = draw_buffer;
entry->read_buffer = read_buffer;
return entry;
}
GSList *
_cogl_create_framebuffer_stack (void)
{
CoglFramebufferStackEntry *entry;
GSList *stack = NULL;
entry = create_stack_entry (NULL, NULL);
return g_slist_prepend (stack, entry);
}
void
_cogl_free_framebuffer_stack (GSList *stack)
{
GSList *l;
for (l = stack; l != NULL; l = l->next)
{
CoglFramebufferStackEntry *entry = l->data;
if (entry->draw_buffer)
cogl_object_unref (entry->draw_buffer);
if (entry->read_buffer)
cogl_object_unref (entry->read_buffer);
g_slice_free (CoglFramebufferStackEntry, entry);
}
g_slist_free (stack);
}
/* Set the current framebuffer without checking if it's already the
* current framebuffer. This is used by cogl_pop_framebuffer while
* the top of the stack is currently not up to date. */
static void
_cogl_set_framebuffers_real (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglFramebufferStackEntry *entry;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (ctx != NULL);
g_return_if_fail (draw_buffer && read_buffer ?
draw_buffer->context == read_buffer->context : TRUE);
entry = ctx->framebuffer_stack->data;
if (draw_buffer)
cogl_object_ref (draw_buffer);
if (entry->draw_buffer)
cogl_object_unref (entry->draw_buffer);
if (read_buffer)
cogl_object_ref (read_buffer);
if (entry->read_buffer)
cogl_object_unref (entry->read_buffer);
entry->draw_buffer = draw_buffer;
entry->read_buffer = read_buffer;
}
static void
_cogl_set_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglFramebuffer *current_draw_buffer;
CoglFramebuffer *current_read_buffer;
g_return_if_fail (cogl_is_framebuffer (draw_buffer));
g_return_if_fail (cogl_is_framebuffer (read_buffer));
current_draw_buffer = cogl_get_draw_framebuffer ();
current_read_buffer = _cogl_get_read_framebuffer ();
if (current_draw_buffer != draw_buffer ||
current_read_buffer != read_buffer)
_cogl_set_framebuffers_real (draw_buffer, read_buffer);
}
void
cogl_set_framebuffer (CoglFramebuffer *framebuffer)
{
_cogl_set_framebuffers (framebuffer, framebuffer);
}
CoglFramebuffer *
cogl_get_draw_framebuffer (void)
{
CoglFramebufferStackEntry *entry;
_COGL_GET_CONTEXT (ctx, NULL);
g_assert (ctx->framebuffer_stack);
entry = ctx->framebuffer_stack->data;
return entry->draw_buffer;
}
CoglFramebuffer *
_cogl_get_read_framebuffer (void)
{
CoglFramebufferStackEntry *entry;
_COGL_GET_CONTEXT (ctx, NULL);
g_assert (ctx->framebuffer_stack);
entry = ctx->framebuffer_stack->data;
return entry->read_buffer;
}
void
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglContext *ctx;
CoglFramebuffer *old_draw_buffer, *old_read_buffer;
g_return_if_fail (cogl_is_framebuffer (draw_buffer));
g_return_if_fail (cogl_is_framebuffer (read_buffer));
ctx = draw_buffer->context;
g_return_if_fail (ctx != NULL);
g_return_if_fail (draw_buffer->context == read_buffer->context);
g_return_if_fail (ctx->framebuffer_stack != NULL);
/* Copy the top of the stack so that when we call cogl_set_framebuffer
it will still know what the old framebuffer was */
old_draw_buffer = cogl_get_draw_framebuffer ();
if (old_draw_buffer)
cogl_object_ref (old_draw_buffer);
old_read_buffer = _cogl_get_read_framebuffer ();
if (old_read_buffer)
cogl_object_ref (old_read_buffer);
ctx->framebuffer_stack =
g_slist_prepend (ctx->framebuffer_stack,
create_stack_entry (old_draw_buffer,
old_read_buffer));
_cogl_set_framebuffers (draw_buffer, read_buffer);
}
void
cogl_push_framebuffer (CoglFramebuffer *buffer)
{
_cogl_push_framebuffers (buffer, buffer);
}
void
cogl_pop_framebuffer (void)
{
CoglFramebufferStackEntry *to_pop;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_assert (ctx->framebuffer_stack != NULL);
g_assert (ctx->framebuffer_stack->next != NULL);
to_pop = ctx->framebuffer_stack->data;
cogl_object_unref (to_pop->draw_buffer);
cogl_object_unref (to_pop->read_buffer);
g_slice_free (CoglFramebufferStackEntry, to_pop);
ctx->framebuffer_stack =
g_slist_delete_link (ctx->framebuffer_stack,
ctx->framebuffer_stack);
}

View file

@ -126,11 +126,6 @@ cogl_program_use (CoglHandle handle)
g_return_if_fail (handle == NULL || cogl_is_program (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) if (handle != NULL)
cogl_object_ref (handle); cogl_object_ref (handle);
if (ctx->current_program != NULL) if (ctx->current_program != NULL)

View file

@ -322,8 +322,7 @@ paint_primitive_silhouette (CoglFramebuffer *framebuffer,
pipeline, pipeline,
COGL_DRAW_SKIP_JOURNAL_FLUSH | COGL_DRAW_SKIP_JOURNAL_FLUSH |
COGL_DRAW_SKIP_PIPELINE_VALIDATION | COGL_DRAW_SKIP_PIPELINE_VALIDATION |
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
COGL_DRAW_SKIP_LEGACY_STATE);
} }
static void static void

View file

@ -71,10 +71,6 @@ cogl_deprecated_headers = [
'deprecated/cogl-auto-texture.h', 'deprecated/cogl-auto-texture.h',
] ]
cogl_deprecated_nonintrospected_headers = [
'deprecated/cogl-framebuffer-deprecated.h',
]
cogl_headers = [ cogl_headers = [
'cogl1-context.h', 'cogl1-context.h',
'cogl-bitmap.h', 'cogl-bitmap.h',
@ -356,7 +352,6 @@ cogl_sources = [
'deprecated/cogl-shader-private.h', 'deprecated/cogl-shader-private.h',
'deprecated/cogl-shader.c', 'deprecated/cogl-shader.c',
'deprecated/cogl-clutter.c', 'deprecated/cogl-clutter.c',
'deprecated/cogl-framebuffer-deprecated.c',
'cogl-glib-source.c', 'cogl-glib-source.c',
'cogl-mutter.h', 'cogl-mutter.h',
] ]
@ -427,7 +422,6 @@ cogl_headers_all = [
cogl_introspected_headers, cogl_introspected_headers,
cogl_nonintrospected_headers, cogl_nonintrospected_headers,
cogl_deprecated_headers, cogl_deprecated_headers,
cogl_deprecated_nonintrospected_headers,
] ]
cogl_test_deps = [] cogl_test_deps = []
@ -497,7 +491,6 @@ install_headers([
install_headers([ install_headers([
cogl_deprecated_headers, cogl_deprecated_headers,
cogl_deprecated_nonintrospected_headers,
], ],
subdir: join_paths(cogl_cogl_includesubdir, 'deprecated')) subdir: join_paths(cogl_cogl_includesubdir, 'deprecated'))

View file

@ -269,7 +269,6 @@ set_cursor_visible (MetaStageX11 *stage_x11)
static void static void
meta_stage_x11_unrealize (ClutterStageWindow *stage_window) meta_stage_x11_unrealize (ClutterStageWindow *stage_window)
{ {
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window); MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
if (clutter_stages_by_xid != NULL) if (clutter_stages_by_xid != NULL)
@ -278,19 +277,6 @@ meta_stage_x11_unrealize (ClutterStageWindow *stage_window)
GINT_TO_POINTER (stage_x11->xwin)); 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) if (stage_x11->frame_closure)
{ {
cogl_onscreen_remove_frame_callback (stage_x11->onscreen, cogl_onscreen_remove_frame_callback (stage_x11->onscreen,

View file

@ -307,32 +307,6 @@ static void
meta_stage_x11_nested_unrealize (ClutterStageWindow *stage_window) meta_stage_x11_nested_unrealize (ClutterStageWindow *stage_window)
{ {
MetaStageX11Nested *stage_nested = META_STAGE_X11_NESTED (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); g_clear_pointer (&stage_nested->pipeline, cogl_object_unref);