summaryrefslogtreecommitdiff
path: root/cogl/cogl-texture-2d.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-texture-2d.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-texture-2d.c')
-rw-r--r--cogl/cogl-texture-2d.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c
index 7328423f..5e988bd6 100644
--- a/cogl/cogl-texture-2d.c
+++ b/cogl/cogl-texture-2d.c
@@ -832,7 +832,10 @@ _cogl_texture_2d_get_data (CoglTexture *tex,
&gl_format,
&gl_type);
- ctx->texture_driver->prep_gl_for_pixels_download (ctx, rowstride, bpp);
+ ctx->texture_driver->prep_gl_for_pixels_download (ctx,
+ rowstride,
+ tex_2d->width,
+ bpp);
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
tex_2d->gl_texture,