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:
parent
77b3c0d670
commit
4ede6ea8c5
23 changed files with 13 additions and 658 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
155
cogl/cogl/cogl.c
155
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. */
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'))
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue