summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/Render.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2016-10-07 21:23:16 +0200
committerdegasus <wickmarkus@web.de>2016-10-07 23:10:36 +0200
commit64b648f6c8fa6e30f6a61607a5f4c57d7f6c48ad (patch)
treeec41fdb39b6cee6162826c42a0a02f00f30e2923 /Source/Core/VideoBackends/D3D/Render.cpp
parenta530708bb10eeef55fb9e1c4a7c1c9dcc617bd51 (diff)
D3D: Use VideoCommon framedumping helpers.
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/Render.cpp56
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