From 6c158ed590246782865c68309be2a2e1c2b17596 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 14 Mar 2025 00:40:34 -0500 Subject: [PATCH] VideoCommon: Create AsyncRequests directly in MMU code to eliminate EFB-related functions in VideoBackendBase. --- Source/Core/Core/PowerPC/MMU.cpp | 24 +++++++++++--- Source/Core/VideoCommon/VideoBackendBase.cpp | 33 -------------------- Source/Core/VideoCommon/VideoBackendBase.h | 6 ---- 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp index f05fe09344..a9fd5ede4b 100644 --- a/Source/Core/Core/PowerPC/MMU.cpp +++ b/Source/Core/Core/PowerPC/MMU.cpp @@ -47,7 +47,9 @@ #include "Core/PowerPC/PowerPC.h" #include "Core/System.h" -#include "VideoCommon/VideoBackendBase.h" +#include "VideoCommon/AsyncRequests.h" +#include "VideoCommon/EFBInterface.h" +#include "VideoCommon/Statistics.h" namespace PowerPC { @@ -109,12 +111,18 @@ static u32 EFB_Read(const u32 addr) } else if (addr & 0x00400000) { - var = g_video_backend->Video_PeekEFBDepth(x, y); + var = AsyncRequests::GetInstance()->PushBlockingEvent([&] { + INCSTAT(g_stats.this_frame.num_efb_peeks); + return g_efb_interface->PeekDepth(x, y); + }); DEBUG_LOG_FMT(MEMMAP, "EFB Z Read @ {}, {}\t= {:#010x}", x, y, var); } else { - var = g_video_backend->Video_PeekEFBColor(x, y); + var = AsyncRequests::GetInstance()->PushBlockingEvent([&] { + INCSTAT(g_stats.this_frame.num_efb_peeks); + return g_efb_interface->PeekColor(x, y); + }); DEBUG_LOG_FMT(MEMMAP, "EFB Color Read @ {}, {}\t= {:#010x}", x, y, var); } @@ -134,12 +142,18 @@ static void EFB_Write(u32 data, u32 addr) } else if (addr & 0x00400000) { - g_video_backend->Video_PokeEFBDepth(x, y, data); + AsyncRequests::GetInstance()->PushEvent([x, y, data] { + INCSTAT(g_stats.this_frame.num_efb_pokes); + g_efb_interface->PokeDepth(x, y, data); + }); DEBUG_LOG_FMT(MEMMAP, "EFB Z Write {:08x} @ {}, {}", data, x, y); } else { - g_video_backend->Video_PokeEFBColor(x, y, data); + AsyncRequests::GetInstance()->PushEvent([x, y, data] { + INCSTAT(g_stats.this_frame.num_efb_pokes); + g_efb_interface->PokeColor(x, y, data); + }); DEBUG_LOG_FMT(MEMMAP, "EFB Color Write {:08x} @ {}, {}", data, x, y); } } diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index af42f3be90..8436f44443 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -22,7 +22,6 @@ #include "Core/CoreTiming.h" #include "Core/DolphinAnalytics.h" #include "Core/System.h" -#include "VideoCommon/Statistics.h" // TODO: ugly #ifdef _WIN32 @@ -105,38 +104,6 @@ void VideoBackendBase::Video_OutputXFB(u32 xfb_addr, u32 fb_width, u32 fb_stride } } -void VideoBackendBase::Video_PokeEFBColor(u32 x, u32 y, u32 data) -{ - AsyncRequests::GetInstance()->PushEvent([x, y, data] { - INCSTAT(g_stats.this_frame.num_efb_pokes); - g_efb_interface->PokeColor(x, y, data); - }); -} - -void VideoBackendBase::Video_PokeEFBDepth(u32 x, u32 y, u32 data) -{ - AsyncRequests::GetInstance()->PushEvent([x, y, data] { - INCSTAT(g_stats.this_frame.num_efb_pokes); - g_efb_interface->PokeDepth(x, y, data); - }); -} - -u32 VideoBackendBase::Video_PeekEFBColor(u32 x, u32 y) -{ - return AsyncRequests::GetInstance()->PushBlockingEvent([&] { - INCSTAT(g_stats.this_frame.num_efb_peeks); - return g_efb_interface->PeekColor(x, y); - }); -} - -u32 VideoBackendBase::Video_PeekEFBDepth(u32 x, u32 y) -{ - return AsyncRequests::GetInstance()->PushBlockingEvent([&] { - INCSTAT(g_stats.this_frame.num_efb_peeks); - return g_efb_interface->PeekDepth(x, y); - }); -} - u32 VideoBackendBase::Video_GetQueryResult(PerfQueryType type) { if (!g_perf_query->ShouldEmulate()) diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index fe71d0f919..223e46ad03 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -50,12 +50,6 @@ public: void Video_OutputXFB(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks); - void Video_PokeEFBColor(u32 x, u32 y, u32 data); - void Video_PokeEFBDepth(u32 x, u32 y, u32 data); - - u32 Video_PeekEFBColor(u32 x, u32 y); - u32 Video_PeekEFBDepth(u32 x, u32 y); - u32 Video_GetQueryResult(PerfQueryType type); u16 Video_GetBoundingBox(int index);