summaryrefslogtreecommitdiff
path: root/cogl/cogl-journal.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-11-21 15:53:40 +0000
committerRobert Bragg <robert@linux.intel.com>2011-12-06 18:51:57 +0000
commit042dc7c8cd3d867727aec67928b0cbea23f6145c (patch)
treec1c150c2a9a7b05f95772f8afcdf9b328785407b /cogl/cogl-journal.c
parent6ab371d587e22ac5807f9224cd420c43168a803f (diff)
downloadcogl-042dc7c8cd3d867727aec67928b0cbea23f6145c.tar.gz
framebuffer: Optimize _cogl_framebuffer_flush_state()
Previously the cost of _cogl_framebuffer_state_flush() would always scale by the total amount of state tracked by CoglFramebuffer even in cases where we knew up-front that we only wanted to flush a subset of the state or in cases where we requested to flush the same framebuffer multiple times with no changes being made to the framebuffer. We now track a set of state changed flags with each framebuffer and track the current read/draw buffers as part of the CoglContext so that we can quickly bail out when asked to flush the same framebuffer multiple times with no changes. _cogl_framebuffer_flush_state() now takes a mask of the state that we want to flush and the implementation has been redesigned so that the cost of checking what needs to be flushed and flushing those changes now scales by how much state we actually plan to update. Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/cogl-journal.c')
-rw-r--r--cogl/cogl-journal.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c
index ad646758..e04bf1c3 100644
--- a/cogl/cogl-journal.c
+++ b/cogl/cogl-journal.c
@@ -710,6 +710,12 @@ _cogl_journal_flush_clip_stacks_and_entries (CoglJournalEntry *batch_start,
_cogl_clip_stack_flush (batch_start->clip_stack, state->framebuffer);
+ /* XXX: Because we are manually flushing clip state here we need to
+ * make sure that the clip state gets updated the next time we flush
+ * framebuffer state by marking the current framebuffer's clip state
+ * as changed. */
+ ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP;
+
_cogl_matrix_stack_push (state->modelview_stack);
/* If we have transformed all our quads at log time then we ensure
@@ -1373,8 +1379,9 @@ _cogl_journal_flush (CoglJournal *journal,
state manually */
_cogl_framebuffer_flush_state (framebuffer,
framebuffer,
- COGL_FRAMEBUFFER_FLUSH_SKIP_MODELVIEW |
- COGL_FRAMEBUFFER_FLUSH_SKIP_CLIP_STATE);
+ COGL_FRAMEBUFFER_STATE_ALL &
+ ~(COGL_FRAMEBUFFER_STATE_MODELVIEW |
+ COGL_FRAMEBUFFER_STATE_CLIP));
state.journal = journal;