VideoCommon/Render: Inplace frame dump encoding.

This increase the performance of good backends a bit, but slows down the bads one a lot.
Let's fix those backends instead of forcing stupid memcpy in the common code.
This commit is contained in:
degasus 2016-11-07 22:46:48 +01:00
parent ccb39e9907
commit 52caa4f2f5
1 changed files with 9 additions and 10 deletions

View File

@ -705,23 +705,20 @@ void Renderer::RunFrameDumps()
if (!m_frame_dump_thread_running.IsSet()) if (!m_frame_dump_thread_running.IsSet())
break; break;
const auto config = m_frame_dump_config; auto config = m_frame_dump_config;
// TODO: Refactor this. Right now it's needed for the implace flipping of the image.
data.assign(config.data, config.data + config.stride * config.height);
// As we've done a copy now, there is no need to block the GPU thread any longer.
m_frame_dump_done.Set();
if (config.upside_down) if (config.upside_down)
FlipImageData(data.data(), config.width, config.height, 4); {
config.data = config.data + (config.height - 1) * config.stride;
config.stride = -config.stride;
}
// Save screenshot // Save screenshot
if (s_screenshot.TestAndClear()) if (s_screenshot.TestAndClear())
{ {
std::lock_guard<std::mutex> lk(s_criticalScreenshot); std::lock_guard<std::mutex> lk(s_criticalScreenshot);
if (TextureToPng(data.data(), config.stride, s_sScreenshotName, config.width, config.height, if (TextureToPng(config.data, config.stride, s_sScreenshotName, config.width, config.height,
false)) false))
OSD::AddMessage("Screenshot saved to " + s_sScreenshotName); OSD::AddMessage("Screenshot saved to " + s_sScreenshotName);
@ -745,9 +742,11 @@ void Renderer::RunFrameDumps()
} }
} }
AVIDump::AddFrame(data.data(), config.width, config.height, config.stride, config.state); AVIDump::AddFrame(config.data, config.width, config.height, config.stride, config.state);
} }
#endif #endif
m_frame_dump_done.Set();
} }
#if defined(HAVE_LIBAV) || defined(_WIN32) #if defined(HAVE_LIBAV) || defined(_WIN32)