journal: use pipeline term instead of source

Since we are adapting the Cogl api to be less stateful one of the things
we no longer require is the cogl_set_source() api since a pipeline can
be explicitly passed as an argument when drawing. This means the term
"source" has been deprecated and internally we should aim to
consistently use the term "pipeline" instead. This patch updates the
journal code to use the term pipeline instead of source.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2012-01-08 03:00:57 +00:00
parent 9a254d8292
commit b168ff8ef6

View File

@ -112,7 +112,7 @@ typedef struct _CoglJournalFlushState
CoglMatrixStack *modelview_stack; CoglMatrixStack *modelview_stack;
CoglMatrixStack *projection_stack; CoglMatrixStack *projection_stack;
CoglPipeline *source; CoglPipeline *pipeline;
} CoglJournalFlushState; } CoglJournalFlushState;
typedef void (*CoglJournalBatchCallback) (CoglJournalEntry *start, typedef void (*CoglJournalBatchCallback) (CoglJournalEntry *start,
@ -298,7 +298,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
attributes = (CoglAttribute **)state->attributes->data; attributes = (CoglAttribute **)state->attributes->data;
if (!_cogl_pipeline_get_real_blend_enabled (state->source)) if (!_cogl_pipeline_get_real_blend_enabled (state->pipeline))
draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE; draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE;
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
@ -306,7 +306,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
{ {
/* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */ /* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */
_cogl_framebuffer_draw_attributes (state->framebuffer, _cogl_framebuffer_draw_attributes (state->framebuffer,
state->source, state->pipeline,
GL_QUADS, GL_QUADS,
state->current_vertex, batch_len * 4, state->current_vertex, batch_len * 4,
attributes, attributes,
@ -321,7 +321,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
CoglVerticesMode mode = COGL_VERTICES_MODE_TRIANGLES; CoglVerticesMode mode = COGL_VERTICES_MODE_TRIANGLES;
int first_vertex = state->current_vertex * 6 / 4; int first_vertex = state->current_vertex * 6 / 4;
_cogl_framebuffer_draw_indexed_attributes (state->framebuffer, _cogl_framebuffer_draw_indexed_attributes (state->framebuffer,
state->source, state->pipeline,
mode, mode,
first_vertex, first_vertex,
batch_len * 6, batch_len * 6,
@ -333,7 +333,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
else else
{ {
_cogl_framebuffer_draw_attributes (state->framebuffer, _cogl_framebuffer_draw_attributes (state->framebuffer,
state->source, state->pipeline,
COGL_VERTICES_MODE_TRIANGLE_FAN, COGL_VERTICES_MODE_TRIANGLE_FAN,
state->current_vertex, 4, state->current_vertex, 4,
attributes, attributes,
@ -444,7 +444,7 @@ _cogl_journal_flush_pipeline_and_entries (CoglJournalEntry *batch_start,
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING))) if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
g_print ("BATCHING: pipeline batch len = %d\n", batch_len); g_print ("BATCHING: pipeline batch len = %d\n", batch_len);
state->source = batch_start->pipeline; state->pipeline = batch_start->pipeline;
/* If we haven't transformed the quads in software then we need to also break /* If we haven't transformed the quads in software then we need to also break
* up batches according to changes in the modelview matrix... */ * up batches according to changes in the modelview matrix... */
@ -1502,7 +1502,7 @@ _cogl_journal_log_quad (CoglJournal *journal,
int next_entry; int next_entry;
guint32 disable_layers; guint32 disable_layers;
CoglJournalEntry *entry; CoglJournalEntry *entry;
CoglPipeline *source; CoglPipeline *final_pipeline;
CoglClipStack *clip_stack; CoglClipStack *clip_stack;
CoglPipelineFlushOptions flush_options; CoglPipelineFlushOptions flush_options;
COGL_STATIC_TIMER (log_timer, COGL_STATIC_TIMER (log_timer,
@ -1576,7 +1576,7 @@ _cogl_journal_log_quad (CoglJournal *journal,
entry->n_layers = n_layers; entry->n_layers = n_layers;
entry->array_offset = next_vert; entry->array_offset = next_vert;
source = pipeline; final_pipeline = pipeline;
flush_options.flags = 0; flush_options.flags = 0;
if (G_UNLIKELY (cogl_pipeline_get_n_layers (pipeline) != n_layers)) if (G_UNLIKELY (cogl_pipeline_get_n_layers (pipeline) != n_layers))
@ -1594,17 +1594,17 @@ _cogl_journal_log_quad (CoglJournal *journal,
if (G_UNLIKELY (flush_options.flags)) if (G_UNLIKELY (flush_options.flags))
{ {
source = cogl_pipeline_copy (pipeline); final_pipeline = cogl_pipeline_copy (pipeline);
_cogl_pipeline_apply_overrides (source, &flush_options); _cogl_pipeline_apply_overrides (final_pipeline, &flush_options);
} }
entry->pipeline = _cogl_pipeline_journal_ref (source); entry->pipeline = _cogl_pipeline_journal_ref (final_pipeline);
clip_stack = _cogl_framebuffer_get_clip_stack (journal->framebuffer); clip_stack = _cogl_framebuffer_get_clip_stack (journal->framebuffer);
entry->clip_stack = _cogl_clip_stack_ref (clip_stack); entry->clip_stack = _cogl_clip_stack_ref (clip_stack);
if (G_UNLIKELY (source != pipeline)) if (G_UNLIKELY (final_pipeline != pipeline))
cogl_handle_unref (source); cogl_handle_unref (final_pipeline);
cogl_get_modelview_matrix (&entry->model_view); cogl_get_modelview_matrix (&entry->model_view);