Open Bug 1540209 Opened 8 months ago Updated 7 months ago

WebGL readback is not prepared to read into buffers with stride alignment of more than 4 or 8 bytes

Categories

(Core :: Graphics: Layers, defect, P3)

defect

Tracking

()

Tracking Status
firefox68 --- affected

People

(Reporter: mstange, Unassigned)

References

Details

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 TexClientFromReadback:

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 ReadbackSharedSurface.

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.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.