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>
This commit is contained in:
parent
6ad168e4be
commit
75226501cf
@ -430,7 +430,7 @@ _cogl_matrix_stack_flush_to_gl_builtins (CoglContext *ctx,
|
|||||||
if (disable_flip)
|
if (disable_flip)
|
||||||
needs_flip = FALSE;
|
needs_flip = FALSE;
|
||||||
else
|
else
|
||||||
needs_flip = cogl_is_offscreen (cogl_get_draw_framebuffer ());
|
needs_flip = cogl_is_offscreen (ctx->current_draw_buffer);
|
||||||
|
|
||||||
cache = &ctx->builtin_flushed_projection;
|
cache = &ctx->builtin_flushed_projection;
|
||||||
}
|
}
|
||||||
|
@ -593,10 +593,9 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
|||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS);
|
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS);
|
||||||
CoglPipelineLogicOpsState *logic_ops_state = &authority->big_state->logic_ops_state;
|
CoglPipelineLogicOpsState *logic_ops_state = &authority->big_state->logic_ops_state;
|
||||||
CoglColorMask color_mask = logic_ops_state->color_mask;
|
CoglColorMask color_mask = logic_ops_state->color_mask;
|
||||||
CoglFramebuffer *draw_framebuffer = cogl_get_draw_framebuffer ();
|
|
||||||
|
|
||||||
if (draw_framebuffer)
|
if (ctx->current_draw_buffer)
|
||||||
color_mask &= draw_framebuffer->color_mask;
|
color_mask &= ctx->current_draw_buffer->color_mask;
|
||||||
|
|
||||||
GE (ctx, glColorMask (!!(color_mask & COGL_COLOR_MASK_RED),
|
GE (ctx, glColorMask (!!(color_mask & COGL_COLOR_MASK_RED),
|
||||||
!!(color_mask & COGL_COLOR_MASK_GREEN),
|
!!(color_mask & COGL_COLOR_MASK_GREEN),
|
||||||
@ -616,7 +615,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
|||||||
GE( ctx, glDisable (GL_CULL_FACE) );
|
GE( ctx, glDisable (GL_CULL_FACE) );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CoglFramebuffer *draw_framebuffer = cogl_get_draw_framebuffer ();
|
|
||||||
gboolean invert_winding;
|
gboolean invert_winding;
|
||||||
|
|
||||||
GE( ctx, glEnable (GL_CULL_FACE) );
|
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
|
/* If we are painting to an offscreen framebuffer then we
|
||||||
need to invert the winding of the front face because
|
need to invert the winding of the front face because
|
||||||
everything is painted upside down */
|
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)
|
switch (cull_face_state->front_winding)
|
||||||
{
|
{
|
||||||
|
@ -951,7 +951,7 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline)
|
|||||||
if (modelview_stack == NULL || projection_stack == NULL)
|
if (modelview_stack == NULL || projection_stack == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
needs_flip = cogl_is_offscreen (cogl_get_draw_framebuffer ());
|
needs_flip = cogl_is_offscreen (ctx->current_draw_buffer);
|
||||||
|
|
||||||
#ifdef HAVE_COGL_GLES2
|
#ifdef HAVE_COGL_GLES2
|
||||||
if (ctx->driver == COGL_DRIVER_GLES2)
|
if (ctx->driver == COGL_DRIVER_GLES2)
|
||||||
|
Loading…
Reference in New Issue
Block a user