VideoCommon: bbox by async events

This commit is contained in:
degasus 2015-01-31 12:43:58 +01:00
parent ad7264da7d
commit edbd402101
3 changed files with 18 additions and 29 deletions

View File

@ -95,6 +95,9 @@ void AsyncRequests::HandleEvent(const AsyncRequests::Event& e)
Renderer::Swap(e.swap_event.xfbAddr, e.swap_event.fbWidth, e.swap_event.fbStride, e.swap_event.fbHeight, rc); Renderer::Swap(e.swap_event.xfbAddr, e.swap_event.fbWidth, e.swap_event.fbStride, e.swap_event.fbHeight, rc);
break; break;
case Event::BBOX_READ:
*e.bbox.data = g_renderer->BBoxRead(e.bbox.index);
} }
} }

View File

@ -23,6 +23,7 @@ public:
EFB_PEEK_COLOR, EFB_PEEK_COLOR,
EFB_PEEK_Z, EFB_PEEK_Z,
SWAP_EVENT, SWAP_EVENT,
BBOX_READ,
} type; } type;
u64 time; u64 time;
@ -49,6 +50,12 @@ public:
u32 fbStride; u32 fbStride;
u32 fbHeight; u32 fbHeight;
} swap_event; } swap_event;
struct
{
int index;
u16* data;
} bbox;
}; };
}; };

View File

@ -24,11 +24,6 @@ static Common::Flag s_FifoShuttingDown;
static Common::Flag s_perfQueryRequested; static Common::Flag s_perfQueryRequested;
static Common::Event s_perfQueryReadyEvent; static Common::Event s_perfQueryReadyEvent;
static Common::Flag s_BBoxRequested;
static Common::Event s_BBoxReadyEvent;
static int s_BBoxIndex;
static u16 s_BBoxResult;
static volatile struct static volatile struct
{ {
u32 xfbAddr; u32 xfbAddr;
@ -184,30 +179,15 @@ u16 VideoBackendHardware::Video_GetBoundingBox(int index)
SyncGPU(SYNC_GPU_BBOX); SyncGPU(SYNC_GPU_BBOX);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread) AsyncRequests::Event e;
{ u16 result;
s_BBoxReadyEvent.Reset(); e.time = 0;
if (s_FifoShuttingDown.IsSet()) e.type = AsyncRequests::Event::BBOX_READ;
return 0; e.bbox.index = index;
s_BBoxIndex = index; e.bbox.data = &result;
s_BBoxRequested.Set(); AsyncRequests::GetInstance()->PushEvent(e, true);
s_BBoxReadyEvent.Wait();
return s_BBoxResult;
}
else
{
return g_renderer->BBoxRead(index);
}
}
static void VideoFifo_CheckBBoxRequest() return result;
{
if (s_BBoxRequested.IsSet())
{
s_BBoxResult = g_renderer->BBoxRead(s_BBoxIndex);
s_BBoxRequested.Clear();
s_BBoxReadyEvent.Set();
}
} }
void VideoBackendHardware::InitializeShared() void VideoBackendHardware::InitializeShared()
@ -275,7 +255,6 @@ void VideoBackendHardware::RunLoop(bool enable)
void VideoFifo_CheckAsyncRequest() void VideoFifo_CheckAsyncRequest()
{ {
VideoFifo_CheckPerfQueryRequest(); VideoFifo_CheckPerfQueryRequest();
VideoFifo_CheckBBoxRequest();
} }
void VideoBackendHardware::Video_GatherPipeBursted() void VideoBackendHardware::Video_GatherPipeBursted()