From b7ef8796b2cf81533a227f98096014a4308e5f92 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 19 Mar 2019 18:00:03 -0400 Subject: [PATCH] cogl: Remove unused cogl_{begin,end}_gl API Any GL calls we want to make should be inside cogl already. https://gitlab.gnome.org/GNOME/mutter/merge_requests/500 --- cogl/cogl/cogl-context-private.h | 2 - cogl/cogl/cogl-context.c | 2 - cogl/cogl/cogl.c | 76 ---------------- cogl/cogl/cogl.symbols | 4 - cogl/cogl/cogl1-context.h | 91 ------------------- .../driver/gl/cogl-attribute-gl-private.h | 3 - cogl/cogl/driver/gl/cogl-attribute-gl.c | 13 --- 7 files changed, 191 deletions(-) diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h index e02d36021..13087e881 100644 --- a/cogl/cogl/cogl-context-private.h +++ b/cogl/cogl/cogl-context-private.h @@ -231,8 +231,6 @@ struct _CoglContext CoglIndices *rectangle_short_indices; int rectangle_short_indices_len; - gboolean in_begin_gl_block; - CoglPipeline *texture_download_pipeline; CoglPipeline *blit_texture_pipeline; diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index 6843636d6..3fea916e7 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -347,8 +347,6 @@ cogl_context_new (CoglDisplay *display, context->current_path = NULL; context->stencil_pipeline = cogl_pipeline_new (context); - context->in_begin_gl_block = FALSE; - context->quad_buffer_indices_byte = NULL; context->quad_buffer_indices = NULL; context->quad_buffer_indices_len = 0; diff --git a/cogl/cogl/cogl.c b/cogl/cogl/cogl.c index bf46ea055..886c9aa7b 100644 --- a/cogl/cogl/cogl.c +++ b/cogl/cogl/cogl.c @@ -347,82 +347,6 @@ cogl_read_pixels (int x, cogl_object_unref (bitmap); } -void -cogl_begin_gl (void) -{ - CoglPipeline *pipeline; - - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - if (ctx->in_begin_gl_block) - { - static gboolean shown = FALSE; - if (!shown) - g_warning ("You should not nest cogl_begin_gl/cogl_end_gl blocks"); - shown = TRUE; - return; - } - ctx->in_begin_gl_block = TRUE; - - /* Flush all batched primitives */ - cogl_flush (); - - /* Flush framebuffer state, including clip state, modelview and - * projection matrix state - * - * NB: _cogl_framebuffer_flush_state may disrupt various state (such - * as the pipeline state) when flushing the clip stack, so should - * always be done first when preparing to draw. */ - _cogl_framebuffer_flush_state (cogl_get_draw_framebuffer (), - _cogl_get_read_framebuffer (), - COGL_FRAMEBUFFER_STATE_ALL); - - /* Setup the state for the current pipeline */ - - /* We considered flushing a specific, minimal pipeline here to try and - * simplify the GL state, but decided to avoid special cases and second - * guessing what would be actually helpful. - * - * A user should instead call cogl_set_source_color4ub() before - * cogl_begin_gl() to simplify the state flushed. - * - * XXX: note defining n_tex_coord_attribs using - * cogl_pipeline_get_n_layers is a hack, but the problem is that - * n_tex_coord_attribs is usually defined when drawing a primitive - * which isn't happening here. - * - * Maybe it would be more useful if this code did flush the - * opaque_color_pipeline and then call into cogl-pipeline-opengl.c to then - * restore all state for the material's backend back to default OpenGL - * values. - */ - pipeline = cogl_get_source (); - _cogl_pipeline_flush_gl_state (ctx, - pipeline, - cogl_get_draw_framebuffer (), - FALSE, - FALSE); - - /* Disable any cached vertex arrays */ - _cogl_gl_disable_all_attributes (ctx); -} - -void -cogl_end_gl (void) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - if (!ctx->in_begin_gl_block) - { - static gboolean shown = FALSE; - if (!shown) - g_warning ("cogl_end_gl is being called before cogl_begin_gl"); - shown = TRUE; - return; - } - ctx->in_begin_gl_block = FALSE; -} - void cogl_push_matrix (void) { diff --git a/cogl/cogl/cogl.symbols b/cogl/cogl/cogl.symbols index 897701949..2b59f9f21 100644 --- a/cogl/cogl/cogl.symbols +++ b/cogl/cogl/cogl.symbols @@ -38,8 +38,6 @@ cogl_attribute_set_buffer cogl_attribute_set_normalized cogl_attribute_type_get_type -cogl_begin_gl - cogl_bitmap_error_get_type cogl_bitmap_get_buffer cogl_bitmap_get_format @@ -198,8 +196,6 @@ cogl_display_set_onscreen_template cogl_double_to_fixed -cogl_end_gl - cogl_euler_copy cogl_euler_equal cogl_euler_free diff --git a/cogl/cogl/cogl1-context.h b/cogl/cogl/cogl1-context.h index bef2ded1c..d9837f950 100644 --- a/cogl/cogl/cogl1-context.h +++ b/cogl/cogl/cogl1-context.h @@ -766,97 +766,6 @@ cogl_set_source_texture (CoglTexture *texture); void cogl_flush (void); -/** - * cogl_begin_gl: - * - * We do not advise nor reliably support the interleaving of raw GL drawing and - * Cogl drawing functions, but if you insist, cogl_begin_gl() and cogl_end_gl() - * provide a simple mechanism that may at least give you a fighting chance of - * succeeding. - * - * Note: this doesn't help you modify the behaviour of Cogl drawing functions - * through the modification of GL state; that will never be reliably supported, - * but if you are trying to do something like: - * - * |[ - * { - * - setup some OpenGL state. - * - draw using OpenGL (e.g. glDrawArrays() ) - * - reset modified OpenGL state. - * - continue using Cogl to draw - * } - * ]| - * - * You should surround blocks of drawing using raw GL with cogl_begin_gl() - * and cogl_end_gl(): - * - * |[ - * { - * cogl_begin_gl (); - * - setup some OpenGL state. - * - draw using OpenGL (e.g. glDrawArrays() ) - * - reset modified OpenGL state. - * cogl_end_gl (); - * - continue using Cogl to draw - * } - * ]| - * - * Don't ever try and do: - * - * |[ - * { - * - setup some OpenGL state. - * - use Cogl to draw - * - reset modified OpenGL state. - * } - * ]| - * - * When the internals of Cogl evolves, this is very liable to break. - * - * This function will flush all batched primitives, and subsequently flush - * all internal Cogl state to OpenGL as if it were going to draw something - * itself. - * - * The result is that the OpenGL modelview matrix will be setup; the state - * corresponding to the current source material will be set up and other world - * state such as backface culling, depth and fogging enabledness will be sent - * to OpenGL. - * - * No special material state is flushed, so if you want Cogl to setup a - * simplified material state it is your responsibility to set a simple source - * material before calling cogl_begin_gl(). E.g. by calling - * cogl_set_source_color4ub(). - * - * It is your responsibility to restore any OpenGL state that you modify - * to how it was after calling cogl_begin_gl() if you don't do this then the - * result of further Cogl calls is undefined. - * - * You can not nest begin/end blocks. - * - * Again we would like to stress, we do not advise the use of this API and if - * possible we would prefer to improve Cogl than have developers require raw - * OpenGL. - * - * Since: 1.0 - * Deprecated: 1.16: Use the #CoglGLES2Context api instead - */ -COGL_DEPRECATED_FOR (CoglGLES2Context_API) -void -cogl_begin_gl (void); - -/** - * cogl_end_gl: - * - * This is the counterpart to cogl_begin_gl() used to delimit blocks of drawing - * code using raw OpenGL. Please refer to cogl_begin_gl() for full details. - * - * Since: 1.0 - * Deprecated: 1.16: Use the #CoglGLES2Context api instead - */ -COGL_DEPRECATED_FOR (CoglGLES2Context_API) -void -cogl_end_gl (void); - G_END_DECLS #endif /* __COGL_1_CONTEXT_H__ */ diff --git a/cogl/cogl/driver/gl/cogl-attribute-gl-private.h b/cogl/cogl/driver/gl/cogl-attribute-gl-private.h index efb3c0ea2..8370621e3 100644 --- a/cogl/cogl/driver/gl/cogl-attribute-gl-private.h +++ b/cogl/cogl/driver/gl/cogl-attribute-gl-private.h @@ -47,7 +47,4 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer, CoglAttribute **attributes, int n_attributes); -void -_cogl_gl_disable_all_attributes (CoglContext *ctx); - #endif /* _COGL_ATTRIBUTE_GL_PRIVATE_H_ */ diff --git a/cogl/cogl/driver/gl/cogl-attribute-gl.c b/cogl/cogl/driver/gl/cogl-attribute-gl.c index e198a9830..8a5f2fa11 100644 --- a/cogl/cogl/driver/gl/cogl-attribute-gl.c +++ b/cogl/cogl/driver/gl/cogl-attribute-gl.c @@ -523,16 +523,3 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer, if (copy) cogl_object_unref (copy); } - -void -_cogl_gl_disable_all_attributes (CoglContext *ctx) -{ - _cogl_bitmask_clear_all (&ctx->enable_builtin_attributes_tmp); - _cogl_bitmask_clear_all (&ctx->enable_texcoord_attributes_tmp); - _cogl_bitmask_clear_all (&ctx->enable_custom_attributes_tmp); - - /* XXX: we can pass a NULL source pipeline here because we know a - * source pipeline only needs to be referenced when enabling - * attributes. */ - apply_attribute_enable_updates (ctx, NULL); -}