[cairo] [PATCH 1/2] gl: Don't reset the FBO draw/readbuffers every time we bind the FBO.
Eric Anholt
eric at anholt.net
Mon Jan 31 20:19:59 PST 2011
Draw/readbuffers are a property of the framebuffer, not of the
context. So we can leave them in place across bindings. I left the
window drawbuffer setting in place until we decide how to handle
interoperating of cairo-gl with normal GL usage.
[ 0] before firefox-talos-gfx 67.552 67.561 0.22% 3/3
[ 0] after firefox-talos-gfx 66.689 66.913 0.41% 3/3
---
src/cairo-gl-device.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 25423e0..3d3cf0e 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -248,6 +248,8 @@ _cairo_gl_ensure_framebuffer (cairo_gl_context_t *ctx,
ctx->tex_target,
surface->tex,
0);
+ glDrawBuffer (GL_COLOR_ATTACHMENT0);
+ glReadBuffer (GL_COLOR_ATTACHMENT0);
status = dispatch->CheckFramebufferStatus (GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
@@ -284,8 +286,6 @@ _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
if (_cairo_gl_surface_is_texture (surface)) {
_cairo_gl_ensure_framebuffer (ctx, surface);
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->fb);
- glDrawBuffer (GL_COLOR_ATTACHMENT0);
- glReadBuffer (GL_COLOR_ATTACHMENT0);
} else {
ctx->make_current (ctx, surface);
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, 0);
--
1.7.2.3
More information about the cairo
mailing list