diff options
| author | comex <comexk@gmail.com> | 2014-11-19 20:25:23 -0500 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2014-11-19 20:25:23 -0500 |
| commit | fb50cb6d99062069a71db49d56d975df5c6eecb3 (patch) | |
| tree | b0a9615bcaa4d5d4efa65e590ff3b0e500391f6b /Source/Core/VideoCommon/MainBase.cpp | |
| parent | dd2c8c49b37360f8b8838ccdb323a84eae00e065 (diff) | |
| parent | c211450b997effa6d91059fb0aaa564892297719 (diff) | |
Merge pull request #1550 from degasus/bbox
OGL: implement bounding box support with ssbo
Diffstat (limited to 'Source/Core/VideoCommon/MainBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/MainBase.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index d775cfe64c..40d2f57f20 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -1,6 +1,7 @@ #include "Common/Event.h" #include "Core/ConfigManager.h" +#include "VideoCommon/BoundingBox.h" #include "VideoCommon/BPStructs.h" #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/Fifo.h" @@ -25,6 +26,11 @@ static Common::Event s_efbAccessReadyEvent; static Common::Flag s_perfQueryRequested; 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 { u32 xfbAddr; @@ -217,6 +223,39 @@ u32 VideoBackendHardware::Video_GetQueryResult(PerfQueryType type) return g_perf_query->GetQueryResult(type); } +u16 VideoBackendHardware::Video_GetBoundingBox(int index) +{ + if (!g_ActiveConfig.backend_info.bSupportsBBox) + return BoundingBox::coords[index]; + + SyncGPU(SYNC_GPU_BBOX); + + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread) + { + s_BBoxReadyEvent.Reset(); + if (s_FifoShuttingDown.IsSet()) + return 0; + s_BBoxIndex = index; + s_BBoxRequested.Set(); + s_BBoxReadyEvent.Wait(); + return s_BBoxResult; + } + else + { + return g_renderer->BBoxRead(index); + } +} + +static void VideoFifo_CheckBBoxRequest() +{ + if (s_BBoxRequested.IsSet()) + { + s_BBoxResult = g_renderer->BBoxRead(s_BBoxIndex); + s_BBoxRequested.Clear(); + s_BBoxReadyEvent.Set(); + } +} + void VideoBackendHardware::InitializeShared() { VideoCommon_Init(); @@ -292,6 +331,7 @@ void VideoFifo_CheckAsyncRequest() VideoFifo_CheckSwapRequest(); VideoFifo_CheckEFBAccess(); VideoFifo_CheckPerfQueryRequest(); + VideoFifo_CheckBBoxRequest(); } void VideoBackendHardware::Video_GatherPipeBursted() |
