AVIDump: Add a struct for the state.

So AddFrame use no global state and can be threaded well.
This commit is contained in:
degasus
2016-11-04 18:19:35 +01:00
parent dad5041737
commit be29090aae
9 changed files with 44 additions and 18 deletions

View File

@ -824,8 +824,9 @@ 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);
AVIDump::Frame state = AVIDump::FetchState(ticks);
DumpFrameData(reinterpret_cast<const u8*>(map.pData), source_width, source_height, map.RowPitch,
ticks);
state);
FinishFrameData();
D3D::context->Unmap(s_screenshot_texture, 0);

View File

@ -777,8 +777,9 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
D3D12_RANGE read_range = {0, dst_location.PlacedFootprint.Footprint.RowPitch * source_height};
CheckHR(s_screenshot_texture->Map(0, &read_range, &screenshot_texture_map));
AVIDump::Frame state = AVIDump::FetchState(ticks);
DumpFrameData(reinterpret_cast<const u8*>(screenshot_texture_map), source_width, source_height,
dst_location.PlacedFootprint.Footprint.RowPitch, ticks);
dst_location.PlacedFootprint.Footprint.RowPitch, state);
FinishFrameData();
D3D12_RANGE write_range = {};

View File

@ -1455,8 +1455,9 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
glReadPixels(flipped_trc.left, flipped_trc.bottom, flipped_trc.GetWidth(),
flipped_trc.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, image.data());
AVIDump::Frame state = AVIDump::FetchState(ticks);
DumpFrameData(image.data(), flipped_trc.GetWidth(), flipped_trc.GetHeight(),
flipped_trc.GetWidth() * 4, ticks, true);
flipped_trc.GetWidth() * 4, state, true);
FinishFrameData();
}
// Finish up the current frame, print some stats

View File

@ -125,7 +125,8 @@ void SWRenderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
// Save screenshot
if (IsFrameDumping())
{
DumpFrameData(GetCurrentColorTexture(), fbWidth, fbHeight, fbWidth * 4, ticks);
AVIDump::Frame state = AVIDump::FetchState(ticks);
DumpFrameData(GetCurrentColorTexture(), fbWidth, fbHeight, fbWidth * 4, state);
FinishFrameData();
}

View File

@ -747,10 +747,11 @@ bool Renderer::DrawFrameDump(const EFBRectangle& rc, u32 xfb_addr,
void Renderer::DumpFrame(u64 ticks)
{
AVIDump::Frame state = AVIDump::FetchState(ticks);
DumpFrameData(reinterpret_cast<const u8*>(m_frame_dump_readback_texture->GetMapPointer()),
static_cast<int>(m_frame_dump_render_texture->GetWidth()),
static_cast<int>(m_frame_dump_render_texture->GetHeight()),
static_cast<int>(m_frame_dump_readback_texture->GetRowStride()), ticks);
static_cast<int>(m_frame_dump_readback_texture->GetRowStride()), state);
FinishFrameData();
}