glmemory: use the GL stride calculation also for downloading into sysmem

Allows writing into sysmem with arbitrary strides.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6795>
This commit is contained in:
Matthew Waters 2024-05-07 23:04:04 +10:00 committed by GStreamer Marge Bot
parent 477beab403
commit b0b185112d

View file

@ -71,6 +71,10 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
#define GL_UNPACK_ROW_LENGTH 0x0CF2
#endif
#ifndef GL_PACK_ROW_LENGTH
#define GL_PACK_ROW_LENGTH 0x0D02
#endif
#ifndef GL_TEXTURE_RECTANGLE
#define GL_TEXTURE_RECTANGLE 0x84F5
#endif
@ -459,6 +463,13 @@ gst_gl_memory_read_pixels (GstGLMemory * gl_mem, gpointer write_pointer)
}
}
if (USING_OPENGL (context) || USING_GLES3 (context)
|| USING_OPENGL3 (context)) {
gl->PixelStorei (GL_PACK_ROW_LENGTH, gl_mem->unpack_length);
} else if (USING_GLES2 (context)) {
gl->PixelStorei (GL_PACK_ALIGNMENT, gl_mem->unpack_length);
}
_gst_gl_memory_start_log (gl_mem, "glReadPixels");
gl->ReadPixels (0, 0, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem), format,
type, write_pointer);