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:
20
cogl/cogl.c
20
cogl/cogl.c
@ -282,7 +282,7 @@ cogl_set_backface_culling_enabled (gboolean setting)
|
||||
return;
|
||||
|
||||
/* Currently the journal can't track changes to backface culling state... */
|
||||
_cogl_journal_flush ();
|
||||
_cogl_framebuffer_flush_journal (_cogl_get_framebuffer ());
|
||||
|
||||
ctx->enable_backface_culling = setting;
|
||||
}
|
||||
@ -479,7 +479,12 @@ cogl_disable_fog (void)
|
||||
void
|
||||
cogl_flush (void)
|
||||
{
|
||||
_cogl_journal_flush ();
|
||||
GList *l;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
for (l = ctx->framebuffers; l; l = l->next)
|
||||
_cogl_framebuffer_flush_journal (l->data);
|
||||
}
|
||||
|
||||
void
|
||||
@ -505,8 +510,15 @@ _cogl_read_pixels_with_rowstride (int x,
|
||||
|
||||
g_return_if_fail (source == COGL_READ_PIXELS_COLOR_BUFFER);
|
||||
|
||||
/* make sure any batched primitives get emitted to the GL driver before
|
||||
* issuing our read pixels... */
|
||||
/* make sure any batched primitives get emitted to the GL driver
|
||||
* before issuing our read pixels...
|
||||
*
|
||||
* XXX: Note we currently use cogl_flush to ensure *all* journals
|
||||
* are flushed here and not _cogl_journal_flush because we don't
|
||||
* track the dependencies between framebuffers so we don't know if
|
||||
* the current framebuffer depends on the contents of other
|
||||
* framebuffers which could also have associated journal entries.
|
||||
*/
|
||||
cogl_flush ();
|
||||
|
||||
framebuffer = _cogl_get_framebuffer ();
|
||||
|
Reference in New Issue
Block a user