[cogl] Don't use cogl_get_draw_framebuffer when flushing pipeline state
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] Don't use cogl_get_draw_framebuffer when flushing pipeline state
- Date: Mon, 5 Mar 2012 19:52:27 +0000 (UTC)
commit 75226501cfc272eb54dba29d98937461cd502b63
Author: Neil Roberts <neil linux intel com>
Date: Sat Feb 25 15:10:02 2012 +0000
Don't use cogl_get_draw_framebuffer when flushing pipeline state
Some of the state when flushing a pipeline depends on the current
framebuffer being used. These are:
â The matrix stack, so that it can flip vertically or not depending on
whether the framebuffer is offscreen.
â The colormask. This is combined with the framebuffer's color mask.
â The cull face mode. If the framebuffer is offscreen then backface
culling is translated to frontface culling and vice-versa.
These states were not working if the new framebuffer draw_primitive
API was used because in that case the framebuffer is not pushed to the
framebuffer stack so it would use the wrong one. This patch changes it
to use ctx->current_draw_buffer which is a pointer to the framebuffer
whose state was last flushed.
https://bugzilla.gnome.org/show_bug.cgi?id=670793
Reviewed-by: Robert Bragg <robert linux intel com>
cogl/cogl-matrix-stack.c | 2 +-
cogl/cogl-pipeline-opengl.c | 8 +++-----
cogl/cogl-pipeline-progend-glsl.c | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c
index fd1bed0..40d0903 100644
--- a/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl-matrix-stack.c
@@ -430,7 +430,7 @@ _cogl_matrix_stack_flush_to_gl_builtins (CoglContext *ctx,
if (disable_flip)
needs_flip = FALSE;
else
- needs_flip = cogl_is_offscreen (cogl_get_draw_framebuffer ());
+ needs_flip = cogl_is_offscreen (ctx->current_draw_buffer);
cache = &ctx->builtin_flushed_projection;
}
diff --git a/cogl/cogl-pipeline-opengl.c b/cogl/cogl-pipeline-opengl.c
index 3237dc4..a763240 100644
--- a/cogl/cogl-pipeline-opengl.c
+++ b/cogl/cogl-pipeline-opengl.c
@@ -593,10 +593,9 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS);
CoglPipelineLogicOpsState *logic_ops_state = &authority->big_state->logic_ops_state;
CoglColorMask color_mask = logic_ops_state->color_mask;
- CoglFramebuffer *draw_framebuffer = cogl_get_draw_framebuffer ();
- if (draw_framebuffer)
- color_mask &= draw_framebuffer->color_mask;
+ if (ctx->current_draw_buffer)
+ color_mask &= ctx->current_draw_buffer->color_mask;
GE (ctx, glColorMask (!!(color_mask & COGL_COLOR_MASK_RED),
!!(color_mask & COGL_COLOR_MASK_GREEN),
@@ -616,7 +615,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
GE( ctx, glDisable (GL_CULL_FACE) );
else
{
- CoglFramebuffer *draw_framebuffer = cogl_get_draw_framebuffer ();
gboolean invert_winding;
GE( ctx, glEnable (GL_CULL_FACE) );
@@ -642,7 +640,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
/* If we are painting to an offscreen framebuffer then we
need to invert the winding of the front face because
everything is painted upside down */
- invert_winding = cogl_is_offscreen (draw_framebuffer);
+ invert_winding = cogl_is_offscreen (ctx->current_draw_buffer);
switch (cull_face_state->front_winding)
{
diff --git a/cogl/cogl-pipeline-progend-glsl.c b/cogl/cogl-pipeline-progend-glsl.c
index 5d65d70..3bb6f79 100644
--- a/cogl/cogl-pipeline-progend-glsl.c
+++ b/cogl/cogl-pipeline-progend-glsl.c
@@ -951,7 +951,7 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline)
if (modelview_stack == NULL || projection_stack == NULL)
return;
- needs_flip = cogl_is_offscreen (cogl_get_draw_framebuffer ());
+ needs_flip = cogl_is_offscreen (ctx->current_draw_buffer);
#ifdef HAVE_COGL_GLES2
if (ctx->driver == COGL_DRIVER_GLES2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]