2015-02-10 22:05 GMT+01:00 Henri Verbeet hverbeet@gmail.com:
On 10 February 2015 at 20:14, Matteo Bruni mbruni@codeweavers.com wrote:
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_pitch / format->byte_count);
if (src_pitch & (surface_alignment - 1))
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
What's a bit awkward about this is that if the pitch isn't a multiple of the pixel byte width it's still not going to work. But I guess this is the best we can do.
Yes, I think the only 100% foolproof way would be to manually upload row by row in that case. FWIW OpenGL ES 2.0 has only GL_UNPACK_ALIGNMENT (i.e. no GL_UNPACK_ROW_LENGTH or anything else) so we'll need something like that if we ever want to support it. ES 3.0 does have GL_UNPACK_ROW_LENGTH instead so it's in the same spot as desktop GL in that regard.
For the time being, I could add a check (maybe inside a WARN_ON() to avoid the overhead in the non-debug case) with a FIXME if the unlucky case happens.