summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/Render.cpp
diff options
context:
space:
mode:
authorChris Burgener <christhecoolist@gmail.com>2016-06-26 13:23:10 -0400
committerChris Burgener <christhecoolist@gmail.com>2016-06-27 10:13:17 -0400
commitf31adf9635283a288b4765b07b01bfa700dd50b2 (patch)
tree5eb5e4edfdca09a8c5d0e079e22bbc9ed3fd957b /Source/Core/VideoBackends/D3D/Render.cpp
parent88dbaf1fa50a0ac692c228861843deba826aa6f3 (diff)
Fix D3D crashes/issues
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/Render.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index a18538e234..d7babc9ff7 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -880,12 +880,8 @@ 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;
- static int s_recordHeight;
-
if (!s_screenshot_texture)
CreateScreenshotTexture();
@@ -897,9 +893,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
&source_box);
if (!bLastFrameDumped)
{
- s_recordWidth = source_width;
- s_recordHeight = source_height;
- bAVIDumping = AVIDump::Start(s_recordWidth, s_recordHeight, AVIDump::DumpFormat::FORMAT_BGR);
+ bAVIDumping = AVIDump::Start(source_width, source_height, AVIDump::DumpFormat::FORMAT_BGR);
if (!bAVIDumping)
{
PanicAlert("Error dumping frames to AVI.");
@@ -908,7 +902,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
{
std::string msg = StringFromFormat("Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)",
File::GetUserPath(D_DUMPFRAMES_IDX).c_str(),
- s_recordWidth, s_recordHeight);
+ source_width, source_height);
OSD::AddMessage(msg, 2000);
}
@@ -918,14 +912,11 @@ 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)
- {
- frame_data.resize(3 * s_recordWidth * s_recordHeight);
- w = s_recordWidth;
- h = s_recordHeight;
- }
+ if (frame_data.capacity() != 3 * source_width * source_height)
+ frame_data.resize(3 * source_width * source_height);
+
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 +927,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);