glamor: Just set the logic op to what we want at the start of all rendering.

By dropping the unconditional logic op disable at the end of
rendering, this fixes GL errors being thrown in GLES2 contexts (which
don't have logic ops).  On desktop, this also means a little less
overhead per draw call from taking one less trip through the
glEnable/glDisable switch statement of doom in Mesa.

The exchange here is that we end up taking a trip through it in the
XV, Render, and gradient-generation paths.  If the glEnable() is
actually costly, we should probably cache our logic op state in our
screen, since there's no way the GL could make that switch statement
as cheap as the caller caching it would be.

v2: Don't forget to set the logic op in Xephyr's drawing.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Eric Anholt 2014-12-27 09:00:58 -10:00
commit 6ba6cc57e1
14 changed files with 27 additions and 49 deletions

View file

@ -210,7 +210,6 @@ glamor_text(DrawablePtr drawable, GCPtr gc,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisable(GL_COLOR_LOGIC_OP);
return x;
}
@ -286,18 +285,14 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
if (!prog)
goto bail_ctx;
goto bail;
x = glamor_text(drawable, gc, glamor_font, prog,
x, y, count, chars, charinfo, sixteen);
glDisable(GL_COLOR_LOGIC_OP);
*final_pos = x;
return TRUE;
bail_ctx:
glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@ -468,7 +463,6 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
return TRUE;
bail:
glDisable(GL_COLOR_LOGIC_OP);
return FALSE;
}