diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2016-01-28 18:24:32 -0500 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2016-01-28 18:24:32 -0500 |
| commit | e1f21602fdb49b2d03893167781a68d956c618c3 (patch) | |
| tree | c9c1864fa854f61526a90115bd2eee95eadabd75 /Source/Core/VideoBackends/OGL/Render.cpp | |
| parent | 437b3db88e1cbc43df123e269a2f4034bb34700d (diff) | |
| parent | 3f15aa4b574bc2d5d0df6337db6d9e848421f4f6 (diff) | |
Merge pull request #3426 from Sonicadvance1/ES_fix_framedump
Add support for framedumping to OpenGL ES.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Render.cpp | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index bf2da15e3f..e80ca40ab5 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1361,65 +1361,63 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co } // Frame dumps are handled a little differently in Windows - // Frame dumping disabled entirely on GLES3 - if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL) - { #if defined(HAVE_LIBAV) || defined (_WIN32) - if (SConfig::GetInstance().m_DumpFrames) + if (SConfig::GetInstance().m_DumpFrames) + { + std::lock_guard<std::mutex> lk(s_criticalScreenshot); + + if (frame_data.empty() || + w != flipped_trc.GetWidth() || h != flipped_trc.GetHeight()) { - std::lock_guard<std::mutex> lk(s_criticalScreenshot); - if (frame_data.empty() || w != flipped_trc.GetWidth() || - h != flipped_trc.GetHeight()) - { - w = flipped_trc.GetWidth(); - h = flipped_trc.GetHeight(); - frame_data.resize(3 * w * h); - } - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(flipped_trc.left, flipped_trc.bottom, w, h, GL_BGR, GL_UNSIGNED_BYTE, &frame_data[0]); - if (w > 0 && h > 0) + w = flipped_trc.GetWidth(); + h = flipped_trc.GetHeight(); + frame_data.resize(4 * w * h); + } + + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glReadPixels(flipped_trc.left, flipped_trc.bottom, w, h, GL_RGBA, GL_UNSIGNED_BYTE, &frame_data[0]); + if (w > 0 && h > 0) + { + if (!bLastFrameDumped) { - if (!bLastFrameDumped) + bAVIDumping = AVIDump::Start(w, h, AVIDump::DumpFormat::FORMAT_RGBA); + if (!bAVIDumping) { - bAVIDumping = AVIDump::Start(w, h); - if (!bAVIDumping) - { - OSD::AddMessage("AVIDump Start failed", 2000); - } - else - { - OSD::AddMessage(StringFromFormat( - "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", - File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), w, h), 2000); - } + OSD::AddMessage("AVIDump Start failed", 2000); } - if (bAVIDumping) + else { - FlipImageData(&frame_data[0], w, h); - AVIDump::AddFrame(&frame_data[0], w, h); + OSD::AddMessage(StringFromFormat( + "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), w, h), 2000); } - - bLastFrameDumped = true; } - else + if (bAVIDumping) { - NOTICE_LOG(VIDEO, "Error reading framebuffer"); + FlipImageData(&frame_data[0], w, h, 4); + AVIDump::AddFrame(&frame_data[0], w, h); } + + bLastFrameDumped = true; } else { - if (bLastFrameDumped && bAVIDumping) - { - std::vector<u8>().swap(frame_data); - w = h = 0; - AVIDump::Stop(); - bAVIDumping = false; - OSD::AddMessage("Stop dumping frames", 2000); - } - bLastFrameDumped = false; + NOTICE_LOG(VIDEO, "Error reading framebuffer"); } -#endif } + else + { + if (bLastFrameDumped && bAVIDumping) + { + std::vector<u8>().swap(frame_data); + w = h = 0; + AVIDump::Stop(); + bAVIDumping = false; + OSD::AddMessage("Stop dumping frames", 2000); + } + bLastFrameDumped = false; + } +#endif // Finish up the current frame, print some stats SetWindowSize(fbStride, fbHeight); |
