From a25dcf337c8b0dd89dbe6f0fcb82627f52d70e1a Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 21 Nov 2012 10:24:35 +0100 Subject: [PATCH] read_viewport can return false during video record. --- gfx/gl.c | 2 +- retroarch.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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;