diff --git a/gfx/gl.c b/gfx/gl.c index 74621b52ad..718ea64077 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1542,7 +1542,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer) RARCH_PERFORMANCE_INIT(read_viewport); RARCH_PERFORMANCE_START(read_viewport); - glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, get_alignment(gl->vp.width * 3)); #ifdef HAVE_OPENGLES glReadPixels(gl->vp.x, gl->vp.y, diff --git a/retroarch.c b/retroarch.c index f75ecdf5e1..fbc6215dfd 100644 --- a/retroarch.c +++ b/retroarch.c @@ -226,9 +226,11 @@ static void recording_dump_frame(const void *data, unsigned width, unsigned heig return; } - // Big bottleneck. Also adds one frame "delay" to video output as we haven't rendered the current frame yet. - // It will probably improve performance a lot though, who knows. - video_read_viewport_func(g_extern.record_gpu_buffer); + // Big bottleneck. + // Since we might need to do read-backs asynchronously, it might take 3-4 times + // before this returns true ... + if (!video_read_viewport_func(g_extern.record_gpu_buffer)) + return; ffemu_data.pitch = g_extern.record_gpu_width * 3; ffemu_data.width = g_extern.record_gpu_width;