mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
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
This commit is contained in:
parent
7e8a864992
commit
b7ef8796b2
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
*
|
||||
* <note>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().</note>
|
||||
*
|
||||
* <note>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.</note>
|
||||
*
|
||||
* <note>You can not nest begin/end blocks.</note>
|
||||
*
|
||||
* 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__ */
|
||||
|
@ -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_ */
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user