Skip to content

Commit

Permalink
Framedumps: Add finish() function to limit memory lifetime.
Browse files Browse the repository at this point in the history
  • Loading branch information
degasus committed Oct 7, 2016
1 parent 3255078 commit 1d5fbe0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/D3D/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
formatBufferDump((u8*)map.pData, image.data(), source_width, source_height, map.RowPitch);

DumpFrameData(image.data(), source_width, source_height, AVIDump::DumpFormat::FORMAT_BGR, true);
FinishFrameData();

D3D::context->Unmap(s_screenshot_texture, 0);
}
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/D3D12/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
source_height, dst_location.PlacedFootprint.Footprint.RowPitch);

DumpFrameData(image.data(), source_width, source_height, AVIDump::DumpFormat::FORMAT_BGR, true);
FinishFrameData();

D3D12_RANGE write_range = {};
s_screenshot_texture->Unmap(0, &write_range);
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/OGL/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,

DumpFrameData(image.data(), flipped_trc.GetWidth(), flipped_trc.GetHeight(),
AVIDump::DumpFormat::FORMAT_RGBA, true);
FinishFrameData();
}
// Finish up the current frame, print some stats

Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoBackends/Vulkan/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
static_cast<int>(m_screenshot_render_texture->GetWidth()),
static_cast<int>(m_screenshot_render_texture->GetHeight()),
AVIDump::DumpFormat::FORMAT_RGBA);
FinishFrameData();
}
}

Expand Down
4 changes: 4 additions & 0 deletions Source/Core/VideoCommon/RenderBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ void Renderer::DumpFrameData(const u8* data, int w, int h, AVIDump::DumpFormat f
#endif
}

void Renderer::FinishFrameData()
{
}

void Renderer::FlipImageData(u8* data, int w, int h, int pixel_width)
{
for (int y = 0; y < h / 2; ++y)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoCommon/RenderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class Renderer
bool IsFrameDumping();
void DumpFrameData(const u8* data, int w, int h, AVIDump::DumpFormat format,
bool swap_upside_down = false);
void FinishFrameData();

static volatile bool s_bScreenshot;
static std::mutex s_criticalScreenshot;
Expand Down

0 comments on commit 1d5fbe0

Please sign in to comment.