mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
[cogl_read_pixels] don't force a 4 byte pack alignment
Technically this change shouldn't make a difference since we are calling glReadPixels with GL_RGBA GL_UNSIGNED_BYTE which is a 4 byte format and it should always result in the same value according to how OpenGL calculates the location of sequential rows. i.e. k = a/s * ceil(snl/a) where: a = alignment s = component size (1) n = number of components per pixel (4) l = number of pixels in a row gives: k = 4/1 * ceil(4l/4) and k = 1/1 * ceil(4l/1) which are equivalent I'm changing it because I've seen i915 driver code that bails out of hardware accelerated paths if the alignment isn't 1, and because conceptually we have no alignment constraints here so even if the current value has no effect, when we start reading back other formats it may upset things.
This commit is contained in:
parent
f59180d073
commit
1acf5cc36f
10
cogl/cogl.c
10
cogl/cogl.c
@ -826,14 +826,14 @@ cogl_read_pixels (int x,
|
||||
|
||||
/* Setup the pixel store parameters that may have been changed by
|
||||
Cogl */
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 4);
|
||||
GE (glPixelStorei (GL_PACK_ALIGNMENT, 1));
|
||||
#ifdef HAVE_COGL_GL
|
||||
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
|
||||
glPixelStorei (GL_PACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei (GL_PACK_SKIP_ROWS, 0);
|
||||
GE (glPixelStorei (GL_PACK_ROW_LENGTH, 0));
|
||||
GE (glPixelStorei (GL_PACK_SKIP_PIXELS, 0));
|
||||
GE (glPixelStorei (GL_PACK_SKIP_ROWS, 0));
|
||||
#endif /* HAVE_COGL_GL */
|
||||
|
||||
glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
GE (glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
|
||||
|
||||
/* NB: All offscreen rendering is done upside down so there is no need
|
||||
* to flip in this case... */
|
||||
|
Loading…
Reference in New Issue
Block a user