VideoCommon: Create AsyncRequests directly in MMU code to eliminate EFB-related functions in VideoBackendBase.

This commit is contained in:
Jordan Woyak
2025-03-14 00:40:34 -05:00
parent 63b848ca93
commit 6c158ed590
3 changed files with 19 additions and 44 deletions

View File

@ -47,7 +47,9 @@
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/System.h" #include "Core/System.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/AsyncRequests.h"
#include "VideoCommon/EFBInterface.h"
#include "VideoCommon/Statistics.h"
namespace PowerPC namespace PowerPC
{ {
@ -109,12 +111,18 @@ static u32 EFB_Read(const u32 addr)
} }
else if (addr & 0x00400000) 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); DEBUG_LOG_FMT(MEMMAP, "EFB Z Read @ {}, {}\t= {:#010x}", x, y, var);
} }
else 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); 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) 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); DEBUG_LOG_FMT(MEMMAP, "EFB Z Write {:08x} @ {}, {}", data, x, y);
} }
else 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); DEBUG_LOG_FMT(MEMMAP, "EFB Color Write {:08x} @ {}, {}", data, x, y);
} }
} }

View File

@ -22,7 +22,6 @@
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/DolphinAnalytics.h" #include "Core/DolphinAnalytics.h"
#include "Core/System.h" #include "Core/System.h"
#include "VideoCommon/Statistics.h"
// TODO: ugly // TODO: ugly
#ifdef _WIN32 #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) u32 VideoBackendBase::Video_GetQueryResult(PerfQueryType type)
{ {
if (!g_perf_query->ShouldEmulate()) if (!g_perf_query->ShouldEmulate())

View File

@ -50,12 +50,6 @@ public:
void Video_OutputXFB(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks); 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); u32 Video_GetQueryResult(PerfQueryType type);
u16 Video_GetBoundingBox(int index); u16 Video_GetBoundingBox(int index);