summaryrefslogtreecommitdiff
path: root/cogl/cogl-framebuffer.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-03-22 11:40:16 +0000
committerNeil Roberts <neil@linux.intel.com>2012-04-05 13:51:56 +0100
commitec5009fa23b11f9df9ffeead7bdf0de3fa12cd07 (patch)
tree962cf3c8eed7599a056ebd38ce96fc08cf09a71f /cogl/cogl-framebuffer.c
parentd54111795fee3fd0618c448c5279f2421396a154 (diff)
downloadcogl-ec5009fa23b11f9df9ffeead7bdf0de3fa12cd07.tar.gz
Use GL_PACK_ALIGNMENT of 1 whenever possible
The Intel driver currently has an optimisation when calling glReadPixels into a PBO so that it will use a blit instead of the Mesa fallback path. However this only works if the GL_PACK_ALIGNMENT is exactly 1, even if this would be equivalent to a higher alignment value because the bpp*width is already aligned. To make it more likely to hit this fast path, we now detect this situation and explicitly use an alignment of 1. To make this work the texture driver needs to be passed down the bpp*width as well as the rowstride when configuring the alignment. Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-framebuffer.c')
-rw-r--r--cogl/cogl-framebuffer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index dff08fff..b55b016a 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -2065,7 +2065,10 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
bpp = _cogl_pixel_format_get_bytes_per_pixel (read_format);
rowstride = cogl_bitmap_get_rowstride (tmp_bmp);
- ctx->texture_driver->prep_gl_for_pixels_download (ctx, rowstride, bpp);
+ ctx->texture_driver->prep_gl_for_pixels_download (ctx,
+ rowstride,
+ width,
+ bpp);
tmp_data = _cogl_bitmap_bind (tmp_bmp,
COGL_BUFFER_ACCESS_WRITE,
@@ -2113,7 +2116,10 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
bpp = _cogl_pixel_format_get_bytes_per_pixel (bmp_format);
- ctx->texture_driver->prep_gl_for_pixels_download (ctx, rowstride, bpp);
+ ctx->texture_driver->prep_gl_for_pixels_download (ctx,
+ rowstride,
+ width,
+ bpp);
pixels = _cogl_bitmap_bind (shared_bmp,
COGL_BUFFER_ACCESS_WRITE,