cogl: Adds _cogl_swap_buffers_notify for clutter backends

This adds a stop-gap mechanism for Cogl to know when the window system
is requested to present the current backbuffer to the frontbuffer by
adding a _cogl_swap_buffers_notify function that backends are now
expected to call right after issuing the equivalent request to OpenGL
vie the platforms OpenGL binding layer. This (blindly) updates all the
backends to call this new function.

For now Cogl doesn't do anything with the notification but the intention
is to use it as part of a planned read-pixel optimization which will
need to reset some state at the start of each new frame.
This commit is contained in:
Robert Bragg 2011-01-12 22:06:58 +00:00
parent e1563436b1
commit 60fd6ab708
4 changed files with 21 additions and 0 deletions

View File

@ -193,6 +193,9 @@ _cogl_framebuffer_flush_journal (CoglFramebuffer *framebuffer);
void
_cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer);
void
_cogl_framebuffer_swap_notify (CoglFramebuffer *framebuffer);
typedef enum _CoglFramebufferFlushFlags
{
/* XXX: When using this, that imples you are going to manually load the

View File

@ -313,6 +313,11 @@ _cogl_framebuffer_clear (CoglFramebuffer *framebuffer,
cogl_color_get_alpha_float (color));
}
void
_cogl_framebuffer_swap_notify (CoglFramebuffer *framebuffer)
{
}
int
_cogl_framebuffer_get_width (CoglFramebuffer *framebuffer)
{

View File

@ -1097,3 +1097,13 @@ _cogl_error_quark (void)
return g_quark_from_static_string ("cogl-error-quark");
}
/* Until Cogl becomes responsible for handling swap-buffer requests
* this API is used by Clutter to notify us when it issues a
* swap-buffer on our behalf. */
void
_cogl_swap_buffers_notify (void)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_cogl_framebuffer_swap_notify (_cogl_get_framebuffer ());
}

View File

@ -1293,6 +1293,9 @@ _cogl_driver_error_quark (void);
void
_cogl_onscreen_clutter_backend_set_size (int width, int height);
void
_cogl_swap_buffers_notify (void);
G_END_DECLS
#undef __COGL_H_INSIDE__