diff options
| author | JMC47 <JMC4789@gmail.com> | 2025-03-15 18:17:29 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-15 18:17:29 -0400 |
| commit | f4c37aeb148c93511b406be9ddeb88324b029ccd (patch) | |
| tree | 46071afb24e28e8472b8504094d9db2d3e371a22 /Source/Core/VideoCommon/VideoBackendBase.cpp | |
| parent | 99cde4e26912f514c1cdac8e46e2145d29fa1585 (diff) | |
| parent | 6c158ed590246782865c68309be2a2e1c2b17596 (diff) | |
Merge pull request #13423 from jordan-woyak/async-request-cleanup-1
AsyncRequests Cleanups.
Diffstat (limited to 'Source/Core/VideoCommon/VideoBackendBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VideoBackendBase.cpp | 73 |
1 files changed, 10 insertions, 63 deletions
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 8150120610..8436f44443 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -61,7 +61,6 @@ #include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VertexManagerBase.h" #include "VideoCommon/VertexShaderManager.h" -#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoState.h" #include "VideoCommon/Widescreen.h" @@ -98,50 +97,10 @@ void VideoBackendBase::Video_OutputXFB(u32 xfb_addr, u32 fb_width, u32 fb_stride auto& system = Core::System::GetInstance(); system.GetFifo().SyncGPU(Fifo::SyncGPUReason::Swap); - AsyncRequests::Event e; - e.time = ticks; - e.type = AsyncRequests::Event::SWAP_EVENT; - - e.swap_event.xfbAddr = xfb_addr; - e.swap_event.fbWidth = fb_width; - e.swap_event.fbStride = fb_stride; - e.swap_event.fbHeight = fb_height; - e.swap_event.presentation_time = system.GetCoreTiming().GetTargetHostTime(ticks); - AsyncRequests::GetInstance()->PushEvent(e, false); - } -} - -u32 VideoBackendBase::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 data) -{ - if (!g_ActiveConfig.bEFBAccessEnable || x >= EFB_WIDTH || y >= EFB_HEIGHT) - { - return 0; - } - - if (type == EFBAccessType::PokeColor || type == EFBAccessType::PokeZ) - { - AsyncRequests::Event e; - e.type = type == EFBAccessType::PokeColor ? AsyncRequests::Event::EFB_POKE_COLOR : - AsyncRequests::Event::EFB_POKE_Z; - e.time = 0; - e.efb_poke.data = data; - e.efb_poke.x = x; - e.efb_poke.y = y; - AsyncRequests::GetInstance()->PushEvent(e, false); - return 0; - } - else - { - AsyncRequests::Event e; - u32 result; - e.type = type == EFBAccessType::PeekColor ? AsyncRequests::Event::EFB_PEEK_COLOR : - AsyncRequests::Event::EFB_PEEK_Z; - e.time = 0; - e.efb_peek.x = x; - e.efb_peek.y = y; - e.efb_peek.data = &result; - AsyncRequests::GetInstance()->PushEvent(e, true); - return result; + const TimePoint presentation_time = system.GetCoreTiming().GetTargetHostTime(ticks); + AsyncRequests::GetInstance()->PushEvent([=] { + g_presenter->ViSwap(xfb_addr, fb_width, fb_stride, fb_height, ticks, presentation_time); + }); } } @@ -155,12 +114,10 @@ u32 VideoBackendBase::Video_GetQueryResult(PerfQueryType type) auto& system = Core::System::GetInstance(); system.GetFifo().SyncGPU(Fifo::SyncGPUReason::PerfQuery); - AsyncRequests::Event e; - e.time = 0; - e.type = AsyncRequests::Event::PERF_QUERY; - if (!g_perf_query->IsFlushed()) - AsyncRequests::GetInstance()->PushEvent(e, true); + { + AsyncRequests::GetInstance()->PushBlockingEvent([] { g_perf_query->FlushResults(); }); + } return g_perf_query->GetQueryResult(type); } @@ -196,15 +153,8 @@ u16 VideoBackendBase::Video_GetBoundingBox(int index) auto& system = Core::System::GetInstance(); system.GetFifo().SyncGPU(Fifo::SyncGPUReason::BBox); - AsyncRequests::Event e; - u16 result; - e.time = 0; - e.type = AsyncRequests::Event::BBOX_READ; - e.bbox.index = index; - e.bbox.data = &result; - AsyncRequests::GetInstance()->PushEvent(e, true); - - return result; + return AsyncRequests::GetInstance()->PushBlockingEvent( + [&] { return g_bounding_box->Get(index); }); } static VideoBackendBase* GetDefaultVideoBackend() @@ -309,10 +259,7 @@ void VideoBackendBase::DoState(PointerWrap& p) return; } - AsyncRequests::Event ev = {}; - ev.do_save_state.p = &p; - ev.type = AsyncRequests::Event::DO_SAVE_STATE; - AsyncRequests::GetInstance()->PushEvent(ev, true); + AsyncRequests::GetInstance()->PushBlockingEvent([&] { VideoCommon_DoState(p); }); // Let the GPU thread sleep after loading the state, so we're not spinning if paused after loading // a state. The next GP burst will wake it up again. |
