From e5b7b2e9eebb21ed19924c821ddde97576a65480 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Tue, 9 Apr 2024 18:57:32 -0500 Subject: [PATCH 1/2] VideoCommon: add xfbs presented to video events --- Source/Core/VideoCommon/VideoEvents.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/VideoCommon/VideoEvents.h b/Source/Core/VideoCommon/VideoEvents.h index 1d8b329265..9c763dce34 100644 --- a/Source/Core/VideoCommon/VideoEvents.h +++ b/Source/Core/VideoCommon/VideoEvents.h @@ -3,6 +3,9 @@ #pragma once +#include +#include + #include "Common/CommonTypes.h" #include "Common/HookableEvent.h" @@ -71,6 +74,8 @@ struct PresentInfo // Accuracy of actual_present_time PresentTimeAccuracy present_time_accuracy = PresentTimeAccuracy::Unimplemented; + + std::vector xfb_copy_hashes; }; // An event called just as a frame is queued for presentation. From abf380b7057991678c9e4591837aea37069ef202 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Tue, 9 Apr 2024 18:59:33 -0500 Subject: [PATCH 2/2] VideoCommon: add xfb hash values (if available) to present information --- Source/Core/VideoCommon/Present.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/Core/VideoCommon/Present.cpp b/Source/Core/VideoCommon/Present.cpp index 0cc19d6e14..a90ffaf687 100644 --- a/Source/Core/VideoCommon/Present.cpp +++ b/Source/Core/VideoCommon/Present.cpp @@ -178,6 +178,25 @@ void Presenter::ViSwap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, present_info.reason = PresentInfo::PresentReason::VideoInterface; } + if (m_xfb_entry) + { + // With no references, this XFB copy wasn't stitched together + // so just use its name directly + if (m_xfb_entry->references.empty()) + { + if (!m_xfb_entry->texture_info_name.empty()) + present_info.xfb_copy_hashes.push_back(m_xfb_entry->texture_info_name); + } + else + { + for (const auto& reference : m_xfb_entry->references) + { + if (!reference->texture_info_name.empty()) + present_info.xfb_copy_hashes.push_back(reference->texture_info_name); + } + } + } + BeforePresentEvent::Trigger(present_info); if (!is_duplicate || !g_ActiveConfig.bSkipPresentingDuplicateXFBs)