From 9f264c0872603ba1963adfa706ca7a1490bd0a24 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 8 Oct 2016 12:56:28 +0200 Subject: [PATCH] AVIDump: Move CoreTiming into caller. --- Source/Core/Core/HW/SystemTimers.cpp | 2 +- Source/Core/Core/HW/VideoInterface.cpp | 10 +++---- Source/Core/Core/HW/VideoInterface.h | 2 +- Source/Core/VideoBackends/D3D/Render.cpp | 6 ++-- Source/Core/VideoBackends/D3D/Render.h | 2 +- Source/Core/VideoBackends/D3D12/Render.cpp | 4 +-- Source/Core/VideoBackends/D3D12/Render.h | 2 +- Source/Core/VideoBackends/Null/Render.cpp | 2 +- Source/Core/VideoBackends/Null/Render.h | 2 +- Source/Core/VideoBackends/OGL/Render.cpp | 4 +-- Source/Core/VideoBackends/OGL/Render.h | 2 +- .../VideoBackends/Software/SWRenderer.cpp | 2 +- .../Core/VideoBackends/Software/SWRenderer.h | 2 +- Source/Core/VideoBackends/Vulkan/Renderer.cpp | 4 +-- Source/Core/VideoBackends/Vulkan/Renderer.h | 2 +- Source/Core/VideoCommon/AVIDump.cpp | 28 ++++++++++++------- Source/Core/VideoCommon/AVIDump.h | 4 +-- Source/Core/VideoCommon/AsyncRequests.cpp | 2 +- Source/Core/VideoCommon/MainBase.cpp | 5 ++-- Source/Core/VideoCommon/RenderBase.cpp | 15 ++++++---- Source/Core/VideoCommon/RenderBase.h | 7 +++-- Source/Core/VideoCommon/VideoBackendBase.h | 2 +- 22 files changed, 63 insertions(+), 48 deletions(-) diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp index e2f8e3e9f4..ac75dfbd58 100644 --- a/Source/Core/Core/HW/SystemTimers.cpp +++ b/Source/Core/Core/HW/SystemTimers.cpp @@ -119,7 +119,7 @@ static void IPC_HLE_UpdateCallback(u64 userdata, s64 cyclesLate) static void VICallback(u64 userdata, s64 cyclesLate) { - VideoInterface::Update(); + VideoInterface::Update(CoreTiming::GetTicks() - cyclesLate); CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerHalfLine() - cyclesLate, et_VI); } diff --git a/Source/Core/Core/HW/VideoInterface.cpp b/Source/Core/Core/HW/VideoInterface.cpp index 4abed42657..186ea42d69 100644 --- a/Source/Core/Core/HW/VideoInterface.cpp +++ b/Source/Core/Core/HW/VideoInterface.cpp @@ -638,7 +638,7 @@ u32 GetTicksPerField() return GetTicksPerEvenField(); } -static void BeginField(FieldType field) +static void BeginField(FieldType field, u64 ticks) { // Could we fit a second line of data in the stride? bool potentially_interlaced_xfb = @@ -707,7 +707,7 @@ static void BeginField(FieldType field) // To correctly handle that case we would need to collate all changes // to VI during scanout and delay outputting the frame till then. if (xfbAddr) - g_video_backend->Video_BeginField(xfbAddr, fbWidth, fbStride, fbHeight); + g_video_backend->Video_BeginField(xfbAddr, fbWidth, fbStride, fbHeight, ticks); } static void EndField() @@ -717,7 +717,7 @@ static void EndField() // Purpose: Send VI interrupt when triggered // Run when: When a frame is scanned (progressive/interlace) -void Update() +void Update(u64 ticks) { if (s_half_line_of_next_si_poll == s_half_line_count) { @@ -726,11 +726,11 @@ void Update() } if (s_half_line_count == s_even_field_first_hl) { - BeginField(FIELD_EVEN); + BeginField(FIELD_EVEN, ticks); } else if (s_half_line_count == s_odd_field_first_hl) { - BeginField(FIELD_ODD); + BeginField(FIELD_ODD, ticks); } else if (s_half_line_count == s_even_field_last_hl) { diff --git a/Source/Core/Core/HW/VideoInterface.h b/Source/Core/Core/HW/VideoInterface.h index 653081ebc4..6e444ee034 100644 --- a/Source/Core/Core/HW/VideoInterface.h +++ b/Source/Core/Core/HW/VideoInterface.h @@ -337,7 +337,7 @@ u32 GetXFBAddressTop(); u32 GetXFBAddressBottom(); // Update and draw framebuffer -void Update(); +void Update(u64 ticks); // UpdateInterrupts: check if we have to generate a new VI Interrupt void UpdateInterrupts(); diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 9452d03f86..15289f49f3 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -713,7 +713,7 @@ void Renderer::SetBlendMode(bool forceUpdate) // 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) + const EFBRectangle& rc, u64 ticks, float Gamma) { if ((!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) { @@ -824,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(map.pData), source_width, source_height, - map.RowPitch); + DumpFrameData(reinterpret_cast(map.pData), source_width, source_height, map.RowPitch, + ticks); FinishFrameData(); D3D::context->Unmap(s_screenshot_texture, 0); diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index 9119573655..66f546be6c 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -47,7 +47,7 @@ public: TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, - float Gamma) override; + u64 ticks, float Gamma) override; void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override; diff --git a/Source/Core/VideoBackends/D3D12/Render.cpp b/Source/Core/VideoBackends/D3D12/Render.cpp index 7e94638321..0ae95aaedd 100644 --- a/Source/Core/VideoBackends/D3D12/Render.cpp +++ b/Source/Core/VideoBackends/D3D12/Render.cpp @@ -632,7 +632,7 @@ void Renderer::SetBlendMode(bool force_update) // This function has the final picture. We adjust the aspect ratio here. void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, - const EFBRectangle& rc, float gamma) + const EFBRectangle& rc, u64 ticks, float gamma) { if ((!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fb_width || !fb_height) { @@ -778,7 +778,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height CheckHR(s_screenshot_texture->Map(0, &read_range, &screenshot_texture_map)); DumpFrameData(reinterpret_cast(screenshot_texture_map), source_width, source_height, - dst_location.PlacedFootprint.Footprint.RowPitch); + dst_location.PlacedFootprint.Footprint.RowPitch, ticks); FinishFrameData(); D3D12_RANGE write_range = {}; diff --git a/Source/Core/VideoBackends/D3D12/Render.h b/Source/Core/VideoBackends/D3D12/Render.h index fabc1680f9..b4620c0154 100644 --- a/Source/Core/VideoBackends/D3D12/Render.h +++ b/Source/Core/VideoBackends/D3D12/Render.h @@ -47,7 +47,7 @@ public: TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, const EFBRectangle& rc, - float gamma) override; + u64 ticks, float gamma) override; void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override; diff --git a/Source/Core/VideoBackends/Null/Render.cpp b/Source/Core/VideoBackends/Null/Render.cpp index fa26955ced..55e84be99d 100644 --- a/Source/Core/VideoBackends/Null/Render.cpp +++ b/Source/Core/VideoBackends/Null/Render.cpp @@ -38,7 +38,7 @@ TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc) return result; } -void Renderer::SwapImpl(u32, u32, u32, u32, const EFBRectangle&, float) +void Renderer::SwapImpl(u32, u32, u32, u32, const EFBRectangle&, u64, float) { UpdateActiveConfig(); } diff --git a/Source/Core/VideoBackends/Null/Render.h b/Source/Core/VideoBackends/Null/Render.h index 73e35d886d..0c2bd035c2 100644 --- a/Source/Core/VideoBackends/Null/Render.h +++ b/Source/Core/VideoBackends/Null/Render.h @@ -23,7 +23,7 @@ public: TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, const EFBRectangle& rc, - float gamma) override; + u64 ticks, float gamma) override; void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 047ac0f69e..03aa2d4fd7 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1339,7 +1339,7 @@ void Renderer::SetBlendMode(bool forceUpdate) // 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) + const EFBRectangle& rc, u64 ticks, float Gamma) { if (g_ogl_config.bSupportsDebug) { @@ -1452,7 +1452,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, flipped_trc.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, image.data()); DumpFrameData(image.data(), flipped_trc.GetWidth(), flipped_trc.GetHeight(), - flipped_trc.GetWidth() * 4, true); + flipped_trc.GetWidth() * 4, ticks, true); FinishFrameData(); } // Finish up the current frame, print some stats diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index 7fb14771b5..a74948065c 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -94,7 +94,7 @@ public: TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, - float Gamma) override; + u64 ticks, float Gamma) override; void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override; diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index fcab41aebc..9cd223798b 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -110,7 +110,7 @@ void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed* xfb, u32 fbWidt // Called on the GPU thread void SWRenderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, - const EFBRectangle& rc, float Gamma) + const EFBRectangle& rc, u64 ticks, float Gamma) { if (g_ActiveConfig.bUseXFB) { diff --git a/Source/Core/VideoBackends/Software/SWRenderer.h b/Source/Core/VideoBackends/Software/SWRenderer.h index 749a24e782..b7449eb81a 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.h +++ b/Source/Core/VideoBackends/Software/SWRenderer.h @@ -34,7 +34,7 @@ public: TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, - float Gamma) override; + u64 ticks, float Gamma) override; void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override; diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 7192f93169..77a788ae08 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -460,7 +460,7 @@ void Renderer::ReinterpretPixelData(unsigned int convtype) } void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, - const EFBRectangle& rc, float gamma) + const EFBRectangle& rc, u64 ticks, float gamma) { // Flush any pending EFB pokes. m_framebuffer_mgr->FlushEFBPokes(m_state_tracker.get()); @@ -486,7 +486,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height DumpFrameData(reinterpret_cast(m_screenshot_readback_texture->GetMapPointer()), static_cast(m_screenshot_render_texture->GetWidth()), static_cast(m_screenshot_render_texture->GetHeight()), - static_cast(m_screenshot_readback_texture->GetRowStride())); + static_cast(m_screenshot_readback_texture->GetRowStride()), ticks); FinishFrameData(); } diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.h b/Source/Core/VideoBackends/Vulkan/Renderer.h index c97ee50a06..d3a5d42926 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.h +++ b/Source/Core/VideoBackends/Vulkan/Renderer.h @@ -42,7 +42,7 @@ public: TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, const EFBRectangle& rc, - float gamma) override; + u64 ticks, float gamma) override; void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override; diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index 80af9f8d84..58782f9b0f 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -20,7 +20,6 @@ extern "C" { #include "Common/MsgHandler.h" #include "Core/ConfigManager.h" -#include "Core/CoreTiming.h" #include "Core/HW/SystemTimers.h" #include "Core/HW/VideoInterface.h" //for TargetRefreshRate #include "Core/Movie.h" @@ -41,6 +40,7 @@ static SwsContext* s_sws_context = nullptr; static int s_width; static int s_height; static u64 s_last_frame; +static bool s_last_frame_is_valid = false; static bool s_start_dumping = false; static bool s_stop_dumping = false; static u64 s_last_pts; @@ -51,6 +51,7 @@ static const u8* s_stored_frame_data; static int s_stored_frame_width; static int s_stored_frame_height; static int s_stored_frame_stride; +static u64 s_stored_frame_ticks; static void InitAVCodec() { @@ -71,7 +72,7 @@ bool AVIDump::Start(int w, int h) s_current_width = w; s_current_height = h; - s_last_frame = CoreTiming::GetTicks(); + s_last_frame_is_valid = false; s_last_pts = 0; s_stop_dumping = false; @@ -169,14 +170,14 @@ static void PreparePacket(AVPacket* pkt) pkt->size = 0; } -void AVIDump::AddFrame(const u8* data, int width, int height, int stride) +void AVIDump::AddFrame(const u8* data, int width, int height, int stride, u64 ticks) { // Store current frame data in case frame dumping stops before next frame update, // but make sure that you don't store the last stored frame and check the resolution upon // closing the file or else you store recursion, and dolphins don't like recursion. if (!s_stop_dumping) { - StoreFrameData(data, width, height, stride); + StoreFrameData(data, width, height, stride, ticks); CheckResolution(width, height); } s_src_frame->data[0] = const_cast(data); @@ -205,15 +206,20 @@ void AVIDump::AddFrame(const u8* data, int width, int height, int stride) // Check to see if the first frame being dumped is the first frame of output from the emulator. // This prevents an issue with starting dumping later in emulation from placing the frames // incorrectly. + if (!s_last_frame_is_valid) + { + s_last_frame = ticks; + s_last_frame_is_valid = true; + } if (!s_start_dumping && Movie::GetCurrentFrame() < 1) { - delta = CoreTiming::GetTicks(); + delta = ticks; last_pts = AV_NOPTS_VALUE; s_start_dumping = true; } else { - delta = CoreTiming::GetTicks() - s_last_frame; + delta = ticks - s_last_frame; last_pts = (s_last_pts * s_stream->codec->time_base.den) / SystemTimers::GetTicksPerSecond(); } u64 pts_in_ticks = s_last_pts + delta; @@ -221,7 +227,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height, int stride) (pts_in_ticks * s_stream->codec->time_base.den) / SystemTimers::GetTicksPerSecond(); if (s_scaled_frame->pts != last_pts) { - s_last_frame = CoreTiming::GetTicks(); + s_last_frame = ticks; s_last_pts = pts_in_ticks; error = avcodec_encode_video2(s_stream->codec, &pkt, s_scaled_frame, &got_packet); } @@ -255,7 +261,8 @@ void AVIDump::Stop() { s_stop_dumping = true; // Write the last stored frame just in case frame dumping stops before the next frame update - AddFrame(s_stored_frame_data, s_stored_frame_width, s_stored_frame_height, s_stored_frame_stride); + AddFrame(s_stored_frame_data, s_stored_frame_width, s_stored_frame_height, s_stored_frame_stride, + s_stored_frame_ticks); av_write_trailer(s_format_context); CloseFile(); s_file_index = 0; @@ -295,7 +302,7 @@ void AVIDump::CloseFile() void AVIDump::DoState() { - s_last_frame = CoreTiming::GetTicks(); + s_last_frame_is_valid = false; } void AVIDump::CheckResolution(int width, int height) @@ -316,10 +323,11 @@ void AVIDump::CheckResolution(int width, int height) } } -void AVIDump::StoreFrameData(const u8* data, int width, int height, int stride) +void AVIDump::StoreFrameData(const u8* data, int width, int height, int stride, u64 ticks) { s_stored_frame_data = data; s_stored_frame_width = width; s_stored_frame_height = height; s_stored_frame_stride = stride; + s_stored_frame_ticks = ticks; } diff --git a/Source/Core/VideoCommon/AVIDump.h b/Source/Core/VideoCommon/AVIDump.h index 2d1dc89185..c0c205210f 100644 --- a/Source/Core/VideoCommon/AVIDump.h +++ b/Source/Core/VideoCommon/AVIDump.h @@ -12,11 +12,11 @@ private: static bool CreateFile(); static void CloseFile(); static void CheckResolution(int width, int height); - static void StoreFrameData(const u8* data, int width, int height, int stride); + static void StoreFrameData(const u8* data, int width, int height, int stride, u64 ticks); public: static bool Start(int w, int h); - static void AddFrame(const u8* data, int width, int height, int stride); + static void AddFrame(const u8* data, int width, int height, int stride, u64 ticks); static void Stop(); static void DoState(); }; diff --git a/Source/Core/VideoCommon/AsyncRequests.cpp b/Source/Core/VideoCommon/AsyncRequests.cpp index d88bb7aa50..aa19f41928 100644 --- a/Source/Core/VideoCommon/AsyncRequests.cpp +++ b/Source/Core/VideoCommon/AsyncRequests.cpp @@ -135,7 +135,7 @@ void AsyncRequests::HandleEvent(const AsyncRequests::Event& e) case Event::SWAP_EVENT: Renderer::Swap(e.swap_event.xfbAddr, e.swap_event.fbWidth, e.swap_event.fbStride, - e.swap_event.fbHeight, rc); + e.swap_event.fbHeight, rc, e.time); break; case Event::BBOX_READ: diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index 5323651708..782833de2d 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -47,14 +47,15 @@ void VideoBackendBase::Video_ExitLoop() } // Run from the CPU thread (from VideoInterface.cpp) -void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight) +void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, + u64 ticks) { if (m_initialized && g_ActiveConfig.bUseXFB && g_renderer) { Fifo::SyncGPU(Fifo::SyncGPUReason::Swap); AsyncRequests::Event e; - e.time = 0; + e.time = ticks; e.type = AsyncRequests::Event::SWAP_EVENT; e.swap_event.xfbAddr = xfbAddr; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 9a81fa5e4d..d0bf77e0db 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -28,6 +28,7 @@ #include "Core/ConfigManager.h" #include "Core/Core.h" +#include "Core/CoreTiming.h" #include "Core/FifoPlayer/FifoRecorder.h" #include "Core/HW/VideoInterface.h" #include "Core/Host.h" @@ -138,8 +139,11 @@ void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbStri } else { + // The timing is not predictable here. So try to use the XFB path to dump frames. + u64 ticks = CoreTiming::GetTicks(); + // below div two to convert from bytes to pixels - it expects width, not stride - Swap(xfbAddr, fbStride / 2, fbStride / 2, fbHeight, sourceRc, Gamma); + Swap(xfbAddr, fbStride / 2, fbStride / 2, fbHeight, sourceRc, ticks, Gamma); } } @@ -516,10 +520,10 @@ void Renderer::RecordVideoMemory() } void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, - float Gamma) + u64 ticks, float Gamma) { // TODO: merge more generic parts into VideoCommon - g_renderer->SwapImpl(xfbAddr, fbWidth, fbStride, fbHeight, rc, Gamma); + g_renderer->SwapImpl(xfbAddr, fbWidth, fbStride, fbHeight, rc, ticks, Gamma); if (XFBWrited) g_renderer->m_fps_counter.Update(); @@ -558,7 +562,8 @@ bool Renderer::IsFrameDumping() return false; } -void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, bool swap_upside_down) +void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, u64 ticks, + bool swap_upside_down) { if (w == 0 || h == 0) return; @@ -601,7 +606,7 @@ void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, bool swap } if (m_AVI_dumping) { - AVIDump::AddFrame(m_frame_data.data(), w, h, stride); + AVIDump::AddFrame(m_frame_data.data(), w, h, stride, ticks); } m_last_frame_dumped = true; diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index f405ddc5eb..5c6a98dd21 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -123,9 +123,9 @@ public: // Finish up the current frame, print some stats static void Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, - float Gamma = 1.0f); + u64 ticks, float Gamma = 1.0f); virtual void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, - const EFBRectangle& rc, float Gamma = 1.0f) = 0; + const EFBRectangle& rc, u64 ticks, float Gamma = 1.0f) = 0; static PEControl::PixelFormat GetPrevPixelFormat() { return prev_efb_format; } static void StorePixelFormat(PEControl::PixelFormat new_format) { prev_efb_format = new_format; } @@ -146,7 +146,8 @@ protected: static void RecordVideoMemory(); bool IsFrameDumping(); - void DumpFrameData(const u8* data, int w, int h, int stride, bool swap_upside_down = false); + void DumpFrameData(const u8* data, int w, int h, int stride, u64 ticks, + bool swap_upside_down = false); void FinishFrameData(); static volatile bool s_bScreenshot; diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index d5cb8a4259..69b2df58c1 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -75,7 +75,7 @@ public: void Video_ExitLoop(); virtual void Video_Cleanup() = 0; // called from gl/d3d thread - void Video_BeginField(u32, u32, u32, u32); + void Video_BeginField(u32, u32, u32, u32, u64); u32 Video_AccessEFB(EFBAccessType, u32, u32, u32); u32 Video_GetQueryResult(PerfQueryType type);