diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-05-25 23:26:39 -0400 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-05-25 23:26:39 -0400 |
| commit | dad5d8e13d32b9678ef40ce329da371a7f82a779 (patch) | |
| tree | b8030db50a1c8483c09e2ad79113b6e8608bcbff /Source/Core/VideoCommon | |
| parent | 3817dd0f914f3a5fa66c1974c6228d6102f46b5e (diff) | |
| parent | d91d93505710aaef711a2cbb1b3ca6b8cee66cfa (diff) | |
Merge pull request #2357 from degasus/ogl_efb_poke_merge
ogl: efb poke merge
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/AsyncRequests.cpp | 29 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/AsyncRequests.h | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.h | 7 |
4 files changed, 47 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/AsyncRequests.cpp b/Source/Core/VideoCommon/AsyncRequests.cpp index a702bf01f6..993b6bce2c 100644 --- a/Source/Core/VideoCommon/AsyncRequests.cpp +++ b/Source/Core/VideoCommon/AsyncRequests.cpp @@ -20,7 +20,34 @@ void AsyncRequests::PullEventsInternal() while (!m_queue.empty()) { - const Event& e = m_queue.front(); + Event e = m_queue.front(); + + // try to merge as many efb pokes as possible + // it's a bit hacky, but some games render a complete frame in this way + if ((e.type == Event::EFB_POKE_COLOR || e.type == Event::EFB_POKE_Z)) + { + m_merged_efb_pokes.clear(); + Event first_event = m_queue.front(); + EFBAccessType t = first_event.type == Event::EFB_POKE_COLOR ? POKE_COLOR : POKE_Z; + + do + { + e = m_queue.front(); + + EfbPokeData d; + d.data = e.efb_poke.data; + d.x = e.efb_poke.x; + d.y = e.efb_poke.y; + m_merged_efb_pokes.push_back(d); + + m_queue.pop(); + } while(!m_queue.empty() && m_queue.front().type == first_event.type); + + lock.unlock(); + g_renderer->PokeEFB(t, m_merged_efb_pokes); + lock.lock(); + continue; + } lock.unlock(); HandleEvent(e); diff --git a/Source/Core/VideoCommon/AsyncRequests.h b/Source/Core/VideoCommon/AsyncRequests.h index 8149bb7a45..39e79ab8e3 100644 --- a/Source/Core/VideoCommon/AsyncRequests.h +++ b/Source/Core/VideoCommon/AsyncRequests.h @@ -11,6 +11,8 @@ #include "Common/CommonTypes.h" +struct EfbPokeData; + class AsyncRequests { public: @@ -91,4 +93,6 @@ private: bool m_wake_me_up_again; bool m_enable; bool m_passthrough; + + std::vector<EfbPokeData> m_merged_efb_pokes; }; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 18aaef599f..dba0667b64 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -599,3 +599,11 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const Core::Callback_VideoCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)); XFBWrited = false; } + +void Renderer::PokeEFB(EFBAccessType type, const std::vector<EfbPokeData>& data) +{ + for (EfbPokeData poke : data) + { + AccessEFB(type, poke.x, poke.y, poke.data); + } +} diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index b8a0ec66a5..3535284d2e 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -26,6 +26,12 @@ class PostProcessingShaderImplementation; +struct EfbPokeData +{ + u16 x,y; + u32 data; +}; + // TODO: Move these out of here. extern int frameCount; extern int OSDChoice; @@ -104,6 +110,7 @@ public: static void RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidth, u32 fbHeight, float Gamma = 1.0f); virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) = 0; + virtual void PokeEFB(EFBAccessType type, const std::vector<EfbPokeData>& data); virtual u16 BBoxRead(int index) = 0; virtual void BBoxWrite(int index, u16 value) = 0; |
