diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2016-10-08 00:54:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-08 00:54:36 +0200 |
| commit | a172bd7d8cac3c417e33ba8fafb89963fc8b5bbd (patch) | |
| tree | 5b650dbbd073c0d43ca4eba4301705f31da28f85 /Source/Core/VideoBackends/D3D/Render.cpp | |
| parent | 5e027a0817c4577539fc969c3cd7900553b3fb99 (diff) | |
| parent | 8c999f9ee801116e723381432b96d8a9ae6ddc68 (diff) | |
Merge pull request #4318 from degasus/framedump
Renderer: Move framedumping logic to VideoCommon.
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/D3D/Render.cpp | 56 |
1 files changed, 11 insertions, 45 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 2997173014..fa0fe3581e 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -768,9 +768,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, if (Fifo::WillSkipCurrentFrame() || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) { - if (SConfig::GetInstance().m_DumpFrames && !frame_data.empty()) - AVIDump::AddFrame(&frame_data[0], fbWidth, fbHeight); - + RepeatFrameDumpFrame(); Core::Callback_VideoCopiedToXFB(false); return; } @@ -780,9 +778,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, FramebufferManager::GetXFBSource(xfbAddr, fbStride, fbHeight, &xfbCount); if ((!xfbSourceList || xfbCount == 0) && g_ActiveConfig.bUseXFB && !g_ActiveConfig.bUseRealXFB) { - if (SConfig::GetInstance().m_DumpFrames && !frame_data.empty()) - AVIDump::AddFrame(&frame_data[0], fbWidth, fbHeight); - + RepeatFrameDumpFrame(); Core::Callback_VideoCopiedToXFB(false); return; } @@ -877,7 +873,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, } // Dump frames - if (SConfig::GetInstance().m_DumpFrames) + if (IsFrameDumping()) { if (!s_screenshot_texture) CreateScreenshotTexture(); @@ -888,47 +884,17 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, D3D::context->CopySubresourceRegion(s_screenshot_texture, 0, 0, 0, 0, (ID3D11Resource*)D3D::GetBackBuffer()->GetTex(), 0, &source_box); - if (!bLastFrameDumped) - { - bAVIDumping = AVIDump::Start(source_width, source_height, AVIDump::DumpFormat::FORMAT_BGR); - if (!bAVIDumping) - { - PanicAlert("Error dumping frames to AVI."); - } - else - { - std::string msg = StringFromFormat("Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", - File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), - source_width, source_height); - OSD::AddMessage(msg, 2000); - } - } - if (bAVIDumping) - { - D3D11_MAPPED_SUBRESOURCE map; - D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ, 0, &map); + D3D11_MAPPED_SUBRESOURCE map; + D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ, 0, &map); - if (frame_data.capacity() != 3 * source_width * source_height) - frame_data.resize(3 * source_width * source_height); + // TODO: This convertion is not needed. Get rid of it. + std::vector<u8> image(source_width * source_height * 3); + formatBufferDump((u8*)map.pData, image.data(), source_width, source_height, map.RowPitch); - formatBufferDump((u8*)map.pData, &frame_data[0], source_width, source_height, map.RowPitch); - FlipImageData(&frame_data[0], source_width, source_height); - AVIDump::AddFrame(&frame_data[0], source_width, source_height); - D3D::context->Unmap(s_screenshot_texture, 0); - } - bLastFrameDumped = true; - } - else - { - if (bLastFrameDumped && bAVIDumping) - { - AVIDump::Stop(); - std::vector<u8>().swap(frame_data); - bAVIDumping = false; - OSD::AddMessage("Stop dumping frames to AVI", 2000); - } - bLastFrameDumped = false; + DumpFrameData(image.data(), source_width, source_height, AVIDump::DumpFormat::FORMAT_BGR, true); + + D3D::context->Unmap(s_screenshot_texture, 0); } // Reset viewport for drawing text |
