journal: Support per-framebuffer journals

Instead of having a single journal per context, we now have a
CoglJournal object for each CoglFramebuffer. This means we now don't
have to flush the journal when switching/pushing/popping between
different framebuffers so for example a Clutter scene that involves some
ClutterEffect actors that transiently redirect to an FBO can still be
batched.

This also allows us to track state in the journal that relates to the
current frame of its associated framebuffer which we'll need for our
optimization for using the CPU to handle reading a single pixel back
from a framebuffer when we know the whole scene is currently comprised
of simple rectangles in a journal.
This commit is contained in:
Robert Bragg
2011-01-06 13:25:45 +00:00
parent 5f35bd7b67
commit 1a5a4df326
21 changed files with 375 additions and 101 deletions

View File

@ -98,14 +98,14 @@ _cogl_atlas_texture_reorganize_cb (void *data)
{
CoglAtlas *atlas = data;
/* We don't know if any pipelines may currently be referenced in
* the journal that depend on the current underlying GL texture
* storage so we flush the journal before migrating.
/* We don't know if any journal entries currently depend on OpenGL
* texture coordinates that would be invalidated by reorganizing
* this atlas so we flush all journals before migrating.
*
* We are assuming that texture atlas migration never happens
* during a flush so we don't have to consider recursion here.
*/
_cogl_journal_flush ();
cogl_flush ();
if (atlas->map)
_cogl_rectangle_map_foreach (atlas->map,
@ -294,14 +294,15 @@ _cogl_atlas_texture_migrate_out_of_atlas (CoglAtlasTexture *atlas_tex)
{
COGL_NOTE (ATLAS, "Migrating texture out of the atlas");
/* We don't know if any pipelines may currently be referenced in
* the journal that depend on the current underlying GL texture
* storage so we flush the journal before migrating.
/* We don't know if any journal entries currently depend on
* OpenGL texture coordinates that would be invalidated by
* migrating textures in this atlas so we flush all journals
* before migrating.
*
* We are assuming that texture atlas migration never happens
* during a flush so we don't have to consider recursion here.
*/
_cogl_journal_flush ();
cogl_flush ();
/* Notify cogl-pipeline.c that the texture's underlying GL texture
* storage is changing so it knows it may need to bind a new texture
@ -575,6 +576,9 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
to set as the data for the rectangle in the atlas */
atlas_tex = g_new (CoglAtlasTexture, 1);
_cogl_texture_init (COGL_TEXTURE (atlas_tex),
&cogl_atlas_texture_vtable);
atlas_tex->sub_texture = COGL_INVALID_HANDLE;
/* Look for an existing atlas that can hold the texture */
@ -620,8 +624,6 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
g_free (atlas_tex);
return COGL_INVALID_HANDLE;
}
atlas_tex->_parent.vtable = &cogl_atlas_texture_vtable;
atlas_tex->format = internal_format;
atlas_tex->atlas = atlas;