This is giving me trouble in bug 1479145: I'm trying to make all shmem surfaces have a stride that is aligned to 32 bytes, but I ran into an assertion in
MOZ_ASSERT(mapped.stride / 4 == mapped.size.width);
I think this code is run when displaying WebGL canvases with ClientLayerManager+BasicCompositor.
Looking for other callers of raw_fReadPixels with the same problem, I found one in
Reading the code that's used for texture upload in GLUploadHelpers.cpp it seems that interacting with large strides (larger than width*4 aligned to 8 bytes) is really quite troublesome in GL, because you have to handle multiple cases:
- Desktop GL has
GL_UNPACK_ROW_LENGTH that lets you specify stride/bpp explicitly.
- GLES 3 also has it.
- GLES 2 does not have it, but for texture upload you can use the EXT_unpack_subimage extension if available. I don't see an equivalent extension for readback.
- If the above primitives are not available, you have to do an in-memory copy or upload / readback row by row.