summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/Render.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2016-10-10 11:48:57 +0200
committerGitHub <noreply@github.com>2016-10-10 11:48:57 +0200
commita583d36c7f38fac9fb66c059bf6990bfd819591f (patch)
tree842adfb6ca1a3ac76b290677bd72db2a406b781f /Source/Core/VideoBackends/D3D/Render.cpp
parent562bc01d0e21f103fa9d8ee1993654a81e51fb26 (diff)
parent64927a2f81fe64503060c949ead525995fd63a2a (diff)
Merge pull request #4326 from degasus/framedump
Framedump: Merge screenshot code with framedumping.
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/Render.cpp49
1 files changed, 2 insertions, 47 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index 19f2feb963..9452d03f86 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -32,7 +32,6 @@
#include "VideoCommon/AVIDump.h"
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/Fifo.h"
-#include "VideoCommon/ImageWrite.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
@@ -712,39 +711,6 @@ void Renderer::SetBlendMode(bool forceUpdate)
}
}
-bool Renderer::SaveScreenshot(const std::string& filename, const TargetRectangle& rc)
-{
- if (!s_screenshot_texture)
- CreateScreenshotTexture();
-
- // copy back buffer to system memory
- D3D11_BOX source_box = GetScreenshotSourceBox(rc);
- D3D::context->CopySubresourceRegion(s_screenshot_texture, 0, 0, 0, 0,
- (ID3D11Resource*)D3D::GetBackBuffer()->GetTex(), 0,
- &source_box);
-
- D3D11_MAPPED_SUBRESOURCE map;
- D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ_WRITE, 0, &map);
-
- bool saved_png =
- TextureToPng((u8*)map.pData, map.RowPitch, filename, source_box.right - source_box.left,
- source_box.bottom - source_box.top, false);
-
- D3D::context->Unmap(s_screenshot_texture, 0);
-
- if (saved_png)
- {
- OSD::AddMessage(
- StringFromFormat("Saved %i x %i %s", rc.GetWidth(), rc.GetHeight(), filename.c_str()));
- }
- else
- {
- OSD::AddMessage(StringFromFormat("Error saving %s", filename.c_str()));
- }
-
- return saved_png;
-}
-
// This function has the final picture. We adjust the aspect ratio here.
void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
const EFBRectangle& rc, float Gamma)
@@ -842,17 +808,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
BlitScreen(sourceRc, targetRc, read_texture, GetTargetWidth(), GetTargetHeight(), Gamma);
}
- // done with drawing the game stuff, good moment to save a screenshot
- if (s_bScreenshot)
- {
- std::lock_guard<std::mutex> guard(s_criticalScreenshot);
-
- SaveScreenshot(s_sScreenshotName, GetTargetRectangle());
- s_sScreenshotName.clear();
- s_bScreenshot = false;
- s_screenshotCompleted.Set();
- }
-
// Dump frames
if (IsFrameDumping())
{
@@ -869,8 +824,8 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
D3D11_MAPPED_SUBRESOURCE map;
D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ, 0, &map);
- DumpFrameData(reinterpret_cast<const u8*>(map.pData), source_width, source_height, map.RowPitch,
- AVIDump::DumpFormat::FORMAT_RGBA);
+ DumpFrameData(reinterpret_cast<const u8*>(map.pData), source_width, source_height,
+ map.RowPitch);
FinishFrameData();
D3D::context->Unmap(s_screenshot_texture, 0);