summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D12/Render.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/D3D12/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D12/Render.cpp62
1 files changed, 13 insertions, 49 deletions
diff --git a/Source/Core/VideoBackends/D3D12/Render.cpp b/Source/Core/VideoBackends/D3D12/Render.cpp
index 9bbe2699ba..fb1740d9ac 100644
--- a/Source/Core/VideoBackends/D3D12/Render.cpp
+++ b/Source/Core/VideoBackends/D3D12/Render.cpp
@@ -711,9 +711,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
if (Fifo::WillSkipCurrentFrame() || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) ||
!fb_width || !fb_height)
{
- if (SConfig::GetInstance().m_DumpFrames && !frame_data.empty())
- AVIDump::AddFrame(&frame_data[0], fb_width, fb_height);
-
+ RepeatFrameDumpFrame();
Core::Callback_VideoCopiedToXFB(false);
return;
}
@@ -723,9 +721,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
FramebufferManager::GetXFBSource(xfb_addr, fb_stride, fb_height, &xfb_count);
if ((!xfb_source_list || xfb_count == 0) && g_ActiveConfig.bUseXFB && !g_ActiveConfig.bUseRealXFB)
{
- if (SConfig::GetInstance().m_DumpFrames && !frame_data.empty())
- AVIDump::AddFrame(&frame_data[0], fb_width, fb_height);
-
+ RepeatFrameDumpFrame();
Core::Callback_VideoCopiedToXFB(false);
return;
}
@@ -832,7 +828,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
}
// Dump frames
- if (SConfig::GetInstance().m_DumpFrames)
+ if (IsFrameDumping())
{
if (!s_screenshot_texture)
CreateScreenshotTexture();
@@ -865,51 +861,19 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
D3D::command_list_mgr->ExecuteQueuedWork(true);
- 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);
+ void* screenshot_texture_map;
+ D3D12_RANGE read_range = {0, dst_location.PlacedFootprint.Footprint.RowPitch * source_height};
+ CheckHR(s_screenshot_texture->Map(0, &read_range, &screenshot_texture_map));
- OSD::AddMessage(msg, 2000);
- }
- }
- if (bAVIDumping)
- {
- if (frame_data.capacity() != 3 * source_width * source_height)
- frame_data.resize(3 * source_width * source_height);
-
- void* screenshot_texture_map;
- D3D12_RANGE read_range = {0, dst_location.PlacedFootprint.Footprint.RowPitch * source_height};
- CheckHR(s_screenshot_texture->Map(0, &read_range, &screenshot_texture_map));
- formatBufferDump(static_cast<u8*>(screenshot_texture_map), &frame_data[0], source_width,
- source_height, dst_location.PlacedFootprint.Footprint.RowPitch);
+ // TODO: This convertion is not needed. Get rid of it.
+ std::vector<u8> image(source_width * source_height * 3);
+ formatBufferDump(static_cast<u8*>(screenshot_texture_map), image.data(), source_width,
+ source_height, dst_location.PlacedFootprint.Footprint.RowPitch);
- D3D12_RANGE write_range = {};
- s_screenshot_texture->Unmap(0, &write_range);
+ DumpFrameData(image.data(), source_width, source_height, AVIDump::DumpFormat::FORMAT_BGR, true);
- FlipImageData(&frame_data[0], source_width, source_height);
- AVIDump::AddFrame(&frame_data[0], source_width, source_height);
- }
- 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;
+ D3D12_RANGE write_range = {};
+ s_screenshot_texture->Unmap(0, &write_range);
}
// Reset viewport for drawing text