{
CoglJournalFlushState *state = data;
CoglVertexAttribute **attributes;
- static const CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH |
- COGL_DRAW_SKIP_PIPELINE_VALIDATION |
- COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
+ CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH |
+ COGL_DRAW_SKIP_PIPELINE_VALIDATION |
+ COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
COGL_STATIC_TIMER (time_flush_modelview_and_entries,
"flush: pipeline+entries", /* parent */
attributes = (CoglVertexAttribute **)state->attributes->data;
cogl_push_source (state->source);
+ if (!_cogl_pipeline_get_real_blend_enabled (state->source))
+ draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE;
+
#ifdef HAVE_COGL_GL
/* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */
{
COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0,
COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1,
- COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2
+ COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2,
+ /* By default the vertex attribute drawing code will assume that if
+ there is a color attribute array enabled then we can't determine
+ if the colors will be opaque so we need to enabling
+ blending. However when drawing from the journal we know what the
+ contents of the color array is so we can override this by passing
+ this flag. */
+ COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 3
} CoglDrawFlags;
CoglVertexAttribute *
}
static CoglHandle
-enable_gl_state (CoglVertexAttribute **attributes,
+enable_gl_state (CoglDrawFlags flags,
+ CoglVertexAttribute **attributes,
ValidateLayerState *state)
{
int i;
switch (attributes[i]->name_id)
{
case COGL_VERTEX_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
- if (!_cogl_pipeline_get_real_blend_enabled (source))
+ if ((flags & COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE) == 0 &&
+ !_cogl_pipeline_get_real_blend_enabled (source))
{
CoglPipelineBlendEnable blend_enable =
COGL_PIPELINE_BLEND_ENABLE_ENABLED;
flush_state (flags, &state);
- source = enable_gl_state (attributes, &state);
+ source = enable_gl_state (flags, attributes, &state);
GE (glDrawArrays ((GLenum)mode, first_vertex, n_vertices));
flush_state (flags, &state);
- source = enable_gl_state (attributes, &state);
+ source = enable_gl_state (flags, attributes, &state);
buffer = COGL_BUFFER (cogl_indices_get_array (indices));
base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_ARRAY);