Created
June 26, 2016 16:24
-
-
Save stenzek/09864f8fcb3d9261cd8b1970316f6249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp | |
index a18538e..04b6c70 100644 | |
--- a/Source/Core/VideoBackends/D3D/Render.cpp | |
+++ b/Source/Core/VideoBackends/D3D/Render.cpp | |
@@ -880,7 +880,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, | |
} | |
// Dump frames | |
- static int w = 0, h = 0; | |
if (SConfig::GetInstance().m_DumpFrames) | |
{ | |
static int s_recordWidth; | |
@@ -918,14 +917,14 @@ 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); | |
- if (frame_data.empty() || w != s_recordWidth || h != s_recordHeight) | |
+ if (frame_data.empty() || source_width != s_recordWidth || source_height != s_recordHeight) | |
{ | |
+ s_recordWidth = source_width; | |
+ s_recordHeight = source_height; | |
frame_data.resize(3 * s_recordWidth * s_recordHeight); | |
- w = s_recordWidth; | |
- h = s_recordHeight; | |
} | |
formatBufferDump((u8*)map.pData, &frame_data[0], source_width, source_height, map.RowPitch); | |
- FlipImageData(&frame_data[0], w, h); | |
+ FlipImageData(&frame_data[0], source_width, source_height); | |
AVIDump::AddFrame(&frame_data[0], source_width, source_height); | |
D3D::context->Unmap(s_screenshot_texture, 0); | |
} | |
@@ -936,8 +935,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, | |
if (bLastFrameDumped && bAVIDumping) | |
{ | |
std::vector<u8>().swap(frame_data); | |
- w = h = 0; | |
- | |
AVIDump::Stop(); | |
bAVIDumping = false; | |
OSD::AddMessage("Stop dumping frames to AVI", 2000); | |
diff --git a/Source/Core/VideoBackends/D3D12/Render.cpp b/Source/Core/VideoBackends/D3D12/Render.cpp | |
index f868b36..6c95934 100644 | |
--- a/Source/Core/VideoBackends/D3D12/Render.cpp | |
+++ b/Source/Core/VideoBackends/D3D12/Render.cpp | |
@@ -836,7 +836,6 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height | |
} | |
// Dump frames | |
- static int w = 0, h = 0; | |
if (SConfig::GetInstance().m_DumpFrames) | |
{ | |
static unsigned int s_record_width; | |
@@ -894,11 +893,11 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height | |
} | |
if (bAVIDumping) | |
{ | |
- if (frame_data.empty() || w != s_record_width || h != s_record_height) | |
+ if (frame_data.empty() || source_width != s_record_width || source_height != source_height) | |
{ | |
- frame_data.resize(3 * s_record_width * s_record_height); | |
- w = s_record_width; | |
- h = s_record_height; | |
+ s_record_width = source_width; | |
+ source_height = source_height; | |
+ frame_data.resize(3 * s_record_width * source_height); | |
} | |
void* screenshot_texture_map; | |
@@ -910,7 +909,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height | |
D3D12_RANGE write_range = {}; | |
s_screenshot_texture->Unmap(0, &write_range); | |
- FlipImageData(&frame_data[0], w, h); | |
+ FlipImageData(&frame_data[0], s_record_width, source_height); | |
AVIDump::AddFrame(&frame_data[0], source_width, source_height); | |
} | |
bLastFrameDumped = true; | |
@@ -920,7 +919,6 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height | |
if (bLastFrameDumped && bAVIDumping) | |
{ | |
std::vector<u8>().swap(frame_data); | |
- w = h = 0; | |
AVIDump::Stop(); | |
bAVIDumping = false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment